create-turbo 1.4.2 → 1.4.4-canary.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/dist/index.js +35 -38
- package/package.json +1 -1
- package/templates/_shared_ts/apps/docs/package.json +4 -4
- package/templates/_shared_ts/apps/web/package.json +4 -4
- package/templates/_shared_ts/packages/eslint-config-custom/index.js +1 -1
- package/templates/_shared_ts/packages/eslint-config-custom/package.json +2 -1
- package/templates/_shared_ts/packages/ui/package.json +1 -1
- package/templates/pnpm/apps/docs/package.json +4 -4
- package/templates/pnpm/apps/web/package.json +4 -4
- package/templates/pnpm/packages/ui/package.json +3 -3
package/README.md
CHANGED
package/dist/index.js
CHANGED
@@ -23,7 +23,6 @@ var import_fs_extra = __toESM(require("fs-extra"));
|
|
23
23
|
var import_inquirer = __toESM(require("inquirer"));
|
24
24
|
var import_ora = __toESM(require("ora"));
|
25
25
|
var import_meow = __toESM(require("meow"));
|
26
|
-
var import_lt = __toESM(require("semver/functions/lt"));
|
27
26
|
var import_gradient_string = __toESM(require("gradient-string"));
|
28
27
|
var import_update_check = __toESM(require("update-check"));
|
29
28
|
var import_chalk = __toESM(require("chalk"));
|
@@ -31,7 +30,7 @@ var import_chalk = __toESM(require("chalk"));
|
|
31
30
|
// package.json
|
32
31
|
var package_default = {
|
33
32
|
name: "create-turbo",
|
34
|
-
version: "1.4.
|
33
|
+
version: "1.4.3",
|
35
34
|
description: "Create a new Turborepo",
|
36
35
|
homepage: "https://turborepo.org",
|
37
36
|
license: "MPL-2.0",
|
@@ -165,10 +164,31 @@ function tryGitInit(root) {
|
|
165
164
|
}
|
166
165
|
}
|
167
166
|
|
167
|
+
// src/constants.ts
|
168
|
+
var PACKAGE_MANAGERS = {
|
169
|
+
npm: {
|
170
|
+
name: "npm",
|
171
|
+
command: "npm"
|
172
|
+
},
|
173
|
+
pnpm: {
|
174
|
+
name: "pnpm",
|
175
|
+
command: "pnpm"
|
176
|
+
},
|
177
|
+
yarn: {
|
178
|
+
name: "yarn",
|
179
|
+
command: "yarn"
|
180
|
+
},
|
181
|
+
berry: {
|
182
|
+
name: "berry",
|
183
|
+
command: "yarn"
|
184
|
+
}
|
185
|
+
};
|
186
|
+
|
168
187
|
// src/getPackageManagerVersion.ts
|
169
188
|
var import_child_process4 = require("child_process");
|
170
189
|
var getPackageManagerVersion = (ws) => {
|
171
|
-
switch (ws) {
|
190
|
+
switch (ws.name) {
|
191
|
+
case "berry":
|
172
192
|
case "yarn":
|
173
193
|
return (0, import_child_process4.execSync)("yarn --version").toString().trim();
|
174
194
|
case "pnpm":
|
@@ -244,11 +264,11 @@ async function run() {
|
|
244
264
|
const isPnpmInstalled = shouldUsePnpm();
|
245
265
|
let answers;
|
246
266
|
if (flags.useNpm) {
|
247
|
-
answers = { packageManager: "npm" };
|
267
|
+
answers = { packageManager: PACKAGE_MANAGERS["npm"] };
|
248
268
|
} else if (flags.usePnpm) {
|
249
|
-
answers = { packageManager: "pnpm" };
|
269
|
+
answers = { packageManager: PACKAGE_MANAGERS["pnpm"] };
|
250
270
|
} else if (flags.useYarn) {
|
251
|
-
answers = { packageManager: "yarn" };
|
271
|
+
answers = { packageManager: PACKAGE_MANAGERS["yarn"] };
|
252
272
|
} else {
|
253
273
|
answers = await import_inquirer.default.prompt([
|
254
274
|
{
|
@@ -256,15 +276,15 @@ async function run() {
|
|
256
276
|
type: "list",
|
257
277
|
message: "Which package manager do you want to use?",
|
258
278
|
choices: [
|
259
|
-
{ name: "npm", value: "npm" },
|
279
|
+
{ name: "npm", value: PACKAGE_MANAGERS["npm"] },
|
260
280
|
{
|
261
281
|
name: "pnpm",
|
262
|
-
value: "pnpm",
|
282
|
+
value: PACKAGE_MANAGERS["pnpm"],
|
263
283
|
disabled: !isPnpmInstalled && "not installed"
|
264
284
|
},
|
265
285
|
{
|
266
286
|
name: "yarn",
|
267
|
-
value: "yarn",
|
287
|
+
value: PACKAGE_MANAGERS["yarn"],
|
268
288
|
disabled: !isYarnInstalled && "not installed"
|
269
289
|
}
|
270
290
|
]
|
@@ -283,7 +303,7 @@ async function run() {
|
|
283
303
|
}
|
284
304
|
let sharedTemplate = path2.resolve(__dirname, "../templates", `_shared_ts`);
|
285
305
|
await import_fs_extra.default.copy(sharedTemplate, projectDir);
|
286
|
-
let serverTemplate = path2.resolve(__dirname, "../templates", answers.packageManager);
|
306
|
+
let serverTemplate = path2.resolve(__dirname, "../templates", answers.packageManager.command);
|
287
307
|
if (import_fs_extra.default.existsSync(serverTemplate)) {
|
288
308
|
await import_fs_extra.default.copy(serverTemplate, projectDir, { overwrite: true });
|
289
309
|
}
|
@@ -296,7 +316,7 @@ async function run() {
|
|
296
316
|
...projectPkg[pkgKey]
|
297
317
|
};
|
298
318
|
});
|
299
|
-
sharedPkg.packageManager = `${answers.packageManager}@${getPackageManagerVersion(answers.packageManager)}`;
|
319
|
+
sharedPkg.packageManager = `${answers.packageManager.command}@${getPackageManagerVersion(answers.packageManager)}`;
|
300
320
|
sharedPkg.name = projectName;
|
301
321
|
await import_fs_extra.default.writeFile(path2.join(projectDir, "package.json"), JSON.stringify(sharedPkg, null, 2));
|
302
322
|
if (flags.install) {
|
@@ -315,17 +335,8 @@ async function run() {
|
|
315
335
|
frames: [" ", "> ", ">> ", ">>>"]
|
316
336
|
}
|
317
337
|
}).start();
|
318
|
-
let supportsRegistryArg = false;
|
319
|
-
try {
|
320
|
-
supportsRegistryArg = (0, import_lt.default)(getPackageManagerVersion(answers.packageManager), "2.0.0");
|
321
|
-
} catch (err) {
|
322
|
-
}
|
323
338
|
const installArgs = ["install"];
|
324
|
-
|
325
|
-
const npmRegistry = await getNpmRegistry(answers.packageManager);
|
326
|
-
installArgs.push(`--registry=${npmRegistry}`);
|
327
|
-
}
|
328
|
-
await (0, import_execa.default)(`${answers.packageManager}`, installArgs, {
|
339
|
+
await (0, import_execa.default)(`${answers.packageManager.command}`, installArgs, {
|
329
340
|
stdio: "ignore",
|
330
341
|
cwd: projectDir
|
331
342
|
});
|
@@ -351,10 +362,10 @@ async function run() {
|
|
351
362
|
console.log("Inside that directory, you can run several commands:");
|
352
363
|
}
|
353
364
|
console.log();
|
354
|
-
console.log(import_chalk.default.cyan(` ${answers.packageManager} run build`));
|
365
|
+
console.log(import_chalk.default.cyan(` ${answers.packageManager.command} run build`));
|
355
366
|
console.log(` Build all apps and packages`);
|
356
367
|
console.log();
|
357
|
-
console.log(import_chalk.default.cyan(` ${answers.packageManager} run dev`));
|
368
|
+
console.log(import_chalk.default.cyan(` ${answers.packageManager.command} run dev`));
|
358
369
|
console.log(` Develop all apps and packages`);
|
359
370
|
console.log();
|
360
371
|
console.log(`Turborepo will cache locally by default. For an additional`);
|
@@ -371,18 +382,6 @@ async function run() {
|
|
371
382
|
console.log(import_chalk.default.cyan(` ${getNpxCommand(answers.packageManager)} turbo login`));
|
372
383
|
console.log();
|
373
384
|
}
|
374
|
-
async function getNpmRegistry(pkgManager) {
|
375
|
-
try {
|
376
|
-
const { stdout: registry } = await (0, import_execa.default)(pkgManager, [
|
377
|
-
"config",
|
378
|
-
"get",
|
379
|
-
"registry"
|
380
|
-
]);
|
381
|
-
return registry;
|
382
|
-
} catch (error) {
|
383
|
-
return "";
|
384
|
-
}
|
385
|
-
}
|
386
385
|
var update = (0, import_update_check.default)(package_default).catch(() => null);
|
387
386
|
async function notifyUpdate() {
|
388
387
|
try {
|
@@ -399,9 +398,7 @@ async function notifyUpdate() {
|
|
399
398
|
}
|
400
399
|
}
|
401
400
|
function getNpxCommand(pkgManager) {
|
402
|
-
if (pkgManager === "
|
403
|
-
return "npx";
|
404
|
-
} else if (pkgManager === "pnpm") {
|
401
|
+
if (pkgManager.command === "pnpm") {
|
405
402
|
return getNpxCommandOfPnpm();
|
406
403
|
} else {
|
407
404
|
return "npx";
|
package/package.json
CHANGED
@@ -9,9 +9,9 @@
|
|
9
9
|
"lint": "next lint"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
|
-
"next": "12.2.
|
13
|
-
"react": "
|
14
|
-
"react-dom": "
|
12
|
+
"next": "12.2.4",
|
13
|
+
"react": "18.2.0",
|
14
|
+
"react-dom": "18.2.0",
|
15
15
|
"ui": "*"
|
16
16
|
},
|
17
17
|
"devDependencies": {
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"next-transpile-modules": "9.0.0",
|
22
22
|
"tsconfig": "*",
|
23
23
|
"@types/node": "^17.0.12",
|
24
|
-
"@types/react": "
|
24
|
+
"@types/react": "18.0.17",
|
25
25
|
"typescript": "^4.5.3"
|
26
26
|
}
|
27
27
|
}
|
@@ -9,9 +9,9 @@
|
|
9
9
|
"lint": "next lint"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
|
-
"next": "12.2.
|
13
|
-
"react": "
|
14
|
-
"react-dom": "
|
12
|
+
"next": "12.2.4",
|
13
|
+
"react": "18.2.0",
|
14
|
+
"react-dom": "18.2.0",
|
15
15
|
"ui": "*"
|
16
16
|
},
|
17
17
|
"devDependencies": {
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"next-transpile-modules": "9.0.0",
|
22
22
|
"tsconfig": "*",
|
23
23
|
"@types/node": "^17.0.12",
|
24
|
-
"@types/react": "
|
24
|
+
"@types/react": "18.0.17",
|
25
25
|
"typescript": "^4.5.3"
|
26
26
|
}
|
27
27
|
}
|
@@ -9,9 +9,9 @@
|
|
9
9
|
"lint": "next lint"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
|
-
"next": "12.2.
|
13
|
-
"react": "
|
14
|
-
"react-dom": "
|
12
|
+
"next": "12.2.4",
|
13
|
+
"react": "18.2.0",
|
14
|
+
"react-dom": "18.2.0",
|
15
15
|
"ui": "workspace:*"
|
16
16
|
},
|
17
17
|
"devDependencies": {
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"next-transpile-modules": "9.0.0",
|
22
22
|
"tsconfig": "workspace:*",
|
23
23
|
"@types/node": "^17.0.12",
|
24
|
-
"@types/react": "
|
24
|
+
"@types/react": "18.0.17",
|
25
25
|
"typescript": "^4.5.3"
|
26
26
|
}
|
27
27
|
}
|
@@ -9,9 +9,9 @@
|
|
9
9
|
"lint": "next lint"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
|
-
"next": "12.2.
|
13
|
-
"react": "
|
14
|
-
"react-dom": "
|
12
|
+
"next": "12.2.4",
|
13
|
+
"react": "18.2.0",
|
14
|
+
"react-dom": "18.2.0",
|
15
15
|
"ui": "workspace:*"
|
16
16
|
},
|
17
17
|
"devDependencies": {
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"next-transpile-modules": "9.0.0",
|
22
22
|
"tsconfig": "workspace:*",
|
23
23
|
"@types/node": "^17.0.12",
|
24
|
-
"@types/react": "
|
24
|
+
"@types/react": "18.0.17",
|
25
25
|
"typescript": "^4.5.3"
|
26
26
|
}
|
27
27
|
}
|
@@ -8,11 +8,11 @@
|
|
8
8
|
"lint": "eslint *.ts*"
|
9
9
|
},
|
10
10
|
"devDependencies": {
|
11
|
-
"@types/react": "^
|
12
|
-
"@types/react-dom": "^
|
11
|
+
"@types/react": "^18.0.17",
|
12
|
+
"@types/react-dom": "^18.0.6",
|
13
13
|
"eslint": "^7.32.0",
|
14
14
|
"eslint-config-custom": "workspace:*",
|
15
|
-
"react": "^
|
15
|
+
"react": "^18.2.0",
|
16
16
|
"tsconfig": "workspace:*",
|
17
17
|
"typescript": "^4.5.2"
|
18
18
|
}
|