|
1 | 1 | 'use strict'; |
2 | 2 |
|
3 | | -const del = require('del'); |
4 | 3 | const gulp = require('gulp'); |
5 | 4 | const process = require('process'); |
6 | 5 | const fs = require('fs'); |
7 | | -const argv = require('yargs').argv; |
8 | | -const sassdoc = require('sassdoc'); |
9 | 6 | const path = require('path'); |
10 | | -const { series } = require('gulp'); |
11 | | -const slash = require('slash'); |
12 | | - |
13 | | -const DOCS_OUTPUT_PATH = slash(path.join(__dirname, 'dist', 'igniteui-angular', 'docs')); |
14 | 7 |
|
15 | 8 | module.exports.copyGitHooks = async (cb) => { |
16 | | - |
17 | 9 | if (process.env.AZURE_PIPELINES || process.env.TRAVIS || process.env.CI || !fs.existsSync('.git')) { |
18 | 10 | return; |
19 | 11 | } |
@@ -88,93 +80,6 @@ module.exports.copySchematics = (cb) => { |
88 | 80 | }; |
89 | 81 |
|
90 | 82 |
|
91 | | -function createDocsOutputDirFn(cb) { |
92 | | - !fs.existsSync(DOCS_OUTPUT_PATH) && fs.mkdirSync(DOCS_OUTPUT_PATH); |
93 | | - cb(); |
94 | | -} |
95 | | - |
96 | | -const SASSDOC = { |
97 | | - PROJECT_PATHS: [ |
98 | | - `${path.join(__dirname, 'projects', 'igniteui-angular', 'src', 'lib', 'core', 'styles')}/**/*.scss`, |
99 | | - `${path.join(__dirname, 'node_modules', 'igniteui-theming', 'sass')}/**/*.scss` |
100 | | - ], |
101 | | - DEST: path.join(DOCS_OUTPUT_PATH, 'sass'), |
102 | | - OPTIONS: path.join(__dirname, '.sassdocrc'), |
103 | | -}; |
104 | | - |
105 | | -const sassdocCleanOutputDir = (cb) => { |
106 | | - del.sync(SASSDOC.DEST); |
107 | | - cb(); |
108 | | -} |
109 | | - |
110 | | -function sassdocBuildJson(cb) { |
111 | | - const options = JSON.parse(fs.readFileSync(SASSDOC.OPTIONS, 'utf8')); |
112 | | - |
113 | | - const { convert, exportDir } = argv; |
114 | | - |
115 | | - options.convert = convert; |
116 | | - options.exportDir = exportDir; |
117 | | - |
118 | | - gulp.src(SASSDOC.PROJECT_PATHS) |
119 | | - .pipe(sassdoc(options)); |
120 | | - |
121 | | - cb(); |
122 | | - |
123 | | -} |
124 | | - |
125 | | -function sassdocImportJson(cb) { |
126 | | - const options = JSON.parse(fs.readFileSync(SASSDOC.OPTIONS, 'utf8')); |
127 | | - |
128 | | - const { render, importDir } = argv; |
129 | | - |
130 | | - options.render = render; |
131 | | - options.json_dir = importDir; |
132 | | - options.shellStringsPath = path.join(__dirname, 'extras', 'template', 'strings', 'shell-strings.json'); |
133 | | - |
134 | | - gulp.src(SASSDOC.PROJECT_PATHS) |
135 | | - .pipe(sassdoc(options)); |
136 | | - |
137 | | - cb(); |
138 | | -} |
139 | | - |
140 | | -function sassdocBuildJA(cb) { |
141 | | - const pathTranslations = path.join(__dirname, 'i18nRepo', 'sassdoc', 'ja'); |
142 | | - const options = JSON.parse(fs.readFileSync(SASSDOC.OPTIONS, 'utf8')); |
143 | | - |
144 | | - options.lang = 'jp'; |
145 | | - options.render = argv.render; |
146 | | - options.json_dir = pathTranslations; |
147 | | - options.shellStringsPath = path.join(__dirname, 'extras', 'template', 'strings', 'shell-strings.json'); |
148 | | - |
149 | | - gulp.src(SASSDOC.PROJECT_PATHS) |
150 | | - .pipe(sassdoc(options)); |
151 | | - |
152 | | - cb(); |
153 | | -} |
154 | | - |
155 | | -function sassdocBuildEN(cb) { |
156 | | - const options = JSON.parse(fs.readFileSync(SASSDOC.OPTIONS, 'utf8')); |
157 | | - |
158 | | - options.lang = 'en'; |
159 | | - options.shellStringsPath = path.join(__dirname, 'extras', 'template', 'strings', 'shell-strings.json'); |
160 | | - |
161 | | - gulp.src(SASSDOC.PROJECT_PATHS) |
162 | | - .pipe(sassdoc(options)); |
163 | | - |
164 | | - cb(); |
165 | | -} |
166 | | - |
167 | | -module.exports.createDocsOutputDir = createDocsOutputDirFn; |
168 | | - |
169 | | -/** |
170 | | - * Sassdoc build tasks |
171 | | - */ |
172 | | -module.exports.sassdocCleanOutputDir = sassdocCleanOutputDir; |
173 | | -module.exports.sassdocImportJson = sassdocImportJson; |
174 | | -module.exports.sassdocBuildJson = sassdocBuildJson; |
175 | | -module.exports.sassdocBuildJA = series(sassdocCleanOutputDir, sassdocBuildJA); |
176 | | -module.exports.sassdocBuildEN = series(sassdocCleanOutputDir, sassdocBuildEN); |
177 | | - |
178 | 83 | module.exports.copyPackageForElements = (cb) => { |
179 | 84 | return gulp.src([ |
180 | 85 | path.join(__dirname, 'projects/igniteui-angular-elements/package.json') |
|
0 commit comments