@@ -4,7 +4,8 @@ import { resolve } from 'path'
44import { argv } from 'yargs'
55import shabang from './tools/scripts/fuse-shebang'
66import { SparkyFile } from 'fuse-box/sparky/SparkyFile'
7- import { unlinkSync } from 'fs'
7+ import { spawn } from 'child_process'
8+ // import { unlinkSync } from 'fs'
89
910const appName = 'fng'
1011const outputDir = '.build'
@@ -48,7 +49,7 @@ task('cp.jest', () => {
4849 return src ( 'jest/**' , { base : 'src/templates/unit-tests' } ) . dest ( '.build/' )
4950} )
5051
51- task ( 'bundle' , [ 'cp.jest' , 'ng.util' , 'ng.svg '] , ( ) => {
52+ task ( 'bundle' , [ 'cp.jest' , 'ng.modules ' ] , ( ) => {
5253 bundle . instructions ( '> [src/index.ts]' )
5354 ! isProdBuild &&
5455 bundle . watch ( `src/**` ) . completed ( fp => shabang ( fp . bundle , absOutputPath ) )
@@ -59,61 +60,12 @@ task('bundle', ['cp.jest', 'ng.util', 'ng.svg'], () => {
5960 } )
6061} )
6162
62- task ( 'ng.svg' , ( ) => {
63- const config = FuseBox . init ( {
64- homeDir,
65- target : 'universal@es5' ,
66- output : `${ outputDir } /modules/svg/$name.js` ,
67- globals : {
68- default : '*'
69- } ,
70- package : {
71- name : 'default' ,
72- main : outputPath
73- }
63+ task ( 'ng.modules' , ( ) => {
64+ return new Promise ( ( res , rej ) => {
65+ const tsc = spawn ( resolve ( 'node_modules/.bin/tsc' ) , [
66+ '--p' ,
67+ resolve ( 'src/modules' )
68+ ] )
69+ tsc . on ( 'close' , res )
7470 } )
75- src ( 'test.ts' , { base : 'src/modules/svg' } )
76- . dest ( '.build/modules/svg' )
77- . exec ( )
78- src ( 'src/modules/svg/index.ts' )
79- . file ( '*' , ( file : SparkyFile ) => file . rename ( 'index.d.ts' ) )
80- . dest ( '.build/modules/svg/$name' )
81- . exec ( )
82-
83- config . bundle ( 'index' ) . instructions ( '> [src/modules/svg/test.ts]' )
84- config . run ( )
85- } )
86-
87- task ( 'ng.util' , ( ) => {
88- const config = FuseBox . init ( {
89- homeDir,
90- target : 'universal@es5' ,
91- output : `${ outputDir } /modules/util/$name.js` ,
92- globals : {
93- default : '*'
94- } ,
95- package : {
96- name : 'default' ,
97- main : outputPath
98- }
99- } )
100- src ( '**/*.ts' , { base : 'src/modules/util' } )
101- . dest ( '.build/modules/util' )
102- . exec ( )
103- . then ( ( ) => {
104- return src ( '.build/modules/util/index.ts' )
105- . file ( '*' , ( file : SparkyFile ) => file . rename ( 'index.d.ts' ) )
106- . dest ( '.build/modules/util/$name' )
107- . exec ( )
108- . then ( ( ) => {
109- unlinkSync ( '.build/modules/util/index.ts' )
110- } )
111- } )
112-
113- config
114- . bundle ( 'index' )
115- . instructions (
116- '> [src/modules/util/tokens.ts] + [src/modules/util/window.service.ts]'
117- )
118- config . run ( )
11971} )
0 commit comments