@@ -7,7 +7,6 @@ import { fileURLToPath } from 'url'
7
7
const __dirname = dirname ( fileURLToPath ( import . meta. url ) )
8
8
9
9
const paramOr = ( map , arg , def ) => map . get ( arg ) || def
10
- const valueOr = ( value , def ) => value || def
11
10
const makePath = ( ...p ) => Path . join ( ...p )
12
11
const ignoreContent =
13
12
( ...values ) =>
@@ -20,9 +19,12 @@ const FilesToIgnore = [
20
19
'.vscode' ,
21
20
'.github' ,
22
21
'.husky/_' ,
22
+ '.yarn' ,
23
23
'.yarn/cache' ,
24
24
'.yarn/build-state.yml' ,
25
25
'.yarn/install-state.gz' ,
26
+ '.yarnrc.yml' ,
27
+ '.versionrc.js' ,
26
28
'cmd' ,
27
29
'coverage' ,
28
30
'dist' ,
@@ -81,7 +83,7 @@ function main() {
81
83
}
82
84
83
85
const source = makePath ( __dirname , '../..' )
84
- const dest = valueOr ( argv [ 0 ] , process . cwd ( ) ) . trim ( )
86
+ const dest = paramOr ( args , 'destination' , process . cwd ( ) ) . trim ( )
85
87
const app = paramOr ( args , 'name' , 'my-app' ) . trim ( )
86
88
const destination = makePath ( dest , app )
87
89
@@ -99,7 +101,9 @@ App: ${app}
99
101
100
102
console . log ( 'Copying Templates ...' )
101
103
102
- Templates . forEach ( x => FsExt . copySync ( makePath ( source , 'templates' , x . file ) , makePath ( destination , x . copyTo ) ) )
104
+ for ( const x of Templates ) {
105
+ FsExt . copySync ( makePath ( source , 'templates' , x . file ) , makePath ( destination , x . copyTo ) )
106
+ }
103
107
104
108
console . log ( 'Preparing package.json ...' )
105
109
@@ -108,21 +112,21 @@ App: ${app}
108
112
name : app ,
109
113
}
110
114
111
- PkgFieldsToKeep . forEach ( field => {
115
+ for ( const field of PkgFieldsToKeep ) {
112
116
if ( typeof pkg [ field ] !== 'undefined' ) {
113
117
newPkg [ field ] = pkg [ field ]
114
118
}
115
- } )
119
+ }
116
120
117
- DepsToIgnore . forEach ( dep => {
121
+ for ( const dep of DepsToIgnore ) {
118
122
if ( pkg . dependencies [ dep ] ) {
119
123
delete pkg . dependencies [ dep ]
120
124
}
121
125
122
126
if ( pkg . devDependencies [ dep ] ) {
123
127
delete pkg . dependencies [ dep ]
124
128
}
125
- } )
129
+ }
126
130
127
131
FsExt . writeJsonSync ( makePath ( destination , 'package.json' ) , newPkg , { spaces : 2 } )
128
132
0 commit comments