create-turbo 1.0.11 → 1.0.15

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.11";
34
+ var version = "1.0.15";
35
35
  var description = "Create a new Turborepo";
36
36
  var homepage = "https://turborepo.org";
37
37
  var license = "MPL-2.0";
@@ -48,7 +48,8 @@ var bin = {
48
48
  };
49
49
  var scripts = {
50
50
  build: "tsup src/index.ts --format cjs",
51
- test: "jest"
51
+ test: "jest",
52
+ lint: "eslint src/**/*.ts"
52
53
  };
53
54
  var dependencies = {
54
55
  chalk: "2.4.2",
@@ -101,8 +102,8 @@ var import_child_process = __toModule(require("child_process"));
101
102
  function shouldUseYarn() {
102
103
  try {
103
104
  const userAgent = process.env.npm_config_user_agent;
104
- if (userAgent) {
105
- return Boolean(userAgent && userAgent.startsWith("yarn"));
105
+ if (userAgent && userAgent.startsWith("yarn")) {
106
+ return true;
106
107
  }
107
108
  (0, import_child_process.execSync)("yarnpkg --version", { stdio: "ignore" });
108
109
  return true;
@@ -165,7 +166,9 @@ var help = `
165
166
 
166
167
  If <dir> is not provided up front you will be prompted for it.
167
168
 
168
- Flags:
169
+ Flags:
170
+ --use-npm Explicitly tell the CLI to bootstrap the app using npm.
171
+ --no-install Explicitly do not run the package mananger's install command
169
172
  --help, -h Show this help message
170
173
  --version, -v Show the version of this script
171
174
  `;
@@ -184,8 +187,11 @@ run().then(notifyUpdate).catch(async (reason) => {
184
187
  });
185
188
  async function run() {
186
189
  let { input, flags, showHelp, showVersion } = (0, import_meow.default)(help, {
190
+ booleanDefault: void 0,
187
191
  flags: {
188
192
  help: { type: "boolean", default: false, alias: "h" },
193
+ useNpm: { type: "boolean", default: false },
194
+ install: { type: "boolean", default: true },
189
195
  version: { type: "boolean", default: false, alias: "v" }
190
196
  }
191
197
  });
@@ -208,29 +214,26 @@ async function run() {
208
214
  }
209
215
  ])).dir);
210
216
  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
- ]);
217
+ let answers;
218
+ if (flags.useNpm) {
219
+ answers = { packageManager: "npm" };
220
+ } else {
221
+ answers = await import_inquirer.default.prompt([
222
+ {
223
+ name: "packageManager",
224
+ type: "list",
225
+ message: "Which package manager do you want to use?",
226
+ choices: [
227
+ {
228
+ name: "Yarn",
229
+ value: "yarn",
230
+ disabled: !isYarnInstalled && "not installed"
231
+ },
232
+ { name: "NPM", value: "npm" }
233
+ ]
234
+ }
235
+ ]);
236
+ }
234
237
  let relativeProjectDir = path2.relative(process.cwd(), projectDir);
235
238
  let projectDirIsCurrentDir = relativeProjectDir === "";
236
239
  if (!projectDirIsCurrentDir) {
@@ -257,7 +260,7 @@ async function run() {
257
260
  }
258
261
  });
259
262
  await import_fs_extra.default.writeFile(path2.join(projectDir, "package.json"), JSON.stringify(appPkg, null, 2));
260
- if (answers.install) {
263
+ if (flags.install) {
261
264
  console.log();
262
265
  console.log(`>>> Bootstrapping a new turborepo with the following:`);
263
266
  console.log();
@@ -278,40 +281,46 @@ async function run() {
278
281
  cwd: projectDir
279
282
  });
280
283
  spinner.stop();
284
+ } else {
285
+ console.log();
286
+ console.log(`>>> Bootstrapped a new turborepo with the following:`);
287
+ console.log();
288
+ console.log(` - ${import_chalk.default.bold("apps/web")}: Next.js with TypeScript`);
289
+ console.log(` - ${import_chalk.default.bold("apps/docs")}: Next.js with TypeScript`);
290
+ console.log(` - ${import_chalk.default.bold("packages/ui")}: Shared React component library`);
291
+ console.log(` - ${import_chalk.default.bold("packages/config")}: Shared configuration (ESLint)`);
292
+ console.log(` - ${import_chalk.default.bold("packages/tsconfig")}: Shared TypeScript \`tsconfig.json\``);
293
+ console.log();
281
294
  }
282
295
  process.chdir(projectDir);
