create-tina-app 1.3.2 → 1.3.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,2 +1,9 @@
1
- export declare const PKG_MANAGERS: string[];
1
+ /**
2
+ * The available package managers a user can use.
3
+ * To add a new supported package manager, add the usage command to this list.
4
+ * The `PackageManager` type will be automatically updated as a result.
5
+ */
6
+ declare const PKG_MANAGERS: readonly ["npm", "yarn", "pnpm", "bun"];
7
+ export type PackageManager = (typeof PKG_MANAGERS)[number];
2
8
  export declare function run(): Promise<void>;
9
+ export {};
package/dist/index.js CHANGED
@@ -29,7 +29,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  // src/index.ts
30
30
  var index_exports = {};
31
31
  __export(index_exports, {
32
- PKG_MANAGERS: () => PKG_MANAGERS,
33
32
  run: () => run
34
33
  });
35
34
  module.exports = __toCommonJS(index_exports);
@@ -40,7 +39,7 @@ var import_node_path = __toESM(require("path"));
40
39
 
41
40
  // package.json
42
41
  var name = "create-tina-app";
43
- var version = "1.3.2";
42
+ var version = "1.3.4";
44
43
 
45
44
  // src/util/fileUtil.ts
46
45
  var import_fs_extra = __toESM(require("fs-extra"));
@@ -157,63 +156,15 @@ function updateProjectPackageVersion(dir, version2) {
157
156
 
158
157
  // src/util/install.ts
159
158
  var import_cross_spawn = __toESM(require("cross-spawn"));
160
- function install(root, dependencies, { packageManager, isOnline, devDependencies }) {
161
- const npmFlags = [];
162
- const yarnFlags = [];
163
- const pnpmFlags = [];
159
+ function install(packageManager) {
164
160
  return new Promise((resolve, reject) => {
165
- let args;
166
- const command = packageManager;
167
- if (dependencies == null ? void 0 : dependencies.length) {
168
- switch (packageManager) {
169
- case "yarn":
170
- args = ["add", "--exact"];
171
- if (!isOnline) args.push("--offline");
172
- args.push("--cwd", root);
173
- if (devDependencies) args.push("--dev");
174
- args.push(...dependencies);
175
- break;
176
- case "npm":
177
- args = ["install", "--save-exact"];
178
- args.push(devDependencies ? "--save-dev" : "--save");
179
- args.push(...dependencies);
180
- break;
181
- case "pnpm":
182
- args = ["add"];
183
- if (!isOnline) args.push("--offline");
184
- args.push("--save-exact");
185
- if (devDependencies) args.push("-D");
186
- args.push(...dependencies);
187
- break;
188
- }
189
- } else {
190
- args = ["install"];
191
- if (!isOnline) {
192
- log.warn("You appear to be offline.");
193
- if (packageManager === "yarn") {
194
- log.warn("Falling back to the local Yarn cache.");
195
- args.push("--offline");
196
- }
197
- }
198
- }
199
- switch (packageManager) {
200
- case "yarn":
201
- args.push(...yarnFlags);
202
- break;
203
- case "npm":
204
- args.push(...npmFlags);
205
- break;
206
- case "pnpm":
207
- args.push(...pnpmFlags);
208
- break;
209
- }
210
- const child = (0, import_cross_spawn.default)(command, args, {
161
+ const child = (0, import_cross_spawn.default)(packageManager, ["install"], {
211
162
  stdio: "inherit",
212
163
  env: { ...process.env, ADBLOCK: "1", DISABLE_OPENCOLLECTIVE: "1" }
213
164
  });
214
165
  child.on("close", (code) => {
215
166
  if (code !== 0) {
216
- reject({ command: `${command} ${args.join(" ")}` });
167
+ reject({ command: `${packageManager} install` });
217
168
  return;
218
169
  }
219
170
  resolve();
@@ -436,7 +387,7 @@ async function checkPackageExists(name2) {
436
387
  // src/index.ts
437
388
  var import_node_process = require("process");
438
389
  var import_validate_npm_package_name = __toESM(require("validate-npm-package-name"));
439
- var PKG_MANAGERS = ["npm", "yarn", "pnpm"];
390
+ var PKG_MANAGERS = ["npm", "yarn", "pnpm", "bun"];
440
391
  async function run() {
441
392
  preRunChecks();
442
393
  let projectName = "";
@@ -557,7 +508,7 @@ async function run() {
557
508
  (0, import_node_process.exit)(1);
558
509
  }
559
510
  log.info("Installing packages.");
560
- await install(rootDir, null, { packageManager: pkgManager, isOnline: true });
511
+ await install(pkgManager);
561
512
  log.info("Initializing git repository.");
562
513
  try {
563
514
  if (initializeGit()) {
@@ -568,6 +519,10 @@ async function run() {
568
519
  log.err("Failed to initialize Git repository, skipping.");
569
520
  }
570
521
  log.success("Starter successfully created!");
522
+ if (template.value === "tina-hugo-starter")
523
+ log.warn(
524
+ `Hugo is required for this starter. Install it via ${TextStyles.link("https://gohugo.io/installation/")}.`
525
+ );
571
526
  log.log(TextStyles.bold("\nTo launch your app, run:\n"));
572
527
  log.cmd(`cd ${appName}
573
528
  ${pkgManager} run dev`);
@@ -588,6 +543,5 @@ Next steps:
588
543
  run();
589
544
  // Annotate the CommonJS export names for ESM import in node:
590
545
  0 && (module.exports = {
591
- PKG_MANAGERS,
592
546
  run
593
547
  });
@@ -1,2 +1,2 @@
1
- import { PKG_MANAGERS } from '..';
2
- export declare function checkPackageExists(name: (typeof PKG_MANAGERS)[number]): Promise<boolean>;
1
+ import { PackageManager } from '..';
2
+ export declare function checkPackageExists(name: PackageManager): Promise<boolean>;
@@ -1,21 +1,7 @@
1
- interface InstallArgs {
2
- /**
3
- * The package manager to use (yarn, npm, pnpm).
4
- */
5
- packageManager: 'yarn' | 'npm' | 'pnpm';
6
- /**
7
- * Indicate whether there is an active Internet connection.
8
- */
9
- isOnline: boolean;
10
- /**
11
- * Indicate whether the given dependencies are devDependencies.
12
- */
13
- devDependencies?: boolean;
14
- }
1
+ import { PackageManager } from '..';
15
2
  /**
16
- * Spawn a package manager installation with Yarn, NPM, or PNPM.
3
+ * Spawn a package manager installation.
17
4
  *
18
5
  * @returns A Promise that resolves once the installation is finished.
19
6
  */
20
- export declare function install(root: string, dependencies: string[] | null, { packageManager, isOnline, devDependencies }: InstallArgs): Promise<void>;
21
- export {};
7
+ export declare function install(packageManager: PackageManager): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-tina-app",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist",
@@ -35,7 +35,7 @@
35
35
  "@types/prompts": "^2.4.9",
36
36
  "@types/tar": "6.1.13",
37
37
  "typescript": "^5.7.3",
38
- "@tinacms/scripts": "1.3.2"
38
+ "@tinacms/scripts": "1.3.4"
39
39
  },
40
40
  "dependencies": {
41
41
  "chalk": "4.1.2",