create-manifest 1.2.1 → 1.3.0
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/assets/monorepo/README.md +51 -0
- package/assets/monorepo/api-package.json +9 -0
- package/assets/monorepo/api-readme.md +49 -0
- package/assets/monorepo/root-package.json +15 -0
- package/assets/monorepo/web-package.json +10 -0
- package/assets/monorepo/web-readme.md +9 -0
- package/assets/{README.md → standalone/README.md} +2 -2
- package/assets/standalone/manifest.yml +34 -0
- package/dist/commands/index.js +66 -24
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- /package/assets/{manifest.yml → monorepo/manifest.yml} +0 -0
- /package/assets/{default-package.json → standalone/api-package.json} +0 -0
|
@@ -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,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,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
|
|
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
|
|
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
|
package/dist/commands/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import { updatePackageJsonFile } from '../utils/UpdatePackageJsonFile.js';
|
|
|
14
14
|
import { updateSettingsJsonFile } from '../utils/UpdateSettingsJsonFile.js';
|
|
15
15
|
import { getLatestPackageVersion } from '../utils/GetLatestPackageVersion.js';
|
|
16
16
|
import { getBackendFileContent } from '../utils/GetBackendFileContent.js';
|
|
17
|
-
import { input } from '@inquirer/prompts';
|
|
17
|
+
import { input, select } from '@inquirer/prompts';
|
|
18
18
|
import { slugify } from '../utils/helpers.js';
|
|
19
19
|
import chalk from 'chalk';
|
|
20
20
|
const exec = promisify(execCp);
|
|
@@ -58,6 +58,7 @@ 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 = argv[1] === 'monorepo';
|
|
61
62
|
if (!projectName) {
|
|
62
63
|
projectName = await input({
|
|
63
64
|
message: 'What name would you like to use for the new workspace?',
|
|
@@ -73,24 +74,53 @@ export default class CreateManifest extends Command {
|
|
|
73
74
|
}
|
|
74
75
|
});
|
|
75
76
|
}
|
|
77
|
+
if (!isMonorepo) {
|
|
78
|
+
const projectType = await select({
|
|
79
|
+
message: 'What type of project would you like to develop?',
|
|
80
|
+
choices: [
|
|
81
|
+
{
|
|
82
|
+
name: 'A full-stack app (monorepo)',
|
|
83
|
+
value: 'monorepo',
|
|
84
|
+
description: 'Creates a monorepo with both "web" and "api" folders'
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: 'A standalone backend',
|
|
88
|
+
value: 'standalone',
|
|
89
|
+
description: 'Creates a backend-only project'
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
});
|
|
93
|
+
isMonorepo = projectType === 'monorepo';
|
|
94
|
+
}
|
|
76
95
|
projectName = slugify(projectName);
|
|
77
96
|
const spinner = ora(`Creating your Manifest project in ${projectName} folder...`).start();
|
|
78
|
-
const
|
|
97
|
+
const rootFolderPath = path.join(process.cwd(), projectName);
|
|
79
98
|
// Check if the folder already exists
|
|
80
|
-
if (fs.existsSync(
|
|
81
|
-
spinner.fail(`Error: The "${
|
|
99
|
+
if (fs.existsSync(rootFolderPath)) {
|
|
100
|
+
spinner.fail(`Error: The "${rootFolderPath}" folder already exists in the current directory. Please find another name.`);
|
|
82
101
|
process.exit(1);
|
|
83
102
|
}
|
|
84
|
-
fs.mkdirSync(
|
|
103
|
+
fs.mkdirSync(rootFolderPath);
|
|
104
|
+
let projectFolderPath;
|
|
105
|
+
if (isMonorepo) {
|
|
106
|
+
// If it's a monorepo, create a folder for the project.
|
|
107
|
+
projectFolderPath = path.join(rootFolderPath, 'api');
|
|
108
|
+
fs.mkdirSync(projectFolderPath);
|
|
109
|
+
fs.mkdirSync(path.join(rootFolderPath, 'web'));
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
// If it's a standalone backend, use the root folder as the project folder.
|
|
113
|
+
projectFolderPath = rootFolderPath;
|
|
114
|
+
}
|
|
85
115
|
const manifestFolderName = '.manifest';
|
|
86
116
|
const initialFileName = 'manifest.yml';
|
|
87
117
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
88
|
-
const assetFolderPath = path.join(__dirname, '..', '..', 'assets');
|
|
118
|
+
const assetFolderPath = path.join(__dirname, '..', '..', 'assets', isMonorepo ? 'monorepo' : 'standalone');
|
|
89
119
|
// * 2. Create a folder with the name `.manifest` for compiled files.
|
|
90
120
|
// Construct the folder path. This example creates the folder in the current working directory.
|
|
91
|
-
const
|
|
121
|
+
const compiledFolderPath = path.join(projectFolderPath, manifestFolderName);
|
|
92
122
|
// Create the folder
|
|
93
|
-
fs.mkdirSync(
|
|
123
|
+
fs.mkdirSync(compiledFolderPath);
|
|
94
124
|
// * 3. Create a file with the name `manifest.yml`.
|
|
95
125
|
const newFilePath = path.join(projectFolderPath, initialFileName);
|
|
96
126
|
// Get the content of the file either remote or local.
|
|
@@ -100,18 +130,12 @@ export default class CreateManifest extends Command {
|
|
|
100
130
|
// Write the content to the new file
|
|
101
131
|
fs.writeFileSync(newFilePath, content);
|
|
102
132
|
spinner.succeed();
|
|
103
|
-
spinner.start('
|
|
133
|
+
spinner.start('Creating package.json file...');
|
|
104
134
|
// Update package.json file.
|
|
105
135
|
const packagePath = path.join(projectFolderPath, 'package.json');
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
packageJson = JSON.parse(fs
|
|
112
|
-
.readFileSync(path.join(assetFolderPath, 'default-package.json'), 'utf8')
|
|
113
|
-
.replace('PROJECT_NAME', projectName));
|
|
114
|
-
}
|
|
136
|
+
const packageJson = JSON.parse(fs
|
|
137
|
+
.readFileSync(path.join(assetFolderPath, 'api-package.json'), 'utf8')
|
|
138
|
+
.replace('PROJECT_NAME', projectName));
|
|
115
139
|
const manifestLatestVersion = await getLatestPackageVersion('manifest');
|
|
116
140
|
fs.writeFileSync(packagePath, updatePackageJsonFile({
|
|
117
141
|
fileContent: packageJson,
|
|
@@ -123,10 +147,21 @@ export default class CreateManifest extends Command {
|
|
|
123
147
|
seed: 'node node_modules/manifest/dist/manifest/src/seed/scripts/seed.js'
|
|
124
148
|
}
|
|
125
149
|
}));
|
|
150
|
+
if (isMonorepo) {
|
|
151
|
+
// If it's a monorepo, also update the web package.json file and the root package.json file.
|
|
152
|
+
const webPackagePath = path.join(rootFolderPath, 'web', 'package.json');
|
|
153
|
+
fs.writeFileSync(webPackagePath, fs
|
|
154
|
+
.readFileSync(path.join(assetFolderPath, 'web-package.json'), 'utf8')
|
|
155
|
+
.replace('PROJECT_NAME', projectName));
|
|
156
|
+
const rootPackagePath = path.join(rootFolderPath, 'package.json');
|
|
157
|
+
fs.writeFileSync(rootPackagePath, fs
|
|
158
|
+
.readFileSync(path.join(assetFolderPath, 'root-package.json'), 'utf8')
|
|
159
|
+
.replace('PROJECT_NAME', projectName));
|
|
160
|
+
}
|
|
126
161
|
spinner.succeed();
|
|
127
162
|
spinner.start('Adding settings...');
|
|
128
163
|
// Update .vscode/extensions.json file.
|
|
129
|
-
const vscodeDirPath = path.join(
|
|
164
|
+
const vscodeDirPath = path.join(rootFolderPath, '.vscode');
|
|
130
165
|
const extensionsFilePath = path.join(vscodeDirPath, 'extensions.json');
|
|
131
166
|
let extensionsJson;
|
|
132
167
|
// Ensure the `.vscode` Directory Exists
|
|
@@ -172,7 +207,7 @@ export default class CreateManifest extends Command {
|
|
|
172
207
|
'node_modules',
|
|
173
208
|
'.env',
|
|
174
209
|
'public',
|
|
175
|
-
'manifest
|
|
210
|
+
'.manifest'
|
|
176
211
|
];
|
|
177
212
|
newGitignoreLines.forEach((line) => {
|
|
178
213
|
if (!gitignoreContent.includes(line)) {
|
|
@@ -182,15 +217,22 @@ export default class CreateManifest extends Command {
|
|
|
182
217
|
fs.writeFileSync(gitignorePath, gitignoreContent);
|
|
183
218
|
spinner.succeed();
|
|
184
219
|
// * 9. Add a README.md file if it doesn't exist.
|
|
185
|
-
const readmeFilePath = path.join(
|
|
220
|
+
const readmeFilePath = path.join(rootFolderPath, 'README.md');
|
|
186
221
|
if (!fs.existsSync(readmeFilePath)) {
|
|
187
222
|
fs.writeFileSync(readmeFilePath, fs.readFileSync(path.join(assetFolderPath, 'README.md'), 'utf8'));
|
|
188
223
|
}
|
|
224
|
+
if (isMonorepo) {
|
|
225
|
+
// If it's a monorepo, create a README.md file in the web folder and api folder (in addition to the root folder).
|
|
226
|
+
const webReadmeFilePath = path.join(rootFolderPath, 'web', 'README.md');
|
|
227
|
+
fs.writeFileSync(webReadmeFilePath, fs.readFileSync(path.join(assetFolderPath, 'web-readme.md'), 'utf8'));
|
|
228
|
+
const apiReadmeFilePath = path.join(rootFolderPath, 'api', 'README.md');
|
|
229
|
+
fs.writeFileSync(apiReadmeFilePath, fs.readFileSync(path.join(assetFolderPath, 'api-readme.md'), 'utf8'));
|
|
230
|
+
}
|
|
189
231
|
// * 10. Add optional files based on flags
|
|
190
232
|
// Add rules for IDEs.
|
|
191
233
|
if (flags.cursor) {
|
|
192
234
|
spinner.start('Adding rules for Cursor IDE...');
|
|
193
|
-
const cursorFolderPath = path.join(
|
|
235
|
+
const cursorFolderPath = path.join(rootFolderPath, '.cursor', 'rules');
|
|
194
236
|
const cursorFileName = 'manifest.mdc';
|
|
195
237
|
fs.mkdirSync(cursorFolderPath, { recursive: true });
|
|
196
238
|
let cursorFileContent;
|
|
@@ -211,7 +253,7 @@ export default class CreateManifest extends Command {
|
|
|
211
253
|
}
|
|
212
254
|
if (flags.copilot) {
|
|
213
255
|
spinner.start('Adding rules for Copilot IDE...');
|
|
214
|
-
const copilotFolderPath = path.join(
|
|
256
|
+
const copilotFolderPath = path.join(rootFolderPath, '.github');
|
|
215
257
|
const copilotFileName = 'copilot-instructions.md';
|
|
216
258
|
fs.mkdirSync(copilotFolderPath, { recursive: true });
|
|
217
259
|
let copilotFileContent;
|
|
@@ -232,7 +274,7 @@ export default class CreateManifest extends Command {
|
|
|
232
274
|
}
|
|
233
275
|
if (flags.windsurf) {
|
|
234
276
|
spinner.start('Adding rules for WindSurf IDE...');
|
|
235
|
-
const windsurfFolderPath = path.join(
|
|
277
|
+
const windsurfFolderPath = path.join(rootFolderPath, '.windsurf', 'rules');
|
|
236
278
|
const windsurfFileName = 'manifest.md';
|
|
237
279
|
fs.mkdirSync(windsurfFolderPath, { recursive: true });
|
|
238
280
|
let windsurfFileContent;
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|