🚀 Feature: Support `yarn create` using Yarn classic for creating a new Backstage app
See original GitHub issue🔖 Feature description
I’d like to propose supporting yarn create
for Yarn classic to create Backstage apps, similar to how it’s done for other products, such as Create React App (yarn create react-app
) and NextJS (yarn create next-app
). Do you see value in this? If yes, I’m happy to open a PR.
🎤 Context
Currently, if I try running yarn create @backstage/app
using Yarn classic, Yarn will recognize that the package is @backstage/create-app
, but will complain that the binary file bin/create-app
is missing:
$ yarn create @backstage/app
yarn create v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "@backstage/create-app@0.4.33" with binaries:
- backstage-create-app
/bin/sh: /home/solimant/.yarn/bin/create-app: No such file or directory
error Command failed.
Exit code: 127
Command: /home/solimant/.yarn/bin/create-app
Arguments:
Directory: /home/solimant/repos
Output:
info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.
This is because Yarn uses the package name to look for the generated target binary, which in this case would be create-app
. However, the binary file is actually called backstage-create-app
, and not create-app
, and so Yarn fails to find it.
✌️ Possible Implementation
If we approach this backwards, a reasonable end goal would be to have a binary under ~/.yarn/bin/
called create-backstage-app
. And because Yarn uses the package name to find the binary file, if we kept the package name the same, then we’d have to have a binary under ~/.yarn/bin/
called create-app
, which is too generic, and may be prone to conflicts with other products. Therefore, this means that we’d have to change the package name to become @backstage/create-backstage-app
instead of just @backstage/create-app
in order for Yarn to look for the binary ~/.yarn/bin/create-backstage-app
and not ~/.yarn/bin/create-app
.
Once that decision is established, everything else becomes a pretty straightforward refactor. That said, the actual folder of the CLI can still remain under packages/create-app
, unless there are reasons why it should match the package name, in which case it would need to move under packages/create-backstage-app
.
The end result would be for the following to be successful:
yarn create @backstage/backstage-app
👀 Have you spent some time to check if this feature request has been raised before?
- I checked and didn’t find similar issue
🏢 Have you read the Code of Conduct?
- I have read the Contributing Guidelines
Are you willing to submit PR?
Yes I am willing to submit a PR!
Issue Analytics
- State:
- Created 10 months ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
Oh so to be clear, it’s now
yarn create backstage-app
. I felt that was just as good as if not better thanyarn create @backstage/app
Thought about this some more and realized there’s a bit of a security issue with the potential for someone to publish a malicious package as
yarn create backstage-app
. I’ve published https://www.npmjs.com/package/create-backstage-app to make sure that doesn’t happen, which of course also happens to solve this! 🎉