create-typescript-app 2.3.0 → 2.4.0

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.
@@ -1,33 +1,28 @@
1
1
  import { z } from "zod";
2
2
  import { base } from "../base.js";
3
- const zApp = z.object({
4
- name: z.string(),
5
- url: z.string()
6
- });
3
+ import { getInstallationSuggestions } from "./getInstallationSuggestions.js";
7
4
  const blockGitHubApps = base.createBlock({
8
5
  about: {
9
6
  name: "GitHub Apps"
10
7
  },
11
8
  addons: {
12
- apps: z.array(zApp).default([])
9
+ apps: z.array(
10
+ z.object({
11
+ name: z.string(),
12
+ url: z.string()
13
+ })
14
+ ).default([])
13
15
  },
14
- produce({ addons }) {
16
+ produce({ addons, options }) {
15
17
  return {
16
- suggestions: addons.apps.length ? [
17
- [
18
- `- enable the GitHub app`,
19
- addons.apps.length === 1 ? "" : "s",
20
- `:
21
- `,
22
- addons.apps.map(printApp).join("\n")
23
- ].join("")
24
- ] : void 0
18
+ suggestions: getInstallationSuggestions(
19
+ "enable the GitHub app",
20
+ addons.apps.map((app) => `${app.name} (${app.url})`),
21
+ `https://github.com/${options.owner}/${options.repository}/settings/installations`
22
+ )
25
23
  };
26
24
  }
27
25
  });
28
- function printApp(app) {
29
- return ` - ${app.name} (${app.url})`;
30
- }
31
26
  export {
32
27
  blockGitHubApps
33
28
  };
@@ -1,33 +1,30 @@
1
1
  import { z } from "zod";
2
2
  import { base } from "../base.js";
3
- const zSecret = z.object({
4
- description: z.string(),
5
- name: z.string()
6
- });
3
+ import { getInstallationSuggestions } from "./getInstallationSuggestions.js";
7
4
  const blockRepositorySecrets = base.createBlock({
8
5
  about: {
9
6
  name: "Repository Secrets"
10
7
  },
11
8
  addons: {
12
- secrets: z.array(zSecret).default([])
9
+ secrets: z.array(
10
+ z.object({
11
+ description: z.string(),
12
+ name: z.string()
13
+ })
14
+ ).default([])
13
15
  },
14
- produce({ addons }) {
16
+ produce({ addons, options }) {
15
17
  return {
16
- suggestions: addons.secrets.length ? [
17
- [
18
- `- populate the secret`,
19
- addons.secrets.length === 1 ? "" : "s",
20
- `:
21
- `,
22
- addons.secrets.map(printSecret).join("\n")
23
- ].join("")
24
- ] : void 0
18
+ suggestions: getInstallationSuggestions(
19
+ "populate the secret",
20
+ addons.secrets.map(
21
+ (secret) => `${secret.name} (${secret.description})`
22
+ ),
23
+ `https://github.com/${options.owner}/${options.repository}/settings/secrets/actions`
24
+ )
25
25
  };
26
26
  }
27
27
  });
28
- function printSecret(app) {
29
- return ` - ${app.name} (${app.description})`;
30
- }
31
28
  export {
32
29
  blockRepositorySecrets
33
30
  };
@@ -0,0 +1,3 @@
1
+ declare function getInstallationSuggestions(description: string, entries: string[], url: string): string[] | undefined;
2
+
3
+ export { getInstallationSuggestions };
@@ -0,0 +1,14 @@
1
+ function getInstallationSuggestions(description, entries, url) {
2
+ return entries.length ? [
3
+ [
4
+ `- ${description}`,
5
+ entries.length === 1 ? "" : "s",
6
+ ` on ${url}:
7
+ `,
8
+ entries.map((entry) => ` - ${entry}`).join("\n")
9
+ ].join("")
10
+ ] : void 0;
11
+ }
12
+ export {
13
+ getInstallationSuggestions
14
+ };
@@ -1,5 +1,5 @@
1
1
  var name = "create-typescript-app";
2
- var version = "2.2.0";
2
+ var version = "2.3.0";
3
3
  var description = "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 🎁";
4
4
  var repository = {
5
5
  type: "git",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-typescript-app",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 🎁",
5
5
  "repository": {
6
6
  "type": "git",