283
296
  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}`);
297
+ if (projectDirIsCurrentDir) {
298
+ console.log(`${import_chalk.default.bold(turboGradient(">>> Success!"))} Your new Turborepo is ready. `);
299
+ console.log("Inside this directory, you can run several commands:");
300
+ } else {
301
+ console.log(`${import_chalk.default.bold(turboGradient(">>> Success!"))} Created a new Turborepo at "${relativeProjectDir}". `);
302
+ console.log("Inside that directory, you can run several commands:");
290
303
  }
291
- console.log(` ${answers.packageManager} run build`);
292
304
  console.log();
293
- console.log(`To develop all apps and packages, run the following:`);
305
+ console.log(import_chalk.default.cyan(` ${answers.packageManager} run build`));
306
+ console.log(` Build all apps and packages`);
294
307
  console.log();
295
- if (!projectDirIsCurrentDir) {
296
- console.log(` cd ${relativeProjectDir}`);
297
- }
298
- console.log(` ${answers.packageManager} run dev`);
308
+ console.log(import_chalk.default.cyan(` ${answers.packageManager} run dev`));
309
+ console.log(` Develop all apps and packages`);
299
310
  console.log();
300
311
  console.log(`Turborepo will cache locally by default. For an additional`);
301
312
  console.log(`speed boost, enable Remote Caching (beta) with Vercel by`);
302
- console.log(`entering the following commands:`);
313
+ console.log(`entering the following command:`);
314
+ console.log();
315
+ console.log(import_chalk.default.cyan(` npx turbo login`));
316
+ console.log();
317
+ console.log(`We suggest that you begin by typing:`);
303
318
  console.log();
304
319
  if (!projectDirIsCurrentDir) {
305
- console.log(` cd ${relativeProjectDir}`);
320
+ console.log(` ${import_chalk.default.cyan("cd")} ${relativeProjectDir}`);
306
321
  }
307
- console.log(` npx turbo login`);
322
+ console.log(import_chalk.default.cyan(` npx turbo login`));
308
323
  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
324
  }
316
325
  var update = (0, import_update_check.default)(package_default).catch(() => null);
317
326
  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.15",
4
4
  "description": "Create a new Turborepo",
5
5
  "homepage": "https://turborepo.org",
6
6
  "license": "MPL-2.0",
@@ -17,7 +17,8 @@
17
17
  },
18
18
  "scripts": {
19
19
  "build": "tsup src/index.ts --format cjs",
20
- "test": "jest"
20
+ "test": "jest",
21
+ "lint": "eslint src/**/*.ts"
21
22
  },
22
23
  "dependencies": {
23
24
  "chalk": "2.4.2",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docs",
3
- "version": "1.0.0",
3
+ "version": "0.0.0",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "dev": "next dev --port 3001",
@@ -20,6 +20,6 @@
20
20
  "next-transpile-modules": "9.0.0",
21
21
  "tsconfig": "*",
22
22
  "@types/react": "17.0.37",
23
- "typescript": "4.5.2"
23
+ "typescript": "^4.5.3"
24
24
  }
25
25
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web",
3
- "version": "1.0.0",
3
+ "version": "0.0.0",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "dev": "next dev",
@@ -20,6 +20,6 @@
20
20
  "next-transpile-modules": "9.0.0",
21
21
  "tsconfig": "*",
22
22
  "@types/react": "17.0.37",
23
- "typescript": "4.5.2"
23
+ "typescript": "^4.5.3"
24
24
  }
25
25
  }
@@ -2,13 +2,7 @@ module.exports = {
2
2
  extends: ["next", "prettier"],
3
3
  settings: {
4
4
  next: {
5
- rootDir: [
6
- "apps/docs/",
7
- "apps/web/",
8
- "packages/ui/",
9
- "packages/config/",
10
- "packages/tsconfig/",
11
- ],
5
+ rootDir: ["apps/*/", "packages/*/"],
12
6
  },
13
7
  },
14
8
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "config",
3
- "version": "1.0.0",
3
+ "version": "0.0.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -1,3 +1,3 @@
1
1
  # `tsconfig`
2
2
 
3
- This is the base shared `tsconfig.json` from which all other `tsconfig.json`'s inherit from.
3
+ These are base shared `tsconfig.json`s from which all other `tsconfig.json`'s inherit from.
@@ -2,13 +2,10 @@
2
2
  "$schema": "https://json.schemastore.org/tsconfig",
3
3
  "display": "React Library",
4
4
  "extends": "./base.json",
5
- "include": ["src"],
6
- "exclude": ["node_modules"],
7
5
  "compilerOptions": {
8
6
  "lib": ["ES2015"],
9
7
  "module": "ESNext",
10
- "rootDir": "src",
11
- "outDir": "dist",
12
- "jsx": "react"
8
+ "target": "ES6",
9
+ "jsx": "react-jsx"
13
10
  }
14
11
  }
@@ -0,0 +1 @@
1
+ export * from "./Button";
@@ -1,7 +1,13 @@
1
1
  {
2
2
  "name": "ui",
3
- "version": "1.0.0",
4
- "main": "./Button.tsx",
5
- "types": "./Button.tsx",
6
- "license": "MIT"
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": "*",
11
+ "typescript": "^4.5.3"
12
+ }
7
13
  }
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": "tsconfig/react-library.json",
3
+ "include": ["."],
4
+ "exclude": ["dist", "build", "node_modules"]
5
+ }