create-turbo 1.4.7 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +67 -23
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -14,7 +14,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
14
14
|
}
|
15
15
|
return to;
|
16
16
|
};
|
17
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
17
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
18
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
19
|
+
mod
|
20
|
+
));
|
18
21
|
|
19
22
|
// src/index.ts
|
20
23
|
var path2 = __toESM(require("path"));
|
@@ -31,7 +34,7 @@ var import_chalk = __toESM(require("chalk"));
|
|
31
34
|
// package.json
|
32
35
|
var package_default = {
|
33
36
|
name: "create-turbo",
|
34
|
-
version: "1.4.7
|
37
|
+
version: "1.4.7",
|
35
38
|
description: "Create a new Turborepo",
|
36
39
|
homepage: "https://turborepo.org",
|
37
40
|
license: "MPL-2.0",
|
@@ -272,16 +275,21 @@ async function run() {
|
|
272
275
|
>>> TURBOREPO
|
273
276
|
`)));
|
274
277
|
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
275
|
-
console.log(
|
278
|
+
console.log(
|
279
|
+
">>> Welcome to Turborepo! Let's get you set up with a new codebase."
|
280
|
+
);
|
276
281
|
console.log();
|
277
|
-
let projectDir = path2.resolve(
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
282
|
+
let projectDir = path2.resolve(
|
283
|
+
process.cwd(),
|
284
|
+
input.length > 0 ? input[0] : (await import_inquirer.default.prompt([
|
285
|
+
{
|
286
|
+
type: "input",
|
287
|
+
name: "dir",
|
288
|
+
message: "Where would you like to create your turborepo?",
|
289
|
+
default: "./my-turborepo"
|
290
|
+
}
|
291
|
+
])).dir
|
292
|
+
);
|
285
293
|
const projectName = path2.basename(projectDir);
|
286
294
|
const isYarnInstalled = shouldUseYarn();
|
287
295
|
const isPnpmInstalled = shouldUsePnpm();
|
@@ -318,7 +326,9 @@ async function run() {
|
|
318
326
|
let projectDirIsCurrentDir = relativeProjectDir === "";
|
319
327
|
if (!projectDirIsCurrentDir) {
|
320
328
|
if (import_fs.default.existsSync(projectDir) && import_fs.default.readdirSync(projectDir).length !== 0) {
|
321
|
-
console.log(
|
329
|
+
console.log(
|
330
|
+
`\uFE0F\u{1F6A8} Oops, "${relativeProjectDir}" already exists. Please try again with a different directory.`
|
331
|
+
);
|
322
332
|
process.exit(1);
|
323
333
|
} else {
|
324
334
|
import_fs.default.mkdirSync(projectDir, { recursive: true });
|
@@ -328,18 +338,27 @@ async function run() {
|
|
328
338
|
import_fs.default.cpSync(sharedTemplate, projectDir, { recursive: true });
|
329
339
|
let packageManagerVersion = getPackageManagerVersion(answers.packageManager);
|
330
340
|
let packageManagerConfigs = PACKAGE_MANAGERS[answers.packageManager];
|
331
|
-
let packageManager = packageManagerConfigs.find(
|
341
|
+
let packageManager = packageManagerConfigs.find(
|
342
|
+
(packageManager2) => (0, import_semver.satisfies)(packageManagerVersion, packageManager2.semver)
|
343
|
+
);
|
332
344
|
if (!packageManager) {
|
333
345
|
throw new Error("Unsupported package manager version.");
|
334
346
|
}
|
335
|
-
let packageManagerTemplate = path2.resolve(
|
347
|
+
let packageManagerTemplate = path2.resolve(
|
348
|
+
__dirname,
|
349
|
+
"../templates",
|
350
|
+
packageManager.template
|
351
|
+
);
|
336
352
|
if (import_fs.default.existsSync(packageManagerTemplate)) {
|
337
353
|
import_fs.default.cpSync(packageManagerTemplate, projectDir, {
|
338
354
|
recursive: true,
|
339
355
|
force: true
|
340
356
|
});
|
341
357
|
}
|
342
|
-
import_fs.default.renameSync(
|
358
|
+
import_fs.default.renameSync(
|
359
|
+
path2.join(projectDir, "gitignore"),
|
360
|
+
path2.join(projectDir, ".gitignore")
|
361
|
+
);
|
343
362
|
let sharedPkg = require(path2.join(sharedTemplate, "package.json"));
|
344
363
|
let projectPkg = require(path2.join(projectDir, "package.json"));
|
345
364
|
["dependencies", "devDependencies"].forEach((pkgKey) => {
|
@@ -350,15 +369,26 @@ async function run() {
|
|
350
369
|
});
|
351
370
|
sharedPkg.packageManager = `${packageManager.command}@${packageManagerVersion}`;
|
352
371
|
sharedPkg.name = projectName;
|
353
|
-
import_fs.default.writeFileSync(
|
372
|
+
import_fs.default.writeFileSync(
|
373
|
+
path2.join(projectDir, "package.json"),
|
374
|
+
JSON.stringify(sharedPkg, null, 2)
|
375
|
+
);
|
354
376
|
console.log();
|
355
377
|
console.log(`>>> Created a new turborepo with the following:`);
|
356
378
|
console.log();
|
357
379
|
console.log(` - ${import_chalk.default.bold("apps/web")}: Next.js with TypeScript`);
|
358
380
|
console.log(` - ${import_chalk.default.bold("apps/docs")}: Next.js with TypeScript`);
|
359
|
-
console.log(
|
360
|
-
|
361
|
-
|
381
|
+
console.log(
|
382
|
+
` - ${import_chalk.default.bold("packages/ui")}: Shared React component library`
|
383
|
+
);
|
384
|
+
console.log(
|
385
|
+
` - ${import_chalk.default.bold(
|
386
|
+
"packages/eslint-config-custom"
|
387
|
+
)}: Shared configuration (ESLint)`
|
388
|
+
);
|
389
|
+
console.log(
|
390
|
+
` - ${import_chalk.default.bold("packages/tsconfig")}: Shared TypeScript \`tsconfig.json\``
|
391
|
+
);
|
362
392
|
console.log();
|
363
393
|
if (flags.install) {
|
364
394
|
const spinner = (0, import_ora.default)({
|
@@ -376,10 +406,18 @@ async function run() {
|
|
376
406
|
process.chdir(projectDir);
|
377
407
|
tryGitInit(relativeProjectDir);
|
378
408
|
if (projectDirIsCurrentDir) {
|
379
|
-
console.log(
|
409
|
+
console.log(
|
410
|
+
`${import_chalk.default.bold(
|
411
|
+
turboGradient(">>> Success!")
|
412
|
+
)} Your new Turborepo is ready.`
|
413
|
+
);
|
380
414
|
console.log("Inside this directory, you can run several commands:");
|
381
415
|
} else {
|
382
|
-
console.log(
|
416
|
+
console.log(
|
417
|
+
`${import_chalk.default.bold(
|
418
|
+
turboGradient(">>> Success!")
|
419
|
+
)} Created a new Turborepo at "${relativeProjectDir}".`
|
420
|
+
);
|
383
421
|
console.log("Inside that directory, you can run several commands:");
|
384
422
|
}
|
385
423
|
console.log();
|
@@ -410,8 +448,14 @@ async function notifyUpdate() {
|
|
410
448
|
if (res == null ? void 0 : res.latest) {
|
411
449
|
const isYarn = shouldUseYarn();
|
412
450
|
console.log();
|
413
|
-
console.log(
|
414
|
-
|
451
|
+
console.log(
|
452
|
+
import_chalk.default.yellow.bold("A new version of `create-turbo` is available!")
|
453
|
+
);
|
454
|
+
console.log(
|
455
|
+
"You can update by running: " + import_chalk.default.cyan(
|
456
|
+
isYarn ? "yarn global add create-turbo" : "npm i -g create-turbo"
|
457
|
+
)
|
458
|
+
);
|
415
459
|
console.log();
|
416
460
|
}
|
417
461
|
process.exit();
|