create-turbo 1.0.23 → 1.0.24

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.23";
34
+ var version = "1.0.24";
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/git.ts
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, import_child_process2.execSync)("git rev-parse --is-inside-work-tree", { stdio: "ignore" });
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, import_child_process2.execSync)("hg --cwd . root", { stdio: "ignore" });
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, import_child_process2.execSync)("git --version", { stdio: "ignore" });
153
+ (0, import_child_process3.execSync)("git --version", { stdio: "ignore" });
139
154
  if (isInGitRepository() || isInMercurialRepository()) {
140
155
  return false;
141
156
  }
142
- (0, import_child_process2.execSync)("git init", { stdio: "ignore" });
157
+ (0, import_child_process3.execSync)("git init", { stdio: "ignore" });
143
158
  didInit = true;
144
- (0, import_child_process2.execSync)("git checkout -b main", { stdio: "ignore" });
145
- (0, import_child_process2.execSync)("git add -A", { stdio: "ignore" });
146
- (0, import_child_process2.execSync)('git commit -m "Initial commit from Create Turborepo"', {
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: "Yarn",
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(` npx turbo login`));
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(` npx turbo login`));
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-turbo",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
4
4
  "description": "Create a new Turborepo",
5
5
  "homepage": "https://turborepo.org",
6
6
  "license": "MPL-2.0",
@@ -9,7 +9,7 @@
9
9
  "lint": "next lint"
10
10
  },
11
11
  "dependencies": {
12
- "next": "12.0.3",
12
+ "next": "12.0.7",
13
13
  "react": "17.0.2",
14
14
  "react-dom": "17.0.2",
15
15
  "ui": "*"
@@ -9,7 +9,7 @@
9
9
  "lint": "next lint"
10
10
  },
11
11
  "dependencies": {
12
- "next": "12.0.3",
12
+ "next": "12.0.7",
13
13
  "react": "17.0.2",
14
14
  "react-dom": "17.0.2",
15
15
  "ui": "*"
@@ -6,6 +6,6 @@ module.exports = {
6
6
  },
7
7
  },
8
8
  rules: {
9
- "no-html-link-for-pages": "off",
9
+ "@next/next/no-html-link-for-pages": "off",
10
10
  },
11
11
  };
@@ -7,7 +7,7 @@
7
7
  "eslint-preset.js"
8
8
  ],
9
9
  "dependencies": {
10
- "eslint-config-next": "^12.0.3",
10
+ "eslint-config-next": "^12.0.7",
11
11
  "eslint-config-prettier": "^8.3.0"
12
12
  }
13
13
  }
@@ -8,6 +8,7 @@
8
8
  "@types/react": "^17.0.37",
9
9
  "@types/react-dom": "^17.0.11",
10
10
  "tsconfig": "*",
11
+ "config": "*",
11
12
  "typescript": "^4.5.3"
12
13
  }
13
14
  }
@@ -1,10 +1,10 @@
1
- # Turborepo starter with PNPM
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 [PNPM](https://pnpm.io) as a packages manager. It includes the following packages/apps:
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
- npx turbo login
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
- npx turbo link
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
+ }