Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug: Don't offer to restore repository with --mode create #1085

Closed
3 tasks done
JoshuaKGoldberg opened this issue Dec 7, 2023 · 0 comments · Fixed by #1793
Closed
3 tasks done

🐛 Bug: Don't offer to restore repository with --mode create #1085

JoshuaKGoldberg opened this issue Dec 7, 2023 · 0 comments · Fixed by #1793
Labels
status: accepting prs Please, send a pull request to resolve this! type: bug Something isn't working :(

Comments

@JoshuaKGoldberg
Copy link
Owner

JoshuaKGoldberg commented Dec 7, 2023

Bug Report Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and found none that matched my issue.

Expected

When running npx create-typescript-app --mode create, if the CLI crashes for some reason, you should get the standard error message + call stack but shouldn't be offered to "restore the repository to how it was". That offer doesn't make sense - the repository never existed to begin with!

Actual

I had a bug in #1000 and got:

│
◇  ❌ Error initializing GitHub repository.
│
Error: Failed initializing GitHub repository
    at withSpinner (file:///Users/josh/repos/create-typescript-app/lib/shared/cli/spinners.js:16:11)
    at async createWithOptions (file:///Users/josh/repos/create-typescript-app/lib/create/createWithOptions.js:43:5)
    at async run (file:///Users/josh/repos/create-typescript-app/lib/create/index.js:31:34)
    at async runOrRestore (file:///Users/josh/repos/create-typescript-app/lib/shared/runOrRestore.js:7:5)
    at async Object.create (file:///Users/josh/repos/create-typescript-app/lib/create/index.js:29:11)
    at async bin (file:///Users/josh/repos/create-typescript-app/lib/bin/index.js:67:36)
    at async file:///Users/josh/repos/create-typescript-app/bin/index.js:4:20 {
  [cause]: RequestError [HttpError]: Not Found
      at /Users/josh/repos/create-typescript-app/node_modules/.pnpm/@[email protected]/node_modules/@octokit/request/dist-node/index.js:112:21
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async requestWithGraphqlErrorHandling (/Users/josh/repos/create-typescript-app/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@octokit/plugin-retry/dist-node/index.js:71:20)
      at async Job.doExecute (/Users/josh/repos/create-typescript-app/node_modules/.pnpm/[email protected]/node_modules/bottleneck/light.js:405:18) {
    status: 404,
    response: {
      url: 'https://api.github.com/repos/OWNER/REPO/labels',
      status: 404,
      headers: [Object],
      data: [Object]
    },
    request: {
      method: 'GET',
      url: 'https://api.github.com/repos/OWNER/REPO/labels',
      headers: [Object],
      request: [Object]
    }
  }
}
│
◆  Do you want to restore the repository to how it was?
│  ● Yes / ○ No
└

Additional Info

No response

@JoshuaKGoldberg JoshuaKGoldberg added type: bug Something isn't working :( status: accepting prs Please, send a pull request to resolve this! labels Dec 7, 2023
JoshuaKGoldberg added a commit that referenced this issue Dec 21, 2024
## PR Checklist

- [x] Addresses an existing open issue: fixes #1085
- [x] That issue was marked as [`status: accepting
prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in
[CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md)
were taken

## Overview

When `mode` is `"create"`, `options.skipRestore` now has an additional
`??` to set it to `true`.

Most of the time spent here is adjusting mocks, since `readOptions`
previously always ran in that mode. Looking forward to the new `create`
engine to make this much more automatic and inferred. 😎

💖
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepting prs Please, send a pull request to resolve this! type: bug Something isn't working :(
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant