11'use strict' ;
22
3- const browserSync = require ( 'browser-sync' ) . create ( ) ;
43const del = require ( 'del' ) ;
54const gulp = require ( 'gulp' ) ;
65const process = require ( 'process' ) ;
@@ -9,16 +8,10 @@ const argv = require('yargs').argv;
98const sassdoc = require ( 'sassdoc' ) ;
109const path = require ( 'path' ) ;
1110const { series } = require ( 'gulp' ) ;
12- const { spawnSync } = require ( 'child_process' ) ;
1311const slash = require ( 'slash' ) ;
1412
1513const DOCS_OUTPUT_PATH = slash ( path . join ( __dirname , 'dist' , 'igniteui-angular' , 'docs' ) ) ;
1614
17- const TYPEDOC_THEME = {
18- SRC : slash ( path . join ( __dirname , 'node_modules' , 'ig-typedoc-theme' , 'dist' ) ) ,
19- OUTPUT : slash ( path . join ( DOCS_OUTPUT_PATH , 'typescript' ) )
20- } ;
21-
2215module . exports . copyGitHooks = async ( cb ) => {
2316
2417 if ( process . env . AZURE_PIPELINES || process . env . TRAVIS || process . env . CI || ! fs . existsSync ( '.git' ) ) {
@@ -94,115 +87,12 @@ module.exports.copySchematics = (cb) => {
9487 cb ( ) ;
9588} ;
9689
97- const typedocBuildTheme = ( cb ) => {
98- spawnSync ( `typedoc` , [
99- TYPEDOC . PROJECT_PATH ,
100- "--tsconfig" ,
101- path . join ( __dirname , "tsconfig.typedoc.json" ) ] ,
102- { stdio : 'inherit' , shell : true } ) ;
103- cb ( ) ;
104- } ;
105- typedocBuildTheme . displayName = 'typedoc-build:theme' ;
106-
107- const browserReload = ( cb ) => {
108- browserSync . reload ( ) ;
109-
110- cb ( ) ;
111- } ;
112-
113- const typedocServe = ( cb ) => {
114- const config = {
115- server : {
116- baseDir : TYPEDOC_THEME . OUTPUT
117- } ,
118- port : 3000
119- }
120-
121- browserSync . init ( config ) ;
122-
123- cb ( ) ;
124- } ;
125-
126- function typedocWatchFunc ( cb ) {
127- gulp . watch ( [
128- slash ( path . join ( TYPEDOC_THEME . SRC , 'assets' , 'js' , 'src' , '/**/*.{ts,js}' ) ) ,
129- slash ( path . join ( TYPEDOC_THEME . SRC , 'assets' , 'css' , '/**/*.{scss,sass}' ) ) ,
130- slash ( path . join ( TYPEDOC_THEME . SRC , '/**/*.hbs' ) ) ,
131- slash ( path . join ( TYPEDOC_THEME . SRC , 'assets' , 'images' , '/**/*.{png,jpg,gif}' ) ) ,
132- ] , series ( typedocBuildTheme , browserReload ) ) ;
133-
134- cb ( ) ;
135- }
136-
137-
138- const TYPEDOC = {
139- EXPORT_JSON_PATH : slash ( path . join ( DOCS_OUTPUT_PATH , 'typescript-exported' ) ) ,
140- PROJECT_PATH : slash ( path . join ( __dirname , 'projects' , 'igniteui-angular' , 'src' , 'public_api.ts' ) ) ,
141- TEMPLATE_STRINGS_PATH : slash ( path . join ( __dirname , 'extras' , 'template' , 'strings' , 'shell-strings.json' ) )
142- } ;
143-
144- function typedocBuildExportFn ( cb ) {
145- const childProcess = spawnSync ( 'typedoc' , [
146- TYPEDOC . PROJECT_PATH ,
147- "--generate-json" ,
148- TYPEDOC . EXPORT_JSON_PATH ,
149- "--tsconfig" ,
150- path . join ( __dirname , "tsconfig.typedoc.json" ) ] ,
151- { stdio : 'inherit' , shell : true } ) ;
152- process . exitCode = childProcess . status || 0 ;
153- cb ( ) ;
154- }
155-
156- function typedocImportJsonFn ( cb ) {
157- const childProcess = spawnSync ( 'typedoc' , [
158- TYPEDOC . PROJECT_PATH ,
159- "--generate-from-json" ,
160- TYPEDOC . EXPORT_JSON_PATH ,
161- "--warns" ,
162- "--tsconfig" ,
163- path . join ( __dirname , "tsconfig.typedoc.json" ) ] ,
164- { stdio : 'inherit' , shell : true } ) ;
165- process . exitCode = childProcess . status || 0 ;
166- cb ( ) ;
167- }
16890
16991function createDocsOutputDirFn ( cb ) {
17092 ! fs . existsSync ( DOCS_OUTPUT_PATH ) && fs . mkdirSync ( DOCS_OUTPUT_PATH ) ;
17193 cb ( ) ;
17294}
17395
174- function cleanTypedocOutputDirFn ( cb ) {
175- del . sync ( slash ( path . join ( DOCS_OUTPUT_PATH , 'typescript' ) ) ) ;
176- cb ( ) ;
177- }
178-
179- function typedocBuildDocsJA ( cb ) {
180- const childProcess = spawnSync ( 'typedoc' , [
181- TYPEDOC . PROJECT_PATH ,
182- '--generate-from-json' ,
183- slash ( path . join ( __dirname , 'i18nRepo' , 'typedoc' , 'ja' ) ) ,
184- '--templateStrings' ,
185- TYPEDOC . TEMPLATE_STRINGS_PATH ,
186- '--warns' ,
187- '--localize' ,
188- 'jp' ,
189- "--tsconfig" ,
190- path . join ( __dirname , "tsconfig.typedoc.json" ) ] , { stdio : 'inherit' , shell : true } ) ;
191- process . exitCode = childProcess . status || 0 ;
192- cb ( ) ;
193- }
194-
195- function typedocBuildDocsEN ( cb ) {
196- const childProcess = spawnSync ( 'typedoc' , [
197- TYPEDOC . PROJECT_PATH ,
198- '--localize' ,
199- 'en' ,
200- "--tsconfig" ,
201- path . join ( __dirname , "tsconfig.typedoc.json" ) ] , { stdio : 'inherit' , shell : true } ) ;
202- process . exitCode = childProcess . status || 0 ;
203- cb ( ) ;
204- }
205-
20696const SASSDOC = {
20797 PROJECT_PATHS : [
20898 `${ path . join ( __dirname , 'projects' , 'igniteui-angular' , 'src' , 'lib' , 'core' , 'styles' ) } /**/*.scss` ,
@@ -276,29 +166,6 @@ function sassdocBuildEN(cb) {
276166
277167module . exports . createDocsOutputDir = createDocsOutputDirFn ;
278168
279- /**
280- * Typedoc build tasks
281- */
282- module . exports . exportTypedocJson = typedocBuildExportFn ;
283- module . exports . cleanTypedocOutputDir = cleanTypedocOutputDirFn ;
284- module . exports . typedocBuildTheme = typedocBuildTheme ;
285- module . exports . importTypedocJson = typedocImportJsonFn ;
286- module . exports . typedocServe = series (
287- typedocBuildTheme ,
288- typedocWatchFunc ,
289- typedocServe
290- ) ;
291- module . exports . typedocBuildDocsJA = series (
292- this . createDocsOutputDir ,
293- this . cleanTypedocOutputDir ,
294- typedocBuildDocsJA
295- ) ;
296- module . exports . typedocBuildDocsEN = series (
297- this . createDocsOutputDir ,
298- this . cleanTypedocOutputDir ,
299- typedocBuildDocsEN
300- ) ;
301-
302169/**
303170 * Sassdoc build tasks
304171 */
0 commit comments