@mapples/cli 0.0.10 → 0.0.12
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 +48 -2
- package/dist/index.js.map +1 -1
- package/package-list.json +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -50241,8 +50241,8 @@ const writeJsonToFile = (filePath, data) => {
|
|
|
50241
50241
|
};
|
|
50242
50242
|
|
|
50243
50243
|
const DEFAULT_CONFIG = {
|
|
50244
|
-
sandboxUrl: 'https://
|
|
50245
|
-
assetUrl: 'https://
|
|
50244
|
+
sandboxUrl: 'https://prod-us.mapples.org',
|
|
50245
|
+
assetUrl: 'https://prod.assets.mapples.org',
|
|
50246
50246
|
useExpoRouter: false,
|
|
50247
50247
|
sourceDir: 'mapples',
|
|
50248
50248
|
dirs: {
|
|
@@ -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
|
{
|