create-manifest 1.1.4 → 1.1.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.
@@ -1,3 +1,6 @@
1
+ # This is a sample file for a backend.yml manifest backend.
2
+ # Read more about the manifest format here: https:/manifest.build/docs
3
+
1
4
  name: My pet app 🐾
2
5
  entities:
3
6
  Owner:
@@ -12,6 +15,9 @@ entities:
12
15
  - { name: birthdate, type: date }
13
16
  belongsTo:
14
17
  - Owner
18
+ policies:
19
+ read:
20
+ - access: public
15
21
 
16
22
  Homepage:
17
23
  nameSingular: Home content
@@ -20,3 +26,6 @@ entities:
20
26
  - title
21
27
  - { name: description, type: richText }
22
28
  - { name: cover, type: image }
29
+ policies:
30
+ read:
31
+ - access: public
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "my-manifest-project",
2
+ "name": "PROJECT_NAME",
3
3
  "version": "0.1.0",
4
- "description": "A project made with Manifest",
4
+ "description": "A backend made with Manifest: https://manifest.build",
5
5
  "scripts": {},
6
6
  "dependencies": {}
7
7
  }
@@ -1,8 +1,8 @@
1
1
  import { Args, Command, Flags } from '@oclif/core';
2
2
  import axios from 'axios';
3
3
  import { exec as execCp } from 'node:child_process';
4
- import * as crypto from 'node:crypto';
5
4
  import * as fs from 'node:fs';
5
+ import * as crypto from 'node:crypto';
6
6
  import * as path from 'node:path';
7
7
  import { fileURLToPath } from 'node:url';
8
8
  import { promisify } from 'node:util';
@@ -15,6 +15,8 @@ import { updateSettingsJsonFile } from '../utils/UpdateSettingsJsonFile.js';
15
15
  import { getLatestPackageVersion } from '../utils/GetLatestPackageVersion.js';
16
16
  import { getBackendFileContent } from '../utils/GetBackendFileContent.js';
17
17
  import { input } from '@inquirer/prompts';
18
+ import { slugify } from '../utils/helpers.js';
19
+ import chalk from 'chalk';
18
20
  const exec = promisify(execCp);
19
21
  export default class CreateManifest extends Command {
20
22
  static description = 'Create a new Manifest project with the default files and folders.';
@@ -69,6 +71,7 @@ export default class CreateManifest extends Command {
69
71
  }
70
72
  });
71
73
  }
74
+ projectName = slugify(projectName);
72
75
  const spinner = ora(`Creating your Manifest project in ${projectName} folder...`).start();
73
76
  const projectFolderPath = path.join(process.cwd(), projectName);
74
77
  // Check if the folder already exists
@@ -104,7 +107,9 @@ export default class CreateManifest extends Command {
104
107
  packageJson = parse(fs.readFileSync(packagePath, 'utf8'));
105
108
  }
106
109
  else {
107
- packageJson = JSON.parse(fs.readFileSync(path.join(assetFolderPath, 'default-package.json'), 'utf8'));
110
+ packageJson = JSON.parse(fs
111
+ .readFileSync(path.join(assetFolderPath, 'default-package.json'), 'utf8')
112
+ .replace('PROJECT_NAME', projectName));
108
113
  }
109
114
  const manifestLatestVersion = await getLatestPackageVersion('manifest');
110
115
  fs.writeFileSync(packagePath, updatePackageJsonFile({
@@ -207,7 +212,7 @@ export default class CreateManifest extends Command {
207
212
  spinner.start('Install dependencies...');
208
213
  // Install deps.
209
214
  try {
210
- await exec('npm install');
215
+ await exec(`cd ${projectName} && npm install --silent`);
211
216
  }
212
217
  catch (error) {
213
218
  spinner.fail(`Execution error: ${error}`);
@@ -250,9 +255,12 @@ export default class CreateManifest extends Command {
250
255
  }
251
256
  spinner.succeed();
252
257
  console.log();
253
- console.log('🎉 Manifest successfully installed !');
258
+ console.log(chalk.bold('🎉 Manifest successfully installed !'));
259
+ console.log();
260
+ console.log('To start the server:');
254
261
  console.log();
255
- console.log('🚀 Run `npm run manifest` to start the server.');
262
+ console.log(chalk.bold(` cd ${projectName}`));
263
+ console.log(chalk.bold(' npm run manifest'));
256
264
  console.log();
257
265
  await this.silentKill(serveTask?.child?.pid || 0);
258
266
  process.exit();
@@ -0,0 +1 @@
1
+ export declare const slugify: (text: string) => string;
@@ -0,0 +1,11 @@
1
+ export const slugify = (text) => {
2
+ return text
3
+ .toString() // Convert to string
4
+ .normalize('NFD') // Normalize accents
5
+ .replace(/[\u0300-\u036f]/g, '') // Remove accent marks
6
+ .toLowerCase() // Convert to lowercase
7
+ .replace(/[^a-z0-9\s-]/g, '') // Remove special characters (keep spaces and hyphens)
8
+ .replace(/\s+/g, '-') // Replace spaces with hyphens
9
+ .replace(/-+/g, '-') // Replace multiple hyphens with single hyphen
10
+ .replace(/^-+|-+$/g, ''); // Remove leading/trailing hyphens
11
+ };
@@ -33,5 +33,5 @@
33
33
  "enableJsonFlag": false
34
34
  }
35
35
  },
36
- "version": "1.1.4"
36
+ "version": "1.1.6"
37
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-manifest",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "author": "Manifest",
5
5
  "description": "Create a new Manifest backend",
6
6
  "homepage": "https://manifest.build",