-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Anh Pham
committed
Jan 30, 2024
1 parent
a7b083d
commit 6f16a78
Showing
3 changed files
with
26 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,10 @@ | ||
const chalk = require('chalk'); | ||
const execa = require('execa'); | ||
|
||
const buildDir = 'build'; | ||
const ngTransformerPath = `./src/transformers/downlevel_decorators_transform`; | ||
const bazelFileGlob = 'src/**/BUILD.bazel'; | ||
const ngTestFolder = 'src/ngtsc/reflection/test'; | ||
const ngTransformerURL = | ||
'https://github.com/angular/angular/blob/15.0.4/packages/compiler-cli/src/transformers/downlevel_decorators_transform'; | ||
const ngReflectionURL = 'https://github.com/angular/angular/blob/15.0.4/packages/compiler-cli/src/ngtsc/reflection'; | ||
const tsCompatUrl = 'https://github.com/angular/angular/blob/15.0.4/packages/compiler-cli/src/ngtsc/ts_compatibility'; | ||
const transformersFolder = './src/transformers'; | ||
const ngtscFolder = './src/ngtsc'; | ||
|
||
process.stdout.write(chalk.green(' \u2022 ') + 'clean up ' + chalk.blue(buildDir) + '\n'); | ||
|
||
execa.sync('yarn', ['rimraf', buildDir]); | ||
|
||
process.stdout.write( | ||
chalk.green(' \u2022 ') + | ||
'clean up previously downloaded assets' + | ||
chalk.blue(`${ngTransformerPath}, ${ngtscFolder}`) + | ||
'\n' | ||
); | ||
|
||
execa.sync('yarn', ['rimraf', ngTransformerPath, ngtscFolder]); | ||
|
||
process.stdout.write( | ||
chalk.green(' \u2022 ') + | ||
`downloading Angular Downlevel Decorator Transformer from ${ngTransformerURL}` + | ||
chalk.green(' \u21D2 ') + | ||
transformersFolder + | ||
'\n' | ||
); | ||
|
||
execa.sync('yarn', ['fetcher', `--url=${ngTransformerURL}`, `--out=${transformersFolder}`]); | ||
|
||
process.stdout.write( | ||
chalk.green(' \u2022 ') + | ||
`downloading dependencies for Angular Downlevel Decorator Transformer from ${[ngReflectionURL, tsCompatUrl]}` + | ||
chalk.green(' \u21D2 ') + | ||
ngtscFolder + | ||
'\n' | ||
); | ||
|
||
execa.sync('yarn', ['fetcher', `--url=${ngReflectionURL}`, `--out=${ngtscFolder}`]); | ||
execa.sync('yarn', ['fetcher', `--url=${tsCompatUrl}`, `--out=${ngtscFolder}`]); | ||
|
||
process.stdout.write(chalk.green(' \u2022 ') + 'clean up Bazel files ' + chalk.blue(bazelFileGlob) + '\n'); | ||
|
||
execa.sync('yarn', ['rimraf', bazelFileGlob]); | ||
|
||
process.stdout.write(chalk.green(' \u2022 ') + 'clean up Angular test files ' + chalk.blue(ngTestFolder) + '\n'); | ||
|
||
execa.sync('yarn', ['rimraf', ngTestFolder]); | ||
const { buildSync } = require('esbuild'); | ||
|
||
buildSync({ | ||
entryPoints: ['src/transformers/downlevel-ctor.ts'], | ||
outdir: 'build', | ||
external: ['esbuild', 'ts-jest', 'typescript'], | ||
platform: 'node', | ||
target: 'node16', | ||
bundle: true, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters