nativescript 8.2.3 → 8.3.0-beta.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"@jsdevtools/coverage-istanbul-loader":"3.0.5","karma":"6.
|
|
1
|
+
{"@jsdevtools/coverage-istanbul-loader":"3.0.5","karma":"6.4.0","karma-coverage":"2.2.0","karma-nativescript-launcher":"0.4.0","mocha":"10.0.0","karma-mocha":"2.0.1","karma-chai":"0.1.0","karma-jasmine":"5.1.0","karma-qunit":"4.1.2","@types/karma-chai":"0.1.3","@types/mocha":"9.1.1","@types/jasmine":"4.0.3","@types/qunit":"2.19.2","nyc":"15.1.0"}
|
package/lib/commands/preview.js
CHANGED
|
@@ -11,15 +11,71 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.PreviewCommand = void 0;
|
|
13
13
|
const yok_1 = require("../common/yok");
|
|
14
|
+
const path = require("path");
|
|
15
|
+
const resolve_package_path_1 = require("@rigor789/resolve-package-path");
|
|
16
|
+
const constants_1 = require("../constants");
|
|
17
|
+
const PREVIEW_CLI_PACKAGE = "@nativescript/preview-cli";
|
|
14
18
|
class PreviewCommand {
|
|
15
|
-
constructor($errors) {
|
|
19
|
+
constructor($logger, $errors, $projectData, $packageManager, $childProcess, $options) {
|
|
20
|
+
this.$logger = $logger;
|
|
16
21
|
this.$errors = $errors;
|
|
22
|
+
this.$projectData = $projectData;
|
|
23
|
+
this.$packageManager = $packageManager;
|
|
24
|
+
this.$childProcess = $childProcess;
|
|
25
|
+
this.$options = $options;
|
|
17
26
|
this.allowedParameters = [];
|
|
18
27
|
}
|
|
28
|
+
getPreviewCLIPath() {
|
|
29
|
+
return (0, resolve_package_path_1.resolvePackagePath)(PREVIEW_CLI_PACKAGE, {
|
|
30
|
+
paths: [this.$projectData.projectDir],
|
|
31
|
+
});
|
|
32
|
+
}
|
|
19
33
|
execute(args) {
|
|
20
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
this.$
|
|
22
|
-
|
|
35
|
+
if (!this.$options.disableNpmInstall) {
|
|
36
|
+
yield this.$packageManager.install(`${PREVIEW_CLI_PACKAGE}@latest`, this.$projectData.projectDir, {
|
|
37
|
+
"save-dev": true,
|
|
38
|
+
"save-exact": true,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const previewCLIPath = this.getPreviewCLIPath();
|
|
42
|
+
if (!previewCLIPath) {
|
|
43
|
+
const packageManagerName = yield this.$packageManager.getPackageManagerName();
|
|
44
|
+
let installCommand = "";
|
|
45
|
+
switch (packageManagerName) {
|
|
46
|
+
case constants_1.PackageManagers.npm:
|
|
47
|
+
installCommand = "npm install --save-dev @nativescript/preview-cli";
|
|
48
|
+
break;
|
|
49
|
+
case constants_1.PackageManagers.yarn:
|
|
50
|
+
installCommand = "yarn add -D @nativescript/preview-cli";
|
|
51
|
+
break;
|
|
52
|
+
case constants_1.PackageManagers.pnpm:
|
|
53
|
+
installCommand = "pnpm install --save-dev @nativescript/preview-cli";
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
this.$logger.info([
|
|
57
|
+
`Uhh ohh, no Preview CLI found.`,
|
|
58
|
+
"",
|
|
59
|
+
`This should not happen under regular circumstances, but seems like it did somehow... :(`,
|
|
60
|
+
`Good news though, you can install the Preview CLI by running`,
|
|
61
|
+
"",
|
|
62
|
+
" " + installCommand.green,
|
|
63
|
+
"",
|
|
64
|
+
"Once installed, run this command again and everything should work!",
|
|
65
|
+
"If it still fails, you can invoke the preview-cli directly as a last resort with",
|
|
66
|
+
"",
|
|
67
|
+
" ./node_modules/.bin/preview-cli".cyan,
|
|
68
|
+
"",
|
|
69
|
+
"And if you are still having issues, try again - or reach out on Discord/open an issue on GitHub.",
|
|
70
|
+
].join("\n"));
|
|
71
|
+
this.$errors.fail("Running preview failed.");
|
|
72
|
+
}
|
|
73
|
+
const previewCLIBinPath = path.resolve(previewCLIPath, "./dist/index.js");
|
|
74
|
+
const commandIndex = process.argv.indexOf("preview");
|
|
75
|
+
const commandArgs = process.argv.slice(commandIndex + 1);
|
|
76
|
+
this.$childProcess.spawn(previewCLIBinPath, commandArgs, {
|
|
77
|
+
stdio: "inherit",
|
|
78
|
+
});
|
|
23
79
|
});
|
|
24
80
|
}
|
|
25
81
|
canExecute(args) {
|
|
@@ -423,6 +423,15 @@ class RunController extends events_1.EventEmitter {
|
|
|
423
423
|
const fullLiveSyncResultInfo = yield platformLiveSyncService.liveSyncWatchAction(device, watchInfo);
|
|
424
424
|
_.assign(liveSyncResultInfo, fullLiveSyncResultInfo);
|
|
425
425
|
});
|
|
426
|
+
yield this.$hooksService.executeBeforeHooks("watchAction", {
|
|
427
|
+
hookArgs: {
|
|
428
|
+
liveSyncResultInfo,
|
|
429
|
+
filesToSync,
|
|
430
|
+
allAppFiles,
|
|
431
|
+
isInHMRMode,
|
|
432
|
+
filesChangedEvent: data,
|
|
433
|
+
},
|
|
434
|
+
});
|
|
426
435
|
yield this.refreshApplication(projectData, liveSyncResultInfo, data, deviceDescriptor, fullSyncAction);
|
|
427
436
|
if (!liveSyncResultInfo.didRecover && isInHMRMode) {
|
|
428
437
|
const status = yield this.$hmrStatusService.getHmrStatus(device.deviceInfo.identifier, data.hmrData.hash);
|
|
@@ -432,6 +441,13 @@ class RunController extends events_1.EventEmitter {
|
|
|
432
441
|
yield this.refreshApplication(projectData, liveSyncResultInfo, data, deviceDescriptor);
|
|
433
442
|
}
|
|
434
443
|
}
|
|
444
|
+
yield this.$hooksService.executeAfterHooks("watchAction", {
|
|
445
|
+
liveSyncResultInfo,
|
|
446
|
+
filesToSync,
|
|
447
|
+
allAppFiles,
|
|
448
|
+
filesChangedEvent: data,
|
|
449
|
+
isInHMRMode,
|
|
450
|
+
});
|
|
435
451
|
this.$logger.info(util.format(successfullySyncedMessageFormat, deviceAppData.appIdentifier, device.deviceInfo.identifier));
|
|
436
452
|
});
|
|
437
453
|
if (liveSyncInfo.useHotModuleReload) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nativescript",
|
|
3
3
|
"preferGlobal": true,
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.3.0-beta.0",
|
|
5
5
|
"author": "NativeScript <support@nativescript.org>",
|
|
6
6
|
"description": "Command-line interface for building NativeScript projects",
|
|
7
7
|
"bin": {
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"shelljs": "0.8.4",
|
|
107
107
|
"simple-git": "^2.20.1",
|
|
108
108
|
"simple-plist": "1.1.0",
|
|
109
|
-
"source-map": "0.7.
|
|
109
|
+
"source-map": "0.7.4",
|
|
110
110
|
"stringify-package": "1.0.1",
|
|
111
111
|
"tabtab": "https://github.com/Icenium/node-tabtab/tarball/master",
|
|
112
112
|
"tar": "6.0.2",
|