-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Move create-keystone-app package inside the monorepo #9102
Move create-keystone-app package inside the monorepo #9102
Conversation
2ffc70a
to
c5f6d71
Compare
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit f4b7d78:
|
@dcousens please take a look, and tell me please if I need to change something else. |
I don't mind the idea of different templates, but let's focus on this being a 1:1 move into this monorepo from our |
@iamandrewluca before I review this in depth, can you please highlight any changes you needed to make when porting this from https://github.com/keystonejs/create-keystone-app (as comments on the diff). This will help me focus on what is different instead of reviewing the existing |
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.
The process of creating this package was to do these steps:
- Make a copy of
auth
module - Cleanup everything from
auth
module and leave the bare minimum - Copy starter files from other repo
- Copy source code from other repo
- Apply the changes from this MR on source-code
- Adjust package.json and cli.js to build and run ok with preconstruct
@dcousens I left some comments PS: I synced the branch with the main from upstream. Please check if the pnpm lock file has been updated correctly (don't have much experience with pnpm) On conflict I picked the version from main, then I run a |
aa5a82f
to
1659488
Compare
Checking the diff -r ../../../create-keystone-app/cli.js ./cli.js
2,3c2
< 'use strict';
< require('.');
---
> import './dist/create-keystone-app.esm.js'
diff -r ../../../create-keystone-app/src/index.ts ./src/index.ts
5c5
< import execa, { ExecaError } from 'execa';
---
> import execa from 'execa';
7,8d6
< import { checkVersion } from './checkVersion';
< import { UserError } from './utils';
10a9,11
> import { checkVersion } from './checkVersion';
> import { UserError } from './utils';
> import { fileURLToPath } from 'url';
11a13
> const __dirname = path.dirname(fileURLToPath(import.meta.url));
50c52,53
< const installDeps = async (cwd: string): Promise<'yarn' | 'npm'> => {
---
> async function installDeps (cwd: string) {
> const pkgManager = (process.env.npm_config_user_agent ?? 'npm').split('/').shift()
52c55
< 'Installing dependencies with yarn. This may take a few minutes.'
---
> `Installing dependencies with ${pkgManager}. This may take a few minutes.`
55,75c58,62
< await execa('yarn', ['install'], { cwd });
< spinner.succeed('Installed dependencies with yarn.');
< return 'yarn';
< } catch (_err: any) {
< let err: ExecaError = _err;
< if (err.failed) {
< process.stdout.write('\n');
< spinner.warn('Failed to install with yarn.');
< spinner.start(
< 'Installing dependencies with npm. This may take a few minutes.'
< );
< try {
< await execa('npm', ['install'], { cwd });
< spinner.succeed('Installed dependencies with npm.');
< } catch (npmErr) {
< spinner.fail('Failed to install with npm.');
< throw npmErr;
< }
< process.stdout.write('\n');
< return 'npm';
< }
---
> await execa(pkgManager, ['install'], { cwd });
> spinner.succeed(`Installed dependencies with ${pkgManager}.`);
> return pkgManager;
> } catch (err) {
> spinner.fail(`Failed to install with ${pkgManager}.`);
78c65
< };
---
> }
116c103
< - ${packageManager === 'yarn' ? 'yarn' : 'npm run'} dev
---
> - ${packageManager} run dev I'm happy with this! |
Hooray 🎉 |
PS: I was looking at create-payload-app maybe we can borrow that code for KS also, which will allow multiple KS templates
pnpm publish --dry-run