create-routify 1.5.4 → 1.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-routify",
3
- "version": "1.5.4",
3
+ "version": "v1.5.6",
4
4
  "description": "A powerful cli for super-powering your routify development experience",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -206,8 +206,6 @@ const copy = async (options) => {
206
206
  await cp(options.template.dir, options.projectDir, {
207
207
  recursive: true,
208
208
  });
209
- if (existsSync(join(options.projectDir, 'manifest.js')))
210
- await rm(join(options.projectDir, 'manifest.js'));
211
209
  s.stop('Copied template to project directory');
212
210
  };
213
211
 
@@ -230,7 +228,7 @@ const install = async (options) => {
230
228
  });
231
229
  });
232
230
 
233
- s.stop('Installed via pnpm');
231
+ s.stop('Installed via ' + packageManager);
234
232
  }
235
233
  };
236
234
 
@@ -281,6 +279,24 @@ const normalizeOptions = async (options, configs) => {
281
279
  p.cancel(`Template ${options.starterTemplate} not found`);
282
280
  };
283
281
 
282
+ const normalizeManifest = (manifest) => ({
283
+ features: [],
284
+ preInstall: () => null,
285
+ postInstall: () => null,
286
+ exclude: [
287
+ 'node_modules',
288
+ 'package-lock.json',
289
+ 'pnpm-lock.yaml',
290
+ 'yarn.lock',
291
+ 'dist',
292
+ '.pnpmfile.cjs',
293
+ 'manifest.js',
294
+ '.routify',
295
+ ],
296
+ test: { tests: [] },
297
+ ...manifest,
298
+ });
299
+
284
300
  /**
285
301
  *
286
302
  * @param {TemplateConfig} configs
@@ -295,6 +311,19 @@ const setTemplates = async (configs, options) => {
295
311
  );
296
312
  };
297
313
 
314
+ const removeExcludedFiles = async (options) => {
315
+ const exclude = options.template.manifest.exclude.map((file) =>
316
+ join(options.projectDir, file),
317
+ );
318
+ await Promise.all(
319
+ exclude.map(async (file) => {
320
+ if (existsSync(file)) {
321
+ await rm(file, { recursive: true, force: true });
322
+ }
323
+ }),
324
+ );
325
+ };
326
+
298
327
  export const run = async (options) => {
299
328
  const s = p.spinner();
300
329
  emitter.on('download', (url) => s.start(`Downloading ${url}`));
@@ -307,12 +336,15 @@ export const run = async (options) => {
307
336
  if (!options.headless) await runPrompts(options, configs);
308
337
  else await normalizeOptions(options, configs);
309
338
 
339
+ options.template.manifest = normalizeManifest(options.template.manifest);
340
+
310
341
  await copy(options);
311
342
  await handleFeatures(options);
312
343
  const { preInstall, postInstall } = options.template.manifest;
313
- if (preInstall) await preInstall(options, tools);
344
+ await preInstall(options, tools);
314
345
  await install(options);
315
- if (postInstall) await postInstall(options, tools);
346
+ await postInstall(options, tools);
347
+ await removeExcludedFiles(options);
316
348
 
317
349
  p.note(
318
350
  prompts.nextSteps(options.dir, options.packageManager) +
@@ -29,8 +29,7 @@ let router
29
29
  beforeAll(async () => {
30
30
  await import('../.routify/routify-init.js')
31
31
  router = globalThis.__routify.routers[0]
32
- await router.ready()
33
- await router.activeRoute.get().rendered
32
+ await router.rendered()
34
33
  })
35
34
 
36
35
  ${tests.map(resolveTestTemplate).join('\n\n')}