create-turbo 1.2.15 → 1.2.17-canary.1

Sign up to get free protection for your applications and to get access to all the features.
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.15";
49
+ var version = "1.2.17-canary.1";
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
  }
@@ -258,6 +275,8 @@ async function run() {
258
275
  answers = { packageManager: "npm" };
259
276
  } else if (flags.usePnpm) {
260
277
  answers = { packageManager: "pnpm" };
278
+ } else if (flags.useYarn) {
279
+ answers = { packageManager: "yarn" };
261
280
  } else {
262
281
  answers = await import_inquirer.default.prompt([
263
282
  {
@@ -297,17 +316,14 @@ async function run() {
297
316
  await import_fs_extra.default.copy(serverTemplate, projectDir, { overwrite: true });
298
317
  }
299
318
  await import_fs_extra.default.move(path2.join(projectDir, "gitignore"), path2.join(projectDir, ".gitignore"));
300
- 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"));
301
321
  ["dependencies", "devDependencies"].forEach((pkgKey) => {
302
- for (let key in appPkg[pkgKey]) {
303
- if (appPkg[pkgKey][key] === "*") {
304
- appPkg[pkgKey][key] = `latest`;
305
- }
306
- }
322
+ sharedPkg[pkgKey] = __spreadValues(__spreadValues({}, sharedPkg[pkgKey]), projectPkg[pkgKey]);
307
323
  });
308
- appPkg.packageManager = `${answers.packageManager}@${getPackageManagerVersion(answers.packageManager)}`;
309
- appPkg.name = projectName;
310
- 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));
311
327
  if (flags.install) {
312
328
  console.log();
313
329
  console.log(`>>> Creating a new turborepo with the following:`);
@@ -315,7 +331,7 @@ async function run() {
315
331
  console.log(` - ${import_chalk.default.bold("apps/web")}: Next.js with TypeScript`);
316
332
  console.log(` - ${import_chalk.default.bold("apps/docs")}: Next.js with TypeScript`);
317
333
  console.log(` - ${import_chalk.default.bold("packages/ui")}: Shared React component library`);
318
- 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)`);
319
335
  console.log(` - ${import_chalk.default.bold("packages/tsconfig")}: Shared TypeScript \`tsconfig.json\``);
320
336
  console.log();
321
337
  const spinner = (0, import_ora.default)({
@@ -324,8 +340,17 @@ async function run() {
324
340
  frames: [" ", "> ", ">> ", ">>>"]
325
341
  }
326
342
  }).start();
327
- const npmRegistry = await getNpmRegistry(answers.packageManager);
328
- 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, {
329
354
  stdio: "ignore",
330
355
  cwd: projectDir
331
356
  });
@@ -358,7 +383,7 @@ async function run() {
358
383
  console.log(` Develop all apps and packages`);
359
384
  console.log();
360
385
  console.log(`Turborepo will cache locally by default. For an additional`);
361
- console.log(`speed boost, enable Remote Caching (beta) with Vercel by`);
386
+ console.log(`speed boost, enable Remote Caching with Vercel by`);
362
387
  console.log(`entering the following command:`);
363
388
  console.log();
364
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.15",
3
+ "version": "1.2.17-canary.1",
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)