@capacitor/cli 7.0.0-alpha.1 → 7.0.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.
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.patchOldCapacitorPlugins = exports.migrateCommand = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const utils_fs_1 = require("@ionic/utils-fs");
5
+ const fs_extra_1 = require("fs-extra");
6
6
  const path_1 = require("path");
7
- const rimraf_1 = tslib_1.__importDefault(require("rimraf"));
7
+ const rimraf_1 = require("rimraf");
8
8
  const semver_1 = require("semver");
9
9
  const common_1 = require("../android/common");
10
10
  const colors_1 = tslib_1.__importDefault(require("../colors"));
@@ -45,21 +45,21 @@ const plugins = [
45
45
  '@capacitor/text-zoom',
46
46
  '@capacitor/toast',
47
47
  ];
48
- const coreVersion = '^6.0.0';
49
- const pluginVersion = '^6.0.0';
50
- const gradleVersion = '8.2.1';
48
+ const coreVersion = 'next';
49
+ const pluginVersion = 'next';
50
+ const gradleVersion = '8.11.1';
51
51
  let installFailed = false;
52
52
  async function migrateCommand(config, noprompt, packagemanager) {
53
53
  if (config === null) {
54
54
  (0, errors_1.fatal)('Config data missing');
55
55
  }
56
56
  const capMajor = await checkCapacitorMajorVersion(config);
57
- if (capMajor < 5) {
58
- (0, errors_1.fatal)('Migrate can only be used on capacitor 5 and above, please use the CLI in Capacitor 5 to upgrade to 5 first');
57
+ if (capMajor < 6) {
58
+ (0, errors_1.fatal)('Migrate can only be used on Capacitor 6, please use the CLI in Capacitor 6 to upgrade to 6 first');
59
59
  }
60
60
  const jdkMajor = await (0, common_2.checkJDKMajorVersion)();
61
- if (jdkMajor < 17) {
62
- log_1.logger.warn('Capacitor 6 requires JDK 17 or higher. Some steps may fail.');
61
+ if (jdkMajor < 21) {
62
+ log_1.logger.warn('Capacitor 7 requires JDK 21 or higher. Some steps may fail.');
63
63
  }
64
64
  const variablesAndClasspaths = await getAndroidVariablesAndClasspaths(config);
65
65
  if (!variablesAndClasspaths) {
@@ -73,7 +73,7 @@ async function migrateCommand(config, noprompt, packagemanager) {
73
73
  log_1.logger.info(monorepoWarning);
74
74
  const { migrateconfirm } = noprompt
75
75
  ? { migrateconfirm: 'y' }
76
- : await (0, log_1.logPrompt)(`Capacitor 6 sets a deployment target of iOS 13 and Android 14 (SDK 34). \n`, {
76
+ : await (0, log_1.logPrompt)(`Capacitor 7 sets a deployment target of iOS 14 and Android 15 (SDK 35). \n`, {
77
77
  type: 'text',
78
78
  name: 'migrateconfirm',
79
79
  message: `Are you sure you want to migrate? (Y/n)`,
@@ -118,11 +118,15 @@ async function migrateCommand(config, noprompt, packagemanager) {
118
118
  installFailed = true;
119
119
  }
120
120
  // Update iOS Projects
121
- if (allDependencies['@capacitor/ios'] && (0, utils_fs_1.existsSync)(config.ios.platformDirAbs)) {
121
+ if (allDependencies['@capacitor/ios'] && (0, fs_extra_1.existsSync)(config.ios.platformDirAbs)) {
122
122
  // ios template changes
123
- // Remove NSLocationAlwaysUsageDescription
124
- await (0, common_2.runTask)(`Migrating Info.plist by removing NSLocationAlwaysUsageDescription key.`, () => {
125
- return removeKey((0, path_1.join)(config.ios.nativeTargetDirAbs, 'Info.plist'), 'NSLocationAlwaysUsageDescription');
123
+ // Set deployment target to 14.0
124
+ await (0, common_2.runTask)(`Migrating deployment target to 14.0.`, () => {
125
+ return updateFile(config, (0, path_1.join)(config.ios.nativeXcodeProjDirAbs, 'project.pbxproj'), 'IPHONEOS_DEPLOYMENT_TARGET = ', ';', '14.0');
126
+ });
127
+ // Update Podfile to 14.0
128
+ await (0, common_2.runTask)(`Migrating Podfile to 14.0.`, () => {
129
+ return updateFile(config, (0, path_1.join)(config.ios.nativeProjectDirAbs, 'Podfile'), `platform :ios, '`, `'`, '14.0');
126
130
  });
127
131
  }
128
132
  if (!installFailed) {
@@ -133,10 +137,14 @@ async function migrateCommand(config, noprompt, packagemanager) {
133
137
  else {
134
138
  log_1.logger.warn('Skipped Running cap sync.');
135
139
  }
136
- if (allDependencies['@capacitor/android'] && (0, utils_fs_1.existsSync)(config.android.platformDirAbs)) {
140
+ if (allDependencies['@capacitor/android'] && (0, fs_extra_1.existsSync)(config.android.platformDirAbs)) {
137
141
  const gradleWrapperVersion = getGradleWrapperVersion((0, path_1.join)(config.android.platformDirAbs, 'gradle', 'wrapper', 'gradle-wrapper.properties'));
138
- if (!installFailed && (0, semver_1.gt)(gradleVersion, gradleWrapperVersion)) {
142
+ if (!installFailed && (0, semver_1.gte)(gradleVersion, gradleWrapperVersion)) {
139
143
  try {
144
+ await (0, common_2.runTask)(`Upgrading gradle wrapper`, () => {
145
+ return updateGradleWrapperFiles(config.android.platformDirAbs);
146
+ });
147
+ // Run twice as first time it only updates the wrapper properties file
140
148
  await (0, common_2.runTask)(`Upgrading gradle wrapper files`, () => {
141
149
  return updateGradleWrapperFiles(config.android.platformDirAbs);
142
150
  });
@@ -156,22 +164,6 @@ async function migrateCommand(config, noprompt, packagemanager) {
156
164
  await (0, common_2.runTask)(`Migrating build.gradle file.`, () => {
157
165
  return updateBuildGradle((0, path_1.join)(config.android.platformDirAbs, 'build.gradle'), variablesAndClasspaths);
158
166
  });
159
- // Replace deprecated compileSdkVersion
160
- await (0, common_2.runTask)('Replacing deprecated compileSdkVersion from build.gradle', () => {
161
- return (async () => {
162
- const buildGradleFilename = (0, path_1.join)(config.android.platformDirAbs, 'app', 'build.gradle');
163
- const buildGradleText = readFile(buildGradleFilename);
164
- if (!buildGradleText) {
165
- log_1.logger.error(`Could not read ${buildGradleFilename}. Check its permissions and if it exists.`);
166
- return;
167
- }
168
- const compileSdk = `compileSdkVersion rootProject.ext.compileSdkVersion`;
169
- if (buildGradleText.includes(compileSdk)) {
170
- const buildGradleReplaced = buildGradleText.replace(compileSdk, `compileSdk rootProject.ext.compileSdkVersion`);
171
- (0, utils_fs_1.writeFileSync)(buildGradleFilename, buildGradleReplaced, 'utf-8');
172
- }
173
- })();
174
- });
175
167
  // Variables gradle
176
168
  await (0, common_2.runTask)(`Migrating variables.gradle file.`, () => {
177
169
  return (async () => {
@@ -181,7 +173,7 @@ async function migrateCommand(config, noprompt, packagemanager) {
181
173
  return;
182
174
  }
183
175
  txt = txt.replace(/= {2}'/g, `= '`);
184
- (0, utils_fs_1.writeFileSync)(variablesPath, txt, { encoding: 'utf-8' });
176
+ (0, fs_extra_1.writeFileSync)(variablesPath, txt, { encoding: 'utf-8' });
185
177
  for (const variable of Object.keys(variablesAndClasspaths.variables)) {
186
178
  let replaceStart = `${variable} = '`;
187
179
  let replaceEnd = `'\n`;
@@ -203,16 +195,16 @@ async function migrateCommand(config, noprompt, packagemanager) {
203
195
  let file = readFile(variablesPath);
204
196
  if (file) {
205
197
  file = file.replace('}', ` ${replaceStart}${variablesAndClasspaths.variables[variable].toString()}${replaceEnd}}`);
206
- (0, utils_fs_1.writeFileSync)(variablesPath, file);
198
+ (0, fs_extra_1.writeFileSync)(variablesPath, file);
207
199
  }
208
200
  }
209
201
  }
210
202
  const pluginVariables = {
211
- firebaseMessagingVersion: '23.3.1',
212
- playServicesLocationVersion: '21.1.0',
213
- androidxBrowserVersion: '1.7.0',
214
- androidxMaterialVersion: '1.10.0',
215
- androidxExifInterfaceVersion: '1.3.6',
203
+ firebaseMessagingVersion: '24.1.0',
204
+ playServicesLocationVersion: '21.3.0',
205
+ androidxBrowserVersion: '1.8.0',
206
+ androidxMaterialVersion: '1.12.0',
207
+ androidxExifInterfaceVersion: '1.3.7',
216
208
  androidxCoreKTXVersion: '1.12.0',
217
209
  googleMapsPlayServicesVersion: '18.2.0',
218
210
  googleMapsUtilsVersion: '3.8.2',
@@ -226,7 +218,7 @@ async function migrateCommand(config, noprompt, packagemanager) {
226
218
  }
227
219
  })();
228
220
  });
229
- rimraf_1.default.sync((0, path_1.join)(config.android.appDirAbs, 'build'));
221
+ rimraf_1.rimraf.sync((0, path_1.join)(config.android.appDirAbs, 'build'));
230
222
  if (!installFailed) {
231
223
  await (0, common_2.runTask)('Migrating package from Manifest to build.gradle in Capacitor plugins', () => {
232
224
  return patchOldCapacitorPlugins(config);
@@ -286,11 +278,11 @@ async function installLatestLibs(dependencyManager, runInstall, config) {
286
278
  pkgJson['dependencies'][depKey] = pluginVersion;
287
279
  }
288
280
  }
289
- (0, utils_fs_1.writeFileSync)(pkgJsonPath, JSON.stringify(pkgJson, null, 2), {
281
+ (0, fs_extra_1.writeFileSync)(pkgJsonPath, JSON.stringify(pkgJson, null, 2), {
290
282
  encoding: 'utf-8',
291
283
  });
292
284
  if (runInstall) {
293
- rimraf_1.default.sync((0, path_1.join)(config.app.rootDir, 'node_modules/@capacitor/!(cli)'));
285
+ rimraf_1.rimraf.sync((0, path_1.join)(config.app.rootDir, 'node_modules/@capacitor/!(cli)'));
294
286
  await (0, subprocess_1.runCommand)(dependencyManager, ['install']);
295
287
  if (dependencyManager == 'yarn') {
296
288
  await (0, subprocess_1.runCommand)(dependencyManager, ['upgrade']);
@@ -305,11 +297,11 @@ async function installLatestLibs(dependencyManager, runInstall, config) {
305
297
  }
306
298
  async function writeBreakingChanges() {
307
299
  const breaking = [
308
- '@capacitor/camera',
309
- '@capacitor/filesystem',
310
- '@capacitor/geolocation',
311
- '@capacitor/google-maps',
312
- '@capacitor/local-notifications',
300
+ '@capacitor/app',
301
+ '@capacitor/device',
302
+ '@capacitor/haptics',
303
+ '@capacitor/splash-screen',
304
+ '@capacitor/statusbar',
313
305
  ];
314
306
  const broken = [];
315
307
  for (const lib of breaking) {
@@ -318,7 +310,7 @@ async function writeBreakingChanges() {
318
310
  }
319
311
  }
320
312
  if (broken.length > 0) {
321
- log_1.logger.info(`IMPORTANT: Review https://capacitorjs.com/docs/next/updating/6-0#plugins for breaking changes in these plugins that you use: ${broken.join(', ')}.`);
313
+ log_1.logger.info(`IMPORTANT: Review https://capacitorjs.com/docs/next/updating/7-0#plugins for breaking changes in these plugins that you use: ${broken.join(', ')}.`);
322
314
  }
323
315
  }
324
316
  async function getAndroidVariablesAndClasspaths(config) {
@@ -353,11 +345,11 @@ async function getAndroidVariablesAndClasspaths(config) {
353
345
  }
354
346
  function readFile(filename) {
355
347
  try {
356
- if (!(0, utils_fs_1.existsSync)(filename)) {
348
+ if (!(0, fs_extra_1.existsSync)(filename)) {
357
349
  log_1.logger.error(`Unable to find ${filename}. Try updating it manually`);
358
350
  return;
359
351
  }
360
- return (0, utils_fs_1.readFileSync)(filename, 'utf-8');
352
+ return (0, fs_extra_1.readFileSync)(filename, 'utf-8');
361
353
  }
362
354
  catch (err) {
363
355
  log_1.logger.error(`Unable to read ${filename}. Verify it is not already open. ${err}`);
@@ -416,8 +408,8 @@ async function movePackageFromManifestToBuildGradle(manifestFilename, buildGradl
416
408
  log_1.logger.error(`Unable to update buildGradleText: no changes were detected in Android Manifest file`);
417
409
  return;
418
410
  }
419
- (0, utils_fs_1.writeFileSync)(manifestFilename, manifestReplaced, 'utf-8');
420
- (0, utils_fs_1.writeFileSync)(buildGradleFilename, buildGradleReplaced, 'utf-8');
411
+ (0, fs_extra_1.writeFileSync)(manifestFilename, manifestReplaced, 'utf-8');
412
+ (0, fs_extra_1.writeFileSync)(buildGradleFilename, buildGradleReplaced, 'utf-8');
421
413
  }
422
414
  async function updateBuildGradle(filename, variablesAndClasspaths) {
423
415
  const txt = readFile(filename);
@@ -439,7 +431,7 @@ async function updateBuildGradle(filename, variablesAndClasspaths) {
439
431
  }
440
432
  }
441
433
  }
442
- (0, utils_fs_1.writeFileSync)(filename, replaced, 'utf-8');
434
+ (0, fs_extra_1.writeFileSync)(filename, replaced, 'utf-8');
443
435
  }
444
436
  async function updateFile(config, filename, textStart, textEnd, replacement, skipIfNotFound) {
445
437
  if (config === null) {
@@ -453,7 +445,7 @@ async function updateFile(config, filename, textStart, textEnd, replacement, ski
453
445
  if (txt.includes(textStart)) {
454
446
  if (replacement) {
455
447
  txt = setAllStringIn(txt, textStart, textEnd, replacement);
456
- (0, utils_fs_1.writeFileSync)(path, txt, { encoding: 'utf-8' });
448
+ (0, fs_extra_1.writeFileSync)(path, txt, { encoding: 'utf-8' });
457
449
  }
458
450
  else {
459
451
  // Replacing in code so we need to count the number of brackets to find the end of the function in swift
@@ -476,7 +468,7 @@ async function updateFile(config, filename, textStart, textEnd, replacement, ski
476
468
  replaced += line + '\n';
477
469
  }
478
470
  }
479
- (0, utils_fs_1.writeFileSync)(path, replaced, { encoding: 'utf-8' });
471
+ (0, fs_extra_1.writeFileSync)(path, replaced, { encoding: 'utf-8' });
480
472
  }
481
473
  return true;
482
474
  }
@@ -546,6 +538,6 @@ async function removeKey(filename, key) {
546
538
  return !removing;
547
539
  });
548
540
  if (removed) {
549
- (0, utils_fs_1.writeFileSync)(filename, lines.join('\n'), 'utf-8');
541
+ (0, fs_extra_1.writeFileSync)(filename, lines.join('\n'), 'utf-8');
550
542
  }
551
543
  }
package/dist/tasks/run.js CHANGED
@@ -45,8 +45,7 @@ async function runCommand(config, selectedPlatformName, options) {
45
45
  id: (_a = t.id) !== null && _a !== void 0 ? _a : '?',
46
46
  });
47
47
  });
48
- // TODO: make hidden commander option (https://github.com/tj/commander.js/issues/1106)
49
- if (process.argv.includes('--json')) {
48
+ if (options.json) {
50
49
  process.stdout.write(`${JSON.stringify(outputTargets)}\n`);
51
50
  }
52
51
  else {
@@ -1,24 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.inlineSourceMaps = void 0;
4
- const utils_fs_1 = require("@ionic/utils-fs");
4
+ const fs_extra_1 = require("fs-extra");
5
5
  const path_1 = require("path");
6
6
  const log_1 = require("../log");
7
7
  function walkDirectory(dirPath) {
8
- const files = (0, utils_fs_1.readdirSync)(dirPath);
8
+ const files = (0, fs_extra_1.readdirSync)(dirPath);
9
9
  files.forEach((file) => {
10
10
  const targetFile = (0, path_1.join)(dirPath, file);
11
- if ((0, utils_fs_1.existsSync)(targetFile) && (0, utils_fs_1.lstatSync)(targetFile).isDirectory()) {
11
+ if ((0, fs_extra_1.existsSync)(targetFile) && (0, fs_extra_1.lstatSync)(targetFile).isDirectory()) {
12
12
  walkDirectory(targetFile);
13
13
  }
14
14
  else {
15
15
  const mapFile = (0, path_1.join)(dirPath, `${file}.map`);
16
- if ((0, path_1.extname)(file) === '.js' && (0, utils_fs_1.existsSync)(mapFile)) {
17
- const bufMap = (0, utils_fs_1.readFileSync)(mapFile).toString('base64');
18
- const bufFile = (0, utils_fs_1.readFileSync)(targetFile, 'utf8');
16
+ if ((0, path_1.extname)(file) === '.js' && (0, fs_extra_1.existsSync)(mapFile)) {
17
+ const bufMap = (0, fs_extra_1.readFileSync)(mapFile).toString('base64');
18
+ const bufFile = (0, fs_extra_1.readFileSync)(targetFile, 'utf8');
19
19
  const result = bufFile.replace(`sourceMappingURL=${file}.map`, 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + bufMap);
20
- (0, utils_fs_1.writeFileSync)(targetFile, result);
21
- (0, utils_fs_1.unlinkSync)(mapFile);
20
+ (0, fs_extra_1.writeFileSync)(targetFile, result);
21
+ (0, fs_extra_1.unlinkSync)(mapFile);
22
22
  }
23
23
  }
24
24
  });
@@ -6,7 +6,8 @@ const colors_1 = tslib_1.__importDefault(require("../colors"));
6
6
  const errors_1 = require("../errors");
7
7
  const log_1 = require("../log");
8
8
  const sysconfig_1 = require("../sysconfig");
9
- const telemetry_1 = require("../telemetry");
9
+ const THANK_YOU = `\nThank you for helping to make Capacitor better! 💖` +
10
+ `\nInformation about the data we collect is available on our website: ${colors_1.default.strong('https://capacitorjs.com/docs/next/cli/telemetry')}\n`;
10
11
  async function telemetryCommand(onOrOff) {
11
12
  const sysconfig = await (0, sysconfig_1.readConfig)();
12
13
  const enabled = interpretEnabled(onOrOff);
@@ -18,7 +19,7 @@ async function telemetryCommand(onOrOff) {
18
19
  await (0, sysconfig_1.writeConfig)({ ...sysconfig, telemetry: enabled });
19
20
  (0, log_1.logSuccess)(`You have ${colors_1.default.strong(`opted ${enabled ? 'in' : 'out'}`)} ${enabled ? 'for' : 'of'} telemetry on this machine.`);
20
21
  if (enabled) {
21
- log_1.output.write(telemetry_1.THANK_YOU);
22
+ log_1.output.write(THANK_YOU);
22
23
  }
23
24
  }
24
25
  }
package/dist/telemetry.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sendMetric = exports.telemetryAction = exports.THANK_YOU = void 0;
3
+ exports.sendMetric = exports.telemetryAction = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const commander_1 = require("commander");
6
6
  const debug_1 = tslib_1.__importDefault(require("debug"));
@@ -11,8 +11,9 @@ const sysconfig_1 = require("./sysconfig");
11
11
  const subprocess_1 = require("./util/subprocess");
12
12
  const term_1 = require("./util/term");
13
13
  const debug = (0, debug_1.default)('capacitor:telemetry');
14
- exports.THANK_YOU = `\nThank you for helping to make Capacitor better! 💖` +
15
- `\nInformation about the data we collect is available on our website: ${colors_1.default.strong('https://capacitorjs.com/telemetry')}\n`;
14
+ const THANK_YOU = `\nThank you for helping improve Capacitor by sharing anonymous usage data! 💖` +
15
+ `\nInformation about the data we collect is available on our website: ${colors_1.default.strong('https://capacitorjs.com/docs/next/cli/telemetry')}` +
16
+ `\nYou can disable telemetry at any time by using the ${colors_1.default.input('npx cap telemetry off')} command.`;
16
17
  function telemetryAction(config, action) {
17
18
  return async (...actionArgs) => {
18
19
  const start = new Date();
@@ -55,9 +56,10 @@ function telemetryAction(config, action) {
55
56
  if ((0, term_1.isInteractive)()) {
56
57
  let sysconfig = await (0, sysconfig_1.readConfig)();
57
58
  if (!error && typeof sysconfig.telemetry === 'undefined') {
58
- const confirm = await promptForTelemetry();
59
- sysconfig = { ...sysconfig, telemetry: confirm };
59
+ // Telemetry is opt-out; turn telemetry on then inform the user how to opt-out.
60
+ sysconfig = { ...sysconfig, telemetry: true };
60
61
  await (0, sysconfig_1.writeConfig)(sysconfig);
62
+ log_1.output.write(THANK_YOU);
61
63
  }
62
64
  await sendMetric(sysconfig, 'capacitor_cli_command', data);
63
65
  }
@@ -86,19 +88,6 @@ async function sendMetric(sysconfig, name, data) {
86
88
  }
87
89
  }
88
90
  exports.sendMetric = sendMetric;
89
- async function promptForTelemetry() {
90
- const { confirm } = await (0, log_1.logPrompt)(`${colors_1.default.strong('Would you like to help improve Capacitor by sharing anonymous usage data? 💖')}\n` +
91
- `Read more about what is being collected and why here: ${colors_1.default.strong('https://capacitorjs.com/telemetry')}. You can change your mind at any time by using the ${colors_1.default.input('npx cap telemetry')} command.`, {
92
- type: 'confirm',
93
- name: 'confirm',
94
- message: 'Share anonymous usage data?',
95
- initial: true,
96
- });
97
- if (confirm) {
98
- log_1.output.write(exports.THANK_YOU);
99
- }
100
- return confirm;
101
- }
102
91
  /**
103
92
  * Get a unique anonymous identifier for this app.
104
93
  */
package/dist/util/fs.js CHANGED
@@ -1,24 +1,43 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteFolderRecursive = exports.convertToUnixPath = void 0;
4
- const utils_fs_1 = require("@ionic/utils-fs");
3
+ exports.readdirp = exports.deleteFolderRecursive = exports.convertToUnixPath = void 0;
4
+ const fs_1 = require("fs");
5
+ const promises_1 = require("fs/promises");
6
+ const fs_extra_1 = require("fs-extra");
5
7
  const path_1 = require("path");
6
8
  const convertToUnixPath = (path) => {
7
9
  return path.replace(/\\/g, '/');
8
10
  };
9
11
  exports.convertToUnixPath = convertToUnixPath;
10
12
  const deleteFolderRecursive = (directoryPath) => {
11
- if ((0, utils_fs_1.existsSync)(directoryPath)) {
12
- (0, utils_fs_1.readdirSync)(directoryPath).forEach((file) => {
13
+ if ((0, fs_extra_1.existsSync)(directoryPath)) {
14
+ (0, fs_extra_1.readdirSync)(directoryPath).forEach((file) => {
13
15
  const curPath = (0, path_1.join)(directoryPath, file);
14
- if ((0, utils_fs_1.lstatSync)(curPath).isDirectory()) {
16
+ if ((0, fs_extra_1.lstatSync)(curPath).isDirectory()) {
15
17
  (0, exports.deleteFolderRecursive)(curPath);
16
18
  }
17
19
  else {
18
- (0, utils_fs_1.unlinkSync)(curPath);
20
+ (0, fs_extra_1.unlinkSync)(curPath);
19
21
  }
20
22
  });
21
- (0, utils_fs_1.rmdirSync)(directoryPath);
23
+ (0, fs_extra_1.rmdirSync)(directoryPath);
22
24
  }
23
25
  };
24
26
  exports.deleteFolderRecursive = deleteFolderRecursive;
27
+ async function readdirp(dir, { filter }) {
28
+ const dirContent = await (0, promises_1.readdir)(dir, { recursive: true });
29
+ const dirContentWalker = [];
30
+ const filteredContent = [];
31
+ dirContent.forEach((element) => {
32
+ const path = (0, path_1.join)(dir, element);
33
+ const stats = (0, fs_1.statSync)(path);
34
+ dirContentWalker.push({ path, stats });
35
+ });
36
+ dirContentWalker.forEach((element) => {
37
+ if (filter(element)) {
38
+ filteredContent.push(element.path);
39
+ }
40
+ });
41
+ return filteredContent;
42
+ }
43
+ exports.readdirp = readdirp;
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateIOSPackageJSON = exports.writePluginJSON = exports.findPluginClasses = exports.getPluginFiles = void 0;
4
- const utils_fs_1 = require("@ionic/utils-fs");
4
+ const fs_extra_1 = require("fs-extra");
5
5
  const path_1 = require("path");
6
6
  const cordova_1 = require("../cordova");
7
7
  const plugin_1 = require("../plugin");
8
+ const fs_1 = require("./fs");
8
9
  async function getPluginFiles(plugins) {
9
10
  var _a;
10
11
  let filenameList = [];
@@ -21,7 +22,7 @@ async function getPluginFiles(plugins) {
21
22
  for (const plugin of plugins) {
22
23
  if (plugin.ios && (0, plugin_1.getPluginType)(plugin, 'ios') === 0 /* PluginType.Core */) {
23
24
  const pluginPath = (0, path_1.resolve)(plugin.rootPath, (_a = plugin.ios) === null || _a === void 0 ? void 0 : _a.path);
24
- const filenames = await (0, utils_fs_1.readdirp)(pluginPath, options);
25
+ const filenames = await (0, fs_1.readdirp)(pluginPath, options);
25
26
  filenameList = filenameList.concat(filenames);
26
27
  }
27
28
  }
@@ -31,7 +32,7 @@ exports.getPluginFiles = getPluginFiles;
31
32
  async function findPluginClasses(files) {
32
33
  const classList = [];
33
34
  for (const file of files) {
34
- const fileData = (0, utils_fs_1.readFileSync)(file, 'utf-8');
35
+ const fileData = (0, fs_extra_1.readFileSync)(file, 'utf-8');
35
36
  const swiftPluginRegex = RegExp(/@objc\(([A-Za-z0-9_-]+)\)/);
36
37
  const objcPluginRegex = RegExp(/CAP_PLUGIN\(([A-Za-z0-9_-]+)/);
37
38
  const swiftMatches = swiftPluginRegex.exec(fileData);
@@ -48,9 +49,9 @@ async function findPluginClasses(files) {
48
49
  exports.findPluginClasses = findPluginClasses;
49
50
  async function writePluginJSON(config, classList) {
50
51
  const capJSONFile = (0, path_1.resolve)(config.ios.nativeTargetDirAbs, 'capacitor.config.json');
51
- const capJSON = (0, utils_fs_1.readJSONSync)(capJSONFile);
52
+ const capJSON = (0, fs_extra_1.readJSONSync)(capJSONFile);
52
53
  capJSON['packageClassList'] = classList;
53
- (0, utils_fs_1.writeJSONSync)(capJSONFile, capJSON, { spaces: '\t' });
54
+ (0, fs_extra_1.writeJSONSync)(capJSONFile, capJSON, { spaces: '\t' });
54
55
  }
55
56
  exports.writePluginJSON = writePluginJSON;
56
57
  async function generateIOSPackageJSON(config, plugins) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CapLiveReloadHelper = void 0;
4
- const utils_fs_1 = require("@ionic/utils-fs");
4
+ const fs_extra_1 = require("fs-extra");
5
5
  const os_1 = require("os");
6
6
  const path_1 = require("path");
7
7
  class CapLiveReload {
@@ -126,21 +126,21 @@ class CapLiveReload {
126
126
  const capConfigPath = rootConfigChange
127
127
  ? config.app.extConfigFilePath
128
128
  : (0, path_1.join)(platformAbsPath, 'capacitor.config.json');
129
- const configJson = (0, utils_fs_1.readJSONSync)(capConfigPath);
129
+ const configJson = (0, fs_extra_1.readJSONSync)(capConfigPath);
130
130
  this.configJsonToRevertTo.json = JSON.stringify(configJson, null, 2);
131
131
  this.configJsonToRevertTo.platformPath = capConfigPath;
132
132
  const url = `http://${options.host}:${options.port}`;
133
133
  configJson.server = {
134
134
  url,
135
135
  };
136
- (0, utils_fs_1.writeJSONSync)(capConfigPath, configJson, { spaces: '\t' });
136
+ (0, fs_extra_1.writeJSONSync)(capConfigPath, configJson, { spaces: '\t' });
137
137
  }
138
138
  async revertCapConfigForLiveReload() {
139
139
  if (this.configJsonToRevertTo.json == null || this.configJsonToRevertTo.platformPath == null)
140
140
  return;
141
141
  const capConfigPath = this.configJsonToRevertTo.platformPath;
142
142
  const configJson = this.configJsonToRevertTo.json;
143
- (0, utils_fs_1.writeJSONSync)(capConfigPath, JSON.parse(configJson), { spaces: '\t' });
143
+ (0, fs_extra_1.writeJSONSync)(capConfigPath, JSON.parse(configJson), { spaces: '\t' });
144
144
  this.configJsonToRevertTo.json = null;
145
145
  this.configJsonToRevertTo.platformPath = null;
146
146
  }
package/dist/util/node.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveNode = exports.requireTS = void 0;
4
- const utils_fs_1 = require("@ionic/utils-fs");
5
4
  const fs_1 = require("fs");
5
+ const fs_extra_1 = require("fs-extra");
6
6
  const path_1 = require("path");
7
7
  /**
8
8
  * @see https://github.com/ionic-team/stencil/blob/HEAD/src/compiler/sys/node-require.ts
@@ -12,7 +12,7 @@ const requireTS = (ts, p) => {
12
12
  delete require.cache[id];
13
13
  require.extensions['.ts'] = (module, fileName) => {
14
14
  var _a;
15
- let sourceText = (0, utils_fs_1.readFileSync)(fileName, 'utf8');
15
+ let sourceText = (0, fs_extra_1.readFileSync)(fileName, 'utf8');
16
16
  if (fileName.endsWith('.ts')) {
17
17
  const tsResults = ts.transpileModule(sourceText, {
18
18
  fileName,
package/dist/util/spm.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generatePackageFile = exports.findPackageSwiftFile = exports.checkPackageManager = void 0;
4
- const utils_fs_1 = require("@ionic/utils-fs");
4
+ const fs_extra_1 = require("fs-extra");
5
5
  const path_1 = require("path");
6
6
  const log_1 = require("../log");
7
7
  async function checkPackageManager(config) {
8
8
  const iosDirectory = config.ios.nativeProjectDirAbs;
9
- if ((0, utils_fs_1.existsSync)((0, path_1.resolve)(iosDirectory, 'CapApp-SPM'))) {
9
+ if ((0, fs_extra_1.existsSync)((0, path_1.resolve)(iosDirectory, 'CapApp-SPM'))) {
10
10
  return 'SPM';
11
11
  }
12
12
  return 'Cocoapods';
@@ -22,7 +22,7 @@ async function generatePackageFile(config, plugins) {
22
22
  try {
23
23
  log_1.logger.warn('SPM Support is still experimental');
24
24
  const textToWrite = generatePackageText(config, plugins);
25
- (0, utils_fs_1.writeFileSync)(packageSwiftFile, textToWrite);
25
+ (0, fs_extra_1.writeFileSync)(packageSwiftFile, textToWrite);
26
26
  }
27
27
  catch (err) {
28
28
  log_1.logger.error(`Unable to write to ${packageSwiftFile}. Verify it is not already open. \n Error: ${err}`);
@@ -31,7 +31,7 @@ async function generatePackageFile(config, plugins) {
31
31
  exports.generatePackageFile = generatePackageFile;
32
32
  function generatePackageText(config, plugins) {
33
33
  var _a, _b, _c;
34
- const pbx = (0, utils_fs_1.readFileSync)((0, path_1.join)(config.ios.nativeXcodeProjDirAbs, 'project.pbxproj'), 'utf-8');
34
+ const pbx = (0, fs_extra_1.readFileSync)((0, path_1.join)(config.ios.nativeXcodeProjDirAbs, 'project.pbxproj'), 'utf-8');
35
35
  const searchString = 'IPHONEOS_DEPLOYMENT_TARGET = ';
36
36
  const iosVersion = pbx.substring(pbx.indexOf(searchString) + searchString.length, pbx.indexOf(searchString) + searchString.length + 2);
37
37
  let packageSwiftText = `// swift-tools-version: 5.9
@@ -10,7 +10,7 @@ async function runCommand(command, args, options = {}) {
10
10
  catch (e) {
11
11
  if (e instanceof utils_subprocess_1.SubprocessError) {
12
12
  // old behavior of just throwing the stdout/stderr strings
13
- throw e.output ? e.output : e.code ? e.code : e.error ? e.error.message : 'Unknown error';
13
+ throw e.output ? e.output : e.cause ? `${e.message} ${e.cause.toString()}` : e.code ? e.code : 'Unknown error';
14
14
  }
15
15
  throw e;
16
16
  }
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.extractTemplate = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const utils_fs_1 = require("@ionic/utils-fs");
5
+ const fs_extra_1 = require("fs-extra");
6
6
  const tar_1 = tslib_1.__importDefault(require("tar"));
7
7
  async function extractTemplate(src, dir) {
8
- await (0, utils_fs_1.mkdirp)(dir);
8
+ await (0, fs_extra_1.mkdirp)(dir);
9
9
  await tar_1.default.extract({ file: src, cwd: dir });
10
10
  }
11
11
  exports.extractTemplate = extractTemplate;
package/dist/util/xml.js CHANGED
@@ -2,12 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildXmlElement = exports.writeXML = exports.parseXML = exports.readXML = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const utils_fs_1 = require("@ionic/utils-fs");
5
+ const fs_extra_1 = require("fs-extra");
6
6
  const xml2js_1 = tslib_1.__importDefault(require("xml2js"));
7
7
  async function readXML(path) {
8
8
  var _a;
9
9
  try {
10
- const xmlStr = await (0, utils_fs_1.readFile)(path, { encoding: 'utf-8' });
10
+ const xmlStr = await (0, fs_extra_1.readFile)(path, { encoding: 'utf-8' });
11
11
  try {
12
12
  return await xml2js_1.default.parseStringPromise(xmlStr);
13
13
  }