@@ -12,15 +12,15 @@ const tsConfig = require('../tsconfig.json');
12
12
const {
13
13
transformLoadFileStaticallyFromNPM,
14
14
} = require ( './load-statically-from-npm' ) ;
15
- const { rmdirRecursive, readdirRecursive, showStats } = require ( './utils' ) ;
15
+ const { rmdirRecursive, readdirRecursive, showDirStats } = require ( './utils' ) ;
16
16
17
17
if ( require . main === module ) {
18
- rmdirRecursive ( './dist ' ) ;
19
- fs . mkdirSync ( './dist ' ) ;
18
+ rmdirRecursive ( './npmDist ' ) ;
19
+ fs . mkdirSync ( './npmDist ' ) ;
20
20
21
21
const srcFiles = readdirRecursive ( './src' , { ignoreDir : / ^ _ _ .* _ _ $ / } ) ;
22
22
const { options } = ts . convertCompilerOptionsFromJson (
23
- tsConfig . compilerOptions ,
23
+ { ... tsConfig . compilerOptions , outDir : 'npmDist' } ,
24
24
process . cwd ( ) ,
25
25
) ;
26
26
const program = ts . createProgram ( {
@@ -30,16 +30,19 @@ if (require.main === module) {
30
30
program . emit ( undefined , undefined , undefined , undefined , {
31
31
after : [ transformLoadFileStaticallyFromNPM ] ,
32
32
} ) ;
33
- downlevel ( './dist ' , './dist /ts3.4' ) ;
33
+ downlevel ( './npmDist ' , './npmDist /ts3.4' ) ;
34
34
35
- fs . copyFileSync ( './LICENSE' , './dist /LICENSE' ) ;
36
- fs . copyFileSync ( './README.md' , './dist /README.md' ) ;
35
+ fs . copyFileSync ( './LICENSE' , './npmDist /LICENSE' ) ;
36
+ fs . copyFileSync ( './README.md' , './npmDist /README.md' ) ;
37
37
38
38
// Should be done as the last step so only valid packages can be published
39
39
const packageJSON = buildPackageJSON ( ) ;
40
- fs . writeFileSync ( './dist/package.json' , JSON . stringify ( packageJSON , null , 2 ) ) ;
40
+ fs . writeFileSync (
41
+ './npmDist/package.json' ,
42
+ JSON . stringify ( packageJSON , null , 2 ) ,
43
+ ) ;
41
44
42
- showStats ( ) ;
45
+ showDirStats ( './npmDist' ) ;
43
46
}
44
47
45
48
function buildPackageJSON ( ) {
0 commit comments