create-turbo 1.0.9 → 1.0.13
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +58 -45
- 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/package.json +1 -1
- package/templates/_shared_ts/packages/tsconfig/README.md +1 -1
- package/templates/_shared_ts/packages/ui/index.tsx +1 -0
- package/templates/_shared_ts/packages/ui/package.json +10 -4
- package/templates/_shared_ts/packages/ui/tsconfig.json +7 -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.13";
|
35
35
|
var description = "Create a new Turborepo";
|
36
36
|
var homepage = "https://turborepo.org";
|
37
37
|
var license = "MPL-2.0";
|
@@ -101,8 +101,8 @@ var import_child_process = __toModule(require("child_process"));
|
|
101
101
|
function shouldUseYarn() {
|
102
102
|
try {
|
103
103
|
const userAgent = process.env.npm_config_user_agent;
|
104
|
-
if (userAgent) {
|
105
|
-
return
|
104
|
+
if (userAgent && userAgent.startsWith("yarn")) {
|
105
|
+
return true;
|
106
106
|
}
|
107
107
|
(0, import_child_process.execSync)("yarnpkg --version", { stdio: "ignore" });
|
108
108
|
return true;
|
@@ -165,7 +165,9 @@ var help = `
|
|
165
165
|
|
166
166
|
If <dir> is not provided up front you will be prompted for it.
|
167
167
|
|
168
|
-
Flags:
|
168
|
+
Flags:
|
169
|
+
--use-npm Explicitly tell the CLI to bootstrap the app using npm.
|
170
|
+
--no-install Explicitly do not run the package mananger's install command
|
169
171
|
--help, -h Show this help message
|
170
172
|
--version, -v Show the version of this script
|
171
173
|
`;
|
@@ -184,8 +186,11 @@ run().then(notifyUpdate).catch(async (reason) => {
|
|
184
186
|
});
|
185
187
|
async function run() {
|
186
188
|
let { input, flags, showHelp, showVersion } = (0, import_meow.default)(help, {
|
189
|
+
booleanDefault: void 0,
|
187
190
|
flags: {
|
188
191
|
help: { type: "boolean", default: false, alias: "h" },
|
192
|
+
useNpm: { type: "boolean", default: false },
|
193
|
+
install: { type: "boolean", default: true },
|
189
194
|
version: { type: "boolean", default: false, alias: "v" }
|
190
195
|
}
|
191
196
|
});
|
@@ -207,25 +212,27 @@ async function run() {
|
|
207
212
|
default: "./my-turborepo"
|
208
213
|
}
|
209
214
|
])).dir);
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
215
|
+
const isYarnInstalled = shouldUseYarn();
|
216
|
+
let answers;
|
217
|
+
if (flags.useNpm) {
|
218
|
+
answers = { packageManager: "npm" };
|
219
|
+
} else {
|
220
|
+
answers = await import_inquirer.default.prompt([
|
221
|
+
{
|
222
|
+
name: "packageManager",
|
223
|
+
type: "list",
|
224
|
+
message: "Which package manager do you want to use?",
|
225
|
+
choices: [
|
226
|
+
{
|
227
|
+
name: "Yarn",
|
228
|
+
value: "yarn",
|
229
|
+
disabled: !isYarnInstalled && "not installed"
|
230
|
+
},
|
231
|
+
{ name: "NPM", value: "npm" }
|
232
|
+
]
|
233
|
+
}
|
234
|
+
]);
|
235
|
+
}
|
229
236
|
let relativeProjectDir = path2.relative(process.cwd(), projectDir);
|
230
237
|
let projectDirIsCurrentDir = relativeProjectDir === "";
|
231
238
|
if (!projectDirIsCurrentDir) {
|
@@ -252,7 +259,7 @@ async function run() {
|
|
252
259
|
}
|
253
260
|
});
|
254
261
|
await import_fs_extra.default.writeFile(path2.join(projectDir, "package.json"), JSON.stringify(appPkg, null, 2));
|
255
|
-
if (
|
262
|
+
if (flags.install) {
|
256
263
|
console.log();
|
257
264
|
console.log(`>>> Bootstrapping a new turborepo with the following:`);
|
258
265
|
console.log();
|
@@ -273,40 +280,46 @@ async function run() {
|
|
273
280
|
cwd: projectDir
|
274
281
|
});
|
275
282
|
spinner.stop();
|
283
|
+
} else {
|
284
|
+
console.log();
|
285
|
+
console.log(`>>> Bootstrapped a new turborepo with the following:`);
|
286
|
+
console.log();
|
287
|
+
console.log(` - ${import_chalk.default.bold("apps/web")}: Next.js with TypeScript`);
|
288
|
+
console.log(` - ${import_chalk.default.bold("apps/docs")}: Next.js with TypeScript`);
|
289
|
+
console.log(` - ${import_chalk.default.bold("packages/ui")}: Shared React component library`);
|
290
|
+
console.log(` - ${import_chalk.default.bold("packages/config")}: Shared configuration (ESLint)`);
|
291
|
+
console.log(` - ${import_chalk.default.bold("packages/tsconfig")}: Shared TypeScript \`tsconfig.json\``);
|
292
|
+
console.log();
|
276
293
|
}
|
277
294
|
process.chdir(projectDir);
|
278
295
|
tryGitInit(relativeProjectDir);
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
console.log(
|
296
|
+
if (projectDirIsCurrentDir) {
|
297
|
+
console.log(`${import_chalk.default.bold(turboGradient(">>> Success!"))} Your new Turborepo is ready. `);
|
298
|
+
console.log("Inside this directory, you can run several commands:");
|
299
|
+
} else {
|
300
|
+
console.log(`${import_chalk.default.bold(turboGradient(">>> Success!"))} Created a new Turborepo at "${relativeProjectDir}". `);
|
301
|
+
console.log("Inside that directory, you can run several commands:");
|
285
302
|
}
|
286
|
-
console.log(` ${answers.packageManager} run build`);
|
287
303
|
console.log();
|
288
|
-
console.log(`
|
304
|
+
console.log(import_chalk.default.cyan(` ${answers.packageManager} run build`));
|
305
|
+
console.log(` Build all apps and packages`);
|
289
306
|
console.log();
|
290
|
-
|
291
|
-
|
292
|
-
}
|
293
|
-
console.log(` ${answers.packageManager} run dev`);
|
307
|
+
console.log(import_chalk.default.cyan(` ${answers.packageManager} run dev`));
|
308
|
+
console.log(` Develop all apps and packages`);
|
294
309
|
console.log();
|
295
310
|
console.log(`Turborepo will cache locally by default. For an additional`);
|
296
311
|
console.log(`speed boost, enable Remote Caching (beta) with Vercel by`);
|
297
|
-
console.log(`entering the following
|
312
|
+
console.log(`entering the following command:`);
|
313
|
+
console.log();
|
314
|
+
console.log(import_chalk.default.cyan(` npx turbo login`));
|
315
|
+
console.log();
|
316
|
+
console.log(`We suggest that you begin by typing:`);
|
298
317
|
console.log();
|
299
318
|
if (!projectDirIsCurrentDir) {
|
300
|
-
console.log(` cd ${relativeProjectDir}`);
|
319
|
+
console.log(` ${import_chalk.default.cyan("cd")} ${relativeProjectDir}`);
|
301
320
|
}
|
302
|
-
console.log(` npx turbo login`);
|
321
|
+
console.log(import_chalk.default.cyan(` npx turbo login`));
|
303
322
|
console.log();
|
304
|
-
if (projectDirIsCurrentDir) {
|
305
|
-
console.log(`For more info, checkout the README`);
|
306
|
-
} else {
|
307
|
-
console.log(`For more info, checkout the README in ${import_chalk.default.bold(relativeProjectDir)}`);
|
308
|
-
}
|
309
|
-
console.log(`as well as the official Turborepo docs ${import_chalk.default.underline("https://turborepo.org/docs")}`);
|
310
323
|
}
|
311
324
|
var update = (0, import_update_check.default)(package_default).catch(() => null);
|
312
325
|
async function notifyUpdate() {
|
package/package.json
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./Button";
|
@@ -1,7 +1,13 @@
|
|
1
1
|
{
|
2
2
|
"name": "ui",
|
3
|
-
"version": "
|
4
|
-
"main": "./
|
5
|
-
"types": "./
|
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.2"
|
12
|
+
}
|
7
13
|
}
|