This repository was archived by the owner on Aug 7, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +30
-14
lines changed Expand file tree Collapse file tree 3 files changed +30
-14
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env node
2
- const path = require ( "path" ) ;
3
- const fs = require ( "fs" ) ;
2
+ const { resolve } = require ( "path" ) ;
4
3
5
- const helpers = require ( "../projectHelpers" ) ;
6
- const forceUpdateProjectDeps = require ( "../dependencyManager" ) . forceUpdateProjectDeps ;
4
+ const { getPackageJson, writePackageJson } = require ( "../projectHelpers" ) ;
5
+ const { forceUpdateProjectDeps } = require ( "../dependencyManager" ) ;
6
+ const { editExistingProjectFiles } = require ( "../projectFilesManager" ) ;
7
7
8
- const PROJECT_DIR = path . resolve ( __dirname , "../../../" ) ;
9
- const packageJson = helpers . getPackageJson ( PROJECT_DIR ) ;
8
+ const PROJECT_DIR = resolve ( __dirname , "../../../" ) ;
10
9
10
+ console . info ( "Updating dev dependencies..." ) ;
11
+ const packageJson = getPackageJson ( PROJECT_DIR ) ;
11
12
const { deps } = forceUpdateProjectDeps ( packageJson ) ;
12
13
packageJson . devDependencies = deps ;
14
+ writePackageJson ( packageJson , PROJECT_DIR ) ;
15
+
16
+ console . info ( "\nUpdating configuration files..." ) ;
17
+ editExistingProjectFiles ( PROJECT_DIR ) ;
18
+
19
+ console . info ( "\nProject successfully updated! Don't forget to run `npm install`" ) ;
13
20
14
- helpers . writePackageJson ( packageJson , PROJECT_DIR ) ;
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ const APP_DIR = path.resolve(PROJECT_DIR, "app");
12
12
function install ( ) {
13
13
let packageJson = helpers . getPackageJson ( PROJECT_DIR ) ;
14
14
15
- projectFilesManager . editExistingProjectFiles ( PROJECT_DIR ) ;
16
15
projectFilesManager . addProjectFiles ( PROJECT_DIR , APP_DIR ) ;
17
16
18
17
let scripts = packageJson . scripts || { } ;
Original file line number Diff line number Diff line change @@ -152,19 +152,30 @@ function editFileContent(path, ...funcs) {
152
152
}
153
153
154
154
function replaceStyleUrlResolvePlugin ( config ) {
155
+ if ( config . indexOf ( "StyleUrlResolvePlugin" ) === - 1 ) {
156
+ return config ;
157
+ }
158
+
159
+ console . info ( "Replacing deprecated StyleUrlsResolvePlugin with UrlResolvePlugin..." ) ;
155
160
return config . replace ( / S t y l e U r l R e s o l v e P l u g i n / g, "UrlResolvePlugin" ) ;
156
161
}
157
162
158
163
function addSnapshotPlugin ( config ) {
159
- return config . indexOf ( "NativeScriptSnapshotPlugin" ) > - 1 ?
160
- config :
161
- config . replace ( CONFIG_MATCH , CONFIG_REPLACE ) ;
164
+ if ( config . indexOf ( "NativeScriptSnapshotPlugin" ) > - 1 ) {
165
+ return config ;
166
+ }
167
+
168
+ console . info ( "Adding NativeScriptSnapshotPlugin configuration..." ) ;
169
+ return config . replace ( CONFIG_MATCH , CONFIG_REPLACE ) ;
162
170
}
163
171
164
172
function addSnapshotToVendor ( content ) {
165
- return content . indexOf ( "__snapshot" ) > - 1 ?
166
- content :
167
- content . replace ( FRAME_MATCH , SCOPED_FRAME ) ;
173
+ if ( content . indexOf ( "__snapshot" ) > - 1 ) {
174
+ return content ;
175
+ }
176
+
177
+ console . info ( "Adding __snapshot configuration to app/vendor-platform.android ..." ) ;
178
+ return content . replace ( FRAME_MATCH , SCOPED_FRAME ) ;
168
179
}
169
180
170
181
function getFullPath ( projectDir , filePath ) {
You can’t perform that action at this time.
0 commit comments