@@ -2,6 +2,7 @@ import { spawn } from 'cross-spawn';
22import { copy , writeFile } from 'fs-extra' ;
33import { join } from 'path' ;
44import { keys as tsKeys } from 'ts-transformer-keys' ;
5+ import * as esbuild from "esbuild" ;
56
67interface OverrideOptions {
78 exportName ?: string ;
@@ -165,16 +166,42 @@ function spawnPromise(command: string, args: string[]) {
165166}
166167
167168async function compileSchematics ( ) {
168- await spawnPromise ( `npx` , [ 'tsc' , '-p' , src ( 'schematics' , 'tsconfig.json' ) ] ) ;
169- return Promise . all ( [
169+ await esbuild . build ( {
170+ entryPoints : [
171+ src ( 'schematics' , "update" , "index.ts" ) ,
172+ src ( 'schematics' , "deploy" , "actions.ts" ) ,
173+ src ( 'schematics' , "deploy" , "builder.ts" ) ,
174+ src ( 'schematics' , "add" , "index.ts" ) ,
175+ src ( 'schematics' , "setup" , "index.ts" ) ,
176+ src ( 'schematics' , "update" , "v7" , "index.ts" ) ,
177+ ] ,
178+ format : "cjs" ,
179+ bundle : true ,
180+ minify : true ,
181+ platform : "node" ,
182+ target : "es2016" ,
183+ external : [
184+ "@angular-devkit/schematics" ,
185+ "@angular-devkit/architect" ,
186+ "@angular-devkit/core" ,
187+ "rxjs" ,
188+ "@schematics/angular" ,
189+ "jsonc-parser" ,
190+ "firebase-tools"
191+ ] ,
192+ outdir : dest ( 'schematics' ) ,
193+ //outExtension: {".js": ".mjs"},
194+ } ) ;
195+ await Promise . all ( [
196+ copy ( src ( 'schematics' , 'versions.json' ) , dest ( 'schematics' , 'versions.json' ) ) ,
170197 copy ( src ( 'schematics' , 'builders.json' ) , dest ( 'schematics' , 'builders.json' ) ) ,
171198 copy ( src ( 'schematics' , 'collection.json' ) , dest ( 'schematics' , 'collection.json' ) ) ,
172199 copy ( src ( 'schematics' , 'migration.json' ) , dest ( 'schematics' , 'migration.json' ) ) ,
173200 copy ( src ( 'schematics' , 'deploy' , 'schema.json' ) , dest ( 'schematics' , 'deploy' , 'schema.json' ) ) ,
174201 copy ( src ( 'schematics' , 'add' , 'schema.json' ) , dest ( 'schematics' , 'add' , 'schema.json' ) ) ,
175202 copy ( src ( 'schematics' , 'setup' , 'schema.json' ) , dest ( 'schematics' , 'setup' , 'schema.json' ) ) ,
176- replaceSchematicVersions ( )
177203 ] ) ;
204+ await replaceSchematicVersions ( ) ;
178205}
179206
180207async function buildLibrary ( ) {
0 commit comments