Skip to content

Commit

Permalink
Merge pull request #3690 from IgniteUI/api-docs-gulp-6.2.x
Browse files Browse the repository at this point in the history
Modify gulp api docs tasks in order to follow the build steps
  • Loading branch information
zdrawku authored Jan 23, 2019
2 parents b8db79f + 30fd6b2 commit c56a2e8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 31 deletions.
30 changes: 7 additions & 23 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,6 @@ gulp.task('sassdoc-build', [
'sassdoc-js'
])

const TRANSLATIONS_REPO = {
NAME: 'igniteui-angular-api-i18n',
LINK: `https://github.com/IgniteUI/igniteui-angular-api-i18n`
};

const DOCS_OUTPUT_PATH = path.join(__dirname, 'dist', 'igniteui-angular', 'docs');

const TYPEDOC = {
Expand All @@ -290,28 +285,20 @@ gulp.task('typedoc-build:import', ['typedoc-build'],
shell.task(`typedoc ${TYPEDOC.PROJECT_PATH} --generate-from-json ${TYPEDOC.EXPORT_JSON_PATH}`)
);

gulp.task('clean-translations:localization:repo', () => {
del.sync(`${DOCS_OUTPUT_PATH}/${TRANSLATIONS_REPO.NAME}`)
});

gulp.task('create:docs-output-path', () => {
!fs.existsSync(DOCS_OUTPUT_PATH) && fs.mkdirSync(DOCS_OUTPUT_PATH);
});

gulp.task('copy-translations:localization:repo', ['clean-translations:localization:repo', 'create:docs-output-path'],
shell.task(`git -C ${DOCS_OUTPUT_PATH} clone ${TRANSLATIONS_REPO.LINK}`)
);

gulp.task('typedoc:clean-docs-dir', () => {
del.sync(`${DOCS_OUTPUT_PATH}typescript`)
});

gulp.task('typedoc-build:doc:ja:localization', ['typedoc-build', 'typedoc:clean-docs-dir', 'copy-translations:localization:repo'],
shell.task(`typedoc ${TYPEDOC.PROJECT_PATH} --generate-from-json ${DOCS_OUTPUT_PATH}\\${TRANSLATIONS_REPO.NAME}\\typedoc\\ja --templateStrings ${TYPEDOC.TEMPLATE_STRINGS_PATH} --localize jp`)
gulp.task('typedoc-build:doc:ja:localization', ['typedoc-build', 'create:docs-output-path', 'typedoc:clean-docs-dir'],
shell.task(`typedoc ${TYPEDOC.PROJECT_PATH} --generate-from-json ${path.join(__dirname, 'i18nRepo', 'typedoc', 'ja')} --templateStrings ${TYPEDOC.TEMPLATE_STRINGS_PATH} --localize jp`)
);

gulp.task('typedoc-build:doc:en:localization', ['typedoc-build', 'typedoc:clean-docs-dir', 'copy-translations:localization:repo'],
shell.task(`typedoc ${TYPEDOC.PROJECT_PATH} --generate-from-json ${DOCS_OUTPUT_PATH}\\${TRANSLATIONS_REPO.NAME}\\typedoc\\en --localize en`)
gulp.task('typedoc-build:doc:en:localization', ['typedoc-build', 'create:docs-output-path', 'typedoc:clean-docs-dir'],
shell.task(`typedoc ${TYPEDOC.PROJECT_PATH} --localize en`)
);

const SASSDOC = {
Expand Down Expand Up @@ -340,8 +327,8 @@ gulp.task('sassdoc-build:import', () => {
.pipe(sassdoc(options))
});

gulp.task('sassdoc-build:doc:ja:localizaiton', ['sassdoc-build', 'sassdoc:clean-docs-dir', 'copy-translations:localization:repo'], () => {
const pathTranslations = path.join(DOCS_OUTPUT_PATH, TRANSLATIONS_REPO.NAME, 'sassdoc', 'ja');
gulp.task('sassdoc-build:doc:ja:localizaiton', ['sassdoc-build', 'sassdoc:clean-docs-dir'], () => {
const pathTranslations = path.join(__dirname, 'i18nRepo', 'sassdoc', 'ja');
const options = JSON.parse(fs.readFileSync(SASSDOC.OPTIONS, 'utf8'));

options.lang = 'jp';
Expand All @@ -352,13 +339,10 @@ gulp.task('sassdoc-build:doc:ja:localizaiton', ['sassdoc-build', 'sassdoc:clean-
.pipe(sassdoc(options));
});

gulp.task('sassdoc-build:doc:en:localizaiton', ['sassdoc-build', 'sassdoc:clean-docs-dir', 'copy-translations:localization:repo'], () => {
const pathTranslations = path.join(DOCS_OUTPUT_PATH, TRANSLATIONS_REPO.NAME, 'sassdoc', 'en');
gulp.task('sassdoc-build:doc:en:localizaiton', ['sassdoc-build', 'sassdoc:clean-docs-dir'], () => {
const options = JSON.parse(fs.readFileSync(SASSDOC.OPTIONS, 'utf8'));

options.lang = 'en';
options.render = argv.render;
options.json_dir = pathTranslations;

return gulp.src(`${SASSDOC.PROJECT_PATH}/**/*.scss`)
.pipe(sassdoc(options));
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
"typedoc-build:import": "gulp typedoc-build:import",
"sassdoc-build:export": "gulp sassdoc-build:export --convert true && gulp sassdoc:clean-docs-dir",
"sassdoc-build:import": "gulp sassdoc-build:import --render true",
"build:typedoc:ja:production": "set NODE_ENV=production && gulp typedoc-build:doc:ja:localization && gulp clean-translations:localization:repo",
"build:typedoc:ja:staging": "set NODE_ENV=staging && gulp typedoc-build:doc:ja:localization && gulp clean-translations:localization:repo",
"build:typedoc:en:production": "set NODE_ENV=production && gulp typedoc-build:doc:en:localization && gulp clean-translations:localization:repo",
"build:typedoc:en:staging": "set NODE_ENV=staging && gulp typedoc-build:doc:en:localization && gulp clean-translations:localization:repo",
"build:sassdoc:en:production": "set NODE_ENV=production && set SASSDOC_LANG=en && gulp sassdoc-build:doc:en:localizaiton --render true && gulp clean-translations:localization:repo",
"build:sassdoc:en:staging": "set NODE_ENV=staging && set SASSDOC_LANG=en && gulp sassdoc-build:doc:en:localizaiton --render true && gulp clean-translations:localization:repo",
"build:sassdoc:ja:production": "set NODE_ENV=production && set SASSDOC_LANG=jp && gulp sassdoc-build:doc:ja:localizaiton --render true && gulp clean-translations:localization:repo",
"build:sassdoc:ja:staging": "set NODE_ENV=staging && set SASSDOC_LANG=jp && gulp sassdoc-build:doc:ja:localizaiton --render true && gulp clean-translations:localization:repo",
"build:typedoc:ja:production": "set NODE_ENV=production && gulp typedoc-build:doc:ja:localization",
"build:typedoc:ja:staging": "set NODE_ENV=staging && gulp typedoc-build:doc:ja:localization",
"build:typedoc:en:production": "set NODE_ENV=production && gulp typedoc-build:doc:en:localization",
"build:typedoc:en:staging": "set NODE_ENV=staging && gulp typedoc-build:doc:en:localization",
"build:sassdoc:en:production": "set NODE_ENV=production && set SASSDOC_LANG=en && gulp sassdoc-build:doc:en:localizaiton",
"build:sassdoc:en:staging": "set NODE_ENV=staging && set SASSDOC_LANG=en && gulp sassdoc-build:doc:en:localizaiton",
"build:sassdoc:ja:production": "set NODE_ENV=production && set SASSDOC_LANG=jp && gulp sassdoc-build:doc:ja:localizaiton --render true",
"build:sassdoc:ja:staging": "set NODE_ENV=staging && set SASSDOC_LANG=jp && gulp sassdoc-build:doc:ja:localizaiton --render true",
"postinstall": "gulp copy-git-hooks"
},
"private": true,
Expand Down

0 comments on commit c56a2e8

Please sign in to comment.