Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify gulp api docs tasks in order to follow the build steps #3690

Merged
merged 3 commits into from
Jan 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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