nativescript 8.6.0-vision.4 → 8.6.0-vision.6
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 +1 -1
- package/docs/man_pages/cloud/cloud-setup.md +9 -9
- package/docs/man_pages/device/device-android.md +3 -3
- package/docs/man_pages/device/device-ios.md +5 -5
- package/docs/man_pages/device/device-list-applications.md +4 -4
- package/docs/man_pages/device/device-log.md +4 -4
- package/docs/man_pages/device/device-run.md +5 -5
- package/docs/man_pages/device/device.md +5 -5
- package/docs/man_pages/env-configuration/setup.md +3 -3
- package/docs/man_pages/general/autocomplete-disable.md +3 -3
- package/docs/man_pages/general/autocomplete-enable.md +3 -3
- package/docs/man_pages/general/autocomplete-status.md +3 -3
- package/docs/man_pages/general/autocomplete.md +6 -6
- package/docs/man_pages/general/error-reporting.md +3 -3
- package/docs/man_pages/general/extension-install.md +3 -3
- package/docs/man_pages/general/extension-uninstall.md +3 -3
- package/docs/man_pages/general/extension.md +3 -3
- package/docs/man_pages/general/help.md +6 -6
- package/docs/man_pages/general/info.md +3 -3
- package/docs/man_pages/general/migrate.md +3 -3
- package/docs/man_pages/general/package-manager-get.md +3 -3
- package/docs/man_pages/general/package-manager-set.md +3 -3
- package/docs/man_pages/general/package-manager.md +3 -3
- package/docs/man_pages/general/proxy-clear.md +3 -3
- package/docs/man_pages/general/proxy-set.md +3 -3
- package/docs/man_pages/general/proxy.md +3 -3
- package/docs/man_pages/general/update.md +5 -5
- package/docs/man_pages/general/usage-reporting.md +3 -3
- package/docs/man_pages/lib-management/plugin-add.md +4 -4
- package/docs/man_pages/lib-management/plugin-build.md +3 -3
- package/docs/man_pages/lib-management/plugin-create.md +7 -7
- package/docs/man_pages/lib-management/plugin-install.md +4 -4
- package/docs/man_pages/lib-management/plugin-remove.md +4 -4
- package/docs/man_pages/lib-management/plugin-update.md +3 -3
- package/docs/man_pages/lib-management/plugin.md +4 -4
- package/docs/man_pages/project/configuration/generate.md +3 -3
- package/docs/man_pages/project/configuration/install.md +6 -6
- package/docs/man_pages/project/configuration/platform-add.md +11 -11
- package/docs/man_pages/project/configuration/platform-clean.md +6 -6
- package/docs/man_pages/project/configuration/platform-remove.md +5 -5
- package/docs/man_pages/project/configuration/platform-update.md +11 -11
- package/docs/man_pages/project/configuration/platform.md +3 -3
- package/docs/man_pages/project/configuration/prepare.md +5 -5
- package/docs/man_pages/project/configuration/resources/resources-generate-icons.md +4 -4
- package/docs/man_pages/project/configuration/resources/resources-generate-splashes.md +4 -4
- package/docs/man_pages/project/configuration/resources/resources-update.md +5 -5
- package/docs/man_pages/project/creation/create.md +4 -4
- package/docs/man_pages/project/testing/build-android.md +4 -4
- package/docs/man_pages/project/testing/build-ios.md +6 -6
- package/docs/man_pages/project/testing/build.md +5 -5
- package/docs/man_pages/project/testing/debug-android.md +9 -9
- package/docs/man_pages/project/testing/debug-ios.md +11 -11
- package/docs/man_pages/project/testing/debug.md +4 -4
- package/docs/man_pages/project/testing/deploy.md +8 -8
- package/docs/man_pages/project/testing/dev-test-android.md +5 -5
- package/docs/man_pages/project/testing/dev-test-ios.md +7 -7
- package/docs/man_pages/project/testing/preview.md +4 -4
- package/docs/man_pages/project/testing/run-android.md +7 -7
- package/docs/man_pages/project/testing/run-ios.md +11 -11
- package/docs/man_pages/project/testing/run.md +7 -7
- package/docs/man_pages/project/testing/test-android.md +7 -7
- package/docs/man_pages/project/testing/test-init.md +3 -3
- package/docs/man_pages/project/testing/test-ios.md +9 -9
- package/docs/man_pages/project/testing/test.md +4 -4
- package/docs/man_pages/publishing/apple-login.md +3 -3
- package/docs/man_pages/publishing/appstore-upload.md +7 -7
- package/docs/man_pages/publishing/appstore.md +5 -5
- package/docs/man_pages/publishing/publish-ios.md +7 -7
- package/docs/man_pages/publishing/publish.md +6 -6
- package/docs/man_pages/start.md +2 -1
- package/lib/.d.ts +8 -0
- package/lib/bootstrap.js +4 -0
- package/lib/color.js +6 -1
- package/lib/commands/clean.js +4 -4
- package/lib/commands/run.js +7 -3
- package/lib/commands/start.js +33 -0
- package/lib/commands/typings.js +3 -3
- package/lib/common/definitions/config.d.ts +1 -0
- package/lib/common/definitions/key-commands.d.ts +61 -0
- package/lib/common/definitions/yok.d.ts +5 -0
- package/lib/common/header.js +30 -0
- package/lib/common/mobile/mobile-core/devices-service.js +11 -13
- package/lib/common/yok.js +25 -0
- package/lib/config.js +1 -0
- package/lib/controllers/migrate-controller.js +5 -5
- package/lib/controllers/prepare-controller.js +41 -4
- package/lib/controllers/run-controller.js +5 -0
- package/lib/definitions/livesync.d.ts +3 -0
- package/lib/definitions/prepare.d.ts +3 -0
- package/lib/definitions/project.d.ts +2 -0
- package/lib/definitions/run.d.ts +4 -1
- package/lib/definitions/start-service.d.ts +13 -0
- package/lib/helpers/key-command-helper.js +119 -0
- package/lib/helpers/livesync-command-helper.js +49 -18
- package/lib/key-commands/bootstrap.js +15 -0
- package/lib/key-commands/index.js +291 -0
- package/lib/services/android-plugin-build-service.js +6 -5
- package/lib/services/apple-portal/apple-portal-session-service.js +1 -1
- package/lib/services/build-artifacts-service.js +1 -1
- package/lib/services/ios-project-service.js +10 -10
- package/lib/services/livesync/android-livesync-tool.js +1 -1
- package/lib/services/plugins-service.js +2 -1
- package/lib/services/start-service.js +104 -0
- package/lib/services/webpack/webpack-compiler-service.js +9 -4
- package/node_modules/@npmcli/move-file/node_modules/mkdirp/CHANGELOG.md +15 -0
- package/node_modules/rimraf/CHANGELOG.md +65 -0
- package/node_modules/stringify-package/CHANGELOG.md +16 -0
- package/package.json +3 -2
package/lib/common/yok.js
CHANGED
|
@@ -41,6 +41,7 @@ class Yok {
|
|
|
41
41
|
constructor() {
|
|
42
42
|
this.overrideAlreadyRequiredModule = false;
|
|
43
43
|
this.COMMANDS_NAMESPACE = "commands";
|
|
44
|
+
this.KEY_COMMANDS_NAMESPACE = "keyCommands";
|
|
44
45
|
this.modules = {};
|
|
45
46
|
this.resolutionProgress = {};
|
|
46
47
|
this.hierarchicalCommands = {};
|
|
@@ -78,6 +79,9 @@ class Yok {
|
|
|
78
79
|
require(names, file) {
|
|
79
80
|
forEachName(names, (name) => this.requireOne(name, file));
|
|
80
81
|
}
|
|
82
|
+
requireKeyCommand(name, file) {
|
|
83
|
+
this.requireOne(this.createKeyCommandName(name), file);
|
|
84
|
+
}
|
|
81
85
|
requirePublic(names, file) {
|
|
82
86
|
forEachName(names, (name) => {
|
|
83
87
|
this.requireOne(name, file);
|
|
@@ -136,6 +140,9 @@ class Yok {
|
|
|
136
140
|
}
|
|
137
141
|
});
|
|
138
142
|
}
|
|
143
|
+
registerKeyCommand(name, resolver) {
|
|
144
|
+
this.register(this.createKeyCommandName(name), resolver);
|
|
145
|
+
}
|
|
139
146
|
getDefaultCommand(name, commandArguments) {
|
|
140
147
|
const subCommands = this.hierarchicalCommands[name];
|
|
141
148
|
const defaultCommand = _.find(subCommands, (command) => _.some(command.split("|"), (c) => _.startsWith(c, "*")));
|
|
@@ -270,6 +277,15 @@ class Yok {
|
|
|
270
277
|
command = this.resolve(commandModuleName);
|
|
271
278
|
return command;
|
|
272
279
|
}
|
|
280
|
+
resolveKeyCommand(name) {
|
|
281
|
+
let command;
|
|
282
|
+
const commandModuleName = this.createKeyCommandName(name);
|
|
283
|
+
if (!this.modules[commandModuleName]) {
|
|
284
|
+
return null;
|
|
285
|
+
}
|
|
286
|
+
command = this.resolve(commandModuleName);
|
|
287
|
+
return command;
|
|
288
|
+
}
|
|
273
289
|
resolve(param, ctorArguments) {
|
|
274
290
|
if (_.isFunction(param)) {
|
|
275
291
|
return this.resolveConstructor(param, ctorArguments);
|
|
@@ -372,12 +388,21 @@ class Yok {
|
|
|
372
388
|
}
|
|
373
389
|
return commands;
|
|
374
390
|
}
|
|
391
|
+
getRegisteredKeyCommandsNames() {
|
|
392
|
+
const modulesNames = _.keys(this.modules);
|
|
393
|
+
const commandsNames = _.filter(modulesNames, (moduleName) => _.startsWith(moduleName, `${this.KEY_COMMANDS_NAMESPACE}.`));
|
|
394
|
+
let commands = _.map(commandsNames, (commandName) => commandName.substr(this.KEY_COMMANDS_NAMESPACE.length + 1));
|
|
395
|
+
return commands;
|
|
396
|
+
}
|
|
375
397
|
getChildrenCommandsNames(commandName) {
|
|
376
398
|
return this.hierarchicalCommands[commandName];
|
|
377
399
|
}
|
|
378
400
|
createCommandName(name) {
|
|
379
401
|
return `${this.COMMANDS_NAMESPACE}.${name}`;
|
|
380
402
|
}
|
|
403
|
+
createKeyCommandName(name) {
|
|
404
|
+
return `${this.KEY_COMMANDS_NAMESPACE}.${name}`;
|
|
405
|
+
}
|
|
381
406
|
dispose() {
|
|
382
407
|
Object.keys(this.modules).forEach((moduleName) => {
|
|
383
408
|
const instances = this.modules[moduleName].instances;
|
package/lib/config.js
CHANGED
|
@@ -51,6 +51,7 @@ class StaticConfig {
|
|
|
51
51
|
this.ANALYTICS_INSTALLATION_ID_SETTING_NAME = "AnalyticsInstallationID";
|
|
52
52
|
this.RESOURCE_DIR_PATH = path.join(__dirname, "..", "resources");
|
|
53
53
|
this.version = require("../package.json").version;
|
|
54
|
+
this.cliBinPath = path.resolve(__dirname, "..", "bin", "nativescript.js");
|
|
54
55
|
this._adbFilePath = null;
|
|
55
56
|
this._userAgent = null;
|
|
56
57
|
}
|
|
@@ -112,7 +112,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
112
112
|
{
|
|
113
113
|
packageName: "@nativescript/angular",
|
|
114
114
|
minVersion: "10.0.0",
|
|
115
|
-
desiredVersion: "
|
|
115
|
+
desiredVersion: "^16.0.0",
|
|
116
116
|
shouldMigrateAction(dependency, projectData, loose) {
|
|
117
117
|
return __awaiter(this, void 0, void 0, function* () {
|
|
118
118
|
if (!this.hasDependency(dependency, projectData)) {
|
|
@@ -451,7 +451,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
451
451
|
constants.NODE_MODULES_FOLDER_NAME,
|
|
452
452
|
constants.PACKAGE_LOCK_JSON_FILE_NAME,
|
|
453
453
|
]);
|
|
454
|
-
const { dependencies, devDependencies
|
|
454
|
+
const { dependencies, devDependencies } = yield this.$pluginsService.getDependenciesFromPackageJson(projectData.projectDir);
|
|
455
455
|
const hasSchematics = [...dependencies, ...devDependencies].find((p) => p.name === "@nativescript/schematics");
|
|
456
456
|
if (!hasSchematics) {
|
|
457
457
|
yield this.$projectCleanupService.clean([
|
|
@@ -781,7 +781,7 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
781
781
|
migrateNativeScriptAngular() {
|
|
782
782
|
return __awaiter(this, void 0, void 0, function* () {
|
|
783
783
|
const minVersion = "10.0.0";
|
|
784
|
-
const desiredVersion = "~
|
|
784
|
+
const desiredVersion = "~16.2.0";
|
|
785
785
|
const dependencies = [
|
|
786
786
|
{
|
|
787
787
|
packageName: "@angular/animations",
|
|
@@ -834,13 +834,13 @@ class MigrateController extends update_controller_base_1.UpdateControllerBase {
|
|
|
834
834
|
{
|
|
835
835
|
packageName: "rxjs",
|
|
836
836
|
minVersion: "6.6.0",
|
|
837
|
-
desiredVersion: "~7.
|
|
837
|
+
desiredVersion: "~7.8.0",
|
|
838
838
|
shouldAddIfMissing: true,
|
|
839
839
|
},
|
|
840
840
|
{
|
|
841
841
|
packageName: "zone.js",
|
|
842
842
|
minVersion: "0.11.1",
|
|
843
|
-
desiredVersion: "~0.
|
|
843
|
+
desiredVersion: "~0.14.0",
|
|
844
844
|
shouldAddIfMissing: true,
|
|
845
845
|
},
|
|
846
846
|
{
|
|
@@ -17,13 +17,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.PrepareController = void 0;
|
|
19
19
|
const choki = require("chokidar");
|
|
20
|
-
const helpers_1 = require("../common/helpers");
|
|
21
|
-
const decorators_1 = require("../common/decorators");
|
|
22
20
|
const events_1 = require("events");
|
|
21
|
+
const _ = require("lodash");
|
|
23
22
|
const path = require("path");
|
|
24
|
-
const
|
|
23
|
+
const decorators_1 = require("../common/decorators");
|
|
24
|
+
const helpers_1 = require("../common/helpers");
|
|
25
25
|
const yok_1 = require("../common/yok");
|
|
26
|
-
const
|
|
26
|
+
const constants_1 = require("../constants");
|
|
27
27
|
class PrepareController extends events_1.EventEmitter {
|
|
28
28
|
constructor($platformController, $hooksService, $fs, $logger, $mobileHelper, $nodeModulesDependenciesBuilder, $platformsDataService, $pluginsService, $prepareNativePlatformService, $projectChangesService, $projectDataService, $webpackCompilerService, $watchIgnoreListService, $analyticsService, $markingModeService, $projectConfigService, $projectService) {
|
|
29
29
|
super();
|
|
@@ -48,6 +48,7 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
48
48
|
this.isInitialPrepareReady = false;
|
|
49
49
|
this.persistedData = [];
|
|
50
50
|
this.webpackCompilerHandler = null;
|
|
51
|
+
this.pausedFileWatch = false;
|
|
51
52
|
}
|
|
52
53
|
prepare(prepareData) {
|
|
53
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -123,6 +124,11 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
123
124
|
this.watchersData[projectData.projectDir][platformData.platformNameLowerCase] = {
|
|
124
125
|
nativeFilesWatcher: null,
|
|
125
126
|
hasWebpackCompilerProcess: false,
|
|
127
|
+
prepareArguments: {
|
|
128
|
+
platformData,
|
|
129
|
+
projectData,
|
|
130
|
+
prepareData,
|
|
131
|
+
},
|
|
126
132
|
};
|
|
127
133
|
}
|
|
128
134
|
yield this.startJSWatcherWithPrepare(platformData, projectData, prepareData);
|
|
@@ -154,6 +160,8 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
154
160
|
if (!this.watchersData[projectData.projectDir][platformData.platformNameLowerCase].hasWebpackCompilerProcess) {
|
|
155
161
|
const handler = (data) => {
|
|
156
162
|
if (data.platform.toLowerCase() === platformData.platformNameLowerCase) {
|
|
163
|
+
if (this.isFileWatcherPaused())
|
|
164
|
+
return;
|
|
157
165
|
this.emitPrepareEvent(Object.assign(Object.assign({}, data), { hasNativeChanges: false }));
|
|
158
166
|
}
|
|
159
167
|
};
|
|
@@ -196,6 +204,8 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
196
204
|
const watcher = choki
|
|
197
205
|
.watch(patterns, watcherOptions)
|
|
198
206
|
.on("all", (event, filePath) => __awaiter(this, void 0, void 0, function* () {
|
|
207
|
+
if (this.isFileWatcherPaused())
|
|
208
|
+
return;
|
|
199
209
|
filePath = path.join(projectData.projectDir, filePath);
|
|
200
210
|
if (this.$watchIgnoreListService.isFileInIgnoreList(filePath)) {
|
|
201
211
|
this.$watchIgnoreListService.removeFileFromIgnoreList(filePath);
|
|
@@ -297,6 +307,33 @@ class PrepareController extends events_1.EventEmitter {
|
|
|
297
307
|
});
|
|
298
308
|
});
|
|
299
309
|
}
|
|
310
|
+
isFileWatcherPaused() {
|
|
311
|
+
return this.pausedFileWatch;
|
|
312
|
+
}
|
|
313
|
+
toggleFileWatcher() {
|
|
314
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
315
|
+
this.pausedFileWatch = !this.pausedFileWatch;
|
|
316
|
+
const watchers = Object.values(this.watchersData);
|
|
317
|
+
if (this.pausedFileWatch) {
|
|
318
|
+
for (const watcher of watchers) {
|
|
319
|
+
for (const platform in watcher) {
|
|
320
|
+
yield this.$webpackCompilerService.stopWebpackCompiler(platform);
|
|
321
|
+
watcher[platform].hasWebpackCompilerProcess = false;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
for (const watcher of watchers) {
|
|
327
|
+
for (const platform in watcher) {
|
|
328
|
+
const args = watcher[platform].prepareArguments;
|
|
329
|
+
watcher[platform].hasWebpackCompilerProcess = true;
|
|
330
|
+
yield this.$webpackCompilerService.compileWithWatch(args.platformData, args.projectData, args.prepareData);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return this.pausedFileWatch;
|
|
335
|
+
});
|
|
336
|
+
}
|
|
300
337
|
}
|
|
301
338
|
__decorate([
|
|
302
339
|
(0, decorators_1.performanceLog)(),
|
|
@@ -136,8 +136,12 @@ class RunController extends events_1.EventEmitter {
|
|
|
136
136
|
this.emitCore(constants_2.RunOnDeviceEvents.runOnDeviceStopped, {
|
|
137
137
|
projectDir,
|
|
138
138
|
deviceIdentifier,
|
|
139
|
+
keepProcessAlive: stopOptions === null || stopOptions === void 0 ? void 0 : stopOptions.keepProcessAlive,
|
|
139
140
|
});
|
|
140
141
|
});
|
|
142
|
+
if (stopOptions === null || stopOptions === void 0 ? void 0 : stopOptions.keepProcessAlive) {
|
|
143
|
+
this.removeAllListeners(constants_2.RunOnDeviceEvents.runOnDeviceStopped);
|
|
144
|
+
}
|
|
141
145
|
}
|
|
142
146
|
});
|
|
143
147
|
}
|
|
@@ -298,6 +302,7 @@ class RunController extends events_1.EventEmitter {
|
|
|
298
302
|
}
|
|
299
303
|
else {
|
|
300
304
|
const shouldBuild = prepareResultData.hasNativeChanges ||
|
|
305
|
+
buildData.nativePrepare.forceRebuildNativeApp ||
|
|
301
306
|
(yield this.$buildController.shouldBuild(buildData));
|
|
302
307
|
if (shouldBuild) {
|
|
303
308
|
packageFilePath = yield deviceDescriptor.buildAction();
|
|
@@ -141,6 +141,7 @@ declare global {
|
|
|
141
141
|
error?: Error;
|
|
142
142
|
notification?: string;
|
|
143
143
|
isFullSync?: boolean;
|
|
144
|
+
keepProcessAlive?: boolean;
|
|
144
145
|
}
|
|
145
146
|
|
|
146
147
|
interface IIsEmulator {
|
|
@@ -577,6 +578,8 @@ declare global {
|
|
|
577
578
|
): Promise<ILiveSyncDeviceDescriptor[]>;
|
|
578
579
|
getDeviceInstances(platform?: string): Promise<Mobile.IDevice[]>;
|
|
579
580
|
getLiveSyncData(projectDir: string): ILiveSyncInfo;
|
|
581
|
+
|
|
582
|
+
stop(): Promise<void>;
|
|
580
583
|
}
|
|
581
584
|
|
|
582
585
|
interface ILiveSyncServiceResolver {
|
|
@@ -10,6 +10,7 @@ declare global {
|
|
|
10
10
|
env: any;
|
|
11
11
|
watch?: boolean;
|
|
12
12
|
watchNative: boolean;
|
|
13
|
+
watchNodeModules?: boolean;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
interface IiOSCodeSigningData {
|
|
@@ -31,6 +32,8 @@ declare global {
|
|
|
31
32
|
interface IPrepareController extends EventEmitter {
|
|
32
33
|
prepare(prepareData: IPrepareData): Promise<IPrepareResultData>;
|
|
33
34
|
stopWatchers(projectDir: string, platform: string): Promise<void>;
|
|
35
|
+
toggleFileWatcher: () => Promise<boolean>;
|
|
36
|
+
// toggleWatchNodeModules: () => Promise<boolean>;
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
interface IPrepareResultData {
|
package/lib/definitions/run.d.ts
CHANGED
|
@@ -14,7 +14,10 @@ declare global {
|
|
|
14
14
|
interface IStopRunData {
|
|
15
15
|
projectDir: string;
|
|
16
16
|
deviceIdentifiers?: string[];
|
|
17
|
-
stopOptions?: {
|
|
17
|
+
stopOptions?: {
|
|
18
|
+
shouldAwaitAllActions: boolean;
|
|
19
|
+
keepProcessAlive?: boolean;
|
|
20
|
+
};
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
interface IRunController extends EventEmitter {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ChildProcess } from "child_process";
|
|
2
|
+
|
|
3
|
+
export interface IStartService {
|
|
4
|
+
ios: ChildProcess;
|
|
5
|
+
android: ChildProcess;
|
|
6
|
+
start(): void;
|
|
7
|
+
toggleVerbose(): void;
|
|
8
|
+
|
|
9
|
+
runIOS(): Promise<void>;
|
|
10
|
+
runAndroid(): Promise<void>;
|
|
11
|
+
stopIOS(): Promise<void>;
|
|
12
|
+
stopAndroid(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const color_1 = require("../color");
|
|
13
|
+
const yok_1 = require("../common/yok");
|
|
14
|
+
class KeyCommandHelper {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.platform = "all";
|
|
17
|
+
this.overrides = {};
|
|
18
|
+
this.onKeyPressed = (data) => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const key = data.toString();
|
|
20
|
+
if (this.keyCommandExecutionBlocked && key !== "\u0003")
|
|
21
|
+
return;
|
|
22
|
+
try {
|
|
23
|
+
const exists = yok_1.injector.getRegisteredKeyCommandsNames().includes(key);
|
|
24
|
+
if (exists) {
|
|
25
|
+
const keyCommand = yok_1.injector.resolveKeyCommand(key);
|
|
26
|
+
if (keyCommand.platform === "all" ||
|
|
27
|
+
keyCommand.platform === this.platform ||
|
|
28
|
+
this.platform === "all") {
|
|
29
|
+
if (keyCommand.canExecute &&
|
|
30
|
+
!keyCommand.canExecute(this.processType)) {
|
|
31
|
+
console.log("blocked execution");
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (keyCommand.willBlockKeyCommandExecution)
|
|
35
|
+
this.keyCommandExecutionBlocked = true;
|
|
36
|
+
if (this.overrides[key]) {
|
|
37
|
+
if (!(yield this.overrides[key]())) {
|
|
38
|
+
this.keyCommandExecutionBlocked = false;
|
|
39
|
+
process.stdin.resume();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (keyCommand.key !== "\u0003") {
|
|
44
|
+
const line = ` ${color_1.color.dim("→")} ${color_1.color.bold(keyCommand.key)} — ${keyCommand.description}`;
|
|
45
|
+
const lineLength = (0, color_1.stripColors)(line).length - 1;
|
|
46
|
+
console.log(color_1.color.dim(` ┌${"─".repeat(lineLength)}┐`));
|
|
47
|
+
console.log(line + color_1.color.dim(" │"));
|
|
48
|
+
console.log(color_1.color.dim(` └${"─".repeat(lineLength)}┘`));
|
|
49
|
+
console.log("");
|
|
50
|
+
}
|
|
51
|
+
const result = yield keyCommand.execute(this.platform);
|
|
52
|
+
this.keyCommandExecutionBlocked = false;
|
|
53
|
+
if (process.stdin.setRawMode) {
|
|
54
|
+
process.stdin.resume();
|
|
55
|
+
}
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
process.stdout.write(key);
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
const $logger = yok_1.injector.resolve("logger");
|
|
63
|
+
$logger.error(e.message);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
addOverride(key, execute) {
|
|
68
|
+
this.overrides[key] = execute;
|
|
69
|
+
}
|
|
70
|
+
removeOverride(key) {
|
|
71
|
+
this.overrides[key] = undefined;
|
|
72
|
+
}
|
|
73
|
+
printCommands(platform) {
|
|
74
|
+
const commands = yok_1.injector.getRegisteredKeyCommandsNames();
|
|
75
|
+
const commandHelp = commands.reduce((arr, key) => {
|
|
76
|
+
const command = yok_1.injector.resolveKeyCommand(key);
|
|
77
|
+
if (!command.description ||
|
|
78
|
+
(command.platform !== "all" &&
|
|
79
|
+
command.platform !== platform &&
|
|
80
|
+
platform !== "all") ||
|
|
81
|
+
(command.canExecute && !command.canExecute(this.processType))) {
|
|
82
|
+
return arr;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
arr.push(` ${color_1.color.bold(command.key)} — ${command.description}`);
|
|
86
|
+
return arr;
|
|
87
|
+
}
|
|
88
|
+
}, []);
|
|
89
|
+
console.info([
|
|
90
|
+
"",
|
|
91
|
+
` The CLI is ${color_1.color.underline(`interactive`)}, you can press the following keys any time (make sure the terminal has focus).`,
|
|
92
|
+
"",
|
|
93
|
+
...commandHelp,
|
|
94
|
+
"",
|
|
95
|
+
].join("\n"));
|
|
96
|
+
}
|
|
97
|
+
attachKeyCommands(platform, processType) {
|
|
98
|
+
this.processType = processType;
|
|
99
|
+
this.platform = platform;
|
|
100
|
+
const stdin = process.stdin;
|
|
101
|
+
if (!stdin.setRawMode) {
|
|
102
|
+
process.on("message", (key) => {
|
|
103
|
+
this.onKeyPressed(Buffer.from(key));
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
stdin.setRawMode(false);
|
|
108
|
+
stdin.setRawMode(true);
|
|
109
|
+
stdin.resume();
|
|
110
|
+
stdin.on("data", this.onKeyPressed);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
detachKeyCommands() {
|
|
114
|
+
process.stdin.off("data", this.onKeyPressed);
|
|
115
|
+
process.stdin.setRawMode(false);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.default = KeyCommandHelper;
|
|
119
|
+
yok_1.injector.register("keyCommandHelper", KeyCommandHelper);
|
|
@@ -10,9 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.LiveSyncCommandHelper = void 0;
|
|
13
|
-
const constants_1 = require("../constants");
|
|
14
|
-
const yok_1 = require("../common/yok");
|
|
15
13
|
const _ = require("lodash");
|
|
14
|
+
const yok_1 = require("../common/yok");
|
|
15
|
+
const constants_1 = require("../constants");
|
|
16
16
|
class LiveSyncCommandHelper {
|
|
17
17
|
constructor($androidBundleValidatorHelper, $buildDataService, $projectData, $options, $deployController, $iosDeviceOperations, $mobileHelper, $devicesService, $injector, $buildController, $analyticsService, $errors, $iOSSimulatorLogProvider, $cleanupService, $runController) {
|
|
18
18
|
this.$androidBundleValidatorHelper = $androidBundleValidatorHelper;
|
|
@@ -66,25 +66,27 @@ class LiveSyncCommandHelper {
|
|
|
66
66
|
}
|
|
67
67
|
createDeviceDescriptors(devices, platform, additionalOptions) {
|
|
68
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
const deviceDescriptors = devices.map((
|
|
69
|
+
const deviceDescriptors = devices.map((d) => {
|
|
70
70
|
const outputPath = additionalOptions &&
|
|
71
71
|
additionalOptions.getOutputDirectory &&
|
|
72
72
|
additionalOptions.getOutputDirectory({
|
|
73
|
-
platform:
|
|
74
|
-
emulator:
|
|
73
|
+
platform: d.deviceInfo.platform,
|
|
74
|
+
emulator: d.isEmulator,
|
|
75
75
|
projectDir: this.$projectData.projectDir,
|
|
76
76
|
});
|
|
77
|
-
const buildData = this.$buildDataService.getBuildData(this.$projectData.projectDir,
|
|
78
|
-
|
|
77
|
+
const buildData = this.$buildDataService.getBuildData(this.$projectData.projectDir, d.deviceInfo.platform, Object.assign(Object.assign({}, this.$options.argv), { outputPath, buildForDevice: !d.isEmulator, watch: !this.$options.release && this.$options.watch, nativePrepare: {
|
|
78
|
+
forceRebuildNativeApp: additionalOptions.forceRebuildNativeApp,
|
|
79
|
+
} }));
|
|
80
|
+
this.$androidBundleValidatorHelper.validateDeviceApiLevel(d, buildData);
|
|
79
81
|
const buildAction = additionalOptions && additionalOptions.buildPlatform
|
|
80
|
-
? additionalOptions.buildPlatform.bind(additionalOptions.buildPlatform,
|
|
82
|
+
? additionalOptions.buildPlatform.bind(additionalOptions.buildPlatform, d.deviceInfo.platform, buildData, this.$projectData)
|
|
81
83
|
: this.$buildController.build.bind(this.$buildController, buildData);
|
|
82
84
|
const info = {
|
|
83
|
-
identifier:
|
|
85
|
+
identifier: d.deviceInfo.identifier,
|
|
84
86
|
buildAction,
|
|
85
87
|
debuggingEnabled: additionalOptions &&
|
|
86
88
|
additionalOptions.deviceDebugMap &&
|
|
87
|
-
additionalOptions.deviceDebugMap[
|
|
89
|
+
additionalOptions.deviceDebugMap[d.deviceInfo.identifier],
|
|
88
90
|
debugOptions: this.$options,
|
|
89
91
|
skipNativePrepare: additionalOptions && additionalOptions.skipNativePrepare,
|
|
90
92
|
buildData,
|
|
@@ -113,17 +115,33 @@ class LiveSyncCommandHelper {
|
|
|
113
115
|
yield this.runInRelease(platform, deviceDescriptors);
|
|
114
116
|
return;
|
|
115
117
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
if (additionalOptions.restartLiveSync) {
|
|
119
|
+
yield this.$runController.stop({
|
|
120
|
+
projectDir: this.$projectData.projectDir,
|
|
121
|
+
deviceIdentifiers: deviceDescriptors.map((device) => device.identifier),
|
|
122
|
+
stopOptions: {
|
|
123
|
+
shouldAwaitAllActions: true,
|
|
124
|
+
keepProcessAlive: true,
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
const devices = yield this.getDeviceInstances(platform);
|
|
128
|
+
yield this.executeLiveSyncOperation(devices, platform, Object.assign(Object.assign({}, additionalOptions), { restartLiveSync: false }));
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
yield this.$runController.run({
|
|
133
|
+
liveSyncInfo,
|
|
134
|
+
deviceDescriptors,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
this.$runController.on(constants_1.RunOnDeviceEvents.runOnDeviceStopped, (data) => __awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
const devices = yield this.getDeviceInstances(platform);
|
|
139
|
+
const remainingDevicesToSync = devices.map((d) => d.deviceInfo.identifier);
|
|
122
140
|
_.remove(remainingDevicesToSync, (d) => d === data.deviceIdentifier);
|
|
123
|
-
if (remainingDevicesToSync.length === 0) {
|
|
141
|
+
if (remainingDevicesToSync.length === 0 && !data.keepProcessAlive) {
|
|
124
142
|
process.exit(134);
|
|
125
143
|
}
|
|
126
|
-
});
|
|
144
|
+
}));
|
|
127
145
|
});
|
|
128
146
|
}
|
|
129
147
|
validatePlatform(platform) {
|
|
@@ -184,6 +202,19 @@ class LiveSyncCommandHelper {
|
|
|
184
202
|
}
|
|
185
203
|
});
|
|
186
204
|
}
|
|
205
|
+
stop() {
|
|
206
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
207
|
+
const devices = yield this.getDeviceInstances();
|
|
208
|
+
return this.$runController.stop({
|
|
209
|
+
projectDir: this.$projectData.projectDir,
|
|
210
|
+
deviceIdentifiers: devices.map((d) => d.deviceInfo.identifier),
|
|
211
|
+
stopOptions: {
|
|
212
|
+
shouldAwaitAllActions: true,
|
|
213
|
+
keepProcessAlive: true,
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
}
|
|
187
218
|
}
|
|
188
219
|
exports.LiveSyncCommandHelper = LiveSyncCommandHelper;
|
|
189
220
|
yok_1.injector.register("liveSyncCommandHelper", LiveSyncCommandHelper);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const yok_1 = require("../common/yok");
|
|
4
|
+
const path = "./key-commands/index";
|
|
5
|
+
yok_1.injector.requireKeyCommand("a", path);
|
|
6
|
+
yok_1.injector.requireKeyCommand("i", path);
|
|
7
|
+
yok_1.injector.requireKeyCommand("A", path);
|
|
8
|
+
yok_1.injector.requireKeyCommand("I", path);
|
|
9
|
+
yok_1.injector.requireKeyCommand("r", path);
|
|
10
|
+
yok_1.injector.requireKeyCommand("R", path);
|
|
11
|
+
yok_1.injector.requireKeyCommand("w", path);
|
|
12
|
+
yok_1.injector.requireKeyCommand("c", path);
|
|
13
|
+
yok_1.injector.requireKeyCommand("n", path);
|
|
14
|
+
yok_1.injector.requireKeyCommand("?", path);
|
|
15
|
+
yok_1.injector.requireKeyCommand("\u0003", path);
|