create-turbo 1.0.23 → 1.0.24-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +49 -15
- package/package.json +1 -1
- package/templates/_shared_ts/apps/docs/package.json +1 -1
- package/templates/_shared_ts/apps/web/package.json +1 -1
- package/templates/_shared_ts/packages/config/eslint-preset.js +1 -1
- package/templates/_shared_ts/packages/config/package.json +1 -1
- package/templates/_shared_ts/packages/ui/package.json +1 -0
- package/templates/pnpm/README.md +4 -4
- package/templates/pnpm/apps/docs/package.json +25 -0
- package/templates/pnpm/apps/web/package.json +25 -0
- package/templates/pnpm/packages/ui/package.json +14 -0
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.
|
34
|
+
var version = "1.0.24-canary.0";
|
35
35
|
var description = "Create a new Turborepo";
|
36
36
|
var homepage = "https://turborepo.org";
|
37
37
|
var license = "MPL-2.0";
|
@@ -112,13 +112,28 @@ function shouldUseYarn() {
|
|
112
112
|
}
|
113
113
|
}
|
114
114
|
|
115
|
-
// src/
|
115
|
+
// src/shouldUsePnpm.ts
|
116
116
|
var import_child_process2 = __toModule(require("child_process"));
|
117
|
+
function shouldUsePnpm() {
|
118
|
+
try {
|
119
|
+
const userAgent = process.env.npm_config_user_agent;
|
120
|
+
if (userAgent && userAgent.startsWith("pnpm")) {
|
121
|
+
return true;
|
122
|
+
}
|
123
|
+
(0, import_child_process2.execSync)("pnpm --version", { stdio: "ignore" });
|
124
|
+
return true;
|
125
|
+
} catch (e) {
|
126
|
+
return false;
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
// src/git.ts
|
131
|
+
var import_child_process3 = __toModule(require("child_process"));
|
117
132
|
var import_path = __toModule(require("path"));
|
118
133
|
var import_rimraf = __toModule(require("rimraf"));
|
119
134
|
function isInGitRepository() {
|
120
135
|
try {
|
121
|
-
(0,
|
136
|
+
(0, import_child_process3.execSync)("git rev-parse --is-inside-work-tree", { stdio: "ignore" });
|
122
137
|
return true;
|
123
138
|
} catch (_) {
|
124
139
|
}
|
@@ -126,7 +141,7 @@ function isInGitRepository() {
|
|
126
141
|
}
|
127
142
|
function isInMercurialRepository() {
|
128
143
|
try {
|
129
|
-
(0,
|
144
|
+
(0, import_child_process3.execSync)("hg --cwd . root", { stdio: "ignore" });
|
130
145
|
return true;
|
131
146
|
} catch (_) {
|
132
147
|
}
|
@@ -135,15 +150,15 @@ function isInMercurialRepository() {
|
|
135
150
|
function tryGitInit(root) {
|
136
151
|
let didInit = false;
|
137
152
|
try {
|
138
|
-
(0,
|
153
|
+
(0, import_child_process3.execSync)("git --version", { stdio: "ignore" });
|
139
154
|
if (isInGitRepository() || isInMercurialRepository()) {
|
140
155
|
return false;
|
141
156
|
}
|
142
|
-
(0,
|
157
|
+
(0, import_child_process3.execSync)("git init", { stdio: "ignore" });
|
143
158
|
didInit = true;
|
144
|
-
(0,
|
145
|
-
(0,
|
146
|
-
(0,
|
159
|
+
(0, import_child_process3.execSync)("git checkout -b main", { stdio: "ignore" });
|
160
|
+
(0, import_child_process3.execSync)("git add -A", { stdio: "ignore" });
|
161
|
+
(0, import_child_process3.execSync)('git commit -m "Initial commit from Create Turborepo"', {
|
147
162
|
stdio: "ignore"
|
148
163
|
});
|
149
164
|
return true;
|
@@ -167,7 +182,8 @@ var help = `
|
|
167
182
|
If <dir> is not provided up front you will be prompted for it.
|
168
183
|
|
169
184
|
Flags:
|
170
|
-
--use-npm Explicitly tell the CLI to bootstrap the app using npm
|
185
|
+
--use-npm Explicitly tell the CLI to bootstrap the app using npm
|
186
|
+
--use-pnpm Explicitly tell the CLI to bootstrap the app using pnpm
|
171
187
|
--no-install Explicitly do not run the package mananger's install command
|
172
188
|
--help, -h Show this help message
|
173
189
|
--version, -v Show the version of this script
|
@@ -191,6 +207,7 @@ async function run() {
|
|
191
207
|
flags: {
|
192
208
|
help: { type: "boolean", default: false, alias: "h" },
|
193
209
|
useNpm: { type: "boolean", default: false },
|
210
|
+
usePnpm: { type: "boolean", default: false },
|
194
211
|
install: { type: "boolean", default: true },
|
195
212
|
version: { type: "boolean", default: false, alias: "v" }
|
196
213
|
}
|
@@ -214,9 +231,12 @@ async function run() {
|
|
214
231
|
}
|
215
232
|
])).dir);
|
216
233
|
const isYarnInstalled = shouldUseYarn();
|
234
|
+
const isPnpmInstalled = shouldUsePnpm();
|
217
235
|
let answers;
|
218
236
|
if (flags.useNpm) {
|
219
237
|
answers = { packageManager: "npm" };
|
238
|
+
} else if (flags.usePnpm) {
|
239
|
+
answers = { packageManager: "pnpm" };
|
220
240
|
} else {
|
221
241
|
answers = await import_inquirer.default.prompt([
|
222
242
|
{
|
@@ -224,12 +244,17 @@ async function run() {
|
|
224
244
|
type: "list",
|
225
245
|
message: "Which package manager do you want to use?",
|
226
246
|
choices: [
|
247
|
+
{ name: "npm", value: "npm" },
|
248
|
+
{
|
249
|
+
name: "pnpm",
|
250
|
+
value: "pnpm",
|
251
|
+
disabled: !isPnpmInstalled && "not installed"
|
252
|
+
},
|
227
253
|
{
|
228
|
-
name: "
|
254
|
+
name: "yarn",
|
229
255
|
value: "yarn",
|
230
256
|
disabled: !isYarnInstalled && "not installed"
|
231
|
-
}
|
232
|
-
{ name: "NPM", value: "npm" }
|
257
|
+
}
|
233
258
|
]
|
234
259
|
}
|
235
260
|
]);
|
@@ -312,14 +337,14 @@ async function run() {
|
|
312
337
|
console.log(`speed boost, enable Remote Caching (beta) with Vercel by`);
|
313
338
|
console.log(`entering the following command:`);
|
314
339
|
console.log();
|
315
|
-
console.log(import_chalk.default.cyan(`
|
340
|
+
console.log(import_chalk.default.cyan(` ${getNpxCommand(answers.packageManager)} turbo login`));
|
316
341
|
console.log();
|
317
342
|
console.log(`We suggest that you begin by typing:`);
|
318
343
|
console.log();
|
319
344
|
if (!projectDirIsCurrentDir) {
|
320
345
|
console.log(` ${import_chalk.default.cyan("cd")} ${relativeProjectDir}`);
|
321
346
|
}
|
322
|
-
console.log(import_chalk.default.cyan(`
|
347
|
+
console.log(import_chalk.default.cyan(` ${getNpxCommand(answers.packageManager)} turbo login`));
|
323
348
|
console.log();
|
324
349
|
}
|
325
350
|
var update = (0, import_update_check.default)(package_default).catch(() => null);
|
@@ -337,3 +362,12 @@ async function notifyUpdate() {
|
|
337
362
|
} catch {
|
338
363
|
}
|
339
364
|
}
|
365
|
+
function getNpxCommand(pkgManager) {
|
366
|
+
if (pkgManager === "yarn") {
|
367
|
+
return "npx";
|
368
|
+
} else if (pkgManager === "pnpm") {
|
369
|
+
return "pnpx";
|
370
|
+
} else {
|
371
|
+
return "npx";
|
372
|
+
}
|
373
|
+
}
|
package/package.json
CHANGED
package/templates/pnpm/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
# Turborepo starter with
|
1
|
+
# Turborepo starter with pnpm
|
2
2
|
|
3
3
|
This is an official starter turborepo.
|
4
4
|
|
5
5
|
## What's inside?
|
6
6
|
|
7
|
-
This turborepo uses [
|
7
|
+
This turborepo uses [pnpm](https://pnpm.io) as a packages manager. It includes the following packages/apps:
|
8
8
|
|
9
9
|
### Apps and Packages
|
10
10
|
|
@@ -55,7 +55,7 @@ By default, Turborepo will cache locally. To enable Remote Caching (Beta) you wi
|
|
55
55
|
|
56
56
|
```
|
57
57
|
cd my-turborepo
|
58
|
-
|
58
|
+
pnpx turbo login
|
59
59
|
```
|
60
60
|
|
61
61
|
This will authenticate the Turborepo CLI with your [Vercel account](https://vercel.com/docs/concepts/personal-accounts/overview).
|
@@ -63,7 +63,7 @@ This will authenticate the Turborepo CLI with your [Vercel account](https://verc
|
|
63
63
|
Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your turborepo:
|
64
64
|
|
65
65
|
```
|
66
|
-
|
66
|
+
pnpx turbo link
|
67
67
|
```
|
68
68
|
|
69
69
|
## Useful Links
|
@@ -0,0 +1,25 @@
|
|
1
|
+
{
|
2
|
+
"name": "docs",
|
3
|
+
"version": "0.0.0",
|
4
|
+
"private": true,
|
5
|
+
"scripts": {
|
6
|
+
"dev": "next dev --port 3001",
|
7
|
+
"build": "next build",
|
8
|
+
"start": "next start",
|
9
|
+
"lint": "next lint"
|
10
|
+
},
|
11
|
+
"dependencies": {
|
12
|
+
"next": "12.0.7",
|
13
|
+
"react": "17.0.2",
|
14
|
+
"react-dom": "17.0.2",
|
15
|
+
"ui": "workspace:*"
|
16
|
+
},
|
17
|
+
"devDependencies": {
|
18
|
+
"config": "workspace:*",
|
19
|
+
"eslint": "7.32.0",
|
20
|
+
"next-transpile-modules": "9.0.0",
|
21
|
+
"tsconfig": "workspace:*",
|
22
|
+
"@types/react": "17.0.37",
|
23
|
+
"typescript": "^4.5.3"
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
{
|
2
|
+
"name": "web",
|
3
|
+
"version": "0.0.0",
|
4
|
+
"private": true,
|
5
|
+
"scripts": {
|
6
|
+
"dev": "next dev",
|
7
|
+
"build": "next build",
|
8
|
+
"start": "next start",
|
9
|
+
"lint": "next lint"
|
10
|
+
},
|
11
|
+
"dependencies": {
|
12
|
+
"next": "12.0.7",
|
13
|
+
"react": "17.0.2",
|
14
|
+
"react-dom": "17.0.2",
|
15
|
+
"ui": "workspace:*"
|
16
|
+
},
|
17
|
+
"devDependencies": {
|
18
|
+
"config": "workspace:*",
|
19
|
+
"eslint": "7.32.0",
|
20
|
+
"next-transpile-modules": "9.0.0",
|
21
|
+
"tsconfig": "workspace:*",
|
22
|
+
"@types/react": "17.0.37",
|
23
|
+
"typescript": "^4.5.3"
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"name": "ui",
|
3
|
+
"version": "0.0.0",
|
4
|
+
"main": "./index.tsx",
|
5
|
+
"types": "./index.tsx",
|
6
|
+
"license": "MIT",
|
7
|
+
"devDependencies": {
|
8
|
+
"@types/react": "^17.0.37",
|
9
|
+
"@types/react-dom": "^17.0.11",
|
10
|
+
"tsconfig": "workspace:*",
|
11
|
+
"config": "workspace:*",
|
12
|
+
"typescript": "^4.5.3"
|
13
|
+
}
|
14
|
+
}
|