@akylas/nativescript-cli 8.8.7 → 8.9.4

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 (36) hide show
  1. package/config/test-deps-versions-generated.json +16 -0
  2. package/docs/man_pages/project/configuration/widget-ios.md +24 -0
  3. package/docs/man_pages/project/configuration/widget.md +24 -0
  4. package/docs/man_pages/start.md +1 -1
  5. package/lib/.d.ts +1 -0
  6. package/lib/bootstrap.js +1 -0
  7. package/lib/bun-package-manager.js +1 -1
  8. package/lib/commands/generate.js +2 -41
  9. package/lib/commands/widget.js +799 -0
  10. package/lib/common/file-system.js +1 -2
  11. package/lib/common/logger/logger.js +4 -4
  12. package/lib/common/mobile/android/android-emulator-services.js +1 -1
  13. package/lib/common/mobile/emulator-helper.js +1 -0
  14. package/lib/common/mobile/mobile-core/devices-service.js +2 -1
  15. package/lib/common/opener.js +2 -2
  16. package/lib/common/services/hooks-service.js +23 -6
  17. package/lib/constants.js +1 -1
  18. package/lib/controllers/migrate-controller.js +8 -8
  19. package/lib/controllers/prepare-controller.js +2 -4
  20. package/lib/definitions/ios.d.ts +11 -1
  21. package/lib/definitions/project.d.ts +50 -24
  22. package/lib/node-package-manager.js +1 -1
  23. package/lib/services/analytics/analytics-service.js +2 -1
  24. package/lib/services/android/gradle-build-args-service.js +1 -1
  25. package/lib/services/android-plugin-build-service.js +1 -1
  26. package/lib/services/assets-generation/assets-generation-service.js +33 -15
  27. package/lib/services/ios/spm-service.js +10 -1
  28. package/lib/services/ios-debugger-port-service.js +1 -1
  29. package/lib/services/ios-project-service.js +45 -14
  30. package/lib/services/livesync/android-livesync-tool.js +1 -1
  31. package/lib/services/project-config-service.js +12 -3
  32. package/lib/services/webpack/webpack-compiler-service.js +4 -3
  33. package/lib/tools/config-manipulation/config-transformer.js +9 -0
  34. package/package.json +47 -53
  35. package/vendor/gradle-app/app/build.gradle +347 -119
  36. package/vendor/gradle-app/build.gradle +7 -7
@@ -111,7 +111,7 @@ class IOSDebuggerPortService {
111
111
  }
