diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 18d157b..65aaee3 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -14,7 +14,7 @@ jobs: - name: Install Supplemental Dependencies run: npm i - name: Build - run: node ./.github/workflows/regenerateDocsReport.js + run: npm run build:docs - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: diff --git a/.github/workflows/regenerateDocsReport.js b/.github/workflows/regenerateDocsReport.js index 266ff9c..c4a97da 100644 --- a/.github/workflows/regenerateDocsReport.js +++ b/.github/workflows/regenerateDocsReport.js @@ -5,5 +5,13 @@ const Generator = require('../../src/Generator'); const FILE_ENCODING = 'utf-8'; -const report = new Generator().generate(path.resolve(__dirname, '../../'), 'cucumber-forge-report-generator') -fs.writeFileSync(path.resolve(__dirname, '../../docs/index.html'), report, FILE_ENCODING); +const featuresDir = path.resolve(__dirname, '../../'); +const report = new Generator().generate(featuresDir, 'cucumber-forge-report-generator') + +// Create /docs if it doesn't exist +const outputDir = path.resolve(__dirname, '../../docs'); +if (!fs.existsSync(outputDir)){ + fs.mkdirSync(outputDir); +} +const filePath = path.resolve(outputDir, 'index.html'); +fs.writeFileSync(filePath, report, FILE_ENCODING); diff --git a/package.json b/package.json index 89170d3..ef86b44 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "lint": "eslint src --color", "lint:fix": "eslint src --color --fix", "build:types": "tsc -p tsconfig.declaration.json", - "prepublishOnly": "npm run build:types" + "prepublishOnly": "npm run build:types", + "build:docs": "node ./.github/workflows/regenerateDocsReport.js" }, "repository": { "type": "git", diff --git a/src/templates/doc_template.html b/src/templates/doc_template.html index 6a4ae6b..55a7759 100644 --- a/src/templates/doc_template.html +++ b/src/templates/doc_template.html @@ -24,7 +24,11 @@