create-tina-app 1.1.3 → 1.1.4

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.d.ts CHANGED
@@ -1,4 +1 @@
1
- /**
2
-
3
- */
4
1
  export declare const run: () => Promise<void>;
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ var import_path4 = __toESM(require("path"));
35
35
 
36
36
  // package.json
37
37
  var name = "create-tina-app";
38
- var version = "1.1.3";
38
+ var version = "1.1.4";
39
39
 
40
40
  // src/util/fileUtil.ts
41
41
  var import_fs_extra = __toESM(require("fs-extra"));
@@ -104,46 +104,61 @@ function isFolderEmpty(root, name2) {
104
104
  // src/util/install.ts
105
105
  var import_chalk2 = __toESM(require("chalk"));
106
106
  var import_cross_spawn = __toESM(require("cross-spawn"));
107
- function install(root, dependencies, { useYarn, isOnline, devDependencies }) {
107
+ function install(root, dependencies, { packageManager, isOnline, devDependencies }) {
108
108
  const npmFlags = [];
109
109
  const yarnFlags = [];
110
+ const pnpmFlags = [];
110
111
  return new Promise((resolve, reject) => {
111
112
  let args;
112
- const command = useYarn ? "yarnpkg" : "npm";
113
+ const command = packageManager;
113
114
  if (dependencies && dependencies.length) {
114
- if (useYarn) {
115
- args = ["add", "--exact"];
116
- if (!isOnline)
117
- args.push("--offline");
118
- args.push("--cwd", root);
119
- if (devDependencies)
120
- args.push("--dev");
121
- args.push(...dependencies);
122
- } else {
123
- args = ["install", "--save-exact"];
124
- args.push(devDependencies ? "--save-dev" : "--save");
125
- args.push(...dependencies);
115
+ switch (packageManager) {
116
+ case "yarn":
117
+ args = ["add", "--exact"];
118
+ if (!isOnline)
119
+ args.push("--offline");
120
+ args.push("--cwd", root);
121
+ if (devDependencies)
122
+ args.push("--dev");
123
+ args.push(...dependencies);
124
+ break;
125
+ case "npm":
126
+ args = ["install", "--save-exact"];
127
+ args.push(devDependencies ? "--save-dev" : "--save");
128
+ args.push(...dependencies);
129
+ break;
130
+ case "pnpm":
131
+ args = ["add"];
132
+ if (!isOnline)
133
+ args.push("--offline");
134
+ args.push("--save-exact");
135
+ if (devDependencies)
136
+ args.push("-D");
137
+ args.push(...dependencies);
138
+ break;
126
139
  }
127
140
  } else {
128
141
  args = ["install"];
129
- if (useYarn) {
130
- if (!isOnline) {
131
- console.log(import_chalk2.default.yellow("You appear to be offline."));
142
+ if (!isOnline) {
143
+ console.log(import_chalk2.default.yellow("You appear to be offline."));
144
+ if (packageManager === "yarn") {
132
145
  console.log(import_chalk2.default.yellow("Falling back to the local Yarn cache."));
133
- console.log();
134
146
  args.push("--offline");
135
- }
136
- } else {
137
- if (!isOnline) {
138
- console.log(import_chalk2.default.yellow("You appear to be offline."));
147
+ } else {
139
148
  console.log();
140
149
  }
141
150
  }
142
151
  }
143
- if (useYarn) {
144
- args.push(...yarnFlags);
145
- } else {
146
- args.push(...npmFlags);
152
+ switch (packageManager) {
153
+ case "yarn":
154
+ args.push(...yarnFlags);
155
+ break;
156
+ case "npm":
157
+ args.push(...npmFlags);
158
+ break;
159
+ case "pnpm":
160
+ args.push(...pnpmFlags);
161
+ break;
147
162
  }
148
163
  const child = (0, import_cross_spawn.default)(command, args, {
149
164
  stdio: "inherit",
@@ -359,15 +374,16 @@ var run = async () => {
359
374
  let example = opts.example;
360
375
  const res = await (0, import_prompts.default)({
361
376
  message: "Which package manager would you like to use?",
362
- name: "useYarn",
377
+ name: "packageManager",
363
378
  type: "select",
364
379
  choices: [
365
380
  { title: "Yarn", value: "yarn" },
366
- { title: "NPM", value: "npm" }
381
+ { title: "NPM", value: "npm" },
382
+ { title: "pnpm", value: "pnpm" }
367
383
  ]
368
384
  });
369
- const useYarn = res.useYarn === "yarn";
370
- const displayedCommand = useYarn ? "yarn" : "npm";
385
+ const packageManager = res.packageManager;
386
+ const displayedCommand = packageManager;
371
387
  if (!projectName) {
372
388
  const res2 = await (0, import_prompts.default)({
373
389
  name: "name",
@@ -403,7 +419,7 @@ var run = async () => {
403
419
  event: {
404
420
  name: "create-tina-app:invoke",
405
421
  example,
406
- useYarn: Boolean(useYarn)
422
+ useYarn: Boolean(res.packageManager === "yarn")
407
423
  }
408
424
  });
409
425
  const root = import_path4.default.join(process.cwd(), dirName);
@@ -427,7 +443,7 @@ var run = async () => {
427
443
  logText("Installing packages. This might take a couple of minutes.")
428
444
  );
429
445
  console.log();
430
- await install(root, null, { useYarn, isOnline: true });
446
+ await install(root, null, { packageManager, isOnline: true });
431
447
  if (tryGitInit(root)) {
432
448
  console.log(logText("Initializing git repository."));
433
449
  console.log();
@@ -436,7 +452,9 @@ var run = async () => {
436
452
  console.log(import_chalk5.default.bold("\nTo launch your app, run:\n"));
437
453
  console.log(" " + cmdText(`cd ${appName}`));
438
454
  console.log(
439
- ` ${cmdText(`${displayedCommand} ${useYarn ? "" : "run "}dev`)}`
455
+ ` ${cmdText(
456
+ `${displayedCommand} ${packageManager === "npm" ? "run " : ""}dev`
457
+ )}`
440
458
  );
441
459
  console.log();
442
460
  console.log("Next steps:");
@@ -1,11 +1,8 @@
1
- /**
2
-
3
- */
4
1
  interface InstallArgs {
5
2
  /**
6
- * Indicate whether to install packages using Yarn.
3
+ * The package manager to use (yarn, npm, pnpm).
7
4
  */
8
- useYarn: boolean;
5
+ packageManager: 'yarn' | 'npm' | 'pnpm';
9
6
  /**
10
7
  * Indicate whether there is an active Internet connection.
11
8
  */
@@ -16,9 +13,9 @@ interface InstallArgs {
16
13
  devDependencies?: boolean;
17
14
  }
18
15
  /**
19
- * Spawn a package manager installation with either Yarn or NPM.
16
+ * Spawn a package manager installation with Yarn, NPM, or PNPM.
20
17
  *
21
18
  * @returns A Promise that resolves once the installation is finished.
22
19
  */
23
- export declare function install(root: string, dependencies: string[] | null, { useYarn, isOnline, devDependencies }: InstallArgs): Promise<void>;
20
+ export declare function install(root: string, dependencies: string[] | null, { packageManager, isOnline, devDependencies }: InstallArgs): Promise<void>;
24
21
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-tina-app",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist",
@@ -41,7 +41,7 @@
41
41
  "got": "^11.8.5",
42
42
  "prompts": "^2.4.2",
43
43
  "tar": "4.4.18",
44
- "@tinacms/metrics": "1.0.3"
44
+ "@tinacms/metrics": "1.0.4"
45
45
  },
46
46
  "scripts": {
47
47
  "types": "pnpm tsc",