112
112
  clearTimeout(data) {
113
113
  const storedData = this.mapDebuggerPortData[`${data.deviceId}${data.appId}`];
114
- if (storedData && storedData.timer) {
114
+ if (storedData && typeof storedData.timer === "number") {
115
115
  clearTimeout(storedData.timer);
116
116
  }
117
117
  }
@@ -18,6 +18,7 @@ const projectServiceBaseLib = require("./platform-project-service-base");
18
18
  const plist_merge_patch_1 = require("plist-merge-patch");
19
19
  const os_1 = require("os");
20
20
  const plist = require("plist");
21
+ const fastGlob = require("fast-glob");
21
22
  const constants_2 = require("../constants");
22
23
  const helpers_2 = require("../common/helpers");
23
24
  const yok_1 = require("../common/yok");
@@ -42,7 +43,7 @@ const getConfigurationName = (release) => {
42
43
  return release ? constants_1.Configurations.Release : constants_1.Configurations.Debug;
43
44
  };
44
45
  class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase {
45
- constructor($fs, $options, $childProcess, $cocoapodsService, $errors, $logger, $injector, $projectDataService, $devicePlatformsConstants, $hostInfo, $xcprojService, $iOSProvisionService, $iOSSigningService, $pbxprojDomXcode, $xcode, $iOSEntitlementsService, $platformEnvironmentRequirements, $plistParser, $xcconfigService, $xcodebuildService, $iOSExtensionsService, $iOSWatchAppService, $iOSNativeTargetService, $sysInfo, $tempService, $spmService, $mobileHelper) {
46
+ constructor($fs, $options, $childProcess, $cocoapodsService, $errors, $logger, $injector, $projectDataService, $devicePlatformsConstants, $hostInfo, $xcprojService, $iOSProvisionService, $iOSSigningService, $pbxprojDomXcode, $xcode, $iOSEntitlementsService, $platformEnvironmentRequirements, $plistParser, $xcconfigService, $xcodebuildService, $iOSExtensionsService, $iOSWatchAppService, $iOSNativeTargetService, $sysInfo, $tempService, $spmService, $mobileHelper, $projectConfigService) {
46
47
  super($fs, $projectDataService);
47
48
  this.$options = $options;
48
49
  this.$childProcess = $childProcess;
@@ -69,6 +70,7 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
69
70
  this.$tempService = $tempService;
70
71
  this.$spmService = $spmService;
71
72
  this.$mobileHelper = $mobileHelper;
73
+ this.$projectConfigService = $projectConfigService;
72
74
  this._platformsDirCache = null;
73
75
  this._platformData = null;
74
76
  }
@@ -362,6 +364,12 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
362
364
  resourcesNativeCodePath = path.join(resourcesDirectoryPath, this.$devicePlatformsConstants.iOS, constants.NATIVE_SOURCE_FOLDER);
363
365
  }
364
366
  await this.prepareNativeSourceCode(constants.TNS_NATIVE_SOURCE_GROUP_NAME, resourcesNativeCodePath, projectData);
367
+ const nativeSource = this.$projectConfigService.getValue(`${this._platformData.platformNameLowerCase}.NativeSource`, []);
368
+ if (nativeSource === null || nativeSource === void 0 ? void 0 : nativeSource.length) {
369
+ for (const source of nativeSource) {
370
+ await this.prepareNativeSourceCode(source.name, source.path, projectData);
371
+ }
372
+ }
365
373
  }
366
374
  this.$iOSWatchAppService.removeWatchApp({ pbxProjPath });
367
375
  const addedWatchApp = await this.$iOSWatchAppService.addWatchAppFromPath({
@@ -532,7 +540,20 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
532
540
  await this.$cocoapodsService.executePodInstall(platformData.projectRoot, this.$xcprojService.getXcodeprojPath(projectData, platformData.projectRoot));
533
541
  await this.$cocoapodsService.mergePodXcconfigFile(projectData, platformData, opts);
534
542
  }
535
- await this.$spmService.applySPMPackages(platformData, projectData);
543
+ const pluginSpmPackages = [];
544
+ for (const plugin of pluginsData) {
545
+ if (plugin.fullPath) {
546
+ const pluginConfigPath = path.join(plugin.fullPath, constants.CONFIG_FILE_NAME_TS);
547
+ if (this.$fs.exists(pluginConfigPath)) {
548
+ const config = this.$projectConfigService.readConfig(plugin.fullPath);
549
+ const packages = _.get(config, `${platformData.platformNameLowerCase}.SPMPackages`, []);
550
+ if (packages.length) {
551
+ pluginSpmPackages.push(...packages);
552
+ }
553
+ }
554
+ }
555
+ }
556
+ await this.$spmService.applySPMPackages(platformData, projectData, pluginSpmPackages);
536
557
  }
537
558
  beforePrepareAllPlugins(projectData, dependencies) {
538
559
  return Promise.resolve(dependencies);
@@ -626,7 +647,7 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
626
647
  }
627
648
  async prepareNativeSourceCode(groupName, sourceFolderPath, projectData) {
628
649
  const project = this.createPbxProj(projectData);
629
- const group = this.getRootGroup(groupName, sourceFolderPath);
650
+ const group = await this.getRootGroup(groupName, sourceFolderPath);
630
651
  project.addPbxGroup(group.files, group.name, group.path, null, {
631
652
  isMain: true,
632
653
  filesRelativeToProject: true,
@@ -666,23 +687,33 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
666
687
  addedExtensionsFromPlugins || addedExtensionFromPlugin;
667
688
  }
668
689
  if (addedExtensionsFromResources || addedExtensionsFromPlugins) {
669
- this.$logger.warn("The support for iOS App Extensions is currently in Beta. For more information about the current development state and any known issues, please check the relevant GitHub issue: https://github.com/NativeScript/nativescript-cli/issues/4472");
690
+ this.$logger.warn("Let us know if there are other Extension features you'd like! https://github.com/NativeScript/NativeScript/issues");
670
691
  }
671
692
  }
672
- getRootGroup(name, rootPath) {
693
+ async getRootGroup(name, rootPath) {
673
694
  const filePathsArr = [];
674
695
  const rootGroup = {
675
696
  name: name,
676
697
  files: filePathsArr,
677
698
  path: rootPath,
678
699
  };
679
- if (this.$fs.exists(rootPath)) {
680
- const stats = this.$fs.getFsStats(rootPath);
681
- if (stats.isDirectory() && !this.$fs.isEmptyDir(rootPath)) {
682
- this.$fs.readDirectory(rootPath).forEach((fileName) => {
683
- const filePath = path.join(rootGroup.path, fileName);
684
- filePathsArr.push(filePath);
685
- });
700
+ if (fastGlob.isDynamicPattern(rootPath)) {
701
+ const projectRoot = this.$projectDataService.getProjectData().projectDir;
702
+ const filePaths = await fastGlob(rootPath);
703
+ for (const filePath of filePaths) {
704
+ const sourceFilePath = path.normalize(path.join(projectRoot, filePath));
705
+ filePathsArr.push(sourceFilePath);
706
+ }
707
+ }
708
+ else {
709
+ if (this.$fs.exists(rootPath)) {
710
+ const stats = this.$fs.getFsStats(rootPath);
711
+ if (stats.isDirectory() && !this.$fs.isEmptyDir(rootPath)) {
712
+ this.$fs.readDirectory(rootPath).forEach((fileName) => {
713
+ const filePath = path.join(rootGroup.path, fileName);
714
+ filePathsArr.push(filePath);
715
+ });
716
+ }
686
717
  }
687
718
  }
688
719
  return rootGroup;
@@ -708,9 +739,9 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
708
739
  await this.addStaticLibrary(path.join(pluginPlatformsFolderPath, fileName), projectData);
709
740
  }
710
741
  }
711
- removeNativeSourceCode(pluginPlatformsFolderPath, pluginData, projectData) {
742
+ async removeNativeSourceCode(pluginPlatformsFolderPath, pluginData, projectData) {
712
743
  const project = this.createPbxProj(projectData);
713
- const group = this.getRootGroup(pluginData.name, pluginPlatformsFolderPath);
744
+ const group = await this.getRootGroup(pluginData.name, pluginPlatformsFolderPath);
714
745
  project.removePbxGroup(group.name, group.path);
715
746
  project.removeFromHeaderSearchPaths(group.path);
716
747
  this.savePbxProj(project, projectData);
@@ -253,7 +253,7 @@ class AndroidLivesyncTool {
253
253
  if (!isConnected) {
254
254
  isConnected = true;
255
255
  if (this.pendingConnectionData &&
256
- this.pendingConnectionData.socketTimer) {
256
+ typeof this.pendingConnectionData.socketTimer === "number") {
257
257
  clearTimeout(this.pendingConnectionData.socketTimer);
258
258
  }
259
259
  const applicationPid = await this.$androidProcessService.getAppProcessId(configuration.deviceIdentifier, configuration.appIdentifier);
@@ -167,7 +167,7 @@ export default {
167
167
  if (!this.$fs.exists(configFilePath)) {
168
168
  this.writeDefaultConfig(this.projectHelper.projectDir);
169
169
  }
170
- if (typeof value === "object") {
170
+ if (!Array.isArray(value) && typeof value === "object") {
171
171
  let allSuccessful = true;
172
172
  for (const prop of this.flattenObjectToPaths(value)) {
173
173
  if (!(await this.setValue(prop.key, prop.value))) {
@@ -195,7 +195,7 @@ export default {
195
195
  this.$logger.error(`Failed to update config.` + error);
196
196
  }
197
197
  finally {
198
- if (this.getValue(key) !== value) {
198
+ if (!Array.isArray(this.getValue(key)) && this.getValue(key) !== value) {
199
199
  this.$logger.error(`${os_1.EOL}Failed to update ${hasTSConfig ? constants_1.CONFIG_FILE_NAME_TS : constants_1.CONFIG_FILE_NAME_JS}.${os_1.EOL}`);
200
200
  this.$logger.printMarkdown(`Please manually update \`${hasTSConfig ? constants_1.CONFIG_FILE_NAME_TS : constants_1.CONFIG_FILE_NAME_JS}\` and set \`${key}\` to \`${value}\`.${os_1.EOL}`);
201
201
  this.$fs.writeFile(configFilePath, configContent);
@@ -297,7 +297,16 @@ You may add \`nsconfig.json\` to \`.gitignore\` as the CLI will regenerate it as
297
297
  flattenObjectToPaths(obj, basePath) {
298
298
  const toPath = (key) => [basePath, key].filter(Boolean).join(".");
299
299
  return Object.keys(obj).reduce((all, key) => {
300
- if (typeof obj[key] === "object") {
300
+ if (Array.isArray(obj[key])) {
301
+ return [
302
+ ...all,
303
+ {
304
+ key: toPath(key),
305
+ value: obj[key],
306
+ },
307
+ ];
308
+ }
309
+ else if (typeof obj[key] === "object" && obj[key] !== null) {
301
310
  return [...all, ...this.flattenObjectToPaths(obj[key], toPath(key))];
302
311
  }
303
312
  return [
@@ -200,9 +200,10 @@ class WebpackCompilerService extends events_1.EventEmitter {
200
200
  cwd: projectData.projectDir,
201
201
  stdio,
202
202
  };
203
- options.env = Object.assign(process.env, {
204
- NATIVESCRIPT_WEBPACK_ENV: JSON.stringify(envData)
205
- });
203
+ options.env = {
204
+ ...process.env,
205
+ NATIVESCRIPT_WEBPACK_ENV: JSON.stringify(envData),
206
+ };
206
207
  if (this.$hostInfo.isWindows) {
207
208
  Object.assign(options.env, { APPDATA: process.env.appData });
208
209
  }
@@ -102,6 +102,15 @@ class ConfigTransformer {
102
102
  else if (typeof value === "number" || typeof value === "boolean") {
103
103
  return `${value}`;
104
104
  }
105
+ else if (Array.isArray(value)) {
106
+ return `[${value.map((v) => this.createInitializer(v)).join(", ")}]`;
107
+ }
108
+ else if (typeof value === "object" && value !== null) {
109
+ const properties = Object.entries(value)
110
+ .map(([key, val]) => `${key}: ${this.createInitializer(val)}`)
111
+ .join(", ");
112
+ return `{ ${properties} }`;
113
+ }
105
114
  return `{}`;
106
115
  }
107
116
  setInitializerValue(initializer, newValue) {
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@akylas/nativescript-cli",
3
3
  "main": "./lib/nativescript-cli-lib.js",
4
- "version": "8.8.7",
5
- "author": "NativeScript <support@nativescript.org>",
4
+ "version": "8.9.4",
5
+ "author": "NativeScript <oss@nativescript.org>",
6
6
  "description": "Command-line interface for building NativeScript projects",
7
7
  "bin": {
8
8
  "nativescript": "./bin/tns",
@@ -33,7 +33,7 @@
33
33
  "build": "grunt",
34
34
  "build.all": "grunt test",
35
35
  "dev": "tsc --watch",
36
- "setup": "npm i --ignore-scripts && npx husky install",
36
+ "setup": "npm i --ignore-scripts && npx husky",
37
37
  "test": "npm run tsc && mocha --config=test/.mocharc.yml",
38
38
  "postinstall": "node postinstall.js",
39
39
  "preuninstall": "node preuninstall.js",
@@ -52,23 +52,21 @@
52
52
  },
53
53
  "keywords": [
54
54
  "nativescript",
55
- "telerik",
56
- "mobile"
55
+ "typescript",
56
+ "javascript"
57
57
  ],
58
58
  "dependencies": {
59
59
  "@foxt/js-srp": "^0.0.3-patch2",
60
- "@nativescript/doctor": "2.0.15",
61
- "@nativescript/schematics-executor": "0.0.2",
62
- "@npmcli/arborist": "^7.2.0",
63
- "@npmcli/move-file": "^2.0.1",
60
+ "@nativescript/doctor": "2.0.16-rc.0",
61
+ "@npmcli/arborist": "^9.0.0",
64
62
  "@rigor789/resolve-package-path": "1.0.7",
65
63
  "@rigor789/trapezedev-project": "7.1.2",
66
64
  "ansi-colors": "^4.1.3",
67
65
  "archiver": "^7.0.1",
68
- "axios": "1.7.7",
66
+ "axios": "1.11.0",
69
67
  "byline": "5.0.0",
70
68
  "chalk": "4.1.2",
71
- "chokidar": "4.0.1",
69
+ "chokidar": "4.0.3",
72
70
  "cli-table3": "0.6.5",
73
71
  "color": "4.2.3",
74
72
  "convert-source-map": "2.0.0",
@@ -76,86 +74,81 @@
76
74
  "email-validator": "2.0.4",
77
75
  "esprima": "4.0.1",
78
76
  "font-finder": "1.1.0",
79
- "glob": "11.0.0",
77
+ "glob": "11.0.1",
80
78
  "ios-device-lib": "0.9.4",
81
79
  "ios-mobileprovision-finder": "1.2.1",
82
- "ios-sim-portable": "4.5.0",
83
- "jimp": "0.22.10",
80
+ "ios-sim-portable": "4.5.1",
81
+ "jimp": "1.6.0",
84
82
  "lodash": "4.17.21",
85
83
  "log4js": "6.9.1",
86
- "marked": "13.0.3",
87
- "marked-terminal": "7.1.0",
84
+ "marked": "15.0.7",
85
+ "marked-terminal": "7.3.0",
88
86
  "minimatch": "10.0.1",
89
87
  "mkdirp": "3.0.1",
90
88
  "mute-stream": "2.0.0",
91
- "nativescript-dev-xcode": "0.8.0",
92
- "open": "10.1.0",
89
+ "nativescript-dev-xcode": "0.8.1",
90
+ "open": "8.4.2",
93
91
  "ora": "5.4.1",
94
- "pacote": "15.1.1",
92
+ "pacote": "21.0.0",
95
93
  "pbxproj-dom": "1.2.0",
96
94
  "plist": "3.1.0",
97
95
  "plist-merge-patch": "0.2.0",
98
- "prettier": "3.3.3",
96
+ "prettier": "3.5.2",
99
97
  "prompts": "2.4.2",
100
98
  "proper-lockfile": "4.1.2",
101
99
  "proxy-lib": "0.4.0",
102
100
  "qr-image": "3.2.0",
103
101
  "qrcode-terminal": "0.12.0",
104
- "semver": "7.6.3",
102
+ "semver": "7.7.1",
105
103
  "shelljs": "0.8.5",
106
104
  "simple-git": "3.27.0",
107
105
  "simple-plist": "1.4.0",
108
- "source-map": "0.8.0-beta.0",
109
- "stringify-package": "1.0.1",
106
+ "source-map": "0.7.4",
110
107
  "tar": "7.4.3",
111
108
  "temp": "0.9.4",
112
- "ts-morph": "17.0.1",
109
+ "ts-morph": "25.0.1",
113
110
  "tunnel": "0.0.6",
114
- "typescript": "5.6.3",
111
+ "typescript": "5.7.3",
115
112
  "universal-analytics": "0.5.3",
116
- "uuid": "10.0.0",
113
+ "uuid": "11.1.0",
117
114
  "winreg": "1.2.5",
118
- "ws": "8.18.0",
115
+ "ws": "8.18.1",
119
116
  "xml2js": "0.6.2",
120
117
  "yargs": "17.7.2"
121
118
  },
122
119
  "devDependencies": {
123
- "@types/archiver": "^6.0.2",
120
+ "@types/archiver": "^6.0.3",
124
121
  "@types/byline": "^4.2.36",
125
- "@types/chai": "4.3.4",
126
- "@types/chai-as-promised": "7.1.5",
127
- "@types/chokidar": "2.1.3",
128
- "@types/color": "3.0.6",
122
+ "@types/chai": "5.0.1",
123
+ "@types/chai-as-promised": "8.0.1",
124
+ "@types/color": "4.2.0",
129
125
  "@types/convert-source-map": "2.0.3",
130
- "@types/form-data": "2.5.0",
131
126
  "@types/glob": "^8.1.0",
132
- "@types/lodash": "4.17.10",
133
- "@types/marked": "^6.0.0",
134
- "@types/node": "22.7.5",
135
- "@types/npmcli__arborist": "^5.6.11",
136
- "@types/ora": "3.2.0",
127
+ "@types/lodash": "4.17.15",
128
+ "@types/marked-terminal": "^6.1.1",
129
+ "@types/node": "^22.0.0",
130
+ "@types/npmcli__arborist": "^6.3.0",
137
131
  "@types/pacote": "^11.1.8",
138
132
  "@types/plist": "^3.0.5",
139
- "@types/prettier": "3.0.0",
140
133
  "@types/prompts": "2.4.9",
141
134
  "@types/proper-lockfile": "4.1.4",
142
135
  "@types/qr-image": "3.2.9",
143
136
  "@types/retry": "0.12.5",
144
137
  "@types/semver": "7.5.8",
145
- "@types/shelljs": "^0.8.15",
138
+ "@types/shelljs": "^0.8.11",
146
139
  "@types/sinon": "^17.0.3",
147
- "@types/source-map": "0.5.7",
148
- "@types/tabtab": "^3.0.4",
140
+ "@types/tabtab": "^3.0.2",
149
141
  "@types/tar": "6.1.13",
150
142
  "@types/temp": "0.9.4",
151
143
  "@types/tunnel": "0.0.7",
152
144
  "@types/universal-analytics": "0.4.8",
153
145
  "@types/uuid": "^10.0.0",
154
- "@types/ws": "8.5.12",
146
+ "@types/ws": "8.5.14",
155
147
  "@types/xml2js": "0.4.14",
156
148
  "@types/yargs": "17.0.33",
157
- "chai": "4.3.7",
158
- "chai-as-promised": "7.1.1",
149
+ "braces": ">=3.0.3",
150
+ "chai": "5.2.0",
151
+ "chai-as-promised": "8.0.1",
159
152
  "conventional-changelog-cli": "^5.0.0",
160
153
  "grunt": "1.6.1",
161
154
  "grunt-contrib-clean": "2.0.1",
@@ -164,14 +157,14 @@
164
157
  "grunt-shell": "4.0.0",
165
158
  "grunt-template": "1.0.0",
166
159
  "grunt-ts": "6.0.0-beta.22",
167
- "husky": "8.0.3",
160
+ "husky": "9.1.7",
168
161
  "istanbul": "0.4.5",
169
- "latest-version": "5.1.0",
170
- "lint-staged": "^13.2.0",
171
- "mocha": "10.2.0",
172
- "sinon": "15.0.3",
162
+ "latest-version": "9.0.0",
163
+ "lint-staged": "~15.4.3",
164
+ "mocha": "11.1.0",
165
+ "sinon": "19.0.2",
173
166
  "source-map-support": "0.5.21",
174
- "standard-version": "9.5.0"
167
+ "xml2js": ">=0.5.0"
175
168
  },
176
169
  "optionalDependencies": {
177
170
  "fsevents": "*"
@@ -187,9 +180,10 @@
187
180
  "analyze": true,
188
181
  "license": "Apache-2.0",
189
182
  "engines": {
190
- "node": ">=14.0.0"
183
+ "node": ">=20.0.0"
191
184
  },
192
185
  "lint-staged": {
193
186
  "*.ts": "prettier --write"
194
- }
187
+ },
188
+ "packageManager": "yarn@4.6.0+sha512.5383cc12567a95f1d668fbe762dfe0075c595b4bfff433be478dbbe24e05251a8e8c3eb992a986667c1d53b6c3a9c85b8398c35a960587fbd9fa3a0915406728"
195
189
  }