@akylas/nativescript-cli 8.7.2 → 8.8.2

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.
Files changed (59) hide show
  1. package/config/test-deps-versions-generated.json +1 -1
  2. package/docs/man_pages/project/configuration/native/native-add-java.md +32 -0
  3. package/docs/man_pages/project/configuration/native/native-add-kotlin.md +34 -0
  4. package/docs/man_pages/project/configuration/native/native-add-objective-c.md +34 -0
  5. package/docs/man_pages/project/configuration/native/native-add-swift.md +32 -0
  6. package/docs/man_pages/project/configuration/native/native-add.md +31 -0
  7. package/docs/man_pages/project/configuration/native/native.md +31 -0
  8. package/lib/.d.ts +2 -0
  9. package/lib/bootstrap.js +8 -0
  10. package/lib/commands/embedding/embed.js +91 -0
  11. package/lib/commands/native-add.js +300 -0
  12. package/lib/commands/plugin/build-plugin.js +3 -9
  13. package/lib/commands/prepare.js +9 -0
  14. package/lib/commands/typings.js +1 -1
  15. package/lib/common/mobile/android/android-virtual-device-service.js +4 -1
  16. package/lib/common/mobile/android/logcat-helper.js +15 -6
  17. package/lib/common/mobile/emulator-helper.js +1 -0
  18. package/lib/common/utils.js +8 -1
  19. package/lib/controllers/migrate-controller.js +6 -6
  20. package/lib/controllers/platform-controller.js +4 -0
  21. package/lib/controllers/prepare-controller.js +61 -14
  22. package/lib/data/build-data.js +2 -0
  23. package/lib/data/prepare-data.js +1 -0
  24. package/lib/declarations.d.ts +14 -3
  25. package/lib/definitions/android-plugin-migrator.d.ts +1 -0
  26. package/lib/definitions/platform.d.ts +1 -0
  27. package/lib/definitions/prepare.d.ts +3 -0
  28. package/lib/definitions/project.d.ts +5 -0
  29. package/lib/helpers/platform-command-helper.js +10 -1
  30. package/lib/options.js +9 -2
  31. package/lib/project-data.js +4 -1
  32. package/lib/providers/project-files-provider.js +1 -1
  33. package/lib/services/android/gradle-build-args-service.js +4 -3
  34. package/lib/services/android/gradle-command-service.js +5 -1
  35. package/lib/services/android-plugin-build-service.js +34 -22
  36. package/lib/services/android-project-service.js +20 -23
  37. package/lib/services/assets-generation/assets-generation-service.js +5 -1
  38. package/lib/services/cocoapods-service.js +9 -3
  39. package/lib/services/files-hash-service.js +3 -2
  40. package/lib/services/ios-project-service.js +50 -17
  41. package/lib/services/livesync/android-device-livesync-sockets-service.js +3 -4
  42. package/lib/services/livesync/android-livesync-service.js +2 -2
  43. package/lib/services/livesync/ios-livesync-service.js +2 -2
  44. package/lib/services/livesync/platform-livesync-service-base.js +4 -3
  45. package/lib/services/log-source-map-service.js +3 -2
  46. package/lib/services/platform/add-platform-service.js +7 -2
  47. package/lib/services/platform/prepare-native-platform-service.js +6 -3
  48. package/lib/services/platform-environment-requirements.js +3 -1
  49. package/lib/services/plugins-service.js +7 -1
  50. package/lib/services/project-changes-service.js +8 -1
  51. package/lib/services/project-config-service.js +1 -1
  52. package/lib/services/project-data-service.js +15 -21
  53. package/lib/services/webpack/webpack-compiler-service.js +14 -6
  54. package/lib/services/xcproj-service.js +12 -0
  55. package/package.json +3 -3
  56. package/vendor/aab-tool/README.txt +1 -1
  57. package/vendor/aab-tool/bundletool.jar +0 -0
  58. package/vendor/gradle-app/app/build.gradle +12 -4
  59. package/vendor/gradle-plugin/build.gradle +12 -4
@@ -37,10 +37,11 @@ class ProjectChangesInfo {
37
37
  }
38
38
  }
