create-typescript-app 1.30.0 → 1.32.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.
- package/README.md +35 -32
- package/lib/bin/index.js +8 -7
- package/lib/bin/index.js.map +1 -1
- package/lib/bin/promptForMode.d.ts +11 -0
- package/lib/bin/promptForMode.js +102 -0
- package/lib/bin/promptForMode.js.map +1 -0
- package/lib/create/createAndEnterGitDirectory.d.ts +3 -0
- package/lib/create/createAndEnterGitDirectory.js +19 -0
- package/lib/create/createAndEnterGitDirectory.js.map +1 -0
- package/lib/create/createRerunSuggestion.d.ts +1 -2
- package/lib/create/createRerunSuggestion.js +18 -5
- package/lib/create/createRerunSuggestion.js.map +1 -1
- package/lib/create/createWithOptions.d.ts +1 -0
- package/lib/create/createWithOptions.js +6 -9
- package/lib/create/createWithOptions.js.map +1 -1
- package/lib/create/index.d.ts +2 -3
- package/lib/create/index.js +16 -19
- package/lib/create/index.js.map +1 -1
- package/lib/initialize/index.d.ts +1 -2
- package/lib/initialize/index.js +7 -7
- package/lib/initialize/index.js.map +1 -1
- package/lib/initialize/initializeWithOptions.d.ts +1 -0
- package/lib/initialize/initializeWithOptions.js +4 -4
- package/lib/initialize/initializeWithOptions.js.map +1 -1
- package/lib/migrate/index.d.ts +1 -2
- package/lib/migrate/index.js +8 -5
- package/lib/migrate/index.js.map +1 -1
- package/lib/migrate/migrateWithOptions.d.ts +1 -0
- package/lib/migrate/migrateWithOptions.js +3 -3
- package/lib/migrate/migrateWithOptions.js.map +1 -1
- package/lib/shared/cli/outro.d.ts +4 -3
- package/lib/shared/cli/outro.js +2 -2
- package/lib/shared/cli/outro.js.map +1 -1
- package/lib/shared/generateNextSteps.d.ts +8 -0
- package/lib/shared/generateNextSteps.js +60 -0
- package/lib/shared/generateNextSteps.js.map +1 -0
- package/lib/shared/getGitHubUserAsAllContributor.d.ts +5 -1
- package/lib/shared/getGitHubUserAsAllContributor.js +11 -3
- package/lib/shared/getGitHubUserAsAllContributor.js.map +1 -1
- package/lib/shared/options/args.d.ts +44 -4
- package/lib/shared/options/args.js +15 -2
- package/lib/shared/options/args.js.map +1 -1
- package/lib/shared/options/augmentOptionsWithExcludes.d.ts +2 -0
- package/lib/shared/options/augmentOptionsWithExcludes.js +33 -3
- package/lib/shared/options/augmentOptionsWithExcludes.js.map +1 -1
- package/lib/shared/options/{readOptionDefaults → createOptionDefaults}/index.d.ts +10 -3
- package/lib/shared/options/{readOptionDefaults → createOptionDefaults}/index.js +14 -9
- package/lib/shared/options/createOptionDefaults/index.js.map +1 -0
- package/lib/shared/options/{readOptionDefaults → createOptionDefaults}/parsePackageAuthor.d.ts +2 -0
- package/lib/shared/options/createOptionDefaults/parsePackageAuthor.js.map +1 -0
- package/lib/shared/options/createOptionDefaults/readDefaultsFromReadme.js.map +1 -0
- package/lib/shared/options/detectEmailRedundancy.d.ts +8 -0
- package/lib/shared/options/detectEmailRedundancy.js +16 -0
- package/lib/shared/options/detectEmailRedundancy.js.map +1 -0
- package/lib/shared/options/ensureRepositoryExists.d.ts +3 -1
- package/lib/shared/options/ensureRepositoryExists.js +2 -1
- package/lib/shared/options/ensureRepositoryExists.js.map +1 -1
- package/lib/shared/options/getPrefillOrPromptedOption.d.ts +1 -1
- package/lib/shared/options/getPrefillOrPromptedOption.js +1 -4
- package/lib/shared/options/getPrefillOrPromptedOption.js.map +1 -1
- package/lib/shared/options/optionsSchema.d.ts +194 -0
- package/lib/shared/options/optionsSchema.js +57 -0
- package/lib/shared/options/optionsSchema.js.map +1 -0
- package/lib/shared/options/readOptions.d.ts +4 -3
- package/lib/shared/options/readOptions.js +46 -58
- package/lib/shared/options/readOptions.js.map +1 -1
- package/lib/shared/packages.d.ts +2 -0
- package/lib/shared/runOrRestore.d.ts +1 -1
- package/lib/shared/types.d.ts +49 -7
- package/lib/steps/addOwnerAsAllContributor.d.ts +5 -1
- package/lib/steps/addOwnerAsAllContributor.js +8 -3
- package/lib/steps/addOwnerAsAllContributor.js.map +1 -1
- package/lib/steps/addToolAllContributors.d.ts +5 -1
- package/lib/steps/addToolAllContributors.js +2 -2
- package/lib/steps/addToolAllContributors.js.map +1 -1
- package/lib/steps/detectExistingContributors.d.ts +2 -0
- package/lib/steps/finalizeDependencies.d.ts +2 -0
- package/lib/steps/finalizeDependencies.js +8 -6
- package/lib/steps/finalizeDependencies.js.map +1 -1
- package/lib/steps/initializeGitHubRepository/index.d.ts +2 -0
- package/lib/steps/initializeGitHubRepository/initializeBranchProtectionSettings.d.ts +2 -0
- package/lib/steps/initializeGitHubRepository/labels/outcomeLabels.js +5 -0
- package/lib/steps/initializeGitHubRepository/labels/outcomeLabels.js.map +1 -1
- package/lib/steps/initializeGitRemote.d.ts +2 -0
- package/lib/steps/initializeRepositorySettings.d.ts +2 -0
- package/lib/steps/uninstallPackages.d.ts +1 -1
- package/lib/steps/uninstallPackages.js +3 -2
- package/lib/steps/uninstallPackages.js.map +1 -1
- package/lib/steps/updateAllContributorsTable.d.ts +2 -0
- package/lib/steps/updateLocalFiles.d.ts +1 -2
- package/lib/steps/updateLocalFiles.js +4 -7
- package/lib/steps/updateLocalFiles.js.map +1 -1
- package/lib/steps/writeReadme/findIntroSectionClose.js +1 -1
- package/lib/steps/writeReadme/findIntroSectionClose.js.map +1 -1
- package/lib/steps/writeReadme/generateTopContent.d.ts +2 -0
- package/lib/steps/writeReadme/generateTopContent.js +17 -2
- package/lib/steps/writeReadme/generateTopContent.js.map +1 -1
- package/lib/steps/writeReadme/index.d.ts +2 -0
- package/lib/steps/writeReadme/index.js +1 -1
- package/lib/steps/writeReadme/index.js.map +1 -1
- package/lib/steps/writing/creation/createESLintRC.d.ts +2 -0
- package/lib/steps/writing/creation/createESLintRC.js +35 -42
- package/lib/steps/writing/creation/createESLintRC.js.map +1 -1
- package/lib/steps/writing/creation/dotGitHub/createDevelopment.d.ts +2 -0
- package/lib/steps/writing/creation/dotGitHub/createDevelopment.js +1 -1
- package/lib/steps/writing/creation/dotGitHub/createDevelopment.js.map +1 -1
- package/lib/steps/writing/creation/dotGitHub/createDotGitHubFiles.d.ts +2 -0
- package/lib/steps/writing/creation/dotGitHub/createDotGitHubFiles.js +9 -9
- package/lib/steps/writing/creation/dotGitHub/createDotGitHubFiles.js.map +1 -1
- package/lib/steps/writing/creation/dotGitHub/createWorkflowFile.d.ts +1 -1
- package/lib/steps/writing/creation/dotGitHub/createWorkflowFile.js.map +1 -1
- package/lib/steps/writing/creation/dotGitHub/{workflows.d.ts → createWorkflows.d.ts} +2 -0
- package/lib/steps/writing/creation/dotGitHub/{workflows.js → createWorkflows.js} +11 -89
- package/lib/steps/writing/creation/dotGitHub/createWorkflows.js.map +1 -0
- package/lib/steps/writing/creation/dotGitHub/index.d.ts +2 -0
- package/lib/steps/writing/creation/dotGitHub/index.js +1 -1
- package/lib/steps/writing/creation/dotGitHub/index.js.map +1 -1
- package/lib/steps/writing/creation/dotGitHub/issueTemplate.d.ts +2 -0
- package/lib/steps/writing/creation/dotVSCode.d.ts +2 -0
- package/lib/steps/writing/creation/index.d.ts +1 -2
- package/lib/steps/writing/creation/index.js +2 -2
- package/lib/steps/writing/creation/index.js.map +1 -1
- package/lib/steps/writing/creation/rootFiles.d.ts +2 -0
- package/lib/steps/writing/creation/rootFiles.js +4 -3
- package/lib/steps/writing/creation/rootFiles.js.map +1 -1
- package/lib/steps/writing/creation/src.d.ts +2 -0
- package/lib/steps/writing/creation/writeAllContributorsRC.d.ts +2 -0
- package/lib/steps/writing/creation/writeAllContributorsRC.js +1 -1
- package/lib/steps/writing/creation/writeAllContributorsRC.js.map +1 -1
- package/lib/steps/writing/creation/writePackageJson.d.ts +2 -0
- package/lib/steps/writing/creation/writePackageJson.js +3 -3
- package/lib/steps/writing/creation/writePackageJson.js.map +1 -1
- package/lib/steps/writing/writeStructure.d.ts +1 -2
- package/lib/steps/writing/writeStructure.js +2 -2
- package/lib/steps/writing/writeStructure.js.map +1 -1
- package/package.json +5 -8
- package/lib/bin/mode.d.ts +0 -14
- package/lib/bin/mode.js +0 -50
- package/lib/bin/mode.js.map +0 -1
- package/lib/create/createAndEnterRepository.d.ts +0 -3
- package/lib/create/createAndEnterRepository.js +0 -15
- package/lib/create/createAndEnterRepository.js.map +0 -1
- package/lib/shared/options/readOptionDefaults/index.js.map +0 -1
- package/lib/shared/options/readOptionDefaults/parsePackageAuthor.js.map +0 -1
- package/lib/shared/options/readOptionDefaults/readDefaultsFromReadme.js.map +0 -1
- package/lib/steps/writing/creation/dotGitHub/workflows.js.map +0 -1
- /package/lib/shared/options/{readOptionDefaults → createOptionDefaults}/parsePackageAuthor.js +0 -0
- /package/lib/shared/options/{readOptionDefaults → createOptionDefaults}/readDefaultsFromReadme.d.ts +0 -0
- /package/lib/shared/options/{readOptionDefaults → createOptionDefaults}/readDefaultsFromReadme.js +0 -0
package/lib/create/index.js
CHANGED
|
@@ -2,25 +2,25 @@ import * as prompts from "@clack/prompts";
|
|
|
2
2
|
import chalk from "chalk";
|
|
3
3
|
import { outro } from "../shared/cli/outro.js";
|
|
4
4
|
import { StatusCodes } from "../shared/codes.js";
|
|
5
|
+
import { generateNextSteps } from "../shared/generateNextSteps.js";
|
|
5
6
|
import { readOptions } from "../shared/options/readOptions.js";
|
|
6
7
|
import { runOrRestore } from "../shared/runOrRestore.js";
|
|
7
|
-
import {
|
|
8
|
+
import { createAndEnterGitDirectory } from "./createAndEnterGitDirectory.js";
|
|
8
9
|
import { createRerunSuggestion } from "./createRerunSuggestion.js";
|
|
9
10
|
import { createWithOptions } from "./createWithOptions.js";
|
|
10
|
-
async
|
|
11
|
-
const inputs = await readOptions(args);
|
|
11
|
+
const create = async (args, promptedOptions) => {
|
|
12
|
+
const inputs = await readOptions(args, "create", promptedOptions);
|
|
12
13
|
if (inputs.cancelled) {
|
|
13
14
|
return {
|
|
14
15
|
code: StatusCodes.Cancelled,
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
error: inputs.error,
|
|
17
|
+
options: inputs.options
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
if (!wat) {
|
|
20
|
+
if (!await createAndEnterGitDirectory(inputs.options.directory)) {
|
|
21
21
|
prompts.outro(
|
|
22
22
|
chalk.red(
|
|
23
|
-
`The ${inputs.options.
|
|
23
|
+
`The ${inputs.options.directory} directory already exists and is not empty. Please clear the directory, run with --mode initialize, or try a different directory.`
|
|
24
24
|
)
|
|
25
25
|
);
|
|
26
26
|
return { code: StatusCodes.Failure, options: inputs.options };
|
|
@@ -29,29 +29,26 @@ async function create(args) {
|
|
|
29
29
|
code: await runOrRestore({
|
|
30
30
|
run: async () => {
|
|
31
31
|
const { sentToGitHub } = await createWithOptions(inputs);
|
|
32
|
+
const nextSteps = generateNextSteps(inputs.options);
|
|
32
33
|
outro(
|
|
33
|
-
sentToGitHub ? [
|
|
34
|
-
{
|
|
35
|
-
label: "Now all you have to do is populate the repository's ACCESS_TOKEN and NPM_TOKEN secrets, and enable the Codecov and Renovate GitHub apps."
|
|
36
|
-
}
|
|
37
|
-
] : [
|
|
34
|
+
sentToGitHub ? nextSteps : [
|
|
38
35
|
{
|
|
39
36
|
label: "Consider creating a GitHub repository from the new directory:",
|
|
40
37
|
lines: [
|
|
41
38
|
`cd ${inputs.options.repository}`,
|
|
42
|
-
createRerunSuggestion(
|
|
39
|
+
createRerunSuggestion({
|
|
43
40
|
...inputs.options,
|
|
41
|
+
mode: "initialize",
|
|
44
42
|
skipGitHubApi: false,
|
|
45
43
|
skipInstall: false
|
|
46
44
|
}),
|
|
47
45
|
`git add -A`,
|
|
48
46
|
`git commit -m "feat: initial commit \u2728"`,
|
|
49
47
|
`git push -u origin main`
|
|
50
|
-
]
|
|
48
|
+
],
|
|
49
|
+
variant: "code"
|
|
51
50
|
},
|
|
52
|
-
|
|
53
|
-
label: "If you do, be sure to populate its ACCESS_TOKEN and NPM_TOKEN secrets, and enable the Codecov and Renovate GitHub apps."
|
|
54
|
-
}
|
|
51
|
+
...nextSteps
|
|
55
52
|
]
|
|
56
53
|
);
|
|
57
54
|
},
|
|
@@ -59,7 +56,7 @@ async function create(args) {
|
|
|
59
56
|
}),
|
|
60
57
|
options: inputs.options
|
|
61
58
|
};
|
|
62
|
-
}
|
|
59
|
+
};
|
|
63
60
|
export {
|
|
64
61
|
create
|
|
65
62
|
};
|
package/lib/create/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/create/index.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\nimport chalk from \"chalk\";\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/create/index.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\nimport chalk from \"chalk\";\n\nimport { outro } from \"../shared/cli/outro.js\";\nimport { StatusCodes } from \"../shared/codes.js\";\nimport { generateNextSteps } from \"../shared/generateNextSteps.js\";\nimport { readOptions } from \"../shared/options/readOptions.js\";\nimport { runOrRestore } from \"../shared/runOrRestore.js\";\nimport { ModeRunner } from \"../shared/types.js\";\nimport { createAndEnterGitDirectory } from \"./createAndEnterGitDirectory.js\";\nimport { createRerunSuggestion } from \"./createRerunSuggestion.js\";\nimport { createWithOptions } from \"./createWithOptions.js\";\n\nexport const create: ModeRunner = async (args, promptedOptions) => {\n\tconst inputs = await readOptions(args, \"create\", promptedOptions);\n\tif (inputs.cancelled) {\n\t\treturn {\n\t\t\tcode: StatusCodes.Cancelled,\n\t\t\terror: inputs.error,\n\t\t\toptions: inputs.options,\n\t\t};\n\t}\n\n\tif (!(await createAndEnterGitDirectory(inputs.options.directory))) {\n\t\tprompts.outro(\n\t\t\tchalk.red(\n\t\t\t\t`The ${inputs.options.directory} directory already exists and is not empty. Please clear the directory, run with --mode initialize, or try a different directory.`,\n\t\t\t),\n\t\t);\n\t\treturn { code: StatusCodes.Failure, options: inputs.options };\n\t}\n\n\treturn {\n\t\tcode: await runOrRestore({\n\t\t\trun: async () => {\n\t\t\t\tconst { sentToGitHub } = await createWithOptions(inputs);\n\t\t\t\tconst nextSteps = generateNextSteps(inputs.options);\n\n\t\t\t\toutro(\n\t\t\t\t\tsentToGitHub\n\t\t\t\t\t\t? nextSteps\n\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tlabel:\n\t\t\t\t\t\t\t\t\t\t\"Consider creating a GitHub repository from the new directory:\",\n\t\t\t\t\t\t\t\t\tlines: [\n\t\t\t\t\t\t\t\t\t\t`cd ${inputs.options.repository}`,\n\t\t\t\t\t\t\t\t\t\tcreateRerunSuggestion({\n\t\t\t\t\t\t\t\t\t\t\t...inputs.options,\n\t\t\t\t\t\t\t\t\t\t\tmode: \"initialize\",\n\t\t\t\t\t\t\t\t\t\t\tskipGitHubApi: false,\n\t\t\t\t\t\t\t\t\t\t\tskipInstall: false,\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t`git add -A`,\n\t\t\t\t\t\t\t\t\t\t`git commit -m \"feat: initial commit ✨\"`,\n\t\t\t\t\t\t\t\t\t\t`git push -u origin main`,\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\tvariant: \"code\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t...nextSteps,\n\t\t\t\t\t\t ],\n\t\t\t\t);\n\t\t\t},\n\t\t\tskipRestore: inputs.options.skipRestore,\n\t\t}),\n\t\toptions: inputs.options,\n\t};\n};\n"],"mappings":"AAAA,YAAY,aAAa;AACzB,OAAO,WAAW;AAElB,SAAS,aAAa;AACtB,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAE7B,SAAS,kCAAkC;AAC3C,SAAS,6BAA6B;AACtC,SAAS,yBAAyB;AAE3B,MAAM,SAAqB,OAAO,MAAM,oBAAoB;AAClE,QAAM,SAAS,MAAM,YAAY,MAAM,UAAU,eAAe;AAChE,MAAI,OAAO,WAAW;AACrB,WAAO;AAAA,MACN,MAAM,YAAY;AAAA,MAClB,OAAO,OAAO;AAAA,MACd,SAAS,OAAO;AAAA,IACjB;AAAA,EACD;AAEA,MAAI,CAAE,MAAM,2BAA2B,OAAO,QAAQ,SAAS,GAAI;AAClE,YAAQ;AAAA,MACP,MAAM;AAAA,QACL,OAAO,OAAO,QAAQ,SAAS;AAAA,MAChC;AAAA,IACD;AACA,WAAO,EAAE,MAAM,YAAY,SAAS,SAAS,OAAO,QAAQ;AAAA,EAC7D;AAEA,SAAO;AAAA,IACN,MAAM,MAAM,aAAa;AAAA,MACxB,KAAK,YAAY;AAChB,cAAM,EAAE,aAAa,IAAI,MAAM,kBAAkB,MAAM;AACvD,cAAM,YAAY,kBAAkB,OAAO,OAAO;AAElD;AAAA,UACC,eACG,YACA;AAAA,YACA;AAAA,cACC,OACC;AAAA,cACD,OAAO;AAAA,gBACN,MAAM,OAAO,QAAQ,UAAU;AAAA,gBAC/B,sBAAsB;AAAA,kBACrB,GAAG,OAAO;AAAA,kBACV,MAAM;AAAA,kBACN,eAAe;AAAA,kBACf,aAAa;AAAA,gBACd,CAAC;AAAA,gBACD;AAAA,gBACA;AAAA,gBACA;AAAA,cACD;AAAA,cACA,SAAS;AAAA,YACV;AAAA,YACA,GAAG;AAAA,UACH;AAAA,QACJ;AAAA,MACD;AAAA,MACA,aAAa,OAAO,QAAQ;AAAA,IAC7B,CAAC;AAAA,IACD,SAAS,OAAO;AAAA,EACjB;AACD;","names":[]}
|
package/lib/initialize/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { outro } from "../shared/cli/outro.js";
|
|
2
2
|
import { StatusCodes } from "../shared/codes.js";
|
|
3
3
|
import { ensureGitRepository } from "../shared/ensureGitRepository.js";
|
|
4
|
+
import { generateNextSteps } from "../shared/generateNextSteps.js";
|
|
4
5
|
import { readOptions } from "../shared/options/readOptions.js";
|
|
5
6
|
import { runOrRestore } from "../shared/runOrRestore.js";
|
|
6
7
|
import { initializeWithOptions } from "./initializeWithOptions.js";
|
|
7
8
|
const initialize = async (args) => {
|
|
8
|
-
const inputs = await readOptions(args);
|
|
9
|
+
const inputs = await readOptions(args, "initialize");
|
|
9
10
|
if (inputs.cancelled) {
|
|
10
11
|
return {
|
|
11
12
|
code: StatusCodes.Cancelled,
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
error: inputs.error,
|
|
14
|
+
options: inputs.options
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
17
|
await ensureGitRepository();
|
|
@@ -25,11 +26,10 @@ const initialize = async (args) => {
|
|
|
25
26
|
`git add -A`,
|
|
26
27
|
`git commit -m "feat: initialized repo \u2728`,
|
|
27
28
|
`git push`
|
|
28
|
-
]
|
|
29
|
+
],
|
|
30
|
+
variant: "code"
|
|
29
31
|
},
|
|
30
|
-
|
|
31
|
-
label: "Otherwise, all you have to do is populate the repository's ACCESS_TOKEN and NPM_TOKEN secrets, and enable the Codecov and Renovate GitHub apps."
|
|
32
|
-
}
|
|
32
|
+
...generateNextSteps(inputs.options)
|
|
33
33
|
]);
|
|
34
34
|
},
|
|
35
35
|
skipRestore: inputs.options.skipRestore
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/initialize/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/initialize/index.ts"],"sourcesContent":["import { outro } from \"../shared/cli/outro.js\";\nimport { StatusCodes } from \"../shared/codes.js\";\nimport { ensureGitRepository } from \"../shared/ensureGitRepository.js\";\nimport { generateNextSteps } from \"../shared/generateNextSteps.js\";\nimport { readOptions } from \"../shared/options/readOptions.js\";\nimport { runOrRestore } from \"../shared/runOrRestore.js\";\nimport { ModeRunner } from \"../shared/types.js\";\nimport { initializeWithOptions } from \"./initializeWithOptions.js\";\n\nexport const initialize: ModeRunner = async (args) => {\n\tconst inputs = await readOptions(args, \"initialize\");\n\tif (inputs.cancelled) {\n\t\treturn {\n\t\t\tcode: StatusCodes.Cancelled,\n\t\t\terror: inputs.error,\n\t\t\toptions: inputs.options,\n\t\t};\n\t}\n\n\tawait ensureGitRepository();\n\n\treturn {\n\t\tcode: await runOrRestore({\n\t\t\trun: async () => {\n\t\t\t\tawait initializeWithOptions(inputs);\n\n\t\t\t\toutro([\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"You may consider committing these changes:\",\n\t\t\t\t\t\tlines: [\n\t\t\t\t\t\t\t`git add -A`,\n\t\t\t\t\t\t\t`git commit -m \"feat: initialized repo ✨`,\n\t\t\t\t\t\t\t`git push`,\n\t\t\t\t\t\t],\n\t\t\t\t\t\tvariant: \"code\",\n\t\t\t\t\t},\n\t\t\t\t\t...generateNextSteps(inputs.options),\n\t\t\t\t]);\n\t\t\t},\n\t\t\tskipRestore: inputs.options.skipRestore,\n\t\t}),\n\t\toptions: inputs.options,\n\t};\n};\n"],"mappings":"AAAA,SAAS,aAAa;AACtB,SAAS,mBAAmB;AAC5B,SAAS,2BAA2B;AACpC,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAE7B,SAAS,6BAA6B;AAE/B,MAAM,aAAyB,OAAO,SAAS;AACrD,QAAM,SAAS,MAAM,YAAY,MAAM,YAAY;AACnD,MAAI,OAAO,WAAW;AACrB,WAAO;AAAA,MACN,MAAM,YAAY;AAAA,MAClB,OAAO,OAAO;AAAA,MACd,SAAS,OAAO;AAAA,IACjB;AAAA,EACD;AAEA,QAAM,oBAAoB;AAE1B,SAAO;AAAA,IACN,MAAM,MAAM,aAAa;AAAA,MACxB,KAAK,YAAY;AAChB,cAAM,sBAAsB,MAAM;AAElC,cAAM;AAAA,UACL;AAAA,YACC,OAAO;AAAA,YACP,OAAO;AAAA,cACN;AAAA,cACA;AAAA,cACA;AAAA,YACD;AAAA,YACA,SAAS;AAAA,UACV;AAAA,UACA,GAAG,kBAAkB,OAAO,OAAO;AAAA,QACpC,CAAC;AAAA,MACF;AAAA,MACA,aAAa,OAAO,QAAQ;AAAA,IAC7B,CAAC;AAAA,IACD,SAAS,OAAO;AAAA,EACjB;AACD;","names":[]}
|
|
@@ -17,7 +17,7 @@ async function initializeWithOptions({
|
|
|
17
17
|
[
|
|
18
18
|
"Updating local files",
|
|
19
19
|
async () => {
|
|
20
|
-
await updateLocalFiles(options
|
|
20
|
+
await updateLocalFiles(options);
|
|
21
21
|
}
|
|
22
22
|
],
|
|
23
23
|
["Updating README.md", updateReadme],
|
|
@@ -30,9 +30,9 @@ async function initializeWithOptions({
|
|
|
30
30
|
],
|
|
31
31
|
["Resetting Git tags", resetGitTags]
|
|
32
32
|
]);
|
|
33
|
-
if (!options.
|
|
33
|
+
if (!options.excludeAllContributors) {
|
|
34
34
|
await withSpinner("Updating existing contributor details", async () => {
|
|
35
|
-
await addOwnerAsAllContributor(options
|
|
35
|
+
await addOwnerAsAllContributor(options);
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
if (github) {
|
|
@@ -46,7 +46,7 @@ async function initializeWithOptions({
|
|
|
46
46
|
if (!options.skipUninstall) {
|
|
47
47
|
await withSpinner(
|
|
48
48
|
"Uninstalling initialization-only packages",
|
|
49
|
-
uninstallPackages
|
|
49
|
+
async () => uninstallPackages(options.offline)
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
await runCommands("Cleaning up files", [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/initialize/initializeWithOptions.ts"],"sourcesContent":["import { withSpinner, withSpinners } from \"../shared/cli/spinners.js\";\nimport { GitHubAndOptions } from \"../shared/options/readOptions.js\";\nimport { addOwnerAsAllContributor } from \"../steps/addOwnerAsAllContributor.js\";\nimport { clearChangelog } from \"../steps/clearChangelog.js\";\nimport { initializeGitHubRepository } from \"../steps/initializeGitHubRepository/index.js\";\nimport { removeSetupScripts } from \"../steps/removeSetupScripts.js\";\nimport { resetGitTags } from \"../steps/resetGitTags.js\";\nimport { runCommands } from \"../steps/runCommands.js\";\nimport { uninstallPackages } from \"../steps/uninstallPackages.js\";\nimport { updateAllContributorsTable } from \"../steps/updateAllContributorsTable.js\";\nimport { updateLocalFiles } from \"../steps/updateLocalFiles.js\";\nimport { updateReadme } from \"../steps/updateReadme.js\";\n\nexport async function initializeWithOptions({\n\tgithub,\n\toptions,\n}: GitHubAndOptions) {\n\tawait withSpinners(\"Initializing local files\", [\n\t\t[\n\t\t\t\"Updating local files\",\n\t\t\tasync () => {\n\t\t\t\tawait updateLocalFiles(options
|
|
1
|
+
{"version":3,"sources":["../../src/initialize/initializeWithOptions.ts"],"sourcesContent":["import { withSpinner, withSpinners } from \"../shared/cli/spinners.js\";\nimport { GitHubAndOptions } from \"../shared/options/readOptions.js\";\nimport { addOwnerAsAllContributor } from \"../steps/addOwnerAsAllContributor.js\";\nimport { clearChangelog } from \"../steps/clearChangelog.js\";\nimport { initializeGitHubRepository } from \"../steps/initializeGitHubRepository/index.js\";\nimport { removeSetupScripts } from \"../steps/removeSetupScripts.js\";\nimport { resetGitTags } from \"../steps/resetGitTags.js\";\nimport { runCommands } from \"../steps/runCommands.js\";\nimport { uninstallPackages } from \"../steps/uninstallPackages.js\";\nimport { updateAllContributorsTable } from \"../steps/updateAllContributorsTable.js\";\nimport { updateLocalFiles } from \"../steps/updateLocalFiles.js\";\nimport { updateReadme } from \"../steps/updateReadme.js\";\n\nexport async function initializeWithOptions({\n\tgithub,\n\toptions,\n}: GitHubAndOptions) {\n\tawait withSpinners(\"Initializing local files\", [\n\t\t[\n\t\t\t\"Updating local files\",\n\t\t\tasync () => {\n\t\t\t\tawait updateLocalFiles(options);\n\t\t\t},\n\t\t],\n\t\t[\"Updating README.md\", updateReadme],\n\t\t[\"Clearing changelog\", clearChangelog],\n\t\t[\n\t\t\t\"Updating all-contributors table\",\n\t\t\tasync () => {\n\t\t\t\tawait updateAllContributorsTable(options);\n\t\t\t},\n\t\t],\n\t\t[\"Resetting Git tags\", resetGitTags],\n\t]);\n\n\tif (!options.excludeAllContributors) {\n\t\tawait withSpinner(\"Updating existing contributor details\", async () => {\n\t\t\tawait addOwnerAsAllContributor(options);\n\t\t});\n\t}\n\n\tif (github) {\n\t\tawait withSpinner(\"Initializing GitHub repository\", async () => {\n\t\t\tawait initializeGitHubRepository(github.octokit, options);\n\t\t});\n\t}\n\n\tif (!options.skipRemoval) {\n\t\tawait withSpinner(\"Removing setup scripts\", removeSetupScripts);\n\t}\n\n\tif (!options.skipUninstall) {\n\t\tawait withSpinner(\"Uninstalling initialization-only packages\", async () =>\n\t\t\tuninstallPackages(options.offline),\n\t\t);\n\t}\n\n\tawait runCommands(\"Cleaning up files\", [\n\t\t\"pnpm lint --fix\",\n\t\t\"pnpm format --write\",\n\t]);\n}\n"],"mappings":"AAAA,SAAS,aAAa,oBAAoB;AAE1C,SAAS,gCAAgC;AACzC,SAAS,sBAAsB;AAC/B,SAAS,kCAAkC;AAC3C,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,kCAAkC;AAC3C,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAE7B,eAAsB,sBAAsB;AAAA,EAC3C;AAAA,EACA;AACD,GAAqB;AACpB,QAAM,aAAa,4BAA4B;AAAA,IAC9C;AAAA,MACC;AAAA,MACA,YAAY;AACX,cAAM,iBAAiB,OAAO;AAAA,MAC/B;AAAA,IACD;AAAA,IACA,CAAC,sBAAsB,YAAY;AAAA,IACnC,CAAC,sBAAsB,cAAc;AAAA,IACrC;AAAA,MACC;AAAA,MACA,YAAY;AACX,cAAM,2BAA2B,OAAO;AAAA,MACzC;AAAA,IACD;AAAA,IACA,CAAC,sBAAsB,YAAY;AAAA,EACpC,CAAC;AAED,MAAI,CAAC,QAAQ,wBAAwB;AACpC,UAAM,YAAY,yCAAyC,YAAY;AACtE,YAAM,yBAAyB,OAAO;AAAA,IACvC,CAAC;AAAA,EACF;AAEA,MAAI,QAAQ;AACX,UAAM,YAAY,kCAAkC,YAAY;AAC/D,YAAM,2BAA2B,OAAO,SAAS,OAAO;AAAA,IACzD,CAAC;AAAA,EACF;AAEA,MAAI,CAAC,QAAQ,aAAa;AACzB,UAAM,YAAY,0BAA0B,kBAAkB;AAAA,EAC/D;AAEA,MAAI,CAAC,QAAQ,eAAe;AAC3B,UAAM;AAAA,MAAY;AAAA,MAA6C,YAC9D,kBAAkB,QAAQ,OAAO;AAAA,IAClC;AAAA,EACD;AAEA,QAAM,YAAY,qBAAqB;AAAA,IACtC;AAAA,IACA;AAAA,EACD,CAAC;AACF;","names":[]}
|
package/lib/migrate/index.d.ts
CHANGED
package/lib/migrate/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { outro } from "../shared/cli/outro.js";
|
|
2
2
|
import { StatusCodes } from "../shared/codes.js";
|
|
3
3
|
import { ensureGitRepository } from "../shared/ensureGitRepository.js";
|
|
4
|
+
import { generateNextSteps } from "../shared/generateNextSteps.js";
|
|
4
5
|
import { readOptions } from "../shared/options/readOptions.js";
|
|
5
6
|
import { runOrRestore } from "../shared/runOrRestore.js";
|
|
6
7
|
import { migrateWithOptions } from "./migrateWithOptions.js";
|
|
7
8
|
const migrate = async (args) => {
|
|
8
|
-
const inputs = await readOptions(args);
|
|
9
|
+
const inputs = await readOptions(args, "migrate");
|
|
9
10
|
if (inputs.cancelled) {
|
|
10
11
|
return {
|
|
11
12
|
code: StatusCodes.Cancelled,
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
error: inputs.error,
|
|
14
|
+
options: inputs.options
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
17
|
await ensureGitRepository();
|
|
@@ -25,8 +26,10 @@ const migrate = async (args) => {
|
|
|
25
26
|
`git add -A`,
|
|
26
27
|
`git commit -m "migrated repo to create-typescript-app \u2728`,
|
|
27
28
|
`git push`
|
|
28
|
-
]
|
|
29
|
-
|
|
29
|
+
],
|
|
30
|
+
variant: "code"
|
|
31
|
+
},
|
|
32
|
+
...generateNextSteps(inputs.options)
|
|
30
33
|
]);
|
|
31
34
|
},
|
|
32
35
|
skipRestore: inputs.options.skipRestore
|
package/lib/migrate/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/migrate/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/migrate/index.ts"],"sourcesContent":["import { outro } from \"../shared/cli/outro.js\";\nimport { StatusCodes } from \"../shared/codes.js\";\nimport { ensureGitRepository } from \"../shared/ensureGitRepository.js\";\nimport { generateNextSteps } from \"../shared/generateNextSteps.js\";\nimport { readOptions } from \"../shared/options/readOptions.js\";\nimport { runOrRestore } from \"../shared/runOrRestore.js\";\nimport { ModeRunner } from \"../shared/types.js\";\nimport { migrateWithOptions } from \"./migrateWithOptions.js\";\n\nexport const migrate: ModeRunner = async (args) => {\n\tconst inputs = await readOptions(args, \"migrate\");\n\tif (inputs.cancelled) {\n\t\treturn {\n\t\t\tcode: StatusCodes.Cancelled,\n\t\t\terror: inputs.error,\n\t\t\toptions: inputs.options,\n\t\t};\n\t}\n\n\tawait ensureGitRepository();\n\n\treturn {\n\t\tcode: await runOrRestore({\n\t\t\trun: async () => {\n\t\t\t\tawait migrateWithOptions(inputs);\n\n\t\t\t\toutro([\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"You may consider committing these changes:\",\n\t\t\t\t\t\tlines: [\n\t\t\t\t\t\t\t`git add -A`,\n\t\t\t\t\t\t\t`git commit -m \"migrated repo to create-typescript-app ✨`,\n\t\t\t\t\t\t\t`git push`,\n\t\t\t\t\t\t],\n\t\t\t\t\t\tvariant: \"code\",\n\t\t\t\t\t},\n\t\t\t\t\t...generateNextSteps(inputs.options),\n\t\t\t\t]);\n\t\t\t},\n\t\t\tskipRestore: inputs.options.skipRestore,\n\t\t}),\n\t\toptions: inputs.options,\n\t};\n};\n"],"mappings":"AAAA,SAAS,aAAa;AACtB,SAAS,mBAAmB;AAC5B,SAAS,2BAA2B;AACpC,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAE7B,SAAS,0BAA0B;AAE5B,MAAM,UAAsB,OAAO,SAAS;AAClD,QAAM,SAAS,MAAM,YAAY,MAAM,SAAS;AAChD,MAAI,OAAO,WAAW;AACrB,WAAO;AAAA,MACN,MAAM,YAAY;AAAA,MAClB,OAAO,OAAO;AAAA,MACd,SAAS,OAAO;AAAA,IACjB;AAAA,EACD;AAEA,QAAM,oBAAoB;AAE1B,SAAO;AAAA,IACN,MAAM,MAAM,aAAa;AAAA,MACxB,KAAK,YAAY;AAChB,cAAM,mBAAmB,MAAM;AAE/B,cAAM;AAAA,UACL;AAAA,YACC,OAAO;AAAA,YACP,OAAO;AAAA,cACN;AAAA,cACA;AAAA,cACA;AAAA,YACD;AAAA,YACA,SAAS;AAAA,UACV;AAAA,UACA,GAAG,kBAAkB,OAAO,OAAO;AAAA,QACpC,CAAC;AAAA,MACF;AAAA,MACA,aAAa,OAAO,QAAQ;AAAA,IAC7B,CAAC;AAAA,IACD,SAAS,OAAO;AAAA,EACjB;AACD;","names":[]}
|
|
@@ -17,7 +17,7 @@ async function migrateWithOptions({
|
|
|
17
17
|
[
|
|
18
18
|
"Writing structure",
|
|
19
19
|
async () => {
|
|
20
|
-
await writeStructure(options
|
|
20
|
+
await writeStructure(options);
|
|
21
21
|
}
|
|
22
22
|
],
|
|
23
23
|
[
|
|
@@ -29,7 +29,7 @@ async function migrateWithOptions({
|
|
|
29
29
|
[
|
|
30
30
|
"Updating local files",
|
|
31
31
|
async () => {
|
|
32
|
-
await updateLocalFiles(options
|
|
32
|
+
await updateLocalFiles(options);
|
|
33
33
|
}
|
|
34
34
|
],
|
|
35
35
|
[
|
|
@@ -44,7 +44,7 @@ async function migrateWithOptions({
|
|
|
44
44
|
await initializeGitHubRepository(github.octokit, options);
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
if (!options.
|
|
47
|
+
if (!options.excludeAllContributors && !options.skipAllContributorsApi) {
|
|
48
48
|
await withSpinner(
|
|
49
49
|
"Detecting existing contributors",
|
|
50
50
|
async () => detectExistingContributors(github?.auth, options)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/migrate/migrateWithOptions.ts"],"sourcesContent":["import { withSpinner, withSpinners } from \"../shared/cli/spinners.js\";\nimport { GitHubAndOptions } from \"../shared/options/readOptions.js\";\nimport { clearUnnecessaryFiles } from \"../steps/clearUnnecessaryFiles.js\";\nimport { detectExistingContributors } from \"../steps/detectExistingContributors.js\";\nimport { finalizeDependencies } from \"../steps/finalizeDependencies.js\";\nimport { initializeGitHubRepository } from \"../steps/initializeGitHubRepository/index.js\";\nimport { runCommands } from \"../steps/runCommands.js\";\nimport { updateAllContributorsTable } from \"../steps/updateAllContributorsTable.js\";\nimport { updateLocalFiles } from \"../steps/updateLocalFiles.js\";\nimport { writeReadme } from \"../steps/writeReadme/index.js\";\nimport { writeStructure } from \"../steps/writing/writeStructure.js\";\n\nexport async function migrateWithOptions({\n\tgithub,\n\toptions,\n}: GitHubAndOptions) {\n\tawait withSpinners(\"Migrating repository structure\", [\n\t\t[\"Clearing unnecessary files\", clearUnnecessaryFiles],\n\t\t[\n\t\t\t\"Writing structure\",\n\t\t\tasync () => {\n\t\t\t\tawait writeStructure(options
|
|
1
|
+
{"version":3,"sources":["../../src/migrate/migrateWithOptions.ts"],"sourcesContent":["import { withSpinner, withSpinners } from \"../shared/cli/spinners.js\";\nimport { GitHubAndOptions } from \"../shared/options/readOptions.js\";\nimport { clearUnnecessaryFiles } from \"../steps/clearUnnecessaryFiles.js\";\nimport { detectExistingContributors } from \"../steps/detectExistingContributors.js\";\nimport { finalizeDependencies } from \"../steps/finalizeDependencies.js\";\nimport { initializeGitHubRepository } from \"../steps/initializeGitHubRepository/index.js\";\nimport { runCommands } from \"../steps/runCommands.js\";\nimport { updateAllContributorsTable } from \"../steps/updateAllContributorsTable.js\";\nimport { updateLocalFiles } from \"../steps/updateLocalFiles.js\";\nimport { writeReadme } from \"../steps/writeReadme/index.js\";\nimport { writeStructure } from \"../steps/writing/writeStructure.js\";\n\nexport async function migrateWithOptions({\n\tgithub,\n\toptions,\n}: GitHubAndOptions) {\n\tawait withSpinners(\"Migrating repository structure\", [\n\t\t[\"Clearing unnecessary files\", clearUnnecessaryFiles],\n\t\t[\n\t\t\t\"Writing structure\",\n\t\t\tasync () => {\n\t\t\t\tawait writeStructure(options);\n\t\t\t},\n\t\t],\n\t\t[\n\t\t\t\"Writing README.md\",\n\t\t\tasync () => {\n\t\t\t\tawait writeReadme(options);\n\t\t\t},\n\t\t],\n\t\t[\n\t\t\t\"Updating local files\",\n\t\t\tasync () => {\n\t\t\t\tawait updateLocalFiles(options);\n\t\t\t},\n\t\t],\n\t\t[\n\t\t\t\"Updating all-contributors table\",\n\t\t\tasync () => {\n\t\t\t\tawait updateAllContributorsTable(options);\n\t\t\t},\n\t\t],\n\t]);\n\n\tif (github) {\n\t\tawait withSpinner(\"Initializing GitHub repository\", async () => {\n\t\t\tawait initializeGitHubRepository(github.octokit, options);\n\t\t});\n\t}\n\n\tif (!options.excludeAllContributors && !options.skipAllContributorsApi) {\n\t\tawait withSpinner(\"Detecting existing contributors\", async () =>\n\t\t\tdetectExistingContributors(github?.auth, options),\n\t\t);\n\t}\n\n\tif (!options.skipInstall) {\n\t\tawait withSpinner(\"Installing packages\", async () =>\n\t\t\tfinalizeDependencies(options),\n\t\t);\n\t}\n\n\tawait runCommands(\"Cleaning up files\", [\n\t\t\"pnpm lint --fix\",\n\t\t\"pnpm format --write\",\n\t]);\n}\n"],"mappings":"AAAA,SAAS,aAAa,oBAAoB;AAE1C,SAAS,6BAA6B;AACtC,SAAS,kCAAkC;AAC3C,SAAS,4BAA4B;AACrC,SAAS,kCAAkC;AAC3C,SAAS,mBAAmB;AAC5B,SAAS,kCAAkC;AAC3C,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAE/B,eAAsB,mBAAmB;AAAA,EACxC;AAAA,EACA;AACD,GAAqB;AACpB,QAAM,aAAa,kCAAkC;AAAA,IACpD,CAAC,8BAA8B,qBAAqB;AAAA,IACpD;AAAA,MACC;AAAA,MACA,YAAY;AACX,cAAM,eAAe,OAAO;AAAA,MAC7B;AAAA,IACD;AAAA,IACA;AAAA,MACC;AAAA,MACA,YAAY;AACX,cAAM,YAAY,OAAO;AAAA,MAC1B;AAAA,IACD;AAAA,IACA;AAAA,MACC;AAAA,MACA,YAAY;AACX,cAAM,iBAAiB,OAAO;AAAA,MAC/B;AAAA,IACD;AAAA,IACA;AAAA,MACC;AAAA,MACA,YAAY;AACX,cAAM,2BAA2B,OAAO;AAAA,MACzC;AAAA,IACD;AAAA,EACD,CAAC;AAED,MAAI,QAAQ;AACX,UAAM,YAAY,kCAAkC,YAAY;AAC/D,YAAM,2BAA2B,OAAO,SAAS,OAAO;AAAA,IACzD,CAAC;AAAA,EACF;AAEA,MAAI,CAAC,QAAQ,0BAA0B,CAAC,QAAQ,wBAAwB;AACvE,UAAM;AAAA,MAAY;AAAA,MAAmC,YACpD,2BAA2B,QAAQ,MAAM,OAAO;AAAA,IACjD;AAAA,EACD;AAEA,MAAI,CAAC,QAAQ,aAAa;AACzB,UAAM;AAAA,MAAY;AAAA,MAAuB,YACxC,qBAAqB,OAAO;AAAA,IAC7B;AAAA,EACD;AAEA,QAAM,YAAY,qBAAqB;AAAA,IACtC;AAAA,IACA;AAAA,EACD,CAAC;AACF;","names":[]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface OutroGroup {
|
|
2
2
|
label: string;
|
|
3
3
|
lines?: string[];
|
|
4
|
+
variant?: "code";
|
|
4
5
|
}
|
|
5
|
-
declare function outro(groups:
|
|
6
|
+
declare function outro(groups: OutroGroup[]): void;
|
|
6
7
|
|
|
7
|
-
export {
|
|
8
|
+
export { OutroGroup, outro };
|
package/lib/shared/cli/outro.js
CHANGED
|
@@ -2,12 +2,12 @@ import * as prompts from "@clack/prompts";
|
|
|
2
2
|
import chalk from "chalk";
|
|
3
3
|
function outro(groups) {
|
|
4
4
|
prompts.outro(chalk.blue(`Great, looks like the script finished! \u{1F389}`));
|
|
5
|
-
for (const { label, lines } of groups) {
|
|
5
|
+
for (const { label, lines, variant } of groups) {
|
|
6
6
|
console.log(chalk.blue(label));
|
|
7
7
|
console.log();
|
|
8
8
|
if (lines) {
|
|
9
9
|
for (const line of lines) {
|
|
10
|
-
console.log(chalk.gray(line));
|
|
10
|
+
console.log(variant === "code" ? chalk.gray(line) : line);
|
|
11
11
|
}
|
|
12
12
|
console.log();
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/shared/cli/outro.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\nimport chalk from \"chalk\";\n\nexport interface
|
|
1
|
+
{"version":3,"sources":["../../../src/shared/cli/outro.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\nimport chalk from \"chalk\";\n\nexport interface OutroGroup {\n\tlabel: string;\n\tlines?: string[];\n\tvariant?: \"code\";\n}\n\nexport function outro(groups: OutroGroup[]) {\n\tprompts.outro(chalk.blue(`Great, looks like the script finished! 🎉`));\n\n\tfor (const { label, lines, variant } of groups) {\n\t\tconsole.log(chalk.blue(label));\n\t\tconsole.log();\n\n\t\tif (lines) {\n\t\t\tfor (const line of lines) {\n\t\t\t\tconsole.log(variant === \"code\" ? chalk.gray(line) : line);\n\t\t\t}\n\n\t\t\tconsole.log();\n\t\t}\n\t}\n\n\tconsole.log(chalk.greenBright(`See ya! 👋`));\n\tconsole.log();\n}\n"],"mappings":"AAAA,YAAY,aAAa;AACzB,OAAO,WAAW;AAQX,SAAS,MAAM,QAAsB;AAC3C,UAAQ,MAAM,MAAM,KAAK,kDAA2C,CAAC;AAErE,aAAW,EAAE,OAAO,OAAO,QAAQ,KAAK,QAAQ;AAC/C,YAAQ,IAAI,MAAM,KAAK,KAAK,CAAC;AAC7B,YAAQ,IAAI;AAEZ,QAAI,OAAO;AACV,iBAAW,QAAQ,OAAO;AACzB,gBAAQ,IAAI,YAAY,SAAS,MAAM,KAAK,IAAI,IAAI,IAAI;AAAA,MACzD;AAEA,cAAQ,IAAI;AAAA,IACb;AAAA,EACD;AAEA,UAAQ,IAAI,MAAM,YAAY,mBAAY,CAAC;AAC3C,UAAQ,IAAI;AACb;","names":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
function generateNextSteps(options) {
|
|
2
|
+
const lines = [
|
|
3
|
+
joinedMessage(
|
|
4
|
+
"enable the",
|
|
5
|
+
[
|
|
6
|
+
options.excludeTests || ["Codecov", "https://github.com/apps/codecov"],
|
|
7
|
+
options.excludeRenovate || [
|
|
8
|
+
"Renovate",
|
|
9
|
+
"https://github.com/apps/renovate"
|
|
10
|
+
]
|
|
11
|
+
],
|
|
12
|
+
"GitHub app"
|
|
13
|
+
),
|
|
14
|
+
joinedMessage(
|
|
15
|
+
"populate the",
|
|
16
|
+
[
|
|
17
|
+
options.excludeAllContributors && options.excludeReleases || [
|
|
18
|
+
"ACCESS_TOKEN",
|
|
19
|
+
"a GitHub PAT with repo and workflow permissions"
|
|
20
|
+
],
|
|
21
|
+
options.excludeReleases || [
|
|
22
|
+
"NPM_TOKEN",
|
|
23
|
+
"an npm access token with automation permissions"
|
|
24
|
+
]
|
|
25
|
+
],
|
|
26
|
+
"secret"
|
|
27
|
+
)
|
|
28
|
+
].filter((line) => !!line);
|
|
29
|
+
switch (lines.length) {
|
|
30
|
+
case 0:
|
|
31
|
+
return [];
|
|
32
|
+
case 1:
|
|
33
|
+
return [{ label: `Be sure to ${lines[0]}` }];
|
|
34
|
+
default:
|
|
35
|
+
return [
|
|
36
|
+
{
|
|
37
|
+
label: "Be sure to:",
|
|
38
|
+
lines: lines.map((line) => `- ${line}`)
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const itemBreak = "\n - ";
|
|
44
|
+
function joinedMessage(prefix, entries, suffix) {
|
|
45
|
+
const realEntries = entries.filter(
|
|
46
|
+
(entry) => entry !== true
|
|
47
|
+
);
|
|
48
|
+
switch (realEntries.length) {
|
|
49
|
+
case 0:
|
|
50
|
+
return void 0;
|
|
51
|
+
case 1:
|
|
52
|
+
return `${prefix} ${realEntries[0][0]} ${suffix} (${realEntries[0][1]}).`;
|
|
53
|
+
default:
|
|
54
|
+
return `${prefix} ${suffix}s: ${itemBreak}${realEntries.map((entry) => `${entry[0]} (${entry[1]})`).join(itemBreak)}`;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
generateNextSteps
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=generateNextSteps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/shared/generateNextSteps.ts"],"sourcesContent":["import { OutroGroup } from \"./cli/outro.js\";\nimport { Options } from \"./types.js\";\n\nexport function generateNextSteps(options: Options): OutroGroup[] {\n\tconst lines = [\n\t\tjoinedMessage(\n\t\t\t\"enable the\",\n\t\t\t[\n\t\t\t\toptions.excludeTests || [\"Codecov\", \"https://github.com/apps/codecov\"],\n\t\t\t\toptions.excludeRenovate || [\n\t\t\t\t\t\"Renovate\",\n\t\t\t\t\t\"https://github.com/apps/renovate\",\n\t\t\t\t],\n\t\t\t],\n\t\t\t\"GitHub app\",\n\t\t),\n\t\tjoinedMessage(\n\t\t\t\"populate the\",\n\t\t\t[\n\t\t\t\t(options.excludeAllContributors && options.excludeReleases) || [\n\t\t\t\t\t\"ACCESS_TOKEN\",\n\t\t\t\t\t\"a GitHub PAT with repo and workflow permissions\",\n\t\t\t\t],\n\t\t\t\toptions.excludeReleases || [\n\t\t\t\t\t\"NPM_TOKEN\",\n\t\t\t\t\t\"an npm access token with automation permissions\",\n\t\t\t\t],\n\t\t\t],\n\t\t\t\"secret\",\n\t\t),\n\t].filter((line): line is string => !!line);\n\n\tswitch (lines.length) {\n\t\tcase 0:\n\t\t\treturn [];\n\t\tcase 1:\n\t\t\treturn [{ label: `Be sure to ${lines[0]}` }];\n\t\tdefault:\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Be sure to:\",\n\t\t\t\t\tlines: lines.map((line) => `- ${line}`),\n\t\t\t\t},\n\t\t\t];\n\t}\n}\n\nconst itemBreak = \"\\n - \";\n\nfunction joinedMessage(\n\tprefix: string,\n\tentries: ([string, string] | true)[],\n\tsuffix: string,\n) {\n\tconst realEntries = entries.filter(\n\t\t(entry): entry is [string, string] => entry !== true,\n\t);\n\n\tswitch (realEntries.length) {\n\t\tcase 0:\n\t\t\treturn undefined;\n\t\tcase 1:\n\t\t\treturn `${prefix} ${realEntries[0][0]} ${suffix} (${realEntries[0][1]}).`;\n\t\tdefault:\n\t\t\treturn `${prefix} ${suffix}s: ${itemBreak}${realEntries\n\t\t\t\t.map((entry) => `${entry[0]} (${entry[1]})`)\n\t\t\t\t.join(itemBreak)}`;\n\t}\n}\n"],"mappings":"AAGO,SAAS,kBAAkB,SAAgC;AACjE,QAAM,QAAQ;AAAA,IACb;AAAA,MACC;AAAA,MACA;AAAA,QACC,QAAQ,gBAAgB,CAAC,WAAW,iCAAiC;AAAA,QACrE,QAAQ,mBAAmB;AAAA,UAC1B;AAAA,UACA;AAAA,QACD;AAAA,MACD;AAAA,MACA;AAAA,IACD;AAAA,IACA;AAAA,MACC;AAAA,MACA;AAAA,QACE,QAAQ,0BAA0B,QAAQ,mBAAoB;AAAA,UAC9D;AAAA,UACA;AAAA,QACD;AAAA,QACA,QAAQ,mBAAmB;AAAA,UAC1B;AAAA,UACA;AAAA,QACD;AAAA,MACD;AAAA,MACA;AAAA,IACD;AAAA,EACD,EAAE,OAAO,CAAC,SAAyB,CAAC,CAAC,IAAI;AAEzC,UAAQ,MAAM,QAAQ;AAAA,IACrB,KAAK;AACJ,aAAO,CAAC;AAAA,IACT,KAAK;AACJ,aAAO,CAAC,EAAE,OAAO,cAAc,MAAM,CAAC,CAAC,GAAG,CAAC;AAAA,IAC5C;AACC,aAAO;AAAA,QACN;AAAA,UACC,OAAO;AAAA,UACP,OAAO,MAAM,IAAI,CAAC,SAAS,KAAK,IAAI,EAAE;AAAA,QACvC;AAAA,MACD;AAAA,EACF;AACD;AAEA,MAAM,YAAY;AAElB,SAAS,cACR,QACA,SACA,QACC;AACD,QAAM,cAAc,QAAQ;AAAA,IAC3B,CAAC,UAAqC,UAAU;AAAA,EACjD;AAEA,UAAQ,YAAY,QAAQ;AAAA,IAC3B,KAAK;AACJ,aAAO;AAAA,IACR,KAAK;AACJ,aAAO,GAAG,MAAM,IAAI,YAAY,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,KAAK,YAAY,CAAC,EAAE,CAAC,CAAC;AAAA,IACtE;AACC,aAAO,GAAG,MAAM,IAAI,MAAM,MAAM,SAAS,GAAG,YAC1C,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,GAAG,EAC1C,KAAK,SAAS,CAAC;AAAA,EACnB;AACD;","names":[]}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { Options } from './types.js';
|
|
2
|
+
import 'zod';
|
|
3
|
+
import './codes.js';
|
|
4
|
+
|
|
5
|
+
declare function getGitHubUserAsAllContributor(options: Pick<Options, "offline" | "owner">): Promise<string>;
|
|
2
6
|
|
|
3
7
|
export { getGitHubUserAsAllContributor };
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import { $ } from "execa";
|
|
3
|
-
async function getGitHubUserAsAllContributor(
|
|
3
|
+
async function getGitHubUserAsAllContributor(options) {
|
|
4
|
+
if (options.offline) {
|
|
5
|
+
console.warn(
|
|
6
|
+
chalk.gray(
|
|
7
|
+
`Skipping populating all-contributors contributions for ${options.owner} because in --offline mode.`
|
|
8
|
+
)
|
|
9
|
+
);
|
|
10
|
+
return options.owner;
|
|
11
|
+
}
|
|
4
12
|
let user;
|
|
5
13
|
try {
|
|
6
14
|
user = JSON.parse((await $`gh api user`).stdout).login;
|
|
7
15
|
} catch {
|
|
8
16
|
console.warn(
|
|
9
17
|
chalk.gray(
|
|
10
|
-
`Couldn't authenticate GitHub user, falling back to the provided owner name '${owner}'.`
|
|
18
|
+
`Couldn't authenticate GitHub user, falling back to the provided owner name '${options.owner}'.`
|
|
11
19
|
)
|
|
12
20
|
);
|
|
13
|
-
user = owner;
|
|
21
|
+
user = options.owner;
|
|
14
22
|
}
|
|
15
23
|
const contributions = [
|
|
16
24
|
"code",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/shared/getGitHubUserAsAllContributor.ts"],"sourcesContent":["import chalk from \"chalk\";\nimport { $ } from \"execa\";\n\ninterface GhUserOutput {\n\tlogin: string;\n}\n\nexport async function getGitHubUserAsAllContributor(
|
|
1
|
+
{"version":3,"sources":["../../src/shared/getGitHubUserAsAllContributor.ts"],"sourcesContent":["import chalk from \"chalk\";\nimport { $ } from \"execa\";\n\nimport { Options } from \"./types.js\";\n\ninterface GhUserOutput {\n\tlogin: string;\n}\n\nexport async function getGitHubUserAsAllContributor(\n\toptions: Pick<Options, \"offline\" | \"owner\">,\n) {\n\tif (options.offline) {\n\t\tconsole.warn(\n\t\t\tchalk.gray(\n\t\t\t\t`Skipping populating all-contributors contributions for ${options.owner} because in --offline mode.`,\n\t\t\t),\n\t\t);\n\t\treturn options.owner;\n\t}\n\n\tlet user: string;\n\n\ttry {\n\t\tuser = (JSON.parse((await $`gh api user`).stdout) as GhUserOutput).login;\n\t} catch {\n\t\tconsole.warn(\n\t\t\tchalk.gray(\n\t\t\t\t`Couldn't authenticate GitHub user, falling back to the provided owner name '${options.owner}'.`,\n\t\t\t),\n\t\t);\n\t\tuser = options.owner;\n\t}\n\n\tconst contributions = [\n\t\t\"code\",\n\t\t\"content\",\n\t\t\"doc\",\n\t\t\"ideas\",\n\t\t\"infra\",\n\t\t\"maintenance\",\n\t\t\"projectManagement\",\n\t\t\"tool\",\n\t].join(\",\");\n\tawait $`npx -y all-contributors-cli@6.25 add ${user} ${contributions}`;\n\n\treturn user;\n}\n"],"mappings":"AAAA,OAAO,WAAW;AAClB,SAAS,SAAS;AAQlB,eAAsB,8BACrB,SACC;AACD,MAAI,QAAQ,SAAS;AACpB,YAAQ;AAAA,MACP,MAAM;AAAA,QACL,0DAA0D,QAAQ,KAAK;AAAA,MACxE;AAAA,IACD;AACA,WAAO,QAAQ;AAAA,EAChB;AAEA,MAAI;AAEJ,MAAI;AACH,WAAQ,KAAK,OAAO,MAAM,gBAAgB,MAAM,EAAmB;AAAA,EACpE,QAAQ;AACP,YAAQ;AAAA,MACP,MAAM;AAAA,QACL,+EAA+E,QAAQ,KAAK;AAAA,MAC7F;AAAA,IACD;AACA,WAAO,QAAQ;AAAA,EAChB;AAEA,QAAM,gBAAgB;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,EAAE,KAAK,GAAG;AACV,QAAM,yCAAyC,IAAI,IAAI,aAAa;AAEpE,SAAO;AACR;","names":[]}
|
|
@@ -1,23 +1,41 @@
|
|
|
1
1
|
declare const allArgOptions: {
|
|
2
|
+
readonly access: {
|
|
3
|
+
readonly type: "string";
|
|
4
|
+
};
|
|
2
5
|
readonly author: {
|
|
3
6
|
readonly type: "string";
|
|
4
7
|
};
|
|
5
8
|
readonly base: {
|
|
6
9
|
readonly type: "string";
|
|
7
10
|
};
|
|
8
|
-
readonly "create-repository": {
|
|
9
|
-
readonly type: "boolean";
|
|
10
|
-
};
|
|
11
11
|
readonly description: {
|
|
12
12
|
readonly type: "string";
|
|
13
13
|
};
|
|
14
|
+
readonly directory: {
|
|
15
|
+
readonly type: "string";
|
|
16
|
+
};
|
|
14
17
|
readonly email: {
|
|
15
18
|
readonly type: "string";
|
|
16
19
|
};
|
|
20
|
+
readonly "email-github": {
|
|
21
|
+
readonly type: "string";
|
|
22
|
+
};
|
|
23
|
+
readonly "email-npm": {
|
|
24
|
+
readonly type: "string";
|
|
25
|
+
};
|
|
26
|
+
readonly "exclude-all-contributors": {
|
|
27
|
+
readonly type: "boolean";
|
|
28
|
+
};
|
|
17
29
|
readonly "exclude-compliance": {
|
|
18
30
|
readonly type: "boolean";
|
|
19
31
|
};
|
|
20
|
-
readonly "exclude-
|
|
32
|
+
readonly "exclude-lint-deprecation": {
|
|
33
|
+
readonly type: "boolean";
|
|
34
|
+
};
|
|
35
|
+
readonly "exclude-lint-eslint": {
|
|
36
|
+
readonly type: "boolean";
|
|
37
|
+
};
|
|
38
|
+
readonly "exclude-lint-jsdoc": {
|
|
21
39
|
readonly type: "boolean";
|
|
22
40
|
};
|
|
23
41
|
readonly "exclude-lint-json": {
|
|
@@ -38,9 +56,18 @@ declare const allArgOptions: {
|
|
|
38
56
|
readonly "exclude-lint-perfectionist": {
|
|
39
57
|
readonly type: "boolean";
|
|
40
58
|
};
|
|
59
|
+
readonly "exclude-lint-regex": {
|
|
60
|
+
readonly type: "boolean";
|
|
61
|
+
};
|
|
41
62
|
readonly "exclude-lint-spelling": {
|
|
42
63
|
readonly type: "boolean";
|
|
43
64
|
};
|
|
65
|
+
readonly "exclude-lint-strict": {
|
|
66
|
+
readonly type: "boolean";
|
|
67
|
+
};
|
|
68
|
+
readonly "exclude-lint-stylistic": {
|
|
69
|
+
readonly type: "boolean";
|
|
70
|
+
};
|
|
44
71
|
readonly "exclude-lint-yml": {
|
|
45
72
|
readonly type: "boolean";
|
|
46
73
|
};
|
|
@@ -56,18 +83,31 @@ declare const allArgOptions: {
|
|
|
56
83
|
readonly funding: {
|
|
57
84
|
readonly type: "string";
|
|
58
85
|
};
|
|
86
|
+
readonly keywords: {
|
|
87
|
+
readonly multiple: true;
|
|
88
|
+
readonly type: "string";
|
|
89
|
+
};
|
|
59
90
|
readonly logo: {
|
|
60
91
|
readonly type: "string";
|
|
61
92
|
};
|
|
62
93
|
readonly "logo-alt": {
|
|
63
94
|
readonly type: "string";
|
|
64
95
|
};
|
|
96
|
+
readonly mode: {
|
|
97
|
+
readonly type: "string";
|
|
98
|
+
};
|
|
99
|
+
readonly offline: {
|
|
100
|
+
readonly type: "boolean";
|
|
101
|
+
};
|
|
65
102
|
readonly owner: {
|
|
66
103
|
readonly type: "string";
|
|
67
104
|
};
|
|
68
105
|
readonly repository: {
|
|
69
106
|
readonly type: "string";
|
|
70
107
|
};
|
|
108
|
+
readonly "skip-all-contributors-api": {
|
|
109
|
+
readonly type: "boolean";
|
|
110
|
+
};
|
|
71
111
|
readonly "skip-github-api": {
|
|
72
112
|
readonly type: "boolean";
|
|
73
113
|
};
|