@mapples/cli 0.0.11 → 0.0.13

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/dist/index.js CHANGED
@@ -52904,15 +52904,15 @@ const installPackage = (packageName, version, packageManager) => {
52904
52904
  let command;
52905
52905
  switch (packageManager) {
52906
52906
  case 'yarn':
52907
- command = `yarn add ${packageName}@${version}`;
52907
+ command = `yarn add ${packageName}@${version} --exact`;
52908
52908
  break;
52909
52909
  case 'pnpm':
52910
- command = `pnpm add ${packageName}@${version}`;
52910
+ command = `pnpm add ${packageName}@${version} --save-exact`;
52911
52911
  break;
52912
52912
  default:
52913
- command = `npm install ${packageName}@${version}`;
52913
+ command = `npm install ${packageName}@${version} --save-exact`;
52914
52914
  }
52915
- console.log(chalk.blue(`Installing ${packageName}@${version}...`));
52915
+ console.log(chalk.blue(`Installing ${packageName}@${version} (exact version)...`));
52916
52916
  require$$1$3.execSync(command, { stdio: 'inherit' });
52917
52917
  console.log(chalk.green(`✓ Installed ${packageName}@${version}`));
52918
52918
  }
@@ -76567,6 +76567,51 @@ const executeSyncOperations$1 = async (syncOptions) => {
76567
76567
  await Promise.all(syncPromises);
76568
76568
  console.log('Sync operations completed successfully!');
76569
76569
  };
76570
+ const createMetroConfig = () => {
76571
+ const metroConfigPath = path.join(process.cwd(), 'metro.config.js');
76572
+ const metroConfigExamplePath = path.join(process.cwd(), 'metro.config_example.js');
76573
+ const metroConfigExists = fs.existsSync(metroConfigPath);
76574
+ const metroConfigContent = `const { getDefaultConfig } = require('expo/metro-config');
76575
+ const { mapplesResolver } = require('@mapples/app/expo');
76576
+
76577
+ module.exports = (() => {
76578
+ const config = getDefaultConfig(__dirname);
76579
+
76580
+ const { transformer, resolver } = config;
76581
+
76582
+ config.transformer = {
76583
+ ...transformer,
76584
+ babelTransformerPath: require.resolve('react-native-svg-transformer/expo'),
76585
+ };
76586
+ config.resolver = {
76587
+ ...resolver,
76588
+ assetExts: resolver.assetExts.filter((ext) => ext !== 'svg'),
76589
+ sourceExts: [...resolver.sourceExts, 'svg'],
76590
+ };
76591
+
76592
+ config.resolver.resolveRequest = mapplesResolver(
76593
+ (context, moduleName, platform) => {
76594
+ // add your custom resolvers here
76595
+ return context.resolveRequest(context, moduleName, platform);
76596
+ },
76597
+ );
76598
+
76599
+ return config;
76600
+ })();
76601
+ `;
76602
+ if (metroConfigExists) {
76603
+ fs.writeFileSync(metroConfigExamplePath, metroConfigContent);
76604
+ console.log('\n⚠️ Warning: metro.config.js already exists in your project.');
76605
+ console.log(' A metro.config_example.js file has been created with the recommended Mapples configuration.');
76606
+ console.log(' To ensure proper functionality of MapplesApp components and automatic asset/style resolution,');
76607
+ console.log(' please update your existing metro.config.js with the configuration from metro.config_example.js.');
76608
+ console.log(' Alternatively, you can manually provide assets and styles to MapplesApp components.\n');
76609
+ }
76610
+ else {
76611
+ fs.writeFileSync(metroConfigPath, metroConfigContent);
76612
+ console.log('Created metro.config.js');
76613
+ }
76614
+ };
76570
76615
  const initProject = async (configPath) => {
76571
76616
  try {
76572
76617
  const existingConfig = readConfig(configPath);
@@ -76579,6 +76624,7 @@ const initProject = async (configPath) => {
76579
76624
  const config = await promptForConfig();
76580
76625
  writeConfig(config, configPath);
76581
76626
  updateGitignore();
76627
+ createMetroConfig();
76582
76628
  console.log('Project initialization completed successfully');
76583
76629
  const { installPackages } = await inquirer.prompt([
76584
76630
  {