create-turbo 1.2.14 → 1.2.17-canary.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/dist/index.js CHANGED
@@ -3,8 +3,22 @@ var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
7
  var __getProtoOf = Object.getPrototypeOf;
7
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
8
22
  var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
9
23
  var __reExport = (target, module2, copyDefault, desc) => {
10
24
  if (module2 && typeof module2 === "object" || typeof module2 === "function") {
@@ -25,13 +39,14 @@ var import_fs_extra = __toESM(require("fs-extra"));
25
39
  var import_inquirer = __toESM(require("inquirer"));
26
40
  var import_ora = __toESM(require("ora"));
27
41
  var import_meow = __toESM(require("meow"));
42
+ var import_lt = __toESM(require("semver/functions/lt"));
28
43
  var import_gradient_string = __toESM(require("gradient-string"));
29
44
  var import_update_check = __toESM(require("update-check"));
30
45
  var import_chalk = __toESM(require("chalk"));
31
46
 
32
47
  // package.json
33
48
  var name = "create-turbo";
34
- var version = "1.2.14";
49
+ var version = "1.2.17-canary.0";
35
50
  var description = "Create a new Turborepo";
36
51
  var homepage = "https://turborepo.org";
37
52
  var license = "MPL-2.0";
@@ -204,6 +219,7 @@ var help = `
204
219
  Flags:
205
220
  --use-npm Explicitly tell the CLI to bootstrap the app using npm
206
221
  --use-pnpm Explicitly tell the CLI to bootstrap the app using pnpm
222
+ --use-yarn Explicitly tell the CLI to bootstrap the app using yarn
207
223
  --no-install Explicitly do not run the package manager's install command
208
224
  --help, -h Show this help message
209
225
  --version, -v Show the version of this script
@@ -228,6 +244,7 @@ async function run() {
228
244
  help: { type: "boolean", default: false, alias: "h" },
229
245
  useNpm: { type: "boolean", default: false },
230
246
  usePnpm: { type: "boolean", default: false },
247
+ useYarn: { type: "boolean", default: false },
231
248
  install: { type: "boolean", default: true },
232
249
  version: { type: "boolean", default: false, alias: "v" }
233
250
  }
@@ -250,6 +267,7 @@ async function run() {
250
267
  default: "./my-turborepo"
251
268
  }
252
269
  ])).dir);
270
+ const projectName = path2.basename(projectDir);
253
271
  const isYarnInstalled = shouldUseYarn();
254
272
  const isPnpmInstalled = shouldUsePnpm();
255
273
  let answers;
@@ -257,6 +275,8 @@ async function run() {
257
275
  answers = { packageManager: "npm" };
258
276
  } else if (flags.usePnpm) {
259
277
  answers = { packageManager: "pnpm" };
278
+ } else if (flags.useYarn) {
279
+ answers = { packageManager: "yarn" };
260
280
  } else {
261
281
  answers = await import_inquirer.default.prompt([
262
282
  {
@@ -296,16 +316,14 @@ async function run() {
296
316
  await import_fs_extra.default.copy(serverTemplate, projectDir, { overwrite: true });
297
317
  }
298
318
  await import_fs_extra.default.move(path2.join(projectDir, "gitignore"), path2.join(projectDir, ".gitignore"));
299
- let appPkg = require(path2.join(sharedTemplate, "package.json"));
319
+ let sharedPkg = require(path2.join(sharedTemplate, "package.json"));
320
+ let projectPkg = require(path2.join(projectDir, "package.json"));
300
321
  ["dependencies", "devDependencies"].forEach((pkgKey) => {
301
- for (let key in appPkg[pkgKey]) {
302
- if (appPkg[pkgKey][key] === "*") {
303
- appPkg[pkgKey][key] = `latest`;
304
- }
305
- }
322
+ sharedPkg[pkgKey] = __spreadValues(__spreadValues({}, sharedPkg[pkgKey]), projectPkg[pkgKey]);
306
323
  });
307
- appPkg.packageManager = `${answers.packageManager}@${getPackageManagerVersion(answers.packageManager)}`;
308
- await import_fs_extra.default.writeFile(path2.join(projectDir, "package.json"), JSON.stringify(appPkg, null, 2));
324
+ sharedPkg.packageManager = `${answers.packageManager}@${getPackageManagerVersion(answers.packageManager)}`;
325
+ sharedPkg.name = projectName;
326
+ await import_fs_extra.default.writeFile(path2.join(projectDir, "package.json"), JSON.stringify(sharedPkg, null, 2));
309
327
  if (flags.install) {
310
328
  console.log();
311
329
  console.log(`>>> Creating a new turborepo with the following:`);
@@ -313,7 +331,7 @@ async function run() {
313
331
  console.log(` - ${import_chalk.default.bold("apps/web")}: Next.js with TypeScript`);
314
332
  console.log(` - ${import_chalk.default.bold("apps/docs")}: Next.js with TypeScript`);
315
333
  console.log(` - ${import_chalk.default.bold("packages/ui")}: Shared React component library`);
316
- console.log(` - ${import_chalk.default.bold("packages/config")}: Shared configuration (ESLint)`);
334
+ console.log(` - ${import_chalk.default.bold("packages/eslint-config-custom")}: Shared configuration (ESLint)`);
317
335
  console.log(` - ${import_chalk.default.bold("packages/tsconfig")}: Shared TypeScript \`tsconfig.json\``);
318
336
  console.log();
319
337
  const spinner = (0, import_ora.default)({
@@ -322,8 +340,17 @@ async function run() {
322
340
  frames: [" ", "> ", ">> ", ">>>"]
323
341
  }
324
342
  }).start();
325
- const npmRegistry = await getNpmRegistry(answers.packageManager);
326
- await (0, import_execa.default)(`${answers.packageManager}`, [`install`, `--registry=${npmRegistry}`], {
343
+ let supportsRegistryArg = false;
344
+ try {
345
+ supportsRegistryArg = (0, import_lt.default)(getPackageManagerVersion(answers.packageManager), "2.0.0");
346
+ } catch (err) {
347
+ }
348
+ const installArgs = ["install"];
349
+ if (supportsRegistryArg) {
350
+ const npmRegistry = await getNpmRegistry(answers.packageManager);
351
+ installArgs.push(`--registry=${npmRegistry}`);
352
+ }
353
+ await (0, import_execa.default)(`${answers.packageManager}`, installArgs, {
327
354
  stdio: "ignore",
328
355
  cwd: projectDir
329
356
  });
@@ -356,7 +383,7 @@ async function run() {
356
383
  console.log(` Develop all apps and packages`);
357
384
  console.log();
358
385
  console.log(`Turborepo will cache locally by default. For an additional`);
359
- console.log(`speed boost, enable Remote Caching (beta) with Vercel by`);
386
+ console.log(`speed boost, enable Remote Caching with Vercel by`);
360
387
  console.log(`entering the following command:`);
361
388
  console.log();
362
389
  console.log(import_chalk.default.cyan(` ${getNpxCommand(answers.packageManager)} turbo login`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-turbo",
3
- "version": "1.2.14",
3
+ "version": "1.2.17-canary.0",
4
4
  "description": "Create a new Turborepo",
5
5
  "homepage": "https://turborepo.org",
6
6
  "license": "MPL-2.0",
@@ -13,6 +13,7 @@
13
13
  "format": "prettier --write \"**/*.{ts,tsx,md}\""
14
14
  },
15
15
  "devDependencies": {
16
+ "eslint-config-custom": "*",
16
17
  "prettier": "latest",
17
18
  "turbo": "latest"
18
19
  },
@@ -48,9 +48,9 @@ npm run dev
48
48
 
49
49
  ### Remote Caching
50
50
 
51
- Turborepo can use a technique known as [Remote Caching (Beta)](https://turborepo.org/docs/core-concepts/remote-caching) to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.
51
+ Turborepo can use a technique known as [Remote Caching](https://turborepo.org/docs/core-concepts/remote-caching) to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.
52
52
 
53
- By default, Turborepo will cache locally. To enable Remote Caching (Beta) you will need an account with Vercel. If you don't have an account you can [create one](https://vercel.com/signup), then enter the following commands:
53
+ By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can [create one](https://vercel.com/signup), then enter the following commands:
54
54
 
55
55
  ```
56
56
  cd my-turborepo
@@ -71,7 +71,7 @@ Learn more about the power of Turborepo:
71
71
 
72
72
  - [Pipelines](https://turborepo.org/docs/core-concepts/pipelines)
73
73
  - [Caching](https://turborepo.org/docs/core-concepts/caching)
74
- - [Remote Caching (Beta)](https://turborepo.org/docs/core-concepts/remote-caching)
74
+ - [Remote Caching](https://turborepo.org/docs/core-concepts/remote-caching)
75
75
  - [Scoped Tasks](https://turborepo.org/docs/core-concepts/scopes)
76
76
  - [Configuration Options](https://turborepo.org/docs/reference/configuration)
77
77
  - [CLI Usage](https://turborepo.org/docs/reference/command-line-reference)
@@ -48,9 +48,9 @@ pnpm run dev
48
48
 
49
49
  ### Remote Caching
50
50
 
51
- Turborepo can use a technique known as [Remote Caching (Beta)](https://turborepo.org/docs/core-concepts/remote-caching) to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.
51
+ Turborepo can use a technique known as [Remote Caching](https://turborepo.org/docs/core-concepts/remote-caching) to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.
52
52
 
53
- By default, Turborepo will cache locally. To enable Remote Caching (Beta) you will need an account with Vercel. If you don't have an account you can [create one](https://vercel.com/signup), then enter the following commands:
53
+ By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can [create one](https://vercel.com/signup), then enter the following commands:
54
54
 
55
55
  ```
56
56
  cd my-turborepo
@@ -71,7 +71,7 @@ Learn more about the power of Turborepo:
71
71
 
72
72
  - [Pipelines](https://turborepo.org/docs/core-concepts/pipelines)
73
73
  - [Caching](https://turborepo.org/docs/core-concepts/caching)
74
- - [Remote Caching (Beta)](https://turborepo.org/docs/core-concepts/remote-caching)
74
+ - [Remote Caching](https://turborepo.org/docs/core-concepts/remote-caching)
75
75
  - [Scoped Tasks](https://turborepo.org/docs/core-concepts/scopes)
76
76
  - [Configuration Options](https://turborepo.org/docs/reference/configuration)
77
77
  - [CLI Usage](https://turborepo.org/docs/reference/command-line-reference)
@@ -48,9 +48,9 @@ yarn run dev
48
48
 
49
49
  ### Remote Caching
50
50
 
51
- Turborepo can use a technique known as [Remote Caching (Beta)](https://turborepo.org/docs/core-concepts/remote-caching) to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.
51
+ Turborepo can use a technique known as [Remote Caching](https://turborepo.org/docs/core-concepts/remote-caching) to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.
52
52
 
53
- By default, Turborepo will cache locally. To enable Remote Caching (Beta) you will need an account with Vercel. If you don't have an account you can [create one](https://vercel.com/signup), then enter the following commands:
53
+ By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can [create one](https://vercel.com/signup), then enter the following commands:
54
54
 
55
55
  ```
56
56
  cd my-turborepo
@@ -71,7 +71,7 @@ Learn more about the power of Turborepo:
71
71
 
72
72
  - [Pipelines](https://turborepo.org/docs/core-concepts/pipelines)
73
73
  - [Caching](https://turborepo.org/docs/core-concepts/caching)
74
- - [Remote Caching (Beta)](https://turborepo.org/docs/core-concepts/remote-caching)
74
+ - [Remote Caching](https://turborepo.org/docs/core-concepts/remote-caching)
75
75
  - [Scoped Tasks](https://turborepo.org/docs/core-concepts/scopes)
76
76
  - [Configuration Options](https://turborepo.org/docs/reference/configuration)
77
77
  - [CLI Usage](https://turborepo.org/docs/reference/command-line-reference)