@tramvai/cli 2.11.0 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/lib/api/analyze/index.d.ts +1 -0
- package/lib/api/analyze/index.js.map +1 -1
- package/lib/api/build/index.d.ts +1 -0
- package/lib/api/build/index.js.map +1 -1
- package/lib/api/start/index.d.ts +1 -0
- package/lib/api/start/index.js.map +1 -1
- package/lib/api/start/utils/banner.js +1 -1
- package/lib/api/start/utils/banner.js.map +1 -1
- package/lib/api/start-prod/index.d.ts +1 -0
- package/lib/api/start-prod/index.js.map +1 -1
- package/lib/builder/webpack/providers/analyze/shared.js +23 -24
- package/lib/builder/webpack/providers/analyze/shared.js.map +1 -1
- package/lib/commands/analyze/command.d.ts +8 -0
- package/lib/commands/analyze/command.js +6 -0
- package/lib/commands/analyze/command.js.map +1 -1
- package/lib/commands/build/command.js +6 -0
- package/lib/commands/build/command.js.map +1 -1
- package/lib/commands/new/steps/initializationGit.js +2 -2
- package/lib/commands/new/steps/initializationGit.js.map +1 -1
- package/lib/commands/new/steps/installDependencies.js +10 -6
- package/lib/commands/new/steps/installDependencies.js.map +1 -1
- package/lib/commands/new/steps/renderTemplate.js +1 -1
- package/lib/commands/new/steps/renderTemplate.js.map +1 -1
- package/lib/commands/new/utils/applyTemplate.js +1 -1
- package/lib/commands/new/utils/applyTemplate.js.map +1 -1
- package/lib/commands/start/command.js +6 -0
- package/lib/commands/start/command.js.map +1 -1
- package/lib/commands/start-prod/command.js +6 -0
- package/lib/commands/start-prod/command.js.map +1 -1
- package/lib/commands/static/command.d.ts +6 -0
- package/lib/commands/static/command.js +6 -0
- package/lib/commands/static/command.js.map +1 -1
- package/lib/commands/update/dependantLibs.d.ts +2 -0
- package/lib/commands/update/dependantLibs.js +43 -0
- package/lib/commands/update/dependantLibs.js.map +1 -0
- package/lib/commands/update/updatePackageJson.js +7 -24
- package/lib/commands/update/updatePackageJson.js.map +1 -1
- package/lib/config/configManager.d.ts +3 -0
- package/lib/config/configManager.js +10 -7
- package/lib/config/configManager.js.map +1 -1
- package/lib/external/pages.d.ts +3 -5
- package/lib/external/pages.js.map +1 -1
- package/lib/library/webpack/application/client/common.js +1 -1
- package/lib/library/webpack/application/client/common.js.map +1 -1
- package/lib/library/webpack/application/server/common.js +1 -1
- package/lib/library/webpack/application/server/common.js.map +1 -1
- package/lib/library/webpack/blocks/configToEnv.js +1 -1
- package/lib/library/webpack/blocks/configToEnv.js.map +1 -1
- package/lib/library/webpack/blocks/filesClient.js +5 -2
- package/lib/library/webpack/blocks/filesClient.js.map +1 -1
- package/lib/library/webpack/blocks/filesServer.js +9 -5
- package/lib/library/webpack/blocks/filesServer.js.map +1 -1
- package/lib/library/webpack/blocks/pagesResolve.js +1 -1
- package/lib/library/webpack/blocks/pagesResolve.js.map +1 -1
- package/lib/library/webpack/common/main.js +17 -16
- package/lib/library/webpack/common/main.js.map +1 -1
- package/lib/library/webpack/loaders/image-loader/index.d.ts +5 -0
- package/lib/library/webpack/loaders/image-loader/index.js +25 -0
- package/lib/library/webpack/loaders/image-loader/index.js.map +1 -0
- package/lib/schema/autogeneratedSchema.json +165 -294
- package/lib/typings/configEntry/common.d.ts +169 -175
- package/lib/utils/commands/dependencies/checkVersions.js +3 -11
- package/lib/utils/commands/dependencies/checkVersions.js.map +1 -1
- package/lib/utils/commands/dependencies/getLatestPackageVersion.d.ts +1 -1
- package/lib/utils/commands/dependencies/getLatestPackageVersion.js +2 -6
- package/lib/utils/commands/dependencies/getLatestPackageVersion.js.map +1 -1
- package/lib/utils/commands/dependencies/getPackageInfo.d.ts +1 -0
- package/lib/utils/commands/dependencies/getPackageInfo.js +13 -0
- package/lib/utils/commands/dependencies/getPackageInfo.js.map +1 -0
- package/lib/utils/commands/dependencies/migrate.js +3 -11
- package/lib/utils/commands/dependencies/migrate.js.map +1 -1
- package/lib/utils/npmRequire.d.ts +15 -0
- package/lib/utils/npmRequire.js +15 -0
- package/lib/utils/npmRequire.js.map +1 -1
- package/lib/validators/commands/runMigrationsAndCheckVersions.js +3 -7
- package/lib/validators/commands/runMigrationsAndCheckVersions.js.map +1 -1
- package/package.json +88 -85
- package/schema.json +165 -294
- package/src/api/analyze/index.ts +1 -0
- package/src/api/build/__integration__/__fixtures__/tramvai.json +3 -0
- package/src/api/build/__integration__/build.test.ts +1 -0
- package/src/api/build/index.ts +1 -0
- package/src/api/start/__integration__/__fixtures__/tramvai.json +2 -4
- package/src/api/start/index.ts +1 -0
- package/src/api/start/utils/banner.ts +1 -1
- package/src/api/start-prod/index.ts +1 -0
- package/src/builder/webpack/providers/analyze/shared.ts +1 -1
- package/src/commands/analyze/command.ts +6 -0
- package/src/commands/build/command.ts +6 -0
- package/src/commands/new/steps/initializationGit.ts +3 -2
- package/src/commands/new/steps/installDependencies.ts +15 -8
- package/src/commands/new/steps/renderTemplate.ts +1 -1
- package/src/commands/new/templates/app/monorepo/tramvai.json.hbs +2 -4
- package/src/commands/new/templates/app/multirepo/tramvai.json.hbs +2 -4
- package/src/commands/new/templates/shared/_npmrc.hbs +0 -1
- package/src/commands/new/utils/applyTemplate.ts +5 -1
- package/src/commands/start/command.ts +6 -0
- package/src/commands/start-prod/command.ts +6 -0
- package/src/commands/static/command.ts +6 -0
- package/src/commands/update/dependantLibs.ts +49 -0
- package/src/commands/update/updatePackageJson.spec.ts +99 -0
- package/src/commands/update/updatePackageJson.ts +7 -25
- package/src/config/configManager.ts +9 -3
- package/src/external/pages.ts +3 -5
- package/src/library/webpack/application/client/common.ts +1 -3
- package/src/library/webpack/application/server/common.ts +1 -3
- package/src/library/webpack/blocks/configToEnv.ts +1 -1
- package/src/library/webpack/blocks/filesClient.ts +5 -2
- package/src/library/webpack/blocks/filesServer.ts +8 -5
- package/src/library/webpack/blocks/pagesResolve.ts +1 -1
- package/src/library/webpack/common/main.ts +19 -18
- package/src/library/webpack/loaders/image-loader/index.ts +26 -0
- package/src/schema/autogeneratedSchema.json +165 -294
- package/src/schema/tramvai.spec.ts +146 -148
- package/src/typings/configEntry/common.ts +171 -175
- package/src/utils/commands/dependencies/checkVersions.ts +3 -13
- package/src/utils/commands/dependencies/getLatestPackageVersion.ts +2 -7
- package/src/utils/commands/dependencies/getPackageInfo.ts +10 -0
- package/src/utils/commands/dependencies/migrate.ts +3 -13
- package/src/utils/npmRequire.ts +15 -0
- package/src/validators/commands/runMigrationsAndCheckVersions.ts +3 -8
- package/lib/utils/commands/dependencies/update.d.ts +0 -7
- package/lib/utils/commands/dependencies/update.js +0 -19
- package/lib/utils/commands/dependencies/update.js.map +0 -1
- package/lib/utils/commands/dependencies/updatePackageJson.d.ts +0 -1
- package/lib/utils/commands/dependencies/updatePackageJson.js +0 -57
- package/lib/utils/commands/dependencies/updatePackageJson.js.map +0 -1
- package/src/utils/commands/dependencies/update.ts +0 -31
- package/src/utils/commands/dependencies/updatePackageJson.ts +0 -63
|
@@ -45,27 +45,6 @@ export interface Experiments {
|
|
|
45
45
|
*/
|
|
46
46
|
useImportModule?: boolean;
|
|
47
47
|
};
|
|
48
|
-
/**
|
|
49
|
-
* @title experimental settings for File-System Routing feature
|
|
50
|
-
* @default {}
|
|
51
|
-
*/
|
|
52
|
-
fileSystemPages?: {
|
|
53
|
-
/**
|
|
54
|
-
* @title Read pages from file system
|
|
55
|
-
* @default false
|
|
56
|
-
*/
|
|
57
|
-
enable?: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* @title Folder with pages from which static routers are generated
|
|
60
|
-
* @default "routes"
|
|
61
|
-
*/
|
|
62
|
-
routesDir?: string | false;
|
|
63
|
-
/**
|
|
64
|
-
* @title Folder with components which can be manually added to static routers
|
|
65
|
-
* @default "pages"
|
|
66
|
-
*/
|
|
67
|
-
pagesDir?: string | false;
|
|
68
|
-
};
|
|
69
48
|
|
|
70
49
|
/**
|
|
71
50
|
* @title experimental settings for code transpilation
|
|
@@ -80,7 +59,7 @@ export interface Experiments {
|
|
|
80
59
|
};
|
|
81
60
|
}
|
|
82
61
|
|
|
83
|
-
|
|
62
|
+
interface ServeConfig {
|
|
84
63
|
/**
|
|
85
64
|
* @default {}
|
|
86
65
|
*/
|
|
@@ -120,176 +99,193 @@ type serveConfig = {
|
|
|
120
99
|
*/
|
|
121
100
|
experiments?: Experiments;
|
|
122
101
|
};
|
|
123
|
-
}
|
|
102
|
+
}
|
|
124
103
|
|
|
125
|
-
|
|
126
|
-
name: string;
|
|
127
|
-
root: string;
|
|
128
|
-
type: ProjectType;
|
|
129
|
-
version?: string;
|
|
104
|
+
interface BuildConfig {
|
|
130
105
|
/**
|
|
131
106
|
* @default {}
|
|
132
107
|
*/
|
|
133
|
-
|
|
108
|
+
options?: Record<string, any>;
|
|
109
|
+
/**
|
|
110
|
+
* @default {}
|
|
111
|
+
*/
|
|
112
|
+
configurations?: {
|
|
134
113
|
/**
|
|
135
|
-
* @
|
|
114
|
+
* @title Enable production build for modern browsers
|
|
115
|
+
* @default true
|
|
116
|
+
*/
|
|
117
|
+
modern?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* @title Enable DedupePlugin
|
|
120
|
+
* @default "equality"
|
|
121
|
+
*/
|
|
122
|
+
dedupe?: DeduplicateStrategy | false;
|
|
123
|
+
/**
|
|
124
|
+
* @title Sets ignore to DedupePlugin
|
|
125
|
+
*/
|
|
126
|
+
dedupeIgnore?: string[];
|
|
127
|
+
/**
|
|
128
|
+
* @title Enable replacing `typeof window` expression
|
|
129
|
+
* @default true
|
|
130
|
+
*/
|
|
131
|
+
removeTypeofWindow?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* @title Enable source maps in production build
|
|
134
|
+
* @default false
|
|
135
|
+
*/
|
|
136
|
+
sourceMap?: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* @title Enable source maps for server assets in production build
|
|
139
|
+
* @default false
|
|
140
|
+
*/
|
|
141
|
+
sourceMapServer?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* @title Configuration for enabling parallel compression for terser plugin
|
|
144
|
+
* @default true
|
|
145
|
+
*/
|
|
146
|
+
terserParallel?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* @title List of modules to exclude from @babel/preset-env
|
|
149
|
+
*/
|
|
150
|
+
excludesPresetEnv?: string[];
|
|
151
|
+
/**
|
|
152
|
+
* @title thread-loader config
|
|
153
|
+
* @additionalProperties true
|
|
154
|
+
*/
|
|
155
|
+
threadLoader?: Record<string, any>;
|
|
156
|
+
/**
|
|
157
|
+
* @title Define plugin config
|
|
158
|
+
* @default {"prod": {}, "dev": {}}
|
|
159
|
+
* @additionalProperties true
|
|
160
|
+
*/
|
|
161
|
+
definePlugin?: Record<string, any>;
|
|
162
|
+
/**
|
|
163
|
+
* @deprecated
|
|
164
|
+
*
|
|
165
|
+
* @default false
|
|
166
|
+
*/
|
|
167
|
+
generateDataQaTag?: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* @deprecated включает использование плагина fill-action-name
|
|
170
|
+
*
|
|
171
|
+
* @default false
|
|
172
|
+
*/
|
|
173
|
+
enableFillActionNamePlugin?: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* @title Set minimizer for css
|
|
176
|
+
*/
|
|
177
|
+
cssMinimize?: 'csso';
|
|
178
|
+
postcss?: {
|
|
179
|
+
/**
|
|
180
|
+
* @title Path to postcss config file
|
|
181
|
+
*/
|
|
182
|
+
config?: string;
|
|
183
|
+
/**
|
|
184
|
+
* @title CSS identifiers build algorythm
|
|
185
|
+
*/
|
|
186
|
+
cssLocalIdentName?: string;
|
|
187
|
+
/**
|
|
188
|
+
* @title CSS identifiers build algorythm for development buld
|
|
189
|
+
*/
|
|
190
|
+
cssLocalIdentNameDev?: string;
|
|
191
|
+
/**
|
|
192
|
+
* @title CSS identifiers build algorythm for production build
|
|
193
|
+
*/
|
|
194
|
+
cssLocalIdentNameProd?: string;
|
|
195
|
+
/**
|
|
196
|
+
* @title Path to postcss config file for assets
|
|
197
|
+
*/
|
|
198
|
+
assetsConfig?: string;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* @title Aliases for project imports
|
|
202
|
+
* @additionalProperties true
|
|
136
203
|
*/
|
|
137
|
-
|
|
204
|
+
alias?: Record<string, any>;
|
|
205
|
+
/**
|
|
206
|
+
* @title svgo-loader options
|
|
207
|
+
*/
|
|
208
|
+
svgo?: {
|
|
209
|
+
/**
|
|
210
|
+
* @title svgo plugins
|
|
211
|
+
*/
|
|
212
|
+
plugins?: Record<string, any>[];
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* @title Settings for image-webpack-loader
|
|
216
|
+
*/
|
|
217
|
+
imageOptimization?: {
|
|
138
218
|
/**
|
|
139
|
-
* @
|
|
219
|
+
* @title Enable image-webpack-loader
|
|
220
|
+
*/
|
|
221
|
+
enabled?: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* @title Pass options to image-webpack-loader
|
|
224
|
+
* @additionalProperties true
|
|
140
225
|
*/
|
|
141
226
|
options?: Record<string, any>;
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* @title transpile libs based only on %40tinkoff/is-modern-lib
|
|
230
|
+
* @default true
|
|
231
|
+
*/
|
|
232
|
+
transpileOnlyModernLibs?: boolean;
|
|
233
|
+
/**
|
|
234
|
+
* @title Browser package resolve aliases. E.g. { "stream": "stream-browserify" }
|
|
235
|
+
* @additionalProperties true
|
|
236
|
+
*/
|
|
237
|
+
webpackResolveAlias?: Record<string, string>;
|
|
238
|
+
/**
|
|
239
|
+
* @title Browser packages to provide with ProvidePlugin. E.g. { "Buffer": ["buffer", "Buffer"] }
|
|
240
|
+
* @additionalProperties true
|
|
241
|
+
*/
|
|
242
|
+
webpackProvide?: Record<string, any>;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* @title experimental settings for File-System Routing feature
|
|
246
|
+
* @default {}
|
|
247
|
+
*/
|
|
248
|
+
fileSystemPages?: {
|
|
142
249
|
/**
|
|
143
|
-
* @
|
|
250
|
+
* @title Read pages from file system
|
|
251
|
+
* @default false
|
|
144
252
|
*/
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* @title Sets ignore to DedupePlugin
|
|
158
|
-
*/
|
|
159
|
-
dedupeIgnore?: string[];
|
|
160
|
-
/**
|
|
161
|
-
* @title Enable replacing `typeof window` expression
|
|
162
|
-
* @default true
|
|
163
|
-
*/
|
|
164
|
-
removeTypeofWindow?: boolean;
|
|
165
|
-
/**
|
|
166
|
-
* @title Enable source maps in production build
|
|
167
|
-
* @default false
|
|
168
|
-
*/
|
|
169
|
-
sourceMap?: boolean;
|
|
170
|
-
/**
|
|
171
|
-
* @title Enable source maps for server assets in production build
|
|
172
|
-
* @default false
|
|
173
|
-
*/
|
|
174
|
-
sourceMapServer?: boolean;
|
|
175
|
-
/**
|
|
176
|
-
* @title Configuration for enabling parallel compression for terser plugin
|
|
177
|
-
* @default true
|
|
178
|
-
*/
|
|
179
|
-
terserParallel?: boolean;
|
|
180
|
-
/**
|
|
181
|
-
* @title List of modules to exclude from @babel/preset-env
|
|
182
|
-
*/
|
|
183
|
-
excludesPresetEnv?: string[];
|
|
184
|
-
/**
|
|
185
|
-
* @title thread-loader config
|
|
186
|
-
* @additionalProperties true
|
|
187
|
-
*/
|
|
188
|
-
threadLoader?: Record<string, any>;
|
|
189
|
-
/**
|
|
190
|
-
* @title Define plugin config
|
|
191
|
-
* @default {"prod": {}, "dev": {}}
|
|
192
|
-
* @additionalProperties true
|
|
193
|
-
*/
|
|
194
|
-
definePlugin?: Record<string, any>;
|
|
195
|
-
/**
|
|
196
|
-
* @deprecated
|
|
197
|
-
*
|
|
198
|
-
* @default false
|
|
199
|
-
*/
|
|
200
|
-
generateDataQaTag?: boolean;
|
|
201
|
-
/**
|
|
202
|
-
* @deprecated включает использование плагина fill-action-name
|
|
203
|
-
*
|
|
204
|
-
* @default false
|
|
205
|
-
*/
|
|
206
|
-
enableFillActionNamePlugin?: boolean;
|
|
207
|
-
/**
|
|
208
|
-
* @title Set minimizer for css
|
|
209
|
-
*/
|
|
210
|
-
cssMinimize?: 'csso';
|
|
211
|
-
postcss?: {
|
|
212
|
-
/**
|
|
213
|
-
* @title Path to postcss config file
|
|
214
|
-
*/
|
|
215
|
-
config?: string;
|
|
216
|
-
/**
|
|
217
|
-
* @title CSS identifiers build algorythm
|
|
218
|
-
*/
|
|
219
|
-
cssLocalIdentName?: string;
|
|
220
|
-
/**
|
|
221
|
-
* @title CSS identifiers build algorythm for development buld
|
|
222
|
-
*/
|
|
223
|
-
cssLocalIdentNameDev?: string;
|
|
224
|
-
/**
|
|
225
|
-
* @title CSS identifiers build algorythm for production build
|
|
226
|
-
*/
|
|
227
|
-
cssLocalIdentNameProd?: string;
|
|
228
|
-
/**
|
|
229
|
-
* @title Path to postcss config file for assets
|
|
230
|
-
*/
|
|
231
|
-
assetsConfig?: string;
|
|
232
|
-
};
|
|
233
|
-
/**
|
|
234
|
-
* @title Aliases for project imports
|
|
235
|
-
* @additionalProperties true
|
|
236
|
-
*/
|
|
237
|
-
alias?: Record<string, any>;
|
|
238
|
-
/**
|
|
239
|
-
* @title svgo-loader options
|
|
240
|
-
*/
|
|
241
|
-
svgo?: {
|
|
242
|
-
/**
|
|
243
|
-
* @title svgo plugins
|
|
244
|
-
*/
|
|
245
|
-
plugins?: Record<string, any>[];
|
|
246
|
-
};
|
|
247
|
-
/**
|
|
248
|
-
* @title Settings for image-webpack-loader
|
|
249
|
-
*/
|
|
250
|
-
imageOptimization?: {
|
|
251
|
-
/**
|
|
252
|
-
* @title Enable image-webpack-loader
|
|
253
|
-
*/
|
|
254
|
-
enabled?: boolean;
|
|
255
|
-
/**
|
|
256
|
-
* @title Pass options to image-webpack-loader
|
|
257
|
-
* @additionalProperties true
|
|
258
|
-
*/
|
|
259
|
-
options?: Record<string, any>;
|
|
260
|
-
};
|
|
261
|
-
/**
|
|
262
|
-
* @title transpile libs based only on %40tinkoff/is-modern-lib
|
|
263
|
-
* @default true
|
|
264
|
-
*/
|
|
265
|
-
transpileOnlyModernLibs?: boolean;
|
|
266
|
-
/**
|
|
267
|
-
* @title Experimental settings
|
|
268
|
-
* @default {}
|
|
269
|
-
*/
|
|
270
|
-
experiments?: Experiments;
|
|
271
|
-
/**
|
|
272
|
-
* @title Browser package resolve aliases. E.g. { "stream": "stream-browserify" }
|
|
273
|
-
* @additionalProperties true
|
|
274
|
-
*/
|
|
275
|
-
webpackResolveAlias?: Record<string, string>;
|
|
276
|
-
/**
|
|
277
|
-
* @title Browser packages to provide with ProvidePlugin. E.g. { "Buffer": ["buffer", "Buffer"] }
|
|
278
|
-
* @additionalProperties true
|
|
279
|
-
*/
|
|
280
|
-
webpackProvide?: Record<string, any>;
|
|
281
|
-
};
|
|
253
|
+
enable?: boolean;
|
|
254
|
+
/**
|
|
255
|
+
* @title Folder with pages from which static routers are generated
|
|
256
|
+
* @default "routes"
|
|
257
|
+
*/
|
|
258
|
+
routesDir?: string | false;
|
|
259
|
+
/**
|
|
260
|
+
* @title Folder with components which can be manually added to static routers
|
|
261
|
+
* @default "pages"
|
|
262
|
+
*/
|
|
263
|
+
pagesDir?: string | false;
|
|
282
264
|
};
|
|
283
265
|
/**
|
|
266
|
+
* @title Experimental settings
|
|
284
267
|
* @default {}
|
|
285
268
|
*/
|
|
286
|
-
|
|
269
|
+
experiments?: Experiments;
|
|
287
270
|
};
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export interface ConfigEntry {
|
|
274
|
+
name: string;
|
|
275
|
+
root: string;
|
|
276
|
+
type: ProjectType;
|
|
277
|
+
version?: string;
|
|
288
278
|
/**
|
|
289
|
-
* @deprecated move serveConfig to commands.serve
|
|
290
|
-
*
|
|
291
279
|
* @default {}
|
|
292
|
-
* @ignore true
|
|
293
280
|
*/
|
|
294
|
-
|
|
281
|
+
commands?: {
|
|
282
|
+
/**
|
|
283
|
+
* @default {}
|
|
284
|
+
*/
|
|
285
|
+
build?: BuildConfig;
|
|
286
|
+
/**
|
|
287
|
+
* @default {}
|
|
288
|
+
*/
|
|
289
|
+
serve?: ServeConfig;
|
|
290
|
+
};
|
|
295
291
|
}
|
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import util from 'util';
|
|
3
|
-
import childProcess from 'child_process';
|
|
1
|
+
import { command } from 'execa';
|
|
4
2
|
import type { Context } from '../../../models/context';
|
|
5
3
|
|
|
6
|
-
const exec = util.promisify(childProcess.exec);
|
|
7
|
-
|
|
8
4
|
export const checkVersions = async (context: Context) => {
|
|
9
|
-
const spinner = ora('Check tramvai versions').start();
|
|
10
|
-
|
|
11
5
|
try {
|
|
12
|
-
await
|
|
13
|
-
spinner.stop();
|
|
14
|
-
console.log('Versions check completed');
|
|
6
|
+
await command(`npx tramvai-check-versions`, { stdio: 'inherit' });
|
|
15
7
|
} catch (e) {
|
|
16
|
-
|
|
17
|
-
console.error('Versions check error:');
|
|
18
|
-
throw e;
|
|
8
|
+
throw new Error('Versions check failed');
|
|
19
9
|
}
|
|
20
10
|
};
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import childProcess from 'child_process';
|
|
3
|
-
|
|
4
|
-
const exec = util.promisify(childProcess.exec);
|
|
1
|
+
import { getPackageInfo } from './getPackageInfo';
|
|
5
2
|
|
|
6
3
|
export const getLatestPackageVersion = async (packageName: string, distTag = 'latest') => {
|
|
7
|
-
|
|
8
|
-
const version = stdout.replace('\n', '');
|
|
9
|
-
return version;
|
|
4
|
+
return getPackageInfo(`${packageName}@${distTag}`, 'version');
|
|
10
5
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import util from 'util';
|
|
2
|
+
import childProcess from 'child_process';
|
|
3
|
+
|
|
4
|
+
const exec = util.promisify(childProcess.exec);
|
|
5
|
+
|
|
6
|
+
export const getPackageInfo = async (packageName: string, field?: string) => {
|
|
7
|
+
const { stdout } = await exec(`npm view ${packageName} --json ${field ?? ''}`);
|
|
8
|
+
|
|
9
|
+
return JSON.parse(stdout);
|
|
10
|
+
};
|
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import util from 'util';
|
|
3
|
-
import childProcess from 'child_process';
|
|
1
|
+
import { command } from 'execa';
|
|
4
2
|
import type { Context } from '../../../models/context';
|
|
5
3
|
|
|
6
|
-
const exec = util.promisify(childProcess.exec);
|
|
7
|
-
|
|
8
4
|
export const migrate = async (context: Context) => {
|
|
9
|
-
const spinner = ora('Migrations start').start();
|
|
10
|
-
|
|
11
5
|
try {
|
|
12
|
-
await
|
|
13
|
-
spinner.stop();
|
|
14
|
-
console.log('Migrations completed');
|
|
6
|
+
await command(`npx tramvai-migrate`, { stdio: 'inherit' });
|
|
15
7
|
} catch (e) {
|
|
16
|
-
|
|
17
|
-
console.error('Migrations error:');
|
|
18
|
-
throw e;
|
|
8
|
+
throw new Error('Migrations failed');
|
|
19
9
|
}
|
|
20
10
|
};
|
package/src/utils/npmRequire.ts
CHANGED
|
@@ -40,6 +40,18 @@ async function runtimeInstallPackage({
|
|
|
40
40
|
spinner.stop();
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated Better do not use this function as it has some problems with npm@>=7
|
|
45
|
+
* This function only used by @tramvai/cli mostly to install optional dependencies during usage and meant to install
|
|
46
|
+
* single package in @tramvai/cli/node_modules dir. Before npm@7 it works just fine and there was only single package was installed.
|
|
47
|
+
* But starting with npm@7 it now installs all of the dependencies tree (see [issue](https://github.com/npm/cli/issues/3023)) that leads
|
|
48
|
+
* to very long installs and additional separate dependencies tree inside @tramvai/cli
|
|
49
|
+
*
|
|
50
|
+
* To mitigate this issue:
|
|
51
|
+
* - wait to [rfc](https://github.com/npm/rfcs/pull/364) be implemented
|
|
52
|
+
* - try [hack](https://github.com/npm/rfcs/pull/364#issuecomment-823637315) with internal workspace suggested in rfc from above
|
|
53
|
+
* - use specific npm version by calling explicitly `npx -q npm@^6`
|
|
54
|
+
*/
|
|
43
55
|
async function npmRequire({
|
|
44
56
|
cliRootDir,
|
|
45
57
|
packageManager,
|
|
@@ -107,6 +119,9 @@ async function npmRequire({
|
|
|
107
119
|
return require(packageName);
|
|
108
120
|
}
|
|
109
121
|
|
|
122
|
+
/**
|
|
123
|
+
* @deprecated Better do not use it, see deprecation notes for the npmRequire
|
|
124
|
+
*/
|
|
110
125
|
function npmRequireList({
|
|
111
126
|
cliRootDir,
|
|
112
127
|
packageManager,
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import childProcess from 'child_process';
|
|
1
|
+
import { command } from 'execa';
|
|
3
2
|
import { isLockfileChanged } from '../../utils/lockfileHash';
|
|
4
3
|
import type { Validator } from './validator.h';
|
|
5
4
|
|
|
6
|
-
const exec = util.promisify(childProcess.exec);
|
|
7
|
-
|
|
8
5
|
export const runMigrationsAndCheckVersions: Validator = async (context) => {
|
|
9
6
|
if (isLockfileChanged(context)) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const { stdout: checkLog } = await exec(`npx tramvai-check-versions`);
|
|
13
|
-
console.log(checkLog);
|
|
7
|
+
await command(`npx tramvai-migrate`, { stdio: 'inherit' });
|
|
8
|
+
await command(`npx tramvai-check-versions`, { stdio: 'inherit' });
|
|
14
9
|
}
|
|
15
10
|
|
|
16
11
|
return { name: 'runMigrationsAndCheckVersions', status: 'ok' };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Context } from '../../../models/context';
|
|
2
|
-
import type { CommandResult } from '../../../models/command';
|
|
3
|
-
export declare type Params = {
|
|
4
|
-
to: string;
|
|
5
|
-
};
|
|
6
|
-
declare const _default: (context: Context, { to: version }: Params) => Promise<CommandResult>;
|
|
7
|
-
export default _default;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const installDependencies_1 = require("./installDependencies");
|
|
5
|
-
const updatePackageJson_1 = require("./updatePackageJson");
|
|
6
|
-
const getLatestPackageVersion_1 = require("./getLatestPackageVersion");
|
|
7
|
-
const deduplicate_1 = require("./deduplicate");
|
|
8
|
-
const migrate_1 = require("./migrate");
|
|
9
|
-
exports.default = (context, { to: version = 'latest' }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
10
|
-
const versionNumber = version === 'latest' ? yield getLatestPackageVersion_1.getLatestPackageVersion('@tramvai/core') : version;
|
|
11
|
-
yield updatePackageJson_1.updatePackageJson(versionNumber);
|
|
12
|
-
yield installDependencies_1.installDependencies(context);
|
|
13
|
-
yield deduplicate_1.deduplicate(context);
|
|
14
|
-
yield migrate_1.migrate(context);
|
|
15
|
-
return Promise.resolve({
|
|
16
|
-
status: 'ok',
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
//# sourceMappingURL=update.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../src/utils/commands/dependencies/update.ts"],"names":[],"mappings":";;;AAEA,+DAA4D;AAC5D,2DAAwD;AACxD,uEAAoE;AACpE,+CAA4C;AAC5C,uCAAoC;AAMpC,kBAAe,CACb,OAAgB,EAChB,EAAE,EAAE,EAAE,OAAO,GAAG,QAAQ,EAAU,EACV,EAAE;IAC1B,MAAM,aAAa,GACjB,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,iDAAuB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAElF,MAAM,qCAAiB,CAAC,aAAa,CAAC,CAAC;IAEvC,MAAM,yCAAmB,CAAC,OAAO,CAAC,CAAC;IAEnC,MAAM,yBAAW,CAAC,OAAO,CAAC,CAAC;IAE3B,MAAM,iBAAO,CAAC,OAAO,CAAC,CAAC;IAEvB,OAAO,OAAO,CAAC,OAAO,CAAC;QACrB,MAAM,EAAE,IAAI;KACb,CAAC,CAAC;AACL,CAAC,CAAA,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const updatePackageJson: (version: string) => Promise<void>;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updatePackageJson = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const semver_1 = require("semver");
|
|
6
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
7
|
-
const getLatestPackageVersion_1 = require("./getLatestPackageVersion");
|
|
8
|
-
// Список пакетов, не начинающихся с @tramvai,
|
|
9
|
-
// которые мы также хотим обновить
|
|
10
|
-
const packagesToUpdate = [
|
|
11
|
-
'browser-timings',
|
|
12
|
-
'dippy',
|
|
13
|
-
'dynamic-components',
|
|
14
|
-
'hook-runner',
|
|
15
|
-
'htmlpagebuilder',
|
|
16
|
-
'meta-tags-generate',
|
|
17
|
-
];
|
|
18
|
-
const shouldUpdateDependency = (name) => {
|
|
19
|
-
return name.startsWith('@tramvai') || packagesToUpdate.includes(name);
|
|
20
|
-
};
|
|
21
|
-
const getVersionFromDep = (dep) => { var _a, _b; return ((_a = semver_1.parse(dep)) === null || _a === void 0 ? void 0 : _a.version) || ((_b = semver_1.minVersion(dep)) === null || _b === void 0 ? void 0 : _b.version); };
|
|
22
|
-
const updateEntry = (deps, dep, { currentVersion, version }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
23
|
-
if (dep.startsWith('@tramvai') && getVersionFromDep(deps[dep]) === currentVersion) {
|
|
24
|
-
console.log(`- ${dep}@${version}`);
|
|
25
|
-
// eslint-disable-next-line no-param-reassign
|
|
26
|
-
deps[dep] = version;
|
|
27
|
-
}
|
|
28
|
-
else if (shouldUpdateDependency(dep)) {
|
|
29
|
-
const latestPackageVersion = yield getLatestPackageVersion_1.getLatestPackageVersion(dep);
|
|
30
|
-
console.log(`- ${dep}@${latestPackageVersion}`);
|
|
31
|
-
// eslint-disable-next-line no-param-reassign
|
|
32
|
-
deps[dep] = latestPackageVersion;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
const updatePackageJson = (version) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
-
console.log(`Update package.json to ${version} version`);
|
|
37
|
-
const file = fs_1.default.readFileSync('package.json');
|
|
38
|
-
const content = JSON.parse(file.toString());
|
|
39
|
-
const currentVersion = getVersionFromDep(content.dependencies['@tramvai/core']);
|
|
40
|
-
if (currentVersion === version) {
|
|
41
|
-
console.error('The installed version is equal to the current version, no update is required.');
|
|
42
|
-
process.exit(0);
|
|
43
|
-
}
|
|
44
|
-
for (const dep in content.dependencies) {
|
|
45
|
-
if (Object.prototype.hasOwnProperty.call(content.dependencies, dep)) {
|
|
46
|
-
yield updateEntry(content.dependencies, dep, { currentVersion, version });
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
for (const dep in content.devDependencies) {
|
|
50
|
-
if (Object.prototype.hasOwnProperty.call(content.devDependencies, dep)) {
|
|
51
|
-
yield updateEntry(content.devDependencies, dep, { currentVersion, version });
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
fs_1.default.writeFileSync('package.json', JSON.stringify(content, null, 2));
|
|
55
|
-
});
|
|
56
|
-
exports.updatePackageJson = updatePackageJson;
|
|
57
|
-
//# sourceMappingURL=updatePackageJson.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updatePackageJson.js","sourceRoot":"","sources":["../../../../src/utils/commands/dependencies/updatePackageJson.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { Context } from '../../../models/context';
|
|
2
|
-
import type { CommandResult } from '../../../models/command';
|
|
3
|
-
import { installDependencies } from './installDependencies';
|
|
4
|
-
import { updatePackageJson } from './updatePackageJson';
|
|
5
|
-
import { getLatestPackageVersion } from './getLatestPackageVersion';
|
|
6
|
-
import { deduplicate } from './deduplicate';
|
|
7
|
-
import { migrate } from './migrate';
|
|
8
|
-
|
|
9
|
-
export type Params = {
|
|
10
|
-
to: string;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export default async (
|
|
14
|
-
context: Context,
|
|
15
|
-
{ to: version = 'latest' }: Params
|
|
16
|
-
): Promise<CommandResult> => {
|
|
17
|
-
const versionNumber =
|
|
18
|
-
version === 'latest' ? await getLatestPackageVersion('@tramvai/core') : version;
|
|
19
|
-
|
|
20
|
-
await updatePackageJson(versionNumber);
|
|
21
|
-
|
|
22
|
-
await installDependencies(context);
|
|
23
|
-
|
|
24
|
-
await deduplicate(context);
|
|
25
|
-
|
|
26
|
-
await migrate(context);
|
|
27
|
-
|
|
28
|
-
return Promise.resolve({
|
|
29
|
-
status: 'ok',
|
|
30
|
-
});
|
|
31
|
-
};
|