create-turbo 1.0.11 → 1.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/dist/index.js +57 -49
  2. package/package.json +1 -1
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.11";
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
  });
@@ -208,29 +213,26 @@ async function run() {
208
213
  }
209
214
  ])).dir);
210
215
  const isYarnInstalled = shouldUseYarn();
211
- let answers = await import_inquirer.default.prompt([
212
- {
213
- name: "packageManager",
214
- type: "list",
215
- message: "Which package manager do you want to use?",
216
- choices: [
217
- {
218
- name: "Yarn",
219
- value: "yarn",
220
- disabled: !isYarnInstalled && "not installed"
221
- },
222
- { name: "NPM", value: "npm" }
223
- ]
224
- },
225
- {
226
- name: "install",
227
- type: "confirm",
228
- message: function(answers2) {
229
- return `Do you want me to run \`${answers2.packageManager} install\`?`;
230
- },
231
- default: true
232
- }
233
- ]);
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
+ }
234
236
  let relativeProjectDir = path2.relative(process.cwd(), projectDir);
235
237
  let projectDirIsCurrentDir = relativeProjectDir === "";
236
238
  if (!projectDirIsCurrentDir) {
@@ -257,7 +259,7 @@ async function run() {
257
259
  }
258
260
  });
259
261
  await import_fs_extra.default.writeFile(path2.join(projectDir, "package.json"), JSON.stringify(appPkg, null, 2));
260
- if (answers.install) {
262
+ if (flags.install) {
261
263
  console.log();
262
264
  console.log(`>>> Bootstrapping a new turborepo with the following:`);
263
265
  console.log();
@@ -278,40 +280,46 @@ async function run() {
278
280
  cwd: projectDir
279
281
  });
280
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();
281
293
  }
282
294
  process.chdir(projectDir);
283
295
  tryGitInit(relativeProjectDir);
284
- console.log(`${import_chalk.default.bold(turboGradient(">>> Success!"))} Your new Turborepo is ready. `);
285
- console.log();
286
- console.log(`To build all apps and packages, run the following:`);
287
- console.log();
288
- if (!projectDirIsCurrentDir) {
289
- 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:");
290
302
  }
291
- console.log(` ${answers.packageManager} run build`);
292
303
  console.log();
293
- 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`);
294
306
  console.log();
295
- if (!projectDirIsCurrentDir) {
296
- console.log(` cd ${relativeProjectDir}`);
297
- }
298
- 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`);
299
309
  console.log();
300
310
  console.log(`Turborepo will cache locally by default. For an additional`);
301
311
  console.log(`speed boost, enable Remote Caching (beta) with Vercel by`);
302
- 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:`);
303
317
  console.log();
304
318
  if (!projectDirIsCurrentDir) {
305
- console.log(` cd ${relativeProjectDir}`);
319
+ console.log(` ${import_chalk.default.cyan("cd")} ${relativeProjectDir}`);
306
320
  }
307
- console.log(` npx turbo login`);
321
+ console.log(import_chalk.default.cyan(` npx turbo login`));
308
322
  console.log();
309
- if (projectDirIsCurrentDir) {
310
- console.log(`For more info, checkout the README`);
311
- } else {
312
- console.log(`For more info, checkout the README in ${import_chalk.default.bold(relativeProjectDir)}`);
313
- }
314
- console.log(`as well as the official Turborepo docs ${import_chalk.default.underline("https://turborepo.org/docs")}`);
315
323
  }
316
324
  var update = (0, import_update_check.default)(package_default).catch(() => null);
317
325
  async function notifyUpdate() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-turbo",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Create a new Turborepo",
5
5
  "homepage": "https://turborepo.org",
6
6
  "license": "MPL-2.0",