create-manifest 1.2.1 → 1.3.1

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.
@@ -0,0 +1,51 @@
1
+ <br>
2
+ <p align="center">
3
+ <a href="https://manifest.build/#gh-light-mode-only">
4
+ <img alt="manifest" src="https://manifest.build/assets/images/logo-transparent.svg" height="55px" alt="Manifest logo" title="Manifest - A backend so simple that it fits in a YAML file" />
5
+ </a>
6
+ <a href="https://manifest.build/#gh-dark-mode-only">
7
+ <img alt="manifest" src="https://manifest.build/assets/images/logo-light.svg" height="55px" alt="Manifest logo" title="Manifest - A backend so simple that it fits in a YAML file" />
8
+ </a>
9
+ </p>
10
+
11
+ <p align='center'>
12
+ <strong>The backend for AI code editors</strong> <br> <span>Manifest is a backend your AI can understand and your team can trust.</span>
13
+
14
+ ## Description
15
+
16
+ Welcome to your [Manifest](https://github.com/mnfst/manifest) project ! Feel free to replace this README by your own.
17
+
18
+ This application is a **monorepo** composed by a [Manifest backend](https://github.com/mnfst/manifest) in the "/api" folder and a frontend of your choice that you can add in the "/web" folder.
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ $ npm install
24
+ ```
25
+
26
+ ## Running the app
27
+
28
+ To run the app in the development mode:
29
+
30
+ ```bash
31
+ npm run start
32
+ ```
33
+
34
+ - Open [http://localhost:1111](http://localhost:1111) to open your admin UI it in your browser
35
+ - Open [http://localhost:1111/api](http://localhost:111/api) to view your REST API documentation
36
+
37
+ The page will reload when you make changes.
38
+
39
+ ## Seed dummy data
40
+
41
+ Seeds some dummy data for your entities:
42
+
43
+ ```bash
44
+ npm run seed
45
+ ```
46
+
47
+ ## Community & Resources
48
+
49
+ - [Docs](https://manifest.build/docs) - Get started with Manifest
50
+ - [Discord](https://discord.gg/FepAked3W7) - Come chat with the community
51
+ - [Github](https://github.com/mnfst/manifest/issues) - Report bugs and share ideas to improve the product.
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@PROJECT_NAME/api",
3
+ "version": "0.1.0",
4
+ "description": "A backend made with Manifest: https://manifest.build",
5
+ "private": true,
6
+ "license": "UNLICENSED",
7
+ "scripts": {},
8
+ "dependencies": {}
9
+ }
@@ -0,0 +1,49 @@
1
+ <br>
2
+ <p align="center">
3
+ <a href="https://manifest.build/#gh-light-mode-only">
4
+ <img alt="manifest" src="https://manifest.build/assets/images/logo-transparent.svg" height="55px" alt="Manifest logo" title="Manifest - A backend so simple that it fits in a YAML file" />
5
+ </a>
6
+ <a href="https://manifest.build/#gh-dark-mode-only">
7
+ <img alt="manifest" src="https://manifest.build/assets/images/logo-light.svg" height="55px" alt="Manifest logo" title="Manifest - A backend so simple that it fits in a YAML file" />
8
+ </a>
9
+ </p>
10
+
11
+ <p align='center'>
12
+ <strong>The backend for AI code editors</strong> <br> <span>Manifest is a backend your AI can understand and your team can trust.</span>
13
+
14
+ ## Description
15
+
16
+ Welcome to your [Manifest](https://github.com/mnfst/manifest) backend ! Feel free to replace this README by your own.
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ $ npm install
22
+ ```
23
+
24
+ ## Running the app
25
+
26
+ To run the app in the development mode:
27
+
28
+ ```bash
29
+ npm run start
30
+ ```
31
+
32
+ - Open [http://localhost:1111](http://localhost:1111) to open your admin UI it in your browser
33
+ - Open [http://localhost:1111/api](http://localhost:111/api) to view your REST API documentation
34
+
35
+ The page will reload when you make changes.
36
+
37
+ ## Seed dummy data
38
+
39
+ Seeds some dummy data for your entities:
40
+
41
+ ```bash
42
+ npm run seed
43
+ ```
44
+
45
+ ## Community & Resources
46
+
47
+ - [Docs](https://manifest.build/docs) - Get started with Manifest
48
+ - [Discord](https://discord.gg/FepAked3W7) - Come chat with the community
49
+ - [Github](https://github.com/mnfst/manifest/issues) - Report bugs and share ideas to improve the product.
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "PROJECT_NAME",
3
+ "private": true,
4
+ "workspaces": ["api", "web"],
5
+ "description": "A full-stack app made with Manifest: https://manifest.build",
6
+ "scripts": {
7
+ "start": "concurrently \"npm run start:api\" \"npm run start:web\"",
8
+ "start:api": "npm run start --workspace=api",
9
+ "start:web": "npm run start --workspace=web",
10
+ "seed": "npm run seed --workspace=api"
11
+ },
12
+ "devDependencies": {
13
+ "concurrently": "^8.0.0"
14
+ }
15
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@PROJECT_NAME/web",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "license": "UNLICENSED",
6
+ "scripts": {
7
+ "start": "echo 'Add your frontend framework here'",
8
+ "build": "echo 'Add your build command here'"
9
+ }
10
+ }
@@ -0,0 +1,9 @@
1
+ # Frontend Application
2
+
3
+ This folder is ready for your frontend framework of choice:
4
+
5
+ - Next.js: `npx create-next-app@latest . --typescript --tailwind`
6
+ - Vite React: `npm create vite@latest . -- --template react-ts`
7
+ - SvelteKit: `npm create svelte@latest .`
8
+
9
+ After setting up your frontend, update the dev script in package.json.
@@ -26,7 +26,7 @@ $ npm install
26
26
  To run the app in the development mode:
27
27
 
28
28
  ```bash
29
- npm run manifest
29
+ npm run start
30
30
  ```
31
31
 
32
32
  - Open [http://localhost:1111](http://localhost:1111) to open your admin UI it in your browser
@@ -39,7 +39,7 @@ The page will reload when you make changes.
39
39
  Seeds some dummy data for your entities:
40
40
 
41
41
  ```bash
42
- npm run manifest:seed
42
+ npm run seed
43
43
  ```
44
44
 
45
45
  ## Community & Resources
@@ -0,0 +1,34 @@
1
+ # This is a sample file for a manifest.yml manifest backend.
2
+ # Read more about the manifest format here: https:/manifest.build/docs
3
+
4
+ name: My pet app 🐾
5
+ entities:
6
+ Owner:
7
+ properties:
8
+ - name
9
+ - { name: birthdate, type: date }
10
+ policies:
11
+ read:
12
+ - access: public
13
+
14
+ Cat:
15
+ properties:
16
+ - name
17
+ - { name: age, type: number }
18
+ - { name: birthdate, type: date }
19
+ belongsTo:
20
+ - Owner
21
+ policies:
22
+ read:
23
+ - access: public
24
+
25
+ Homepage:
26
+ nameSingular: Home content
27
+ single: true
28
+ properties:
29
+ - title
30
+ - { name: description, type: richText }
31
+ - { name: cover, type: image }
32
+ policies:
33
+ read:
34
+ - access: public
@@ -58,6 +58,8 @@ export default class CreateManifest extends Command {
58
58
  // * 1 Create a folder named after the first argument or ask for it.
59
59
  const { argv } = await this.parse(CreateManifest);
60
60
  let projectName = argv[0];
61
+ // let isMonorepo: boolean = argv[1] === 'monorepo'
62
+ const isMonorepo = false; // Hide this feature.
61
63
  if (!projectName) {
62
64
  projectName = await input({
63
65
  message: 'What name would you like to use for the new workspace?',
@@ -73,24 +75,53 @@ export default class CreateManifest extends Command {
73
75
  }
74
76
  });
75
77
  }
78
+ // if (!isMonorepo) {
79
+ // const projectType = await select({
80
+ // message: 'What type of project would you like to develop?',
81
+ // choices: [
82
+ // {
83
+ // name: 'A full-stack app (monorepo)',
84
+ // value: 'monorepo',
85
+ // description: 'Creates a monorepo with both "web" and "api" folders'
86
+ // },
87
+ // {
88
+ // name: 'A standalone backend',
89
+ // value: 'standalone',
90
+ // description: 'Creates a backend-only project'
91
+ // }
92
+ // ]
93
+ // })
94
+ // isMonorepo = projectType === 'monorepo'
95
+ // }
76
96
  projectName = slugify(projectName);
77
97
  const spinner = ora(`Creating your Manifest project in ${projectName} folder...`).start();
78
- const projectFolderPath = path.join(process.cwd(), projectName);
98
+ const rootFolderPath = path.join(process.cwd(), projectName);
79
99
  // Check if the folder already exists
80
- if (fs.existsSync(projectFolderPath)) {
81
- spinner.fail(`Error: The "${projectFolderPath}" folder already exists in the current directory. Please find another name.`);
100
+ if (fs.existsSync(rootFolderPath)) {
101
+ spinner.fail(`Error: The "${rootFolderPath}" folder already exists in the current directory. Please find another name.`);
82
102
  process.exit(1);
83
103
  }
84
- fs.mkdirSync(projectFolderPath);
104
+ fs.mkdirSync(rootFolderPath);
105
+ let projectFolderPath;
106
+ if (isMonorepo) {
107
+ // If it's a monorepo, create a folder for the project.
108
+ projectFolderPath = path.join(rootFolderPath, 'api');
109
+ fs.mkdirSync(projectFolderPath);
110
+ fs.mkdirSync(path.join(rootFolderPath, 'web'));
111
+ }
112
+ else {
113
+ // If it's a standalone backend, use the root folder as the project folder.
114
+ projectFolderPath = rootFolderPath;
115
+ }
85
116
  const manifestFolderName = '.manifest';
86
117
  const initialFileName = 'manifest.yml';
87
118
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
88
- const assetFolderPath = path.join(__dirname, '..', '..', 'assets');
119
+ const assetFolderPath = path.join(__dirname, '..', '..', 'assets', isMonorepo ? 'monorepo' : 'standalone');
89
120
  // * 2. Create a folder with the name `.manifest` for compiled files.
90
121
  // Construct the folder path. This example creates the folder in the current working directory.
91
- const manifestFolderPath = path.join(projectFolderPath, manifestFolderName);
122
+ const compiledFolderPath = path.join(projectFolderPath, manifestFolderName);
92
123
  // Create the folder
93
- fs.mkdirSync(manifestFolderPath);
124
+ fs.mkdirSync(compiledFolderPath);
94
125
  // * 3. Create a file with the name `manifest.yml`.
95
126
  const newFilePath = path.join(projectFolderPath, initialFileName);
96
127
  // Get the content of the file either remote or local.
@@ -100,18 +131,12 @@ export default class CreateManifest extends Command {
100
131
  // Write the content to the new file
101
132
  fs.writeFileSync(newFilePath, content);
102
133
  spinner.succeed();
103
- spinner.start('Updating package.json file...');
134
+ spinner.start('Creating package.json file...');
104
135
  // Update package.json file.
105
136
  const packagePath = path.join(projectFolderPath, 'package.json');
106
- let packageJson;
107
- if (fs.existsSync(packagePath)) {
108
- packageJson = parse(fs.readFileSync(packagePath, 'utf8'));
109
- }
110
- else {
111
- packageJson = JSON.parse(fs
112
- .readFileSync(path.join(assetFolderPath, 'default-package.json'), 'utf8')
113
- .replace('PROJECT_NAME', projectName));
114
- }
137
+ const packageJson = JSON.parse(fs
138
+ .readFileSync(path.join(assetFolderPath, 'api-package.json'), 'utf8')
139
+ .replace('PROJECT_NAME', projectName));
115
140
  const manifestLatestVersion = await getLatestPackageVersion('manifest');
116
141
  fs.writeFileSync(packagePath, updatePackageJsonFile({
117
142
  fileContent: packageJson,
@@ -123,10 +148,21 @@ export default class CreateManifest extends Command {
123
148
  seed: 'node node_modules/manifest/dist/manifest/src/seed/scripts/seed.js'
124
149
  }
125
150
  }));
151
+ if (isMonorepo) {
152
+ // If it's a monorepo, also update the web package.json file and the root package.json file.
153
+ const webPackagePath = path.join(rootFolderPath, 'web', 'package.json');
154
+ fs.writeFileSync(webPackagePath, fs
155
+ .readFileSync(path.join(assetFolderPath, 'web-package.json'), 'utf8')
156
+ .replace('PROJECT_NAME', projectName));
157
+ const rootPackagePath = path.join(rootFolderPath, 'package.json');
158
+ fs.writeFileSync(rootPackagePath, fs
159
+ .readFileSync(path.join(assetFolderPath, 'root-package.json'), 'utf8')
160
+ .replace('PROJECT_NAME', projectName));
161
+ }
126
162
  spinner.succeed();
127
163
  spinner.start('Adding settings...');
128
164
  // Update .vscode/extensions.json file.
129
- const vscodeDirPath = path.join(projectFolderPath, '.vscode');
165
+ const vscodeDirPath = path.join(rootFolderPath, '.vscode');
130
166
  const extensionsFilePath = path.join(vscodeDirPath, 'extensions.json');
131
167
  let extensionsJson;
132
168
  // Ensure the `.vscode` Directory Exists
@@ -172,7 +208,7 @@ export default class CreateManifest extends Command {
172
208
  'node_modules',
173
209
  '.env',
174
210
  'public',
175
- 'manifest/backend.db' // TODO: Adapt to new folder structure.
211
+ '.manifest'
176
212
  ];
177
213
  newGitignoreLines.forEach((line) => {
178
214
  if (!gitignoreContent.includes(line)) {
@@ -182,15 +218,22 @@ export default class CreateManifest extends Command {
182
218
  fs.writeFileSync(gitignorePath, gitignoreContent);
183
219
  spinner.succeed();
184
220
  // * 9. Add a README.md file if it doesn't exist.
185
- const readmeFilePath = path.join(projectFolderPath, 'README.md');
221
+ const readmeFilePath = path.join(rootFolderPath, 'README.md');
186
222
  if (!fs.existsSync(readmeFilePath)) {
187
223
  fs.writeFileSync(readmeFilePath, fs.readFileSync(path.join(assetFolderPath, 'README.md'), 'utf8'));
188
224
  }
225
+ if (isMonorepo) {
226
+ // If it's a monorepo, create a README.md file in the web folder and api folder (in addition to the root folder).
227
+ const webReadmeFilePath = path.join(rootFolderPath, 'web', 'README.md');
228
+ fs.writeFileSync(webReadmeFilePath, fs.readFileSync(path.join(assetFolderPath, 'web-readme.md'), 'utf8'));
229
+ const apiReadmeFilePath = path.join(rootFolderPath, 'api', 'README.md');
230
+ fs.writeFileSync(apiReadmeFilePath, fs.readFileSync(path.join(assetFolderPath, 'api-readme.md'), 'utf8'));
231
+ }
189
232
  // * 10. Add optional files based on flags
190
233
  // Add rules for IDEs.
191
234
  if (flags.cursor) {
192
235
  spinner.start('Adding rules for Cursor IDE...');
193
- const cursorFolderPath = path.join(projectFolderPath, '.cursor', 'rules');
236
+ const cursorFolderPath = path.join(rootFolderPath, '.cursor', 'rules');
194
237
  const cursorFileName = 'manifest.mdc';
195
238
  fs.mkdirSync(cursorFolderPath, { recursive: true });
196
239
  let cursorFileContent;
@@ -211,7 +254,7 @@ export default class CreateManifest extends Command {
211
254
  }
212
255
  if (flags.copilot) {
213
256
  spinner.start('Adding rules for Copilot IDE...');
214
- const copilotFolderPath = path.join(projectFolderPath, '.github');
257
+ const copilotFolderPath = path.join(rootFolderPath, '.github');
215
258
  const copilotFileName = 'copilot-instructions.md';
216
259
  fs.mkdirSync(copilotFolderPath, { recursive: true });
217
260
  let copilotFileContent;
@@ -232,7 +275,7 @@ export default class CreateManifest extends Command {
232
275
  }
233
276
  if (flags.windsurf) {
234
277
  spinner.start('Adding rules for WindSurf IDE...');
235
- const windsurfFolderPath = path.join(projectFolderPath, '.windsurf', 'rules');
278
+ const windsurfFolderPath = path.join(rootFolderPath, '.windsurf', 'rules');
236
279
  const windsurfFileName = 'manifest.md';
237
280
  fs.mkdirSync(windsurfFolderPath, { recursive: true });
238
281
  let windsurfFileContent;
@@ -43,5 +43,5 @@
43
43
  "enableJsonFlag": false
44
44
  }
45
45
  },
46
- "version": "1.2.1"
46
+ "version": "1.3.1"
47
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-manifest",
3
- "version": "1.2.1",
3
+ "version": "1.3.1",
4
4
  "author": "Manifest",
5
5
  "description": "Create a new Manifest backend",
6
6
  "homepage": "https://manifest.build",
File without changes