create-turbo 1.0.8 → 1.0.12

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var import_chalk = __toModule(require("chalk"));
31
31
 
32
32
  // package.json
33
33
  var name = "create-turbo";
34
- var version = "1.0.8";
34
+ var version = "1.0.12";
35
35
  var description = "Create a new Turborepo";
36
36
  var homepage = "https://turborepo.org";
37
37
  var license = "MPL-2.0";
@@ -101,8 +101,8 @@ var import_child_process = __toModule(require("child_process"));
101
101
  function shouldUseYarn() {
102
102
  try {
103
103
  const userAgent = process.env.npm_config_user_agent;
104
- if (userAgent) {
105
- return Boolean(userAgent && userAgent.startsWith("yarn"));
104
+ if (userAgent && userAgent.startsWith("yarn")) {
105
+ return true;
106
106
  }
107
107
  (0, import_child_process.execSync)("yarnpkg --version", { stdio: "ignore" });
108
108
  return true;
@@ -165,7 +165,9 @@ var help = `
165
165
 
166
166
  If <dir> is not provided up front you will be prompted for it.
167
167
 
168
- Flags:
168
+ Flags:
169
+ --use-npm Explicitly tell the CLI to bootstrap the app using npm.
170
+ --no-install Explicitly do not run the package mananger's install command
169
171
  --help, -h Show this help message
170
172
  --version, -v Show the version of this script
171
173
  `;
@@ -184,8 +186,11 @@ run().then(notifyUpdate).catch(async (reason) => {
184
186
  });
185
187
  async function run() {
186
188
  let { input, flags, showHelp, showVersion } = (0, import_meow.default)(help, {
189
+ booleanDefault: void 0,
187
190
  flags: {
188
191
  help: { type: "boolean", default: false, alias: "h" },
192
+ useNpm: { type: "boolean", default: false },
193
+ install: { type: "boolean", default: true },
189
194
  version: { type: "boolean", default: false, alias: "v" }
190
195
  }
191
196
  });
@@ -207,25 +212,27 @@ async function run() {
207
212
  default: "./my-turborepo"
208
213
  }
209
214
  ])).dir);
210
- let answers = await import_inquirer.default.prompt([
211
- {
212
- name: "packageManager",
213
- type: "list",
214
- message: "Which package manager do you want to use?",
215
- choices: [
216
- { name: "Yarn", value: "yarn" },
217
- { name: "NPM", value: "npm" }
218
- ]
219
- },
220
- {
221
- name: "install",
222
- type: "confirm",
223
- message: function(answers2) {
224
- return `Do you want me to run \`${answers2.packageManager} install\`?`;
225
- },
226
- default: true
227
- }
228
- ]);
215
+ const isYarnInstalled = shouldUseYarn();
216
+ let answers;
217
+ if (flags.useNpm) {
218
+ answers = { packageManager: "npm" };
219
+ } else {
220
+ answers = await import_inquirer.default.prompt([
221
+ {
222
+ name: "packageManager",
223
+ type: "list",
224
+ message: "Which package manager do you want to use?",
225
+ choices: [
226
+ {
227
+ name: "Yarn",
228
+ value: "yarn",
229
+ disabled: !isYarnInstalled && "not installed"
230
+ },
231
+ { name: "NPM", value: "npm" }
232
+ ]
233
+ }
234
+ ]);
235
+ }
229
236
  let relativeProjectDir = path2.relative(process.cwd(), projectDir);
230
237
  let projectDirIsCurrentDir = relativeProjectDir === "";
231
238
  if (!projectDirIsCurrentDir) {
@@ -252,7 +259,7 @@ async function run() {
252
259
  }
253
260
  });
254
261
  await import_fs_extra.default.writeFile(path2.join(projectDir, "package.json"), JSON.stringify(appPkg, null, 2));
