create-typescript-app 1.31.0 → 1.33.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 +4 -4
- 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 +10 -4
- 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 +14 -17
- package/lib/create/index.js.map +1 -1
- package/lib/initialize/index.d.ts +1 -2
- package/lib/initialize/index.js +5 -5
- 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 +6 -3
- 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 +21 -5
- package/lib/shared/options/args.js +7 -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 +4 -4
- package/lib/shared/options/augmentOptionsWithExcludes.js.map +1 -1
- package/lib/shared/options/{readOptionDefaults → createOptionDefaults}/index.d.ts +6 -2
- package/lib/shared/options/{readOptionDefaults → createOptionDefaults}/index.js +3 -3
- 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/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 +28 -8
- package/lib/shared/options/optionsSchema.js +7 -2
- package/lib/shared/options/optionsSchema.js.map +1 -1
- package/lib/shared/options/readOptions.d.ts +3 -2
- package/lib/shared/options/readOptions.js +15 -15
- package/lib/shared/options/readOptions.js.map +1 -1
- package/lib/shared/packages.d.ts +2 -0
- package/lib/shared/types.d.ts +41 -9
- 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 -4
- 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 +2 -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 +3 -3
- 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 +10 -1
- 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 +7 -7
- package/lib/steps/writing/creation/dotGitHub/createDotGitHubFiles.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} +9 -86
- 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 +3 -2
- 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 +2 -1
- 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 -6
- 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/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<h1 align="center">Create TypeScript App</h1>
|
|
2
2
|
|
|
3
|
-
<p align="center">Quickstart-friendly TypeScript template with comprehensive
|
|
3
|
+
<p align="center">Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 💝</p>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<a href="#contributors" target="_blank">
|
|
7
7
|
<!-- prettier-ignore-start -->
|
|
8
8
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
9
|
-
<img alt="All Contributors:
|
|
9
|
+
<img alt="All Contributors: 30 👪" src="https://img.shields.io/badge/all_contributors-30_👪-21bb42.svg" />
|
|
10
10
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
11
11
|
<!-- prettier-ignore-end -->
|
|
12
12
|
</a>
|
|
@@ -24,10 +24,14 @@
|
|
|
24
24
|
</a>
|
|
25
25
|
<img alt="Style: Prettier 🧹" src="https://img.shields.io/badge/style-prettier_🧹-21bb42.svg" />
|
|
26
26
|
<img alt="TypeScript: Strict 💪" src="https://img.shields.io/badge/typescript-strict_💪-21bb42.svg" />
|
|
27
|
+
<img alt="npm package version" src="https://img.shields.io/npm/v/create-typescript-app?color=21bb42" />
|
|
27
28
|
</p>
|
|
28
29
|
|
|
29
30
|
<img align="right" alt="Project logo: the TypeScript blue square with rounded corners, but a plus sign instead of 'TS'" src="./create-typescript-app.png">
|
|
30
31
|
|
|
32
|
+
`create-typescript-app` is a one-stop-shop solution to set up a new or existing repository with the latest and greatest TypeScript tooling.
|
|
33
|
+
It includes options not just for building and testing but also GitHub repository templates, contributor recognition, automated release management, and more.
|
|
34
|
+
|
|
31
35
|
## Getting Started
|
|
32
36
|
|
|
33
37
|
First make sure you have the following installed:
|
|
@@ -36,36 +40,31 @@ First make sure you have the following installed:
|
|
|
36
40
|
- [Node.js](https://nodejs.org)
|
|
37
41
|
- [pnpm](https://pnpm.io)
|
|
38
42
|
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
Then in an existing repository or in your directory where you'd like to make a new repository:
|
|
44
|
+
|
|
45
|
+
```shell
|
|
46
|
+
npx create-typescript-app
|
|
47
|
+
```
|
|
41
48
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
- [Migrating an existing repository](./docs/Migration.md): adding this template's tooling on top of an existing repository
|
|
49
|
+
That setup script will walk you through using the template.
|
|
50
|
+
You can read more about the supported setup modes in their docs pages:
|
|
45
51
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
- [**Creating from the terminal**](./docs/Creation.md): creating a new repository locally on the command-line _(recommended)_
|
|
53
|
+
- [**Initializing from the template**](./docs/Initialization.md): creating a new repository with the [_Use this template_](https://github.com/JoshuaKGoldberg/create-typescript-app/generate) button on GitHub
|
|
54
|
+
- [**Migrating an existing repository**](./docs/Migration.md): adding this template's tooling on top of an existing repository
|
|
49
55
|
|
|
50
|
-
|
|
56
|
+
## Documentation
|
|
51
57
|
|
|
52
|
-
|
|
58
|
+
You can read more about `create-typescript-app` and the tooling it supports:
|
|
53
59
|
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
1. [**Tooling**](./docs/Tooling.md): a breakdown of all the pieces this template can set up.
|
|
61
|
+
2. [**Options**](./docs/Options.md): granular options to customize how the template is run.
|
|
62
|
+
3. [**FAQs**](./docs/FAQs.md): frequently asked questions
|
|
56
63
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
- [**pnpm**](https://pnpm.io): Disk-efficient package manager alternative.
|
|
62
|
-
- [**PR Compliance Action**](https://github.com/mtfoley/pr-compliance-action): Checks PRs for compliance such as addressing a linked issue and proper title formatting.
|
|
63
|
-
- [**Prettier**](https://prettier.io): Opinionated formatting for code, run on file save and as a Git commit hook via [husky](https://typicode.github.io/husky) and [lint-staged](https://github.com/okonet/lint-staged).
|
|
64
|
-
- [**release-it**](https://github.com/release-it/release-it): Generates changelogs, bumps the package version, and publishes to GitHub and npm based on [conventional commits](https://www.conventionalcommits.org).
|
|
65
|
-
- [**Renovate**](https://docs.renovatebot.com): Keeps dependencies up-to-date with PRs, configured to wait a few days after each update for safety.
|
|
66
|
-
- [**tsup**](https://tsup.egoist.dev): Builds output definitions and JavaScript files using [esbuild](https://esbuild.github.io).
|
|
67
|
-
- [**TypeScript**](https://typescriptlang.org): A typed superset of JavaScript, configured with strict compiler options.
|
|
68
|
-
- [**Vitest**](https://vitest.dev): Fast unit tests, configured with coverage tracking and [console-fail-test](https://github.com/JoshuaKGoldberg/console-fail-test).
|
|
64
|
+
> [!NOTE]
|
|
65
|
+
> This template is early stage, opinionated, and not endorsed by the TypeScript team.
|
|
66
|
+
> It can be configured to set up a _lot_ of tooling out of the box.
|
|
67
|
+
> If you don't want to use any particular tool, you can always remove it manually.
|
|
69
68
|
|
|
70
69
|
## Development
|
|
71
70
|
|
|
@@ -81,38 +80,42 @@ Thanks! 💖
|
|
|
81
80
|
<table>
|
|
82
81
|
<tbody>
|
|
83
82
|
<tr>
|
|
83
|
+
<td align="center" valign="top" width="14.28%"><a href="https://katt.dev"><img src="https://avatars.githubusercontent.com/u/459267?v=4?s=100" width="100px;" alt="Alex / KATT"/><br /><sub><b>Alex / KATT</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=author%3Akatt" title="Bug reports">🐛</a></td>
|
|
84
84
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/garuna-m6"><img src="https://avatars.githubusercontent.com/u/23234342?v=4?s=100" width="100px;" alt="Anurag"/><br /><sub><b>Anurag</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=garuna-m6" title="Code">💻</a></td>
|
|
85
85
|
<td align="center" valign="top" width="14.28%"><a href="https://conormeagher.com/"><img src="https://avatars.githubusercontent.com/u/363781?v=4?s=100" width="100px;" alt="Conor Meagher"/><br /><sub><b>Conor Meagher</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=conrmahr" title="Code">💻</a></td>
|
|
86
86
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/DanexQ"><img src="https://avatars.githubusercontent.com/u/72567464?v=4?s=100" width="100px;" alt="Daniel"/><br /><sub><b>Daniel</b></sub></a><br /><a href="#infra-DanexQ" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
|
|
87
87
|
<td align="center" valign="top" width="14.28%"><a href="https://roe.dev/"><img src="https://avatars.githubusercontent.com/u/28706372?v=4?s=100" width="100px;" alt="Daniel Roe"/><br /><sub><b>Daniel Roe</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=danielroe" title="Code">💻</a></td>
|
|
88
88
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/nowyDEV"><img src="https://avatars.githubusercontent.com/u/12304307?v=4?s=100" width="100px;" alt="Dominik Nowik"/><br /><sub><b>Dominik Nowik</b></sub></a><br /><a href="#tool-nowyDEV" title="Tools">🔧</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=nowyDEV" title="Code">💻</a></td>
|
|
89
89
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/emday4prez"><img src="https://avatars.githubusercontent.com/u/35363144?v=4?s=100" width="100px;" alt="Emerson"/><br /><sub><b>Emerson</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=emday4prez" title="Code">💻</a></td>
|
|
90
|
-
<td align="center" valign="top" width="14.28%"><a href="https://sinchang.me"><img src="https://avatars.githubusercontent.com/u/3297859?v=4?s=100" width="100px;" alt="Jeff Wen"/><br /><sub><b>Jeff Wen</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=sinchang" title="Code">💻</a></td>
|
|
91
90
|
</tr>
|
|
92
91
|
<tr>
|
|
92
|
+
<td align="center" valign="top" width="14.28%"><a href="https://sinchang.me"><img src="https://avatars.githubusercontent.com/u/3297859?v=4?s=100" width="100px;" alt="Jeff Wen"/><br /><sub><b>Jeff Wen</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=sinchang" title="Code">💻</a></td>
|
|
93
93
|
<td align="center" valign="top" width="14.28%"><a href="https://jessicawilkins.dev/"><img src="https://avatars.githubusercontent.com/u/67210629?v=4?s=100" width="100px;" alt="Jessica Wilkins "/><br /><sub><b>Jessica Wilkins </b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=jdwilkin4" title="Code">💻</a></td>
|
|
94
94
|
<td align="center" valign="top" width="14.28%"><a href="https://typescriptcourse.com/tutorials"><img src="https://avatars.githubusercontent.com/u/3806031?v=4?s=100" width="100px;" alt="Joe Previte"/><br /><sub><b>Joe Previte</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=author%3Ajsjoeio" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=jsjoeio" title="Code">💻</a></td>
|
|
95
|
-
<td align="center" valign="top" width="14.28%"><a href="https://blog.johnnyreilly.com/"><img src="https://avatars.githubusercontent.com/u/1010525?v=4?s=100" width="100px;" alt="John Reilly"/><br /><sub><b>John Reilly</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=johnnyreilly" title="Code">💻</a></td>
|
|
95
|
+
<td align="center" valign="top" width="14.28%"><a href="https://blog.johnnyreilly.com/"><img src="https://avatars.githubusercontent.com/u/1010525?v=4?s=100" width="100px;" alt="John Reilly"/><br /><sub><b>John Reilly</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=johnnyreilly" title="Code">💻</a> <a href="#ideas-johnnyreilly" title="Ideas, Planning, & Feedback">🤔</a></td>
|
|
96
96
|
<td align="center" valign="top" width="14.28%"><a href="http://www.joshuakgoldberg.com"><img src="https://avatars.githubusercontent.com/u/3335181?v=4?s=100" width="100px;" alt="Josh Goldberg"/><br /><sub><b>Josh Goldberg</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=author%3AJoshuaKGoldberg" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=JoshuaKGoldberg" title="Code">💻</a> <a href="#maintenance-JoshuaKGoldberg" title="Maintenance">🚧</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/pulls?q=is%3Apr+reviewed-by%3AJoshuaKGoldberg" title="Reviewed Pull Requests">👀</a> <a href="#tool-JoshuaKGoldberg" title="Tools">🔧</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=JoshuaKGoldberg" title="Documentation">📖</a> <a href="#infra-JoshuaKGoldberg" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=JoshuaKGoldberg" title="Tests">⚠️</a></td>
|
|
97
97
|
<td align="center" valign="top" width="14.28%"><a href="https://twitter.com/Jolg42"><img src="https://avatars.githubusercontent.com/u/1328733?v=4?s=100" width="100px;" alt="Joël Galeran"/><br /><sub><b>Joël Galeran</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=jolg42" title="Code">💻</a></td>
|
|
98
|
-
<td align="center" valign="top" width="14.28%"><a href="https://
|
|
99
|
-
<td align="center" valign="top" width="14.28%"><a href="https://webpro.nl"><img src="https://avatars.githubusercontent.com/u/456426?v=4?s=100" width="100px;" alt="Lars Kappert"/><br /><sub><b>Lars Kappert</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=webpro" title="Code">💻</a></td>
|
|
98
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jaas666"><img src="https://avatars.githubusercontent.com/u/30204147?v=4?s=100" width="100px;" alt="Juan A."/><br /><sub><b>Juan A.</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=jaas666" title="Code">💻</a></td>
|
|
100
99
|
</tr>
|
|
101
100
|
<tr>
|
|
101
|
+
<td align="center" valign="top" width="14.28%"><a href="https://kristo-baricevic.github.io/"><img src="https://avatars.githubusercontent.com/u/108290619?v=4?s=100" width="100px;" alt="Kristo Baricevic"/><br /><sub><b>Kristo Baricevic</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=kristo-baricevic" title="Code">💻</a></td>
|
|
102
|
+
<td align="center" valign="top" width="14.28%"><a href="https://webpro.nl"><img src="https://avatars.githubusercontent.com/u/456426?v=4?s=100" width="100px;" alt="Lars Kappert"/><br /><sub><b>Lars Kappert</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=webpro" title="Code">💻</a></td>
|
|
102
103
|
<td align="center" valign="top" width="14.28%"><a href="https://navinmoorthy.me/"><img src="https://avatars.githubusercontent.com/u/39694575?v=4?s=100" width="100px;" alt="Navin Moorthy"/><br /><sub><b>Navin Moorthy</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=author%3Anavin-moorthy" title="Bug reports">🐛</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=navin-moorthy" title="Code">💻</a></td>
|
|
103
104
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/NazCodeland"><img src="https://avatars.githubusercontent.com/u/113494366?v=4?s=100" width="100px;" alt="NazCodeland"/><br /><sub><b>NazCodeland</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=NazCodeland" title="Code">💻</a></td>
|
|
104
105
|
<td align="center" valign="top" width="14.28%"><a href="https://orta.io"><img src="https://avatars.githubusercontent.com/u/49038?v=4?s=100" width="100px;" alt="Orta Therox"/><br /><sub><b>Orta Therox</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=orta" title="Code">💻</a></td>
|
|
105
106
|
<td align="center" valign="top" width="14.28%"><a href="https://paulisaweso.me/"><img src="https://avatars.githubusercontent.com/u/6335792?v=4?s=100" width="100px;" alt="Paul Esch-Laurent"/><br /><sub><b>Paul Esch-Laurent</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=Pinjasaur" title="Code">💻</a></td>
|
|
106
107
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/promise-dash"><img src="https://avatars.githubusercontent.com/u/86062880?v=4?s=100" width="100px;" alt="Promise Dash"/><br /><sub><b>Promise Dash</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=promise-dash" title="Code">💻</a></td>
|
|
107
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/RebeccaStevens"><img src="https://avatars.githubusercontent.com/u/7224206?v=4?s=100" width="100px;" alt="Rebecca Stevens"/><br /><sub><b>Rebecca Stevens</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=RebeccaStevens" title="Code">💻</a> <a href="#infra-RebeccaStevens" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
|
|
108
|
-
<td align="center" valign="top" width="14.28%"><a href="https://linktr.ee/ronbraha"><img src="https://avatars.githubusercontent.com/u/45559220?v=4?s=100" width="100px;" alt="Ron Braha"/><br /><sub><b>Ron Braha</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=RNR1" title="Code">💻</a> <a href="#design-RNR1" title="Design">🎨</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=RNR1" title="Tests">⚠️</a></td>
|
|
109
108
|
</tr>
|
|
110
109
|
<tr>
|
|
110
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/RebeccaStevens"><img src="https://avatars.githubusercontent.com/u/7224206?v=4?s=100" width="100px;" alt="Rebecca Stevens"/><br /><sub><b>Rebecca Stevens</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=RebeccaStevens" title="Code">💻</a> <a href="#infra-RebeccaStevens" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
|
|
111
|
+
<td align="center" valign="top" width="14.28%"><a href="https://linktr.ee/ronbraha"><img src="https://avatars.githubusercontent.com/u/45559220?v=4?s=100" width="100px;" alt="Ron Braha"/><br /><sub><b>Ron Braha</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=RNR1" title="Code">💻</a> <a href="#design-RNR1" title="Design">🎨</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=RNR1" title="Tests">⚠️</a></td>
|
|
111
112
|
<td align="center" valign="top" width="14.28%"><a href="http://ronjeanfrancois.com"><img src="https://avatars.githubusercontent.com/u/105710107?v=4?s=100" width="100px;" alt="Ron Jean-Francois"/><br /><sub><b>Ron Jean-Francois</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=ronthetech" title="Code">💻</a> <a href="#infra-ronthetech" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
|
|
112
113
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/RuthwikReddy09"><img src="https://avatars.githubusercontent.com/u/126862059?v=4?s=100" width="100px;" alt="Ruthwik"/><br /><sub><b>Ruthwik</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=ruthwikreddy09" title="Code">💻</a></td>
|
|
113
114
|
<td align="center" valign="top" width="14.28%"><a href="https://ryota-murakami.github.io/"><img src="https://avatars.githubusercontent.com/u/5501268?v=4?s=100" width="100px;" alt="Ryota Murakami"/><br /><sub><b>Ryota Murakami</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=ryota-murakami" title="Code">💻</a> <a href="https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=author%3Aryota-murakami" title="Bug reports">🐛</a></td>
|
|
114
115
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/the-lazy-learner"><img src="https://avatars.githubusercontent.com/u/13695177?v=4?s=100" width="100px;" alt="Sudhansu"/><br /><sub><b>Sudhansu</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=the-lazy-learner" title="Code">💻</a></td>
|
|
115
116
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/tungbq"><img src="https://avatars.githubusercontent.com/u/85242618?v=4?s=100" width="100px;" alt="Tung Bui (Leo)"/><br /><sub><b>Tung Bui (Leo)</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=tungbq" title="Code">💻</a></td>
|
|
117
|
+
</tr>
|
|
118
|
+
<tr>
|
|
116
119
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/vasanth9"><img src="https://avatars.githubusercontent.com/u/42891954?v=4?s=100" width="100px;" alt="Vasanth Kumar Cheepurupalli"/><br /><sub><b>Vasanth Kumar Cheepurupalli</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=vasanth9" title="Code">💻</a></td>
|
|
117
120
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/TAKANOME-DEV"><img src="https://avatars.githubusercontent.com/u/79809121?v=4?s=100" width="100px;" alt="takanomedev"/><br /><sub><b>takanomedev</b></sub></a><br /><a href="https://github.com/JoshuaKGoldberg/create-typescript-app/commits?author=TAKANOME-DEV" title="Code">💻</a></td>
|
|
118
121
|
</tr>
|
package/lib/bin/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { initialize } from "../initialize/index.js";
|
|
|
8
8
|
import { migrate } from "../migrate/index.js";
|
|
9
9
|
import { logLine } from "../shared/cli/lines.js";
|
|
10
10
|
import { StatusCodes } from "../shared/codes.js";
|
|
11
|
-
import { promptForMode } from "./
|
|
11
|
+
import { promptForMode } from "./promptForMode.js";
|
|
12
12
|
const operationMessage = (verb) => `Operation ${verb}. Exiting - maybe another time? \u{1F44B}`;
|
|
13
13
|
async function bin(args) {
|
|
14
14
|
console.clear();
|
|
@@ -37,17 +37,17 @@ async function bin(args) {
|
|
|
37
37
|
},
|
|
38
38
|
strict: false
|
|
39
39
|
});
|
|
40
|
-
const mode = await promptForMode(values.mode);
|
|
40
|
+
const { mode, options: promptedOptions } = await promptForMode(values.mode);
|
|
41
41
|
if (typeof mode !== "string") {
|
|
42
42
|
prompts.outro(chalk.red(mode?.message ?? operationMessage("cancelled")));
|
|
43
43
|
return 1;
|
|
44
44
|
}
|
|
45
45
|
const runners = { create, initialize, migrate };
|
|
46
|
-
const { code, error, options } = await runners[mode](args);
|
|
46
|
+
const { code, error, options } = await runners[mode](args, promptedOptions);
|
|
47
47
|
prompts.log.info(
|
|
48
48
|
[
|
|
49
49
|
chalk.italic(`Tip: to run again with the same input values, use:`),
|
|
50
|
-
chalk.blue(createRerunSuggestion(
|
|
50
|
+
chalk.blue(createRerunSuggestion(options))
|
|
51
51
|
].join(" ")
|
|
52
52
|
);
|
|
53
53
|
if (code) {
|
package/lib/bin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bin/index.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\nimport chalk from \"chalk\";\nimport { parseArgs } from \"node:util\";\nimport { fromZodError } from \"zod-validation-error\";\n\nimport { createRerunSuggestion } from \"../create/createRerunSuggestion.js\";\nimport { create } from \"../create/index.js\";\nimport { initialize } from \"../initialize/index.js\";\nimport { migrate } from \"../migrate/index.js\";\nimport { logLine } from \"../shared/cli/lines.js\";\nimport { StatusCodes } from \"../shared/codes.js\";\nimport { promptForMode } from \"./
|
|
1
|
+
{"version":3,"sources":["../../src/bin/index.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\nimport chalk from \"chalk\";\nimport { parseArgs } from \"node:util\";\nimport { fromZodError } from \"zod-validation-error\";\n\nimport { createRerunSuggestion } from \"../create/createRerunSuggestion.js\";\nimport { create } from \"../create/index.js\";\nimport { initialize } from \"../initialize/index.js\";\nimport { migrate } from \"../migrate/index.js\";\nimport { logLine } from \"../shared/cli/lines.js\";\nimport { StatusCodes } from \"../shared/codes.js\";\nimport { promptForMode } from \"./promptForMode.js\";\n\nconst operationMessage = (verb: string) =>\n\t`Operation ${verb}. Exiting - maybe another time? 👋`;\n\nexport async function bin(args: string[]) {\n\tconsole.clear();\n\n\tprompts.intro(\n\t\t[\n\t\t\tchalk.greenBright(`Welcome to`),\n\t\t\tchalk.bgGreenBright.black(`create-typescript-app`),\n\t\t\tchalk.greenBright(`! 🎉`),\n\t\t].join(\" \"),\n\t);\n\n\tlogLine();\n\tlogLine(\n\t\tchalk.yellow(\n\t\t\t\"⚠️ This template is early stage, opinionated, and not endorsed by the TypeScript team. ⚠️\",\n\t\t),\n\t);\n\tlogLine(\n\t\tchalk.yellow(\n\t\t\t\"⚠️ If any tooling it sets displeases you, you can always remove that portion manually. ⚠️\",\n\t\t),\n\t);\n\n\tconst { values } = parseArgs({\n\t\targs,\n\t\toptions: {\n\t\t\tmode: { type: \"string\" },\n\t\t},\n\t\tstrict: false,\n\t});\n\n\tconst { mode, options: promptedOptions } = await promptForMode(values.mode);\n\tif (typeof mode !== \"string\") {\n\t\tprompts.outro(chalk.red(mode?.message ?? operationMessage(\"cancelled\")));\n\t\treturn 1;\n\t}\n\n\tconst runners = { create, initialize, migrate };\n\tconst { code, error, options } = await runners[mode](args, promptedOptions);\n\n\tprompts.log.info(\n\t\t[\n\t\t\tchalk.italic(`Tip: to run again with the same input values, use:`),\n\t\t\tchalk.blue(createRerunSuggestion(options)),\n\t\t].join(\" \"),\n\t);\n\n\tif (code) {\n\t\tlogLine();\n\n\t\tif (error) {\n\t\t\tlogLine(\n\t\t\t\tchalk.red(typeof error === \"string\" ? error : fromZodError(error)),\n\t\t\t);\n\t\t\tlogLine();\n\t\t}\n\n\t\tprompts.cancel(\n\t\t\tcode === StatusCodes.Cancelled\n\t\t\t\t? operationMessage(\"cancelled\")\n\t\t\t\t: operationMessage(\"failed\"),\n\t\t);\n\t}\n\n\treturn code;\n}\n"],"mappings":"AAAA,YAAY,aAAa;AACzB,OAAO,WAAW;AAClB,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAE7B,SAAS,6BAA6B;AACtC,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAE9B,MAAM,mBAAmB,CAAC,SACzB,aAAa,IAAI;AAElB,eAAsB,IAAI,MAAgB;AACzC,UAAQ,MAAM;AAEd,UAAQ;AAAA,IACP;AAAA,MACC,MAAM,YAAY,YAAY;AAAA,MAC9B,MAAM,cAAc,MAAM,uBAAuB;AAAA,MACjD,MAAM,YAAY,aAAM;AAAA,IACzB,EAAE,KAAK,GAAG;AAAA,EACX;AAEA,UAAQ;AACR;AAAA,IACC,MAAM;AAAA,MACL;AAAA,IACD;AAAA,EACD;AACA;AAAA,IACC,MAAM;AAAA,MACL;AAAA,IACD;AAAA,EACD;AAEA,QAAM,EAAE,OAAO,IAAI,UAAU;AAAA,IAC5B;AAAA,IACA,SAAS;AAAA,MACR,MAAM,EAAE,MAAM,SAAS;AAAA,IACxB;AAAA,IACA,QAAQ;AAAA,EACT,CAAC;AAED,QAAM,EAAE,MAAM,SAAS,gBAAgB,IAAI,MAAM,cAAc,OAAO,IAAI;AAC1E,MAAI,OAAO,SAAS,UAAU;AAC7B,YAAQ,MAAM,MAAM,IAAI,MAAM,WAAW,iBAAiB,WAAW,CAAC,CAAC;AACvE,WAAO;AAAA,EACR;AAEA,QAAM,UAAU,EAAE,QAAQ,YAAY,QAAQ;AAC9C,QAAM,EAAE,MAAM,OAAO,QAAQ,IAAI,MAAM,QAAQ,IAAI,EAAE,MAAM,eAAe;AAE1E,UAAQ,IAAI;AAAA,IACX;AAAA,MACC,MAAM,OAAO,oDAAoD;AAAA,MACjE,MAAM,KAAK,sBAAsB,OAAO,CAAC;AAAA,IAC1C,EAAE,KAAK,GAAG;AAAA,EACX;AAEA,MAAI,MAAM;AACT,YAAQ;AAER,QAAI,OAAO;AACV;AAAA,QACC,MAAM,IAAI,OAAO,UAAU,WAAW,QAAQ,aAAa,KAAK,CAAC;AAAA,MAClE;AACA,cAAQ;AAAA,IACT;AAEA,YAAQ;AAAA,MACP,SAAS,YAAY,YAClB,iBAAiB,WAAW,IAC5B,iBAAiB,QAAQ;AAAA,IAC7B;AAAA,EACD;AAEA,SAAO;AACR;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Mode, PromptedOptions } from '../shared/types.js';
|
|
2
|
+
import 'zod';
|
|
3
|
+
import '../shared/codes.js';
|
|
4
|
+
|
|
5
|
+
interface PromptedMode {
|
|
6
|
+
mode: Error | Mode | undefined;
|
|
7
|
+
options?: PromptedOptions;
|
|
8
|
+
}
|
|
9
|
+
declare function promptForMode(input: boolean | string | undefined): Promise<PromptedMode>;
|
|
10
|
+
|
|
11
|
+
export { PromptedMode, promptForMode };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as prompts from "@clack/prompts";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import * as fs from "fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import * as process from "node:process";
|
|
6
|
+
import { logLine } from "../shared/cli/lines.js";
|
|
7
|
+
import { filterPromptCancel } from "../shared/prompts.js";
|
|
8
|
+
const allowedModes = ["create", "initialize", "migrate"];
|
|
9
|
+
function isMode(input) {
|
|
10
|
+
return allowedModes.includes(input);
|
|
11
|
+
}
|
|
12
|
+
function label(base, text) {
|
|
13
|
+
return `${chalk.bold(base)} ${text}`;
|
|
14
|
+
}
|
|
15
|
+
async function promptForMode(input) {
|
|
16
|
+
if (input) {
|
|
17
|
+
if (!isMode(input)) {
|
|
18
|
+
return {
|
|
19
|
+
mode: new Error(
|
|
20
|
+
`Unknown --mode: ${input}. Allowed modes are: ${allowedModes.join(
|
|
21
|
+
", "
|
|
22
|
+
)}.`
|
|
23
|
+
)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return { mode: input };
|
|
27
|
+
}
|
|
28
|
+
const dir = await fs.readdir(".");
|
|
29
|
+
if (dir.length === 0) {
|
|
30
|
+
const mode = filterPromptCancel(
|
|
31
|
+
await prompts.select({
|
|
32
|
+
message: chalk.blue("How would you like to use the template?"),
|
|
33
|
+
options: [
|
|
34
|
+
{
|
|
35
|
+
label: label(
|
|
36
|
+
"create",
|
|
37
|
+
"a new repository in the current empty directory"
|
|
38
|
+
),
|
|
39
|
+
value: "create-current"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: label("create", "a new repository in a new child directory"),
|
|
43
|
+
value: "create-child"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
})
|
|
47
|
+
);
|
|
48
|
+
const directory = path.basename(process.cwd());
|
|
49
|
+
return {
|
|
50
|
+
mode: "create",
|
|
51
|
+
...mode === "create-current" && {
|
|
52
|
+
options: {
|
|
53
|
+
directory: ".",
|
|
54
|
+
repository: directory
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
if (dir.includes(".git")) {
|
|
60
|
+
return {
|
|
61
|
+
mode: filterPromptCancel(
|
|
62
|
+
await prompts.select({
|
|
63
|
+
initialValue: "migrate",
|
|
64
|
+
message: chalk.blue("How would you like to use the template?"),
|
|
65
|
+
options: [
|
|
66
|
+
{
|
|
67
|
+
label: label("create", "a new repository in a child directory"),
|
|
68
|
+
value: "create"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
label: label(
|
|
72
|
+
"initialize",
|
|
73
|
+
"a freshly cloned repository in the current directory"
|
|
74
|
+
),
|
|
75
|
+
value: "initialize"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
label: label(
|
|
79
|
+
"migrate",
|
|
80
|
+
"the existing repository in the current directory"
|
|
81
|
+
),
|
|
82
|
+
value: "migrate"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
})
|
|
86
|
+
)
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
logLine();
|
|
90
|
+
logLine(
|
|
91
|
+
chalk.gray(
|
|
92
|
+
"Defaulting to --mode create because the directory contains children and isn't a Git repository."
|
|
93
|
+
)
|
|
94
|
+
);
|
|
95
|
+
return {
|
|
96
|
+
mode: "create"
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export {
|
|
100
|
+
promptForMode
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=promptForMode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/bin/promptForMode.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\nimport chalk from \"chalk\";\nimport * as fs from \"fs/promises\";\nimport path from \"node:path\";\nimport * as process from \"node:process\";\n\nimport { logLine } from \"../shared/cli/lines.js\";\nimport { filterPromptCancel } from \"../shared/prompts.js\";\nimport { Mode, PromptedOptions } from \"../shared/types.js\";\n\nconst allowedModes = [\"create\", \"initialize\", \"migrate\"] satisfies Mode[];\n\nfunction isMode(input: boolean | string): input is Mode {\n\treturn allowedModes.includes(input as Mode);\n}\n\nfunction label(base: string, text: string) {\n\treturn `${chalk.bold(base)} ${text}`;\n}\n\nexport interface PromptedMode {\n\tmode: Error | Mode | undefined;\n\toptions?: PromptedOptions;\n}\n\nexport async function promptForMode(\n\tinput: boolean | string | undefined,\n): Promise<PromptedMode> {\n\tif (input) {\n\t\tif (!isMode(input)) {\n\t\t\treturn {\n\t\t\t\tmode: new Error(\n\t\t\t\t\t`Unknown --mode: ${input}. Allowed modes are: ${allowedModes.join(\n\t\t\t\t\t\t\", \",\n\t\t\t\t\t)}.`,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\n\t\treturn { mode: input };\n\t}\n\n\tconst dir = await fs.readdir(\".\");\n\n\tif (dir.length === 0) {\n\t\tconst mode = filterPromptCancel(\n\t\t\t(await prompts.select({\n\t\t\t\tmessage: chalk.blue(\"How would you like to use the template?\"),\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: label(\n\t\t\t\t\t\t\t\"create\",\n\t\t\t\t\t\t\t\"a new repository in the current empty directory\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: \"create-current\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: label(\"create\", \"a new repository in a new child directory\"),\n\t\t\t\t\t\tvalue: \"create-child\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t})) as string,\n\t\t);\n\n\t\tconst directory = path.basename(process.cwd());\n\n\t\treturn {\n\t\t\tmode: \"create\",\n\t\t\t...(mode === \"create-current\" && {\n\t\t\t\toptions: {\n\t\t\t\t\tdirectory: \".\",\n\t\t\t\t\trepository: directory,\n\t\t\t\t},\n\t\t\t}),\n\t\t};\n\t}\n\n\tif (dir.includes(\".git\")) {\n\t\treturn {\n\t\t\tmode: filterPromptCancel(\n\t\t\t\t(await prompts.select({\n\t\t\t\t\tinitialValue: \"migrate\" as Mode,\n\t\t\t\t\tmessage: chalk.blue(\"How would you like to use the template?\"),\n\t\t\t\t\toptions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: label(\"create\", \"a new repository in a child directory\"),\n\t\t\t\t\t\t\tvalue: \"create\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: label(\n\t\t\t\t\t\t\t\t\"initialize\",\n\t\t\t\t\t\t\t\t\"a freshly cloned repository in the current directory\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tvalue: \"initialize\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: label(\n\t\t\t\t\t\t\t\t\"migrate\",\n\t\t\t\t\t\t\t\t\"the existing repository in the current directory\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tvalue: \"migrate\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t})) as Mode | symbol,\n\t\t\t),\n\t\t};\n\t}\n\n\tlogLine();\n\tlogLine(\n\t\tchalk.gray(\n\t\t\t\"Defaulting to --mode create because the directory contains children and isn't a Git repository.\",\n\t\t),\n\t);\n\n\treturn {\n\t\tmode: \"create\",\n\t};\n}\n"],"mappings":"AAAA,YAAY,aAAa;AACzB,OAAO,WAAW;AAClB,YAAY,QAAQ;AACpB,OAAO,UAAU;AACjB,YAAY,aAAa;AAEzB,SAAS,eAAe;AACxB,SAAS,0BAA0B;AAGnC,MAAM,eAAe,CAAC,UAAU,cAAc,SAAS;AAEvD,SAAS,OAAO,OAAwC;AACvD,SAAO,aAAa,SAAS,KAAa;AAC3C;AAEA,SAAS,MAAM,MAAc,MAAc;AAC1C,SAAO,GAAG,MAAM,KAAK,IAAI,CAAC,IAAI,IAAI;AACnC;AAOA,eAAsB,cACrB,OACwB;AACxB,MAAI,OAAO;AACV,QAAI,CAAC,OAAO,KAAK,GAAG;AACnB,aAAO;AAAA,QACN,MAAM,IAAI;AAAA,UACT,mBAAmB,KAAK,wBAAwB,aAAa;AAAA,YAC5D;AAAA,UACD,CAAC;AAAA,QACF;AAAA,MACD;AAAA,IACD;AAEA,WAAO,EAAE,MAAM,MAAM;AAAA,EACtB;AAEA,QAAM,MAAM,MAAM,GAAG,QAAQ,GAAG;AAEhC,MAAI,IAAI,WAAW,GAAG;AACrB,UAAM,OAAO;AAAA,MACX,MAAM,QAAQ,OAAO;AAAA,QACrB,SAAS,MAAM,KAAK,yCAAyC;AAAA,QAC7D,SAAS;AAAA,UACR;AAAA,YACC,OAAO;AAAA,cACN;AAAA,cACA;AAAA,YACD;AAAA,YACA,OAAO;AAAA,UACR;AAAA,UACA;AAAA,YACC,OAAO,MAAM,UAAU,2CAA2C;AAAA,YAClE,OAAO;AAAA,UACR;AAAA,QACD;AAAA,MACD,CAAC;AAAA,IACF;AAEA,UAAM,YAAY,KAAK,SAAS,QAAQ,IAAI,CAAC;AAE7C,WAAO;AAAA,MACN,MAAM;AAAA,MACN,GAAI,SAAS,oBAAoB;AAAA,QAChC,SAAS;AAAA,UACR,WAAW;AAAA,UACX,YAAY;AAAA,QACb;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAEA,MAAI,IAAI,SAAS,MAAM,GAAG;AACzB,WAAO;AAAA,MACN,MAAM;AAAA,QACJ,MAAM,QAAQ,OAAO;AAAA,UACrB,cAAc;AAAA,UACd,SAAS,MAAM,KAAK,yCAAyC;AAAA,UAC7D,SAAS;AAAA,YACR;AAAA,cACC,OAAO,MAAM,UAAU,uCAAuC;AAAA,cAC9D,OAAO;AAAA,YACR;AAAA,YACA;AAAA,cACC,OAAO;AAAA,gBACN;AAAA,gBACA;AAAA,cACD;AAAA,cACA,OAAO;AAAA,YACR;AAAA,YACA;AAAA,cACC,OAAO;AAAA,gBACN;AAAA,gBACA;AAAA,cACD;AAAA,cACA,OAAO;AAAA,YACR;AAAA,UACD;AAAA,QACD,CAAC;AAAA,MACF;AAAA,IACD;AAAA,EACD;AAEA,UAAQ;AACR;AAAA,IACC,MAAM;AAAA,MACL;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AAAA,IACN,MAAM;AAAA,EACP;AACD;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { $ } from "execa";
|
|
2
|
+
import * as fs from "node:fs/promises";
|
|
3
|
+
import * as process from "node:process";
|
|
4
|
+
async function createAndEnterGitDirectory(directory) {
|
|
5
|
+
if (directory !== "." && !(await fs.readdir(".")).includes(directory)) {
|
|
6
|
+
await fs.mkdir(directory);
|
|
7
|
+
} else if ((await fs.readdir(directory)).length) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
if (directory !== ".") {
|
|
11
|
+
process.chdir(directory);
|
|
12
|
+
}
|
|
13
|
+
await $`git init -b main`;
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
createAndEnterGitDirectory
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=createAndEnterGitDirectory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/create/createAndEnterGitDirectory.ts"],"sourcesContent":["import { $ } from \"execa\";\nimport * as fs from \"node:fs/promises\";\nimport * as process from \"node:process\";\n\nexport async function createAndEnterGitDirectory(directory: string) {\n\tif (directory !== \".\" && !(await fs.readdir(\".\")).includes(directory)) {\n\t\tawait fs.mkdir(directory);\n\t} else if ((await fs.readdir(directory)).length) {\n\t\treturn false;\n\t}\n\n\tif (directory !== \".\") {\n\t\tprocess.chdir(directory);\n\t}\n\n\tawait $`git init -b main`;\n\n\treturn true;\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAClB,YAAY,QAAQ;AACpB,YAAY,aAAa;AAEzB,eAAsB,2BAA2B,WAAmB;AACnE,MAAI,cAAc,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,GAAG,SAAS,SAAS,GAAG;AACtE,UAAM,GAAG,MAAM,SAAS;AAAA,EACzB,YAAY,MAAM,GAAG,QAAQ,SAAS,GAAG,QAAQ;AAChD,WAAO;AAAA,EACR;AAEA,MAAI,cAAc,KAAK;AACtB,YAAQ,MAAM,SAAS;AAAA,EACxB;AAEA,QAAM;AAEN,SAAO;AACR;","names":[]}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Mode } from '../bin/mode.js';
|
|
2
1
|
import { Options } from '../shared/types.js';
|
|
3
2
|
import 'zod';
|
|
4
3
|
import '../shared/codes.js';
|
|
5
4
|
|
|
6
|
-
declare function createRerunSuggestion(
|
|
5
|
+
declare function createRerunSuggestion(options: Partial<Options>): string;
|
|
7
6
|
|
|
8
7
|
export { createRerunSuggestion };
|
|
@@ -4,7 +4,7 @@ function getFirstMatchingArg(key) {
|
|
|
4
4
|
(arg) => arg.replaceAll("-", "") === key.toLowerCase()
|
|
5
5
|
);
|
|
6
6
|
}
|
|
7
|
-
function createRerunSuggestion(
|
|
7
|
+
function createRerunSuggestion(options) {
|
|
8
8
|
const optionsNormalized = {
|
|
9
9
|
...options,
|
|
10
10
|
...options.email ? {
|
|
@@ -20,10 +20,16 @@ function createRerunSuggestion(mode, options) {
|
|
|
20
20
|
const args = Object.entries(optionsNormalized).sort(
|
|
21
21
|
([a], [b]) => a === "base" ? -1 : b === "base" ? 1 : a.localeCompare(b)
|
|
22
22
|
).filter(([, value]) => !!value).map(([key, value]) => {
|
|
23
|
-
|
|
24
|
-
return `--${getFirstMatchingArg(key)} ${valueStringified.includes(" ") ? `"${value}"` : value}`;
|
|
23
|
+
return `--${getFirstMatchingArg(key)} ${stringifyValue(value)}`;
|
|
25
24
|
}).join(" ");
|
|
26
|
-
return `npx create-typescript-app --mode ${mode} ${args}`;
|
|
25
|
+
return `npx create-typescript-app --mode ${options.mode} ${args}`;
|
|
26
|
+
}
|
|
27
|
+
function stringifyValue(value) {
|
|
28
|
+
if (Array.isArray(value)) {
|
|
29
|
+
return stringifyValue(value.join(" "));
|
|
30
|
+
}
|
|
31
|
+
const valueStringified = `${value}`;
|
|
32
|
+
return valueStringified.includes(" ") ? `"${valueStringified}"` : valueStringified;
|
|
27
33
|
}
|
|
28
34
|
export {
|
|
29
35
|
createRerunSuggestion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/create/createRerunSuggestion.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/create/createRerunSuggestion.ts"],"sourcesContent":["import { allArgOptions } from \"../shared/options/args.js\";\nimport { Options } from \"../shared/types.js\";\n\nfunction getFirstMatchingArg(key: string) {\n\treturn Object.keys(allArgOptions).find(\n\t\t(arg) => arg.replaceAll(\"-\", \"\") === key.toLowerCase(),\n\t);\n}\n\nexport function createRerunSuggestion(options: Partial<Options>): string {\n\tconst optionsNormalized = {\n\t\t...options,\n\t\t...(options.email\n\t\t\t? {\n\t\t\t\t\temail: undefined,\n\t\t\t\t\temailGitHub: options.email.github,\n\t\t\t\t\temailNpm: options.email.npm,\n\t\t\t }\n\t\t\t: { email: undefined }),\n\t\t...(options.logo\n\t\t\t? {\n\t\t\t\t\tlogo: options.logo.src,\n\t\t\t\t\tlogoAlt: options.logo.alt,\n\t\t\t }\n\t\t\t: { logo: undefined }),\n\t};\n\n\tconst args = Object.entries(optionsNormalized)\n\t\t.sort(([a], [b]) =>\n\t\t\ta === \"base\" ? -1 : b === \"base\" ? 1 : a.localeCompare(b),\n\t\t)\n\t\t.filter(([, value]) => !!value)\n\t\t.map(([key, value]) => {\n\t\t\treturn `--${getFirstMatchingArg(key)} ${stringifyValue(value)}`;\n\t\t})\n\t\t.join(\" \");\n\n\treturn `npx create-typescript-app --mode ${options.mode} ${args}`;\n}\n\nfunction stringifyValue(\n\tvalue: boolean | string | string[] | undefined,\n): string {\n\tif (Array.isArray(value)) {\n\t\treturn stringifyValue(value.join(\" \"));\n\t}\n\n\tconst valueStringified = `${value}`;\n\n\treturn valueStringified.includes(\" \")\n\t\t? `\"${valueStringified}\"`\n\t\t: valueStringified;\n}\n"],"mappings":"AAAA,SAAS,qBAAqB;AAG9B,SAAS,oBAAoB,KAAa;AACzC,SAAO,OAAO,KAAK,aAAa,EAAE;AAAA,IACjC,CAAC,QAAQ,IAAI,WAAW,KAAK,EAAE,MAAM,IAAI,YAAY;AAAA,EACtD;AACD;AAEO,SAAS,sBAAsB,SAAmC;AACxE,QAAM,oBAAoB;AAAA,IACzB,GAAG;AAAA,IACH,GAAI,QAAQ,QACT;AAAA,MACA,OAAO;AAAA,MACP,aAAa,QAAQ,MAAM;AAAA,MAC3B,UAAU,QAAQ,MAAM;AAAA,IACxB,IACA,EAAE,OAAO,OAAU;AAAA,IACtB,GAAI,QAAQ,OACT;AAAA,MACA,MAAM,QAAQ,KAAK;AAAA,MACnB,SAAS,QAAQ,KAAK;AAAA,IACtB,IACA,EAAE,MAAM,OAAU;AAAA,EACtB;AAEA,QAAM,OAAO,OAAO,QAAQ,iBAAiB,EAC3C;AAAA,IAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MACb,MAAM,SAAS,KAAK,MAAM,SAAS,IAAI,EAAE,cAAc,CAAC;AAAA,EACzD,EACC,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC,KAAK,EAC7B,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AACtB,WAAO,KAAK,oBAAoB,GAAG,CAAC,IAAI,eAAe,KAAK,CAAC;AAAA,EAC9D,CAAC,EACA,KAAK,GAAG;AAEV,SAAO,oCAAoC,QAAQ,IAAI,IAAI,IAAI;AAChE;AAEA,SAAS,eACR,OACS;AACT,MAAI,MAAM,QAAQ,KAAK,GAAG;AACzB,WAAO,eAAe,MAAM,KAAK,GAAG,CAAC;AAAA,EACtC;AAEA,QAAM,mBAAmB,GAAG,KAAK;AAEjC,SAAO,iBAAiB,SAAS,GAAG,IACjC,IAAI,gBAAgB,MACpB;AACJ;","names":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as prompts from "@clack/prompts";
|
|
2
1
|
import { $ } from "execa";
|
|
3
2
|
import { withSpinner, withSpinners } from "../shared/cli/spinners.js";
|
|
4
3
|
import { doesRepositoryExist } from "../shared/doesRepositoryExist.js";
|
|
@@ -13,7 +12,7 @@ async function createWithOptions({ github, options }) {
|
|
|
13
12
|
[
|
|
14
13
|
"Writing structure",
|
|
15
14
|
async () => {
|
|
16
|
-
await writeStructure(options
|
|
15
|
+
await writeStructure(options);
|
|
17
16
|
}
|
|
18
17
|
],
|
|
19
18
|
[
|
|
@@ -23,9 +22,9 @@ async function createWithOptions({ github, options }) {
|
|
|
23
22
|
}
|
|
24
23
|
]
|
|
25
24
|
]);
|
|
26
|
-
if (!options.
|
|
25
|
+
if (!options.excludeAllContributors && !options.skipAllContributorsApi) {
|
|
27
26
|
await withSpinner("Adding contributors to table", async () => {
|
|
28
|
-
await addToolAllContributors(options
|
|
27
|
+
await addToolAllContributors(options);
|
|
29
28
|
});
|
|
30
29
|
}
|
|
31
30
|
if (!options.skipInstall) {
|
|
@@ -36,12 +35,10 @@ async function createWithOptions({ github, options }) {
|
|
|
36
35
|
}
|
|
37
36
|
await runCommands("Cleaning up files", [
|
|
38
37
|
"pnpm dedupe",
|
|
39
|
-
"pnpm
|
|
40
|
-
"pnpm
|
|
38
|
+
"pnpm lint --fix",
|
|
39
|
+
"pnpm format --write"
|
|
41
40
|
]);
|
|
42
|
-
const sendToGitHub = github && await doesRepositoryExist(github.octokit, options)
|
|
43
|
-
message: "Would you like to push the template's tooling up to the repository on GitHub?"
|
|
44
|
-
}) === true);
|
|
41
|
+
const sendToGitHub = github && await doesRepositoryExist(github.octokit, options);
|
|
45
42
|
if (sendToGitHub) {
|
|
46
43
|
await withSpinner("Initializing GitHub repository", async () => {
|
|
47
44
|
await $`git remote add origin https://github.com/${options.owner}/${options.repository}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/create/createWithOptions.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../src/create/createWithOptions.ts"],"sourcesContent":["import { $ } from \"execa\";\n\nimport { withSpinner, withSpinners } from \"../shared/cli/spinners.js\";\nimport { doesRepositoryExist } from \"../shared/doesRepositoryExist.js\";\nimport { GitHubAndOptions } from \"../shared/options/readOptions.js\";\nimport { addToolAllContributors } from \"../steps/addToolAllContributors.js\";\nimport { finalizeDependencies } from \"../steps/finalizeDependencies.js\";\nimport { initializeGitHubRepository } from \"../steps/initializeGitHubRepository/index.js\";\nimport { runCommands } from \"../steps/runCommands.js\";\nimport { writeReadme } from \"../steps/writeReadme/index.js\";\nimport { writeStructure } from \"../steps/writing/writeStructure.js\";\n\nexport async function createWithOptions({ github, options }: GitHubAndOptions) {\n\tawait withSpinners(\"Creating repository structure\", [\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]);\n\n\tif (!options.excludeAllContributors && !options.skipAllContributorsApi) {\n\t\tawait withSpinner(\"Adding contributors to table\", async () => {\n\t\t\tawait addToolAllContributors(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 dedupe\",\n\t\t\"pnpm lint --fix\",\n\t\t\"pnpm format --write\",\n\t]);\n\n\tconst sendToGitHub =\n\t\tgithub && (await doesRepositoryExist(github.octokit, options));\n\n\tif (sendToGitHub) {\n\t\tawait withSpinner(\"Initializing GitHub repository\", async () => {\n\t\t\tawait $`git remote add origin https://github.com/${options.owner}/${options.repository}`;\n\t\t\tawait $`git add -A`;\n\t\t\tawait $`git commit --message ${\"feat: initialized repo ✨\"}`;\n\t\t\tawait $`git push -u origin main --force`;\n\t\t\tawait initializeGitHubRepository(github.octokit, options);\n\t\t});\n\t}\n\n\treturn { sentToGitHub: sendToGitHub };\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAElB,SAAS,aAAa,oBAAoB;AAC1C,SAAS,2BAA2B;AAEpC,SAAS,8BAA8B;AACvC,SAAS,4BAA4B;AACrC,SAAS,kCAAkC;AAC3C,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAE/B,eAAsB,kBAAkB,EAAE,QAAQ,QAAQ,GAAqB;AAC9E,QAAM,aAAa,iCAAiC;AAAA,IACnD;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,EACD,CAAC;AAED,MAAI,CAAC,QAAQ,0BAA0B,CAAC,QAAQ,wBAAwB;AACvE,UAAM,YAAY,gCAAgC,YAAY;AAC7D,YAAM,uBAAuB,OAAO;AAAA,IACrC,CAAC;AAAA,EACF;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,IACA;AAAA,EACD,CAAC;AAED,QAAM,eACL,UAAW,MAAM,oBAAoB,OAAO,SAAS,OAAO;AAE7D,MAAI,cAAc;AACjB,UAAM,YAAY,kCAAkC,YAAY;AAC/D,YAAM,6CAA6C,QAAQ,KAAK,IAAI,QAAQ,UAAU;AACtF,YAAM;AACN,YAAM,yBAAyB,+BAA0B;AACzD,YAAM;AACN,YAAM,2BAA2B,OAAO,SAAS,OAAO;AAAA,IACzD,CAAC;AAAA,EACF;AAEA,SAAO,EAAE,cAAc,aAAa;AACrC;","names":[]}
|
package/lib/create/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModeRunner } from '../shared/types.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import '../shared/codes.js';
|
|
4
|
-
import '../shared/types.js';
|
|
5
4
|
|
|
6
|
-
declare
|
|
5
|
+
declare const create: ModeRunner;
|
|
7
6
|
|
|
8
7
|
export { create };
|
package/lib/create/index.js
CHANGED
|
@@ -2,13 +2,14 @@ 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,
|
|
@@ -16,11 +17,10 @@ async function create(args) {
|
|
|
16
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
|
};
|