create-manifest 1.1.7 → 1.1.9

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.
@@ -7,6 +7,8 @@ export default class CreateManifest extends Command {
7
7
  static flags: {
8
8
  backendFile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
9
  cursor: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ copilot: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ windsurf: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
12
  };
11
13
  /**
12
14
  * The run method is called when the command is run.
@@ -39,16 +41,16 @@ export default class CreateManifest extends Command {
39
41
  /**
40
42
  * Wait for the server to be ready.
41
43
  *
42
- * @returns {Promise<void>} - Returns a promise that resolves to void when the server is ready.
44
+ * @returns a promise that resolves to void when the server is ready.
43
45
  *
44
46
  **/
45
47
  waitForServerToBeReady(): Promise<void>;
46
48
  /**
47
49
  * Transform a JSON with comments to a JSON without comments.
48
50
  *
49
- * @param {string} jsonWithComments - The JSON with comments.
51
+ * @param jsonString - The JSON with comments.
50
52
  *
51
- * @returns {string} - The JSON without comments.
53
+ * @returns the JSON without comments.
52
54
  *
53
55
  **/
54
56
  removeComments(jsonString: string): string;
@@ -30,7 +30,9 @@ export default class CreateManifest extends Command {
30
30
  backendFile: Flags.string({
31
31
  summary: 'The remote file to use as a template for the backend.yml file. If not provided, the default file will be used.'
32
32
  }),
33
- cursor: Flags.boolean()
33
+ cursor: Flags.boolean(),
34
+ copilot: Flags.boolean(),
35
+ windsurf: Flags.boolean()
34
36
  };
35
37
  /**
36
38
  * The run method is called when the command is run.
@@ -186,7 +188,7 @@ export default class CreateManifest extends Command {
186
188
  fs.writeFileSync(readmeFilePath, fs.readFileSync(path.join(assetFolderPath, 'README.md'), 'utf8'));
187
189
  }
188
190
  // * 10. Add optional files based on flags
189
- // Add rules for Cursor IDE.
191
+ // Add rules for IDEs.
190
192
  if (flags.cursor) {
191
193
  spinner.start('Add rules for Cursor IDE...');
192
194
  const cursorFolderPath = path.join(projectFolderPath, '.cursor', 'rules');
@@ -201,13 +203,55 @@ export default class CreateManifest extends Command {
201
203
  cursorFileContent = await response.text();
202
204
  }
203
205
  catch (error) {
204
- console.error('Error fetching YAML:', error);
206
+ console.error('Error fetching file:', error);
205
207
  throw error;
206
208
  }
207
209
  // Write the content to the new file
208
210
  fs.writeFileSync(path.join(cursorFolderPath, cursorFileName), cursorFileContent);
209
211
  spinner.succeed();
210
212
  }
213
+ if (flags.copilot) {
214
+ spinner.start('Add rules for Copilot IDE...');
215
+ const copilotFolderPath = path.join(projectFolderPath, '.github');
216
+ const copilotFileName = 'copilot-instructions.md';
217
+ fs.mkdirSync(copilotFolderPath, { recursive: true });
218
+ let copilotFileContent;
219
+ try {
220
+ const response = await fetch('https://raw.githubusercontent.com/mnfst/rules/refs/heads/main/copilot/copilot-instructions.md');
221
+ if (!response.ok) {
222
+ throw new Error(`HTTP error! status: ${response.status}`);
223
+ }
224
+ copilotFileContent = await response.text();
225
+ }
226
+ catch (error) {
227
+ console.error('Error fetching file:', error);
228
+ throw error;
229
+ }
230
+ // Write the content to the new file
231
+ fs.writeFileSync(path.join(copilotFolderPath, copilotFileName), copilotFileContent);
232
+ spinner.succeed();
233
+ }
234
+ if (flags.windsurf) {
235
+ spinner.start('Add rules for WindSurf IDE...');
236
+ const windsurfFolderPath = path.join(projectFolderPath, '.windsurf', 'rules');
237
+ const windsurfFileName = 'manifest.md';
238
+ fs.mkdirSync(windsurfFolderPath, { recursive: true });
239
+ let windsurfFileContent;
240
+ try {
241
+ const response = await fetch('https://raw.githubusercontent.com/mnfst/rules/refs/heads/main/windsurf/manifest.md');
242
+ if (!response.ok) {
243
+ throw new Error(`HTTP error! status: ${response.status}`);
244
+ }
245
+ windsurfFileContent = await response.text();
246
+ }
247
+ catch (error) {
248
+ console.error('Error fetching file:', error);
249
+ throw error;
250
+ }
251
+ // Write the content to the new file
252
+ fs.writeFileSync(path.join(windsurfFolderPath, windsurfFileName), windsurfFileContent);
253
+ spinner.succeed();
254
+ }
211
255
  // * 9. Install the new packages.
212
256
  spinner.start('Install dependencies...');
213
257
  // Install deps.
@@ -239,7 +283,7 @@ export default class CreateManifest extends Command {
239
283
  let serveTask = null;
240
284
  try {
241
285
  // We run the manifest script to build the database.
242
- serveTask = exec('npm run manifest');
286
+ serveTask = exec(`cd ${projectName} && npm run manifest`);
243
287
  await this.waitForServerToBeReady();
244
288
  spinner.succeed();
245
289
  }
@@ -248,7 +292,7 @@ export default class CreateManifest extends Command {
248
292
  }
249
293
  spinner.start('Seed initial data...');
250
294
  try {
251
- await exec('npm run manifest:seed');
295
+ await exec(`cd ${projectName} && npm run manifest:seed`);
252
296
  }
253
297
  catch (error) {
254
298
  spinner.fail(`Execution error: ${error}`);
@@ -280,7 +324,7 @@ export default class CreateManifest extends Command {
280
324
  /**
281
325
  * Wait for the server to be ready.
282
326
  *
283
- * @returns {Promise<void>} - Returns a promise that resolves to void when the server is ready.
327
+ * @returns a promise that resolves to void when the server is ready.
284
328
  *
285
329
  **/
286
330
  async waitForServerToBeReady() {
@@ -295,9 +339,9 @@ export default class CreateManifest extends Command {
295
339
  /**
296
340
  * Transform a JSON with comments to a JSON without comments.
297
341
  *
298
- * @param {string} jsonWithComments - The JSON with comments.
342
+ * @param jsonString - The JSON with comments.
299
343
  *
300
- * @returns {string} - The JSON without comments.
344
+ * @returns the JSON without comments.
301
345
  *
302
346
  **/
303
347
  removeComments(jsonString) {
@@ -21,6 +21,16 @@
21
21
  "name": "cursor",
22
22
  "allowNo": false,
23
23
  "type": "boolean"
24
+ },
25
+ "copilot": {
26
+ "name": "copilot",
27
+ "allowNo": false,
28
+ "type": "boolean"
29
+ },
30
+ "windsurf": {
31
+ "name": "windsurf",
32
+ "allowNo": false,
33
+ "type": "boolean"
24
34
  }
25
35
  },
26
36
  "hasDynamicHelp": false,
@@ -33,5 +43,5 @@
33
43
  "enableJsonFlag": false
34
44
  }
35
45
  },
36
- "version": "1.1.7"
46
+ "version": "1.1.9"
37
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-manifest",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "author": "Manifest",
5
5
  "description": "Create a new Manifest backend",
6
6
  "homepage": "https://manifest.build",