255
- if (answers.install) {
262
+ if (flags.install) {
256
263
  console.log();
257
264
  console.log(`>>> Bootstrapping a new turborepo with the following:`);
258
265
  console.log();
@@ -273,40 +280,46 @@ async function run() {
273
280
  cwd: projectDir
274
281
  });
275
282
  spinner.stop();
283
+ } else {
284
+ console.log();
285
+ console.log(`>>> Bootstrapped a new turborepo with the following:`);
286
+ console.log();
287
+ console.log(` - ${import_chalk.default.bold("apps/web")}: Next.js with TypeScript`);
288
+ console.log(` - ${import_chalk.default.bold("apps/docs")}: Next.js with TypeScript`);
289
+ console.log(` - ${import_chalk.default.bold("packages/ui")}: Shared React component library`);
290
+ console.log(` - ${import_chalk.default.bold("packages/config")}: Shared configuration (ESLint)`);
291
+ console.log(` - ${import_chalk.default.bold("packages/tsconfig")}: Shared TypeScript \`tsconfig.json\``);
292
+ console.log();
276
293
  }
277
294
  process.chdir(projectDir);
278
295
  tryGitInit(relativeProjectDir);
279
- console.log(`${import_chalk.default.bold(turboGradient(">>> Success!"))} Your new Turborepo is ready. `);
280
- console.log();
281
- console.log(`To build all apps and packages, run the following:`);
282
- console.log();
283
- if (!projectDirIsCurrentDir) {
284
- console.log(` cd ${relativeProjectDir}`);
296
+ if (projectDirIsCurrentDir) {
297
+ console.log(`${import_chalk.default.bold(turboGradient(">>> Success!"))} Your new Turborepo is ready. `);
298
+ console.log("Inside this directory, you can run several commands:");
299
+ } else {
300
+ console.log(`${import_chalk.default.bold(turboGradient(">>> Success!"))} Created a new Turborepo at "${relativeProjectDir}". `);
301
+ console.log("Inside that directory, you can run several commands:");
285
302
  }
286
- console.log(` ${answers.packageManager} run build`);
287
303
  console.log();
288
- console.log(`To develop all apps and packages, run the following:`);
304
+ console.log(import_chalk.default.cyan(` ${answers.packageManager} run build`));
305
+ console.log(` Build all apps and packages`);
289
306
  console.log();
290
- if (!projectDirIsCurrentDir) {
291
- console.log(` cd ${relativeProjectDir}`);
292
- }
293
- console.log(` ${answers.packageManager} run dev`);
307
+ console.log(import_chalk.default.cyan(` ${answers.packageManager} run dev`));
308
+ console.log(` Develop all apps and packages`);
294
309
  console.log();
295
310
  console.log(`Turborepo will cache locally by default. For an additional`);
296
311
  console.log(`speed boost, enable Remote Caching (beta) with Vercel by`);
297
- console.log(`entering the following commands:`);
312
+ console.log(`entering the following command:`);
313
+ console.log();
314
+ console.log(import_chalk.default.cyan(` npx turbo login`));
315
+ console.log();
316
+ console.log(`We suggest that you begin by typing:`);
298
317
  console.log();
299
318
  if (!projectDirIsCurrentDir) {
300
- console.log(` cd ${relativeProjectDir}`);
319
+ console.log(` ${import_chalk.default.cyan("cd")} ${relativeProjectDir}`);
301
320
  }
302
- console.log(` npx turbo login`);
321
+ console.log(import_chalk.default.cyan(` npx turbo login`));
303
322
  console.log();
304
- if (projectDirIsCurrentDir) {
305
- console.log(`For more info, checkout the README`);
306
- } else {
307
- console.log(`For more info, checkout the README in ${import_chalk.default.bold(relativeProjectDir)}`);
308
- }
309
- console.log(`as well as the official Turborepo docs ${import_chalk.default.underline("https://turborepo.org/docs")}`);
310
323
  }
311
324
  var update = (0, import_update_check.default)(package_default).catch(() => null);
312
325
  async function notifyUpdate() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-turbo",
3
- "version": "1.0.8",
3
+ "version": "1.0.12",
4
4
  "description": "Create a new Turborepo",
5
5
  "homepage": "https://turborepo.org",
6
6
  "license": "MPL-2.0",
@@ -37,7 +37,6 @@
37
37
  },
38
38
  "engines": {
39
39
  "npm": ">=7.0.0",
40
- "pnpm": ">=3.7.0",
41
40
  "node": ">=14.0.0"
42
41
  }
43
42
  }