Skip to content

Commit 3b88004

Browse files
author
Dmitry Nishcheta
committed
Generate docs with @2gis/js-docs-generator
1 parent 36e5142 commit 3b88004

File tree

6 files changed

+183
-163
lines changed

6 files changed

+183
-163
lines changed

.github/workflows/prettier-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ jobs:
99
- uses: actions/checkout@v3
1010
- uses: actions/setup-node@v3
1111
with:
12-
node-version: 16
12+
node-version: 18
1313
- run: npm ci
1414
- run: npm run prettier

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ jobs:
1313
- uses: actions/checkout@v2
1414
- uses: actions/setup-node@v2
1515
with:
16-
node-version: 16
16+
node-version: 18
1717
registry-url: https://registry.npmjs.org/
18+
- run: echo "TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
1819
- run: npm ci
1920
- run: npm run build
2021
- run: npm publish --access public
2122
env:
23+
VERSION: ${{ env.TAG }}
2224
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v3
1515
- uses: actions/setup-node@v3
1616
with:
17-
node-version: 16
17+
node-version: 18
1818
- run: npm ci
1919
- run: npm run test:screenshots
2020
- uses: actions/upload-artifact@v3

build/documentalist.js

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
1-
const { Documentalist, TypescriptPlugin } = require('@documentalist/compiler');
2-
const { mkdirSync, writeFileSync } = require('fs');
1+
const { generateDocs } = require('@2gis/js-docs-generator');
2+
const fs = require('fs');
3+
const path = require('path');
34

4-
mkdirSync('dist', {
5-
recursive: true,
6-
});
5+
const version = process.env.VERSION || 'branch';
6+
fs.mkdirSync(path.join('dist', 'docs', version), { recursive: true });
77

8-
new Documentalist()
9-
.use(/\.ts$/, new TypescriptPlugin())
10-
.documentGlobs('src/*')
11-
.then((docs) => JSON.stringify(docs))
12-
.then((json) => writeFileSync('dist/docs.json', json))
8+
generateDocs({
9+
version,
10+
defaultReference: 'Deck2gisLayer',
11+
docsHost: 'https://unpkg.com/@2gis/deck2gis-layer@^2/dist/docs',
12+
excludePaths: [],
13+
globs: ['src/**/*'],
14+
ignoreMarkdown: true,
15+
legacyOutPath: 'dist/docs.json',
16+
})
17+
.then((result) => {
18+
fs.writeFileSync(path.join('dist', 'docs', 'manifest.json'), result.manifest);
19+
fs.writeFileSync(path.join('dist', 'docs', version, 'en.json'), result.reference.en);
20+
fs.writeFileSync(path.join('dist', 'docs', version, 'ru.json'), result.reference.ru);
21+
})
1322
.catch((e) => {
1423
console.log(e);
1524
process.exit(1);

0 commit comments

Comments
 (0)