@mapples/cli 0.0.4 → 0.0.6

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/README.md CHANGED
@@ -47,7 +47,7 @@ This command will:
47
47
  - Create page directories with the following structure:
48
48
  ```
49
49
  src/pages/{PageName}/
50
- ├── {PageName}Component.tsx
50
+ ├── {PageName}Mapplet.tsx
51
51
  ├── {PageName}.json
52
52
  ├── _meta_{PageName}.json
53
53
  ├── index.ts
@@ -101,7 +101,7 @@ The CLI uses a `.mapplesrc.json` file for configuration. Here are the available
101
101
 
102
102
  When synchronizing pages, the CLI generates the following files for each page:
103
103
 
104
- ### Component File (`{PageName}Component.tsx`)
104
+ ### Component File (`{PageName}Mapplet.tsx`)
105
105
 
106
106
  A React component that uses the `@mapples/render` package to render page content.
107
107
 
package/dist/index.js CHANGED
@@ -75350,6 +75350,8 @@ const createPageFromTemplates = (pageName, pageData, config) => {
75350
75350
  const templateDir = path.resolve(__dirname, '../templates/PageTemplate');
75351
75351
  const destDir = path.join(process.cwd(), config.sourceDir, config.dirs.pages, pageName);
75352
75352
  ensureDirectoryExists$2(destDir);
75353
+ // Files that should not be overwritten if they already exist
75354
+ const protectedExtensions = ['.tsx'];
75353
75355
  const templateFiles = fs.readdirSync(templateDir);
75354
75356
  templateFiles.forEach((file) => {
75355
75357
  const templatePath = path.join(templateDir, file);
@@ -75363,6 +75365,12 @@ const createPageFromTemplates = (pageName, pageData, config) => {
75363
75365
  }
75364
75366
  destFileName = destFileName.replace(/{{PageName}}/g, pageName).replace(/\.tmpl$/, '');
75365
75367
  const destPath = path.join(destDir, destFileName);
75368
+ // Check if this file has a protected extension and already exists
75369
+ const fileExtension = path.extname(destFileName);
75370
+ if (protectedExtensions.includes(fileExtension) && fs.existsSync(destPath)) {
75371
+ console.log(`Skipping protected file: ${destFileName}`);
75372
+ return;
75373
+ }
75366
75374
  if (file === `_meta_{{PageName}}.json.tmpl`) {
75367
75375
  const metaData = lodashExports.cloneDeep(pageData);
75368
75376
  lodashExports.unset(metaData, 'data');
@@ -75371,7 +75379,7 @@ const createPageFromTemplates = (pageName, pageData, config) => {
75371
75379
  else if (file === `{{PageName}}.json.tmpl`) {
75372
75380
  writeJsonToFile(destPath, pageData.data || {});
75373
75381
  }
75374
- else if (file === `{{PageName}}Component.tsx.tmpl` || file === `index.ts.tmpl`) {
75382
+ else if (file === `{{PageName}}Mapplet.tsx.tmpl` || file === `index.ts.tmpl`) {
75375
75383
  processTemplateFile(templatePath, destPath, { PageName: pageName });
75376
75384
  }
75377
75385
  });