-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor: Move @backstage/cli create-app to separate package #1745
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Sorry about the slow review 馃槄
Definitely agree we need a common place to put some of the modules in the CLI. Some of the stuff is needed in other places too, like the backend and config-loader. Completely fine with having the duplicated code for now and dealing with it in a followup.
Regarding the template the idea as to download it from git, but tbh I think we should just put it in a templates/
folder like in the CLI, and think about downloading it later. The main use-case for downloading is to be able to point to multiple different templates, and we don't have that 馃榿
I think the e2e tests can stay in the CLI, they're testing many different parts of the repo, but mostly related to the CLI.
"commander": "^4.1.1", | ||
"chalk": "^4.0.0", | ||
"fs-extra": "^9.0.0", | ||
"react-dev-utils": "^10.2.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can get rid of this right? Afaik it's only used in the bundling parts of the cli.
packages/create-app/src/createApp.ts
Outdated
@@ -107,7 +107,7 @@ export default async (cmd: Command): Promise<void> => { | |||
]; | |||
const answers: Answers = await inquirer.prompt(questions); | |||
|
|||
const templateDir = paths.resolveOwn('templates/default-app'); | |||
const templateDir = paths.resolveOwnRoot('packages/cli/templates/default-app'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this won't be available when running via npx
, as it assumes this monorepo layout we'll be executed as a package in node_modules
. I'd say just move over the default-app
template to this package instead. It does create a problem with the dependency on the template in app:diff
, but tbh I think we can remove that for now as it isn't very useful in its current form anyway.
return resolvePath(ownDir, '../..'); | ||
} | ||
|
||
export function findPaths(): Paths { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Planning to move this entire util and file to a separate package, so let's duplicate this for now and deal with it later.
} | ||
} | ||
|
||
export async function templatingTask( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be sure to find a common place for these things too 馃榿
e7a9f2a
to
489a57b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's time to promote this to a proper PR 馃槑
Best double check that everything has been moved out of the app template in master btw. I think there were some additions recently.
I am a little bit struggling with making the e2e tests pass. |
packages/create-app/package.json
Outdated
"backstage" | ||
], | ||
"license": "Apache-2.0", | ||
"main": "src/index.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"main": "src/index.ts", | |
"main": "dist/index.cjs.js", |
I think e2e tests break because specifying src/index.ts
as the entrypoint causes it to be included in the packages version, just like if you included it in the files
list. That in turn causes the entrypoint script to believe that it's a local development package, i.e. isLocal
is set to true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that mean that I have to put the builder
part into the package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah I think this change should be enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ayshiff#1 馃榿
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Rugvip 馃憤
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Hoping that last addition did the trick 馃榿
Hi, I've just noticed that running
Looks like changes made in this PR like moving files from The fact that no one has noticed this (or at least there is not GitHub issue) makes me wonder if its worth keeping this functionallty at all. On the other hand I'm in the middle of upgrading backstage and without running |
@stefanbuck so you're right, I don't think people really use that way as much. I'd recommend updating the Feel free to contribute a fix to the this command too if you feel it's better :) |
Well, if no one was complaining about this command being broken for the past 6 months, I would rather tend to remove it. Would you would accept a PR for this? |
@Rugvip - thoughts? |
Hey, I just made a Pull Request!
Closes #1537
It creates another package
create-app
which contains the logic for downloading and executing templates.I need some help to finish this refacto 馃憤
I have some questions about what I did:
src/lib(paths-tasks...).ts
utilities). As I need them insidecreate-app
package, it makes it redundant.create-app
inside the package ?鉁旓笍 Checklist
yarn test