39
39
  class ProjectChangesService {
40
- constructor($devicePlatformsConstants, $fs, $logger, $hooksService, $nodeModulesDependenciesBuilder) {
40
+ constructor($devicePlatformsConstants, $fs, $logger, $options, $hooksService, $nodeModulesDependenciesBuilder) {
41
41
  this.$devicePlatformsConstants = $devicePlatformsConstants;
42
42
  this.$fs = $fs;
43
43
  this.$logger = $logger;
44
+ this.$options = $options;
44
45
  this.$hooksService = $hooksService;
45
46
  this.$nodeModulesDependenciesBuilder = $nodeModulesDependenciesBuilder;
46
47
  }
@@ -130,6 +131,9 @@ class ProjectChangesService {
130
131
  return prepareInfoFilePath;
131
132
  }
132
133
  getPrepareInfo(platformData) {
134
+ if (this.$options.hostProjectPath) {
135
+ return null;
136
+ }
133
137
  const prepareInfoFilePath = this.getPrepareInfoFilePath(platformData);
134
138
  let prepareInfo = null;
135
139
  if (this.$fs.exists(prepareInfoFilePath)) {
@@ -147,6 +151,9 @@ class ProjectChangesService {
147
151
  if (!this._prepareInfo) {
148
152
  yield this.ensurePrepareInfo(platformData, projectData, prepareData);
149
153
  }
154
+ if (this.$options.hostProjectPath) {
155
+ return null;
156
+ }
150
157
  const prepareInfoFilePath = this.getPrepareInfoFilePath(platformData);
151
158
  this.$fs.writeJson(prepareInfoFilePath, this._prepareInfo);
152
159
  });
@@ -195,7 +195,7 @@ export default {
195
195
  singleQuote: true,
196
196
  };
197
197
  this.$logger.trace("updating config, prettier options: ", prettierOptions);
198
- this.$fs.writeFile(configFilePath, (0, prettier_1.format)(newContent, Object.assign(Object.assign({}, prettierOptions), { parser: "typescript" })));
198
+ this.$fs.writeFile(configFilePath, (0, prettier_1.format)(newContent, Object.assign(Object.assign({}, prettierOptions), { parser: "typescript", plugins: [] })));
199
199
  }
200
200
  catch (error) {
201
201
  this.$logger.error(`Failed to update config.` + error);
@@ -368,28 +368,22 @@ class ProjectDataService {
368
368
  return this.getInstalledRuntimePackage(projectDir, platform);
369
369
  }
370
370
  getInstalledRuntimePackage(projectDir, platform) {
371
- var _a, _b;
371
+ var _a, _b, _c, _d;
372
+ console.log('getInstalledRuntimePackage');
373
+ let packageName = [];
374
+ if (platform === "ios") {
375
+ packageName.push((_a = this.$projectData.nsConfig.ios) === null || _a === void 0 ? void 0 : _a.runtimePackageName, constants.SCOPED_IOS_RUNTIME_NAME, constants.TNS_IOS_RUNTIME_NAME);
376
+ }
377
+ else if (platform === "android") {
378
+ packageName.push((_b = this.$projectData.nsConfig.android) === null || _b === void 0 ? void 0 : _b.runtimePackageName, constants.SCOPED_ANDROID_RUNTIME_NAME, constants.TNS_IOS_RUNTIME_NAME);
379
+ }
380
+ else if (platform === "visionos") {
381
+ packageName.push(constants.SCOPED_VISIONOS_RUNTIME_NAME);
382
+ }
372
383
  const runtimePackage = this.$pluginsService
373
384
  .getDependenciesFromPackageJson(projectDir)
374
385
  .devDependencies.find((d) => {
375
- var _a, _b;
376
- if (platform === "ios") {
377
- const packageName = ((_a = this.$projectData.nsConfig.ios) === null || _a === void 0 ? void 0 : _a.runtimePackageName) || constants.SCOPED_IOS_RUNTIME_NAME;
378
- return [
379
- packageName,
380
- constants.TNS_IOS_RUNTIME_NAME,
381
- ].includes(d.name);
382
- }
383
- else if (platform === "android") {
384
- const packageName = ((_b = this.$projectData.nsConfig.android) === null || _b === void 0 ? void 0 : _b.runtimePackageName) || constants.SCOPED_ANDROID_RUNTIME_NAME;
385
- return [
386
- packageName,
387
- constants.TNS_ANDROID_RUNTIME_NAME,
388
- ].includes(d.name);
389
- }
390
- else if (platform === "visionos") {
391
- return d.name === constants.SCOPED_VISIONOS_RUNTIME_NAME;
392
- }
386
+ return packageName.includes(d.name);
393
387
  });
394
388
  if (runtimePackage) {
395
389
  const coerced = semver.coerce(runtimePackage.version);
@@ -420,13 +414,13 @@ class ProjectDataService {
420
414
  this.$logger.trace("Could not find an installed runtime, falling back to default runtimes");
421
415
  if (platform === "ios") {
422
416
  return {
423
- name: ((_a = this.$projectData.nsConfig.ios) === null || _a === void 0 ? void 0 : _a.runtimePackageName) || constants.SCOPED_IOS_RUNTIME_NAME,
417
+ name: ((_c = this.$projectData.nsConfig.ios) === null || _c === void 0 ? void 0 : _c.runtimePackageName) || constants.SCOPED_IOS_RUNTIME_NAME,
424
418
  version: null,
425
419
  };
426
420
  }
427
421
  else if (platform === "android") {
428
422
  return {
429
- name: ((_b = this.$projectData.nsConfig.android) === null || _b === void 0 ? void 0 : _b.runtimePackageName) || constants.SCOPED_ANDROID_RUNTIME_NAME,
423
+ name: ((_d = this.$projectData.nsConfig.android) === null || _d === void 0 ? void 0 : _d.runtimePackageName) || constants.SCOPED_ANDROID_RUNTIME_NAME,
430
424
  version: null,
431
425
  };
432
426
  }
@@ -94,8 +94,8 @@ class WebpackCompilerService extends events_1.EventEmitter {
94
94
  hash: "",
95
95
  };
96
96
  }
97
- const files = result.emittedFiles.map((file) => path.join(platformData.appDestinationDirectoryPath, "app", file));
98
- const fallbackFiles = result.fallbackFiles.map((file) => path.join(platformData.appDestinationDirectoryPath, "app", file));
97
+ const files = result.emittedFiles.map((file) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, file));
98
+ const fallbackFiles = result.fallbackFiles.map((file) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, file));
99
99
  const data = {
100
100
  files,
101
101
  hasOnlyHotUpdateFiles: files.every((f) => f.indexOf("hot-update") > -1),
@@ -214,10 +214,18 @@ class WebpackCompilerService extends events_1.EventEmitter {
214
214
  args.push("--watch");
215
215
  }
216
216
  const stdio = prepareData.watch ? ["ipc"] : "inherit";
217
- const childProcess = this.$childProcess.spawn(process.execPath, args, {
217
+ const options = {
218
218
  cwd: projectData.projectDir,
219
219
  stdio,
220
- });
220
+ };
221
+ if (this.$options.hostProjectPath) {
222
+ options.env = {
223
+ USER_PROJECT_PLATFORMS_ANDROID: this.$options.hostProjectPath,
224
+ USER_PROJECT_PLATFORMS_ANDROID_MODULE: this.$options.hostProjectModuleName,
225
+ USER_PROJECT_PLATFORMS_IOS: this.$options.hostProjectPath,
226
+ };
227
+ }
228
+ const childProcess = this.$childProcess.spawn(process.execPath, args, options);
221
229
  this.webpackProcesses[platformData.platformNameLowerCase] = childProcess;
222
230
  yield this.$cleanupService.addKillProcess(childProcess.pid.toString());
223
231
  return childProcess;
@@ -338,8 +346,8 @@ class WebpackCompilerService extends events_1.EventEmitter {
338
346
  return;
339
347
  }
340
348
  this.$logger.trace("Webpack build done!");
341
- const files = message.data.emittedAssets.map((asset) => path.join(platformData.appDestinationDirectoryPath, "app", asset));
342
- const staleFiles = message.data.staleAssets.map((asset) => path.join(platformData.appDestinationDirectoryPath, "app", asset));
349
+ const files = message.data.emittedAssets.map((asset) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, asset));
350
+ const staleFiles = message.data.staleAssets.map((asset) => path.join(platformData.appDestinationDirectoryPath, this.$options.hostProjectModuleName, asset));
343
351
  const lastHash = (() => {
344
352
  const absoluteFileNameWithLastHash = files.find((fileName) => fileName.endsWith("hot-update.js"));
345
353
  if (!absoluteFileNameWithLastHash) {
@@ -1,11 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const path = require("path");
4
+ const fs = require("fs");
4
5
  const constants_1 = require("../constants");
5
6
  const yok_1 = require("../common/yok");
6
7
  class XcprojService {
7
8
  getXcodeprojPath(projectData, projectRoot) {
8
9
  return path.join(projectRoot, projectData.projectName + constants_1.IosProjectConstants.XcodeProjExtName);
9
10
  }
11
+ findXcodeProject(dir) {
12
+ const filesAndDirs = fs.readdirSync(dir);
13
+ for (let i = 0; i < filesAndDirs.length; i++) {
14
+ const fullPath = path.join(dir, filesAndDirs[i]);
15
+ if (fs.statSync(fullPath).isDirectory() &&
16
+ filesAndDirs[i].endsWith(".xcodeproj")) {
17
+ return fullPath;
18
+ }
19
+ }
20
+ return null;
21
+ }
10
22
  }
11
23
  yok_1.injector.register("xcprojService", XcprojService);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@akylas/nativescript-cli",
3
3
  "main": "./lib/nativescript-cli-lib.js",
4
- "version": "8.7.2",
4
+ "version": "8.8.2",
5
5
  "author": "NativeScript <support@nativescript.org>",
6
6
  "description": "Command-line interface for building NativeScript projects",
7
7
  "bin": {
@@ -55,7 +55,7 @@
55
55
  "mobile"
56
56
  ],
57
57
  "dependencies": {
58
- "@nativescript/doctor": "2.0.14",
58
+ "@nativescript/doctor": "2.0.15",
59
59
  "@nativescript/schematics-executor": "0.0.2",
60
60
  "@npmcli/arborist": "^7.2.0",
61
61
  "@npmcli/move-file": "^2.0.0",
@@ -86,7 +86,7 @@
86
86
  "minimatch": "7.4.2",
87
87
  "mkdirp": "2.1.6",
88
88
  "mute-stream": "1.0.0",
89
- "nativescript-dev-xcode": "0.7.0",
89
+ "nativescript-dev-xcode": "0.8.0",
90
90
  "open": "8.4.2",
91
91
  "ora": "5.4.1",
92
92
  "pacote": "15.1.1",
@@ -1 +1 @@
1
- Downloaded from https://github.com/google/bundletool/releases/tag/1.8.2
1
+ Downloaded from https://github.com/google/bundletool/releases/tag/1.15.6
Binary file
@@ -86,8 +86,8 @@ def pluginsJarLibraries = new LinkedList<String>()
86
86
  def allJarLibraries = new LinkedList<String>()
87
87
 
88
88
  def computeKotlinVersion = { -> project.hasProperty("kotlinVersion") ? kotlinVersion : "${ns_default_kotlin_version}" }
89
- def computeCompileSdkVersion = { -> project.hasProperty("compileSdk") ? compileSdk : NS_DEFAULT_COMPILE_SDK_VERSION as int }
90
- def computeTargetSdkVersion = { -> project.hasProperty("targetSdk") ? targetSdk : NS_DEFAULT_COMPILE_SDK_VERSION as int }
89
+ def computeCompileSdkVersion = { -> project.hasProperty("compileSdk") ? compileSdk as int : NS_DEFAULT_COMPILE_SDK_VERSION as int }
90
+ def computeTargetSdkVersion = { -> project.hasProperty("targetSdk") ? targetSdk as int : NS_DEFAULT_COMPILE_SDK_VERSION as int }
91
91
  def computeBuildToolsVersion = { ->
92
92
  project.hasProperty("buildToolsVersion") ? buildToolsVersion : NS_DEFAULT_BUILD_TOOLS_VERSION as String
93
93
  }
@@ -401,7 +401,11 @@ dependencies {
401
401
 
402
402
  task addDependenciesFromNativeScriptPlugins {
403
403
  nativescriptDependencies.each { dep ->
404
- def aarFiles = fileTree(dir: file("$rootDir/${dep.directory}/$PLATFORMS_ANDROID"), include: ["**/*.aar"])
404
+ def aarFiles = fileTree(dir: file("$rootDir/${dep.directory}/$PLATFORMS_ANDROID")).matching {
405
+ include "**/*.aar"
406
+ exclude "cpp/**"
407
+ exclude project.hasProperty("aarIgnoreFilter") ? project.findProperty('aarIgnoreFilter').split(',').collect{it as String} : []
408
+ }
405
409
  aarFiles.each { aarFile ->
406
410
  def length = aarFile.name.length() - 4
407
411
  def fileName = aarFile.name[0..<length]
@@ -409,7 +413,11 @@ task addDependenciesFromNativeScriptPlugins {
409
413
  project.dependencies.add("implementation", [name: fileName, ext: "aar"])
410
414
  }
411
415
 
412
- def jarFiles = fileTree(dir: file("$rootDir/${dep.directory}/$PLATFORMS_ANDROID"), include: ["**/*.jar"])
416
+ def jarFiles = fileTree(dir: file("$rootDir/${dep.directory}/$PLATFORMS_ANDROID")).matching {
417
+ include "**/*.jar"
418
+ exclude "cpp/**"
419
+ exclude project.hasProperty("jarIgnoreFilter") ? project.findProperty('jarIgnoreFilter').split(',').collect{it as String} : []
420
+ }
413
421
  jarFiles.each { jarFile ->
414
422
  def jarFileAbsolutePath = jarFile.getAbsolutePath()
415
423
  outLogger.withStyle(Style.SuccessHeader).println "\t + adding jar plugin dependency: $jarFileAbsolutePath"
@@ -284,8 +284,8 @@ android {
284
284
  }
285
285
  }
286
286
 
287
- def computeCompileSdkVersion = { -> project.hasProperty("compileSdk") ? project.compileSdk : 31 }
288
- def computeTargetSdkVersion = { -> project.hasProperty("targetSdk") ? project.targetSdk : 31 as int }
287
+ def computeCompileSdkVersion = { -> project.hasProperty("compileSdk") ? project.compileSdk as int : 31 }
288
+ def computeTargetSdkVersion = { -> project.hasProperty("targetSdk") ? project.targetSdk as int : 31 as int }
289
289
  def computeBuildToolsVersion = { ->
290
290
  project.hasProperty("buildToolsVersion") ? project.buildToolsVersion : "31.0.0"
291
291
  }
@@ -317,7 +317,11 @@ android {
317
317
 
318
318
  task addDependenciesFromNativeScriptPlugins {
319
319
  nativescriptDependencies.each { dep ->
320
- def aarFiles = fileTree(dir: getDepPlatformDir(dep), include: ["**/*.aar"])
320
+ def aarFiles = fileTree(dir: getDepPlatformDir(dep)).matching {
321
+ include "**/*.aar"
322
+ exclude "cpp/**"
323
+ exclude project.hasProperty("aarIgnoreFilter") ? project.findProperty('aarIgnoreFilter').split(',').collect{it as String} : []
324
+ }
321
325
  def currentDirname = file(project.buildscript.sourceFile).getParentFile().getName()
322
326
  aarFiles.each { aarFile ->
323
327
  def length = aarFile.name.length() - 4
@@ -329,7 +333,11 @@ task addDependenciesFromNativeScriptPlugins {
329
333
  project.dependencies.add("implementation", [name: fileName, ext: "aar"])
330
334
  }
331
335
 
332
- def jarFiles = fileTree(dir: getDepPlatformDir(dep), include: ["*.jar"])
336
+ def jarFiles = fileTree(dir: getDepPlatformDir(dep)).matching {
337
+ include "**/*.jar"
338
+ exclude "cpp/**"
339
+ exclude project.hasProperty("jarIgnoreFilter") ? project.findProperty('jarIgnoreFilter').split(',').collect{it as String} : []
340
+ }
333
341
  jarFiles.each { jarFile ->
334
342
  def jarFileAbsolutePath = jarFile.getAbsolutePath()
335
343
  outLogger.withStyle(Style.SuccessHeader).println "\t + adding jar plugin dependency: $jarFileAbsolutePath"