@quilted/create 0.1.36 → 0.1.38

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @quilted/create
2
2
 
3
+ ## 0.1.38
4
+
5
+ ### Patch Changes
6
+
7
+ - [`36b00358`](https://github.com/lemonmade/quilt/commit/36b00358f47008300d96a5b672242be74163c4d7) Thanks [@lemonmade](https://github.com/lemonmade)! - Fix some package creation issues
8
+
9
+ ## 0.1.37
10
+
11
+ ### Patch Changes
12
+
13
+ - [`c931b6b4`](https://github.com/lemonmade/quilt/commit/c931b6b4bee464a4f6c16c6410bd727a5210469c) Thanks [@lemonmade](https://github.com/lemonmade)! - Improve create workflow
14
+
3
15
  ## 0.1.36
4
16
 
5
17
  ### Patch Changes
package/build/cjs/app.cjs CHANGED
@@ -244,7 +244,7 @@ async function createApp() {
244
244
  });
245
245
  return;
246
246
  }
247
- const inWorkspace = fs__namespace.existsSync('quilt.workspace.ts');
247
+ const inWorkspace = await packageManager.getInWorkspace(argv);
248
248
  const name = await getName(argv, {
249
249
  inWorkspace
250
250
  });
@@ -252,14 +252,18 @@ async function createApp() {
252
252
  name
253
253
  });
254
254
  const template = await getTemplate(argv);
255
- const createAsMonorepo = !inWorkspace && (await packageManager.getCreateAsMonorepo(argv));
256
- const shouldInstall = await packageManager.getShouldInstall(argv);
257
- const packageManager$1 = await packageManager.getPackageManager(argv, {
258
- root: directory
259
- });
255
+ const createAsMonorepo = !inWorkspace && (await packageManager.getCreateAsMonorepo(argv, {
256
+ type: 'app'
257
+ }));
260
258
  const setupExtras = await packageManager.getExtrasToSetup(argv, {
261
259
  inWorkspace
262
260
  });
261
+ const shouldInstall = await packageManager.getShouldInstall(argv, {
262
+ type: 'app'
263
+ });
264
+ const packageManager$1 = await packageManager.getPackageManager(argv, {
265
+ root: directory
266
+ });
263
267
  const partOfMonorepo = inWorkspace || createAsMonorepo;
264
268
  const appDirectory = createAsMonorepo ? path__namespace.join(directory, 'app') : directory;
265
269
  if (fs__namespace.existsSync(directory)) {
@@ -293,33 +297,32 @@ async function createApp() {
293
297
  // If we are creating a monorepo, we need to add the root package.json and
294
298
  // package manager workspace configuration.
295
299
  if (createAsMonorepo) {
300
+ const appRelativeToRoot = packageManager.relativeDirectoryForDisplay(path__namespace.relative(directory, appDirectory));
296
301
  const workspacePackageJson = JSON.parse(await workspaceTemplate.read('package.json'));
297
302
  workspacePackageJson.name = packageManager.toValidPackageName(name);
303
+ workspacePackageJson.workspaces = [appRelativeToRoot, './packages/*'];
298
304
  if (packageManager$1.type === 'pnpm') {
299
305
  await outputRoot.write('pnpm-workspace.yaml', await packageManager.format(`
300
306
  packages:
307
+ - '${appRelativeToRoot}'
301
308
  - './packages/*'
302
309
  `, {
303
310
  as: 'yaml'
304
311
  }));
305
- } else {
306
- workspacePackageJson.workspaces = ['packages/*'];
307
312
  }
308
313
  await outputRoot.write('package.json', await packageManager.format(JSON.stringify(workspacePackageJson), {
309
314
  as: 'json-stringify'
310
315
  }));
311
316
  } else {
312
317
  const [projectPackageJson, projectTSConfig, workspacePackageJson] = await Promise.all([appTemplate.read('package.json').then(content => JSON.parse(content)), appTemplate.read('tsconfig.json').then(content => JSON.parse(content)), workspaceTemplate.read('package.json').then(content => JSON.parse(content))]);
313
- workspacePackageJson.name = packageManager.toValidPackageName(name);
314
- workspacePackageJson.eslintConfig = projectPackageJson.eslintConfig;
315
- workspacePackageJson.browserslist = projectPackageJson.browserslist;
316
- workspacePackageJson.devDependencies = packageManager.mergeDependencies(workspacePackageJson.devDependencies, projectPackageJson.devDependencies);
318
+ const combinedPackageJson = packageManager.mergeWorkspaceAndProjectPackageJsons(projectPackageJson, workspacePackageJson);
319
+ combinedPackageJson.name = packageManager.toValidPackageName(name);
317
320
  let quiltProject = await appTemplate.read('quilt.project.ts');
318
321
  quiltProject = quiltProject.replace('quiltApp', 'quiltWorkspace, quiltApp').replace('quiltApp(', 'quiltWorkspace(), quiltApp(');
319
322
  await outputRoot.write('quilt.project.ts', await packageManager.format(quiltProject, {
320
323
  as: 'typescript'
321
324
  }));
322
- await outputRoot.write('package.json', await packageManager.format(JSON.stringify(workspacePackageJson), {
325
+ await outputRoot.write('package.json', await packageManager.format(JSON.stringify(combinedPackageJson), {
323
326
  as: 'json-stringify'
324
327
  }));
325
328
  await outputRoot.write('tsconfig.json', await packageManager.format(JSON.stringify(projectTSConfig), {
@@ -352,12 +355,9 @@ async function createApp() {
352
355
  await Promise.all([packageManager.addToTsConfig(appDirectory, outputRoot), packageManager.addToPackageManagerWorkspaces(appDirectory, outputRoot, packageManager$1.type)]);
353
356
  }
354
357
  if (shouldInstall) {
355
- process.stdout.write('\nInstalling dependencies...\n');
358
+ console.log();
356
359
  // TODO: better loading, handle errors
357
360
  await packageManager$1.install();
358
- process.stdout.moveCursor(0, -1);
359
- process.stdout.clearLine(1);
360
- console.log('Installed dependencies.');
361
361
  }
362
362
  const commands = [];
363
363
  if (!inWorkspace && directory !== process.cwd()) {
@@ -366,10 +366,6 @@ async function createApp() {
366
366
  if (!shouldInstall) {
367
367
  commands.push(`${packageManager$1.commands.install()} ${packageManager.dim_1('# Install all your dependencies')}`);
368
368
  }
369
- if (!inWorkspace) {
370
- // TODO: change this condition to check if git was initialized already
371
- commands.push(`git init && git add -A && git commit -m "Initial commit" ${packageManager.dim_1('# Start your git history (optional)')}`);
372
- }
373
369
  commands.push(`${packageManager$1.commands.run('develop')} ${packageManager.dim_1('# Start the development server')}`);
374
370
  const whatsNext = index.stripIndent`
375
371
  Your new app is ready to go! There’s just ${commands.length > 1 ? 'a few more steps' : 'one more step'} you’ll need to take