create-convex-monorepo 0.2.0 → 0.3.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/CONTRIBUTING.md +19 -1
- package/README.md +53 -2
- package/assets/setup/convex-setup.d.mts +16 -0
- package/dist/cli/workspace.d.ts +2 -0
- package/dist/cli/workspace.js +19 -0
- package/dist/cli/workspace.js.map +1 -0
- package/dist/commands/workspace.d.ts +20 -0
- package/dist/commands/workspace.js +272 -0
- package/dist/commands/workspace.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/workspace/add.d.ts +9 -0
- package/dist/workspace/add.js +326 -0
- package/dist/workspace/add.js.map +1 -0
- package/dist/workspace/changes.d.ts +23 -0
- package/dist/workspace/changes.js +157 -0
- package/dist/workspace/changes.js.map +1 -0
- package/dist/workspace/doctor.d.ts +16 -0
- package/dist/workspace/doctor.js +483 -0
- package/dist/workspace/doctor.js.map +1 -0
- package/dist/workspace/env.d.ts +12 -0
- package/dist/workspace/env.js +50 -0
- package/dist/workspace/env.js.map +1 -0
- package/dist/workspace/project.d.ts +28 -0
- package/dist/workspace/project.js +147 -0
- package/dist/workspace/project.js.map +1 -0
- package/dist/workspace/upgrade.d.ts +17 -0
- package/dist/workspace/upgrade.js +86 -0
- package/dist/workspace/upgrade.js.map +1 -0
- package/docs/adding-a-framework.md +6 -0
- package/docs/adding-an-auth-provider.md +8 -0
- package/docs/architecture.md +13 -1
- package/docs/releases.md +18 -24
- package/docs/verification.md +29 -1
- package/package.json +6 -3
package/CONTRIBUTING.md
CHANGED
|
@@ -34,6 +34,24 @@ Describe the failing behavior, the generated combination involved, and the expec
|
|
|
34
34
|
|
|
35
35
|
Check current upstream documentation before changing Convex generation, exports, bundler resolution, or SDK versions. Record compatibility findings in `docs/research.md`. Do not edit Convex-generated internals, cast away shared API types, or suppress errors to pass a build. Refresh official generated assets through supported Convex tooling when the example backend changes.
|
|
36
36
|
|
|
37
|
+
## Workspace command development
|
|
38
|
+
|
|
39
|
+
`pnpm dev:workspace --help` runs the management CLI from source. Run it inside a generated fixture by invoking the built `convex-monorepo` binary or using the exported planning APIs in tests. `pnpm test:workspace:e2e` generates one app, adds the remaining frameworks, adds Clerk, syncs URLs, installs dependencies, and runs doctor, typechecks, lint, and builds. Set `CCM_EXAMPLE=none` to test adding apps after Clerk configuration on a blank project.
|
|
40
|
+
|
|
41
|
+
Changes to mutation commands need tests for customized files, preflight conflicts, dry runs, cancellation, and preservation of unrelated content. Diagnostic tests should include both missing dependencies and real installed type resolution. Mock registry responses in unit tests for upgrade checks.
|
|
42
|
+
|
|
43
|
+
## Contribution and review process
|
|
44
|
+
|
|
45
|
+
Fork the repository, make changes on a branch in your fork, and open a pull request against `main`. A fork is your own copy; creating one or pushing to it does not change this repository or grant access to it.
|
|
46
|
+
|
|
47
|
+
Outside-contributor workflows require maintainer approval before they run. Approval to run CI only permits the tests to execute; it does not approve or merge the change. Fork PR workflows run with read-only repository permissions and do not receive repository secrets.
|
|
48
|
+
|
|
49
|
+
The normal merge requirements are a passing `CI passed` check, a passing `Conventional PR title` check, an approving review, and resolved review conversations. New commits dismiss previous approvals. `.github/CODEOWNERS` names `@adamtrip` for all files, including itself and the release workflows. GitHub reads code ownership from the PR's target branch, so this requirement starts applying once the file is on `main`.
|
|
50
|
+
|
|
51
|
+
Auto-merge is disabled. The `main` push allowlist contains only `@adamtrip`; passing CI does not give contributors permission to merge. Release-please creates release PRs, but does not merge them. The maintainer decides when a release PR is ready, and merging it starts automated npm publication.
|
|
52
|
+
|
|
53
|
+
Repository administrators retain GitHub's branch-protection override. This permits the sole maintainer to merge their own PRs, which GitHub does not let them approve. The override also applies to tools authenticated as that administrator; it is not a separate human-approval mechanism. Adding another administrator or granting access to an admin credential grants that power too. Routine contributions should use PRs, and automation should not use the override to merge contributions without the maintainer's explicit instruction.
|
|
54
|
+
|
|
37
55
|
## Tests and pull requests
|
|
38
56
|
|
|
39
57
|
Add focused regression tests for the behavior being fixed. Run generated-app typechecks and builds for affected frameworks and auth choices. For Expo, include Metro export evidence. Report exact checks run, failures, skipped checks, and whether real backend/auth interaction was exercised. Never include deployment keys or personal environment files in fixtures or logs.
|
|
@@ -46,7 +64,7 @@ Use Conventional Commits for commits and PR titles. For example, `feat(cli): ini
|
|
|
46
64
|
|
|
47
65
|
Use `fix:` for a patch, `feat:` for a minor, and `!` for a breaking change, such as `feat(cli)!: change application selection flags`. Explain breaking changes and migration steps in the PR body. These rules also apply before v1.0, so a breaking change from 0.1.0 proposes 1.0.0. `perf:` also triggers a patch; other ordinary maintenance commits do not trigger a release alone.
|
|
48
66
|
|
|
49
|
-
Release-please maintains a PR with the next version and changelog. Do not add changeset files or manually bump versions for normal changes. Maintainers review and merge the release PR to create a GitHub release, which starts the npm publishing workflow. It verifies the release commit and publishes the tested tarball using
|
|
67
|
+
Release-please maintains a PR with the next version and changelog. Do not add changeset files or manually bump versions for normal changes. Maintainers review and merge the release PR to create a GitHub release, which starts the npm publishing workflow. It verifies the release commit and publishes the tested tarball using npm trusted publishing without a stored npm token. See [release setup and publishing](docs/releases.md).
|
|
50
68
|
|
|
51
69
|
## Reporting problems
|
|
52
70
|
|
package/README.md
CHANGED
|
@@ -24,7 +24,58 @@ npx create-convex-monorepo@latest
|
|
|
24
24
|
|
|
25
25
|
Both commands run the same CLI. You can also install it globally with `npm install --global create-convex-monorepo` and run `create-convex-monorepo` directly. Running through npx does not change the generated workspace's package manager, which is pnpm.
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Contributors can run the checkout with `pnpm dev`; see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
28
|
+
|
|
29
|
+
## Manage an existing workspace
|
|
30
|
+
|
|
31
|
+
The same npm package also provides the `convex-monorepo` command. Install it in the generated workspace:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
pnpm add -Dw create-convex-monorepo@latest
|
|
35
|
+
pnpm exec convex-monorepo add
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Or run it without installing a project dependency:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
pnpm --package create-convex-monorepo@latest dlx convex-monorepo doctor
|
|
42
|
+
npx --yes --package create-convex-monorepo@latest convex-monorepo doctor
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Run commands from the workspace root or any subdirectory:
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
pnpm exec convex-monorepo add app admin --framework vite --example none --dry-run
|
|
49
|
+
pnpm exec convex-monorepo add app admin --framework vite --example none --install
|
|
50
|
+
pnpm exec convex-monorepo add app mobile --framework expo --no-install
|
|
51
|
+
pnpm exec convex-monorepo add auth clerk --dry-run
|
|
52
|
+
pnpm exec convex-monorepo add auth clerk --install
|
|
53
|
+
pnpm exec convex-monorepo env sync --app mobile
|
|
54
|
+
pnpm exec convex-monorepo doctor
|
|
55
|
+
pnpm exec convex-monorepo upgrade --check
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
| Command | Behavior |
|
|
59
|
+
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
60
|
+
| `add app` | Creates an app using the existing backend and auth, updates root scripts and metadata, and links the public backend URL when configured. |
|
|
61
|
+
| `add auth clerk` | Adds Clerk to generated app providers and the backend auth configuration. Customized files that need replacement cause a conflict. |
|
|
62
|
+
| `env sync` | Links only the public backend URL, using each framework's variable prefix. Supports `--app` and `--dry-run`. |
|
|
63
|
+
| `doctor` | Checks workspace configuration, installed dependencies, environment settings, and shared API types. Supports `--json`; errors exit with status 1. |
|
|
64
|
+
| `upgrade --check` | Compares generator versions with npm's latest stable release and reports the running CLI's tested dependency baseline through `--json`. Makes no changes. |
|
|
65
|
+
|
|
66
|
+
The add commands support `--dry-run`, `--install`, `--no-install`, and `--yes`. Without prompts, provide the app name and framework; dependency installation defaults to off. `--yes` enables installation unless `--no-install` is set, and never overrides conflicts. A dry run shows file paths without printing environment values or installing dependencies.
|
|
67
|
+
|
|
68
|
+
Existing workspaces with metadata version 1, including projects created with 0.2.1, are supported. Preserve `convex-monorepo.json`; the CLI reads it rather than guessing which directories belong to your project. Per-app starter choices are recorded there when they differ from the original selection.
|
|
69
|
+
|
|
70
|
+
### Changes and conflicts
|
|
71
|
+
|
|
72
|
+
Commands plan every file before applying changes. They reject unsafe paths, symlinks, existing app directories, conflicting scripts or dependencies, and customized auth files that would need replacement. App addition requires the generated `apps/*` and `packages/*` workspace layout and Turbo dev script. Adding a messages UI also requires the generated messages backend contract; use `--example none` with a customized backend.
|
|
73
|
+
|
|
74
|
+
Auth addition supports `none` to Clerk. It preserves backend schemas, functions, generated internals, unrelated package fields, and existing README content. Follow the new `CLERK_SETUP.md` for account configuration. Existing public messages do not acquire an owner automatically and will not appear in authenticated accounts. Review stored-data migration separately. Already configured Clerk is a no-op; replacing an auth provider is not supported.
|
|
75
|
+
|
|
76
|
+
A workspace lock prevents two CLI edits from running together. Each planned file is checked again before writing. Failed edits roll back files that still contain this command's output; observed concurrent edits are preserved and reported. Filesystem checks are optimistic, so avoid editing affected files while a command is applying. A failed dependency installation leaves the applied files available for retry with `pnpm install`.
|
|
77
|
+
|
|
78
|
+
Doctor is read-only and uses an in-memory TypeScript probe. It does not run application scripts, start services, configure a deployment, validate a real Clerk session, or prove a native Expo build works. Missing installation or environment configuration is reported with suggested steps. The upgrade command does not rewrite files, migrate templates, or update dependency versions.
|
|
28
79
|
|
|
29
80
|
## Interactive usage
|
|
30
81
|
|
|
@@ -118,7 +169,7 @@ my-app/
|
|
|
118
169
|
└── package.json
|
|
119
170
|
```
|
|
120
171
|
|
|
121
|
-
`convex-monorepo.json` records the selected applications and auth provider.
|
|
172
|
+
`convex-monorepo.json` records the selected applications and auth provider. The workspace commands use this metadata to locate apps and plan changes. `upgrade --check` reports versions without applying migrations.
|
|
122
173
|
|
|
123
174
|
## Multiple frontends
|
|
124
175
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Shared runtime helpers, also copied into generated projects as plain JavaScript. */
|
|
2
|
+
export function publicVariable(framework: string): string;
|
|
3
|
+
export function deploymentUrl(value: string | undefined): string;
|
|
4
|
+
export function linkEnvironment(
|
|
5
|
+
contents: string,
|
|
6
|
+
variable: string,
|
|
7
|
+
url: string,
|
|
8
|
+
): string;
|
|
9
|
+
export function linkFrontends(
|
|
10
|
+
root: string,
|
|
11
|
+
signal?: AbortSignal,
|
|
12
|
+
): Promise<void>;
|
|
13
|
+
export function initializeConvex(
|
|
14
|
+
root: string,
|
|
15
|
+
signal?: AbortSignal,
|
|
16
|
+
): Promise<void>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { getPackageVersion } from '../version.js';
|
|
3
|
+
import { runWorkspace } from '../commands/workspace.js';
|
|
4
|
+
const controller = new AbortController();
|
|
5
|
+
const interrupt = () => controller.abort(new Error('Workspace command interrupted.'));
|
|
6
|
+
process.once('SIGINT', interrupt);
|
|
7
|
+
process.once('SIGTERM', interrupt);
|
|
8
|
+
try {
|
|
9
|
+
await runWorkspace(process.argv.slice(2), await getPackageVersion(), controller.signal);
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
13
|
+
process.exitCode = controller.signal.aborted ? 130 : 1;
|
|
14
|
+
}
|
|
15
|
+
finally {
|
|
16
|
+
process.removeListener('SIGINT', interrupt);
|
|
17
|
+
process.removeListener('SIGTERM', interrupt);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/cli/workspace.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;AACzC,MAAM,SAAS,GAAG,GAAG,EAAE,CACrB,UAAU,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC,CAAC;AAChE,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAClC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AACnC,IAAI,CAAC;IACH,MAAM,YAAY,CAChB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EACrB,MAAM,iBAAiB,EAAE,EACzB,UAAU,CAAC,MAAM,CAClB,CAAC;AACJ,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,OAAO,CAAC,KAAK,CACX,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACnE,CAAC;IACF,OAAO,CAAC,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACzD,CAAC;QAAS,CAAC;IACT,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC5C,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Example, Framework } from '../generator/types.js';
|
|
2
|
+
export declare const workspaceHelp = "convex-monorepo <command> [options]\n\nManage an existing Convex monorepo from its root or any subdirectory.\n\n add Choose an app or authentication interactively\n add app [name] Add an application\n --framework <name> next, vite, tanstack-start, or expo\n --example <name> none or messages (defaults to workspace example)\n add auth [clerk] Add Clerk authentication\n doctor [--json] Check workspace configuration and setup\n env sync [--app name] Copy public Convex URLs to frontend env files\n upgrade --check [--json] Check the latest stable generator version\n\nAdd options:\n --install / --no-install Install dependencies after applying changes\n --yes, -y Skip prompts and install unless --no-install\n\nAdd and env sync options:\n --dry-run Show planned paths without writing or installing\n\n --help, -h Show usage\n --version, -v Show CLI version\n\nWithout a terminal, add app requires a name and --framework. Installation\nis off unless --install or --yes is passed. Existing files are never forced.\n";
|
|
3
|
+
type CommandKind = 'help' | 'add' | 'add-app' | 'add-auth' | 'doctor' | 'env-sync' | 'upgrade';
|
|
4
|
+
export interface WorkspaceCommand {
|
|
5
|
+
command: CommandKind;
|
|
6
|
+
help: boolean;
|
|
7
|
+
version: boolean;
|
|
8
|
+
name?: string;
|
|
9
|
+
framework?: Framework;
|
|
10
|
+
example?: Example;
|
|
11
|
+
provider?: 'clerk';
|
|
12
|
+
app?: string;
|
|
13
|
+
install?: boolean;
|
|
14
|
+
yes: boolean;
|
|
15
|
+
dryRun: boolean;
|
|
16
|
+
json: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function parseWorkspaceCommand(args: string[]): WorkspaceCommand;
|
|
19
|
+
export declare function runWorkspace(args: string[], version: string, signal?: AbortSignal): Promise<void>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import * as prompts from '@clack/prompts';
|
|
2
|
+
import { parseArgs } from 'node:util';
|
|
3
|
+
import { frameworks, validateProjectName } from '../generator/options.js';
|
|
4
|
+
import { pnpm } from '../package-manager/index.js';
|
|
5
|
+
import { loadWorkspace } from '../workspace/project.js';
|
|
6
|
+
import { applyPlan } from '../workspace/changes.js';
|
|
7
|
+
import { planAddApp, planAddAuth } from '../workspace/add.js';
|
|
8
|
+
import { planEnvSync } from '../workspace/env.js';
|
|
9
|
+
import { doctor } from '../workspace/doctor.js';
|
|
10
|
+
import { checkUpgrade } from '../workspace/upgrade.js';
|
|
11
|
+
export const workspaceHelp = `convex-monorepo <command> [options]
|
|
12
|
+
|
|
13
|
+
Manage an existing Convex monorepo from its root or any subdirectory.
|
|
14
|
+
|
|
15
|
+
add Choose an app or authentication interactively
|
|
16
|
+
add app [name] Add an application
|
|
17
|
+
--framework <name> next, vite, tanstack-start, or expo
|
|
18
|
+
--example <name> none or messages (defaults to workspace example)
|
|
19
|
+
add auth [clerk] Add Clerk authentication
|
|
20
|
+
doctor [--json] Check workspace configuration and setup
|
|
21
|
+
env sync [--app name] Copy public Convex URLs to frontend env files
|
|
22
|
+
upgrade --check [--json] Check the latest stable generator version
|
|
23
|
+
|
|
24
|
+
Add options:
|
|
25
|
+
--install / --no-install Install dependencies after applying changes
|
|
26
|
+
--yes, -y Skip prompts and install unless --no-install
|
|
27
|
+
|
|
28
|
+
Add and env sync options:
|
|
29
|
+
--dry-run Show planned paths without writing or installing
|
|
30
|
+
|
|
31
|
+
--help, -h Show usage
|
|
32
|
+
--version, -v Show CLI version
|
|
33
|
+
|
|
34
|
+
Without a terminal, add app requires a name and --framework. Installation
|
|
35
|
+
is off unless --install or --yes is passed. Existing files are never forced.
|
|
36
|
+
`;
|
|
37
|
+
export function parseWorkspaceCommand(args) {
|
|
38
|
+
const { values, positionals } = parseArgs({
|
|
39
|
+
args,
|
|
40
|
+
allowPositionals: true,
|
|
41
|
+
options: {
|
|
42
|
+
help: { type: 'boolean', short: 'h' },
|
|
43
|
+
version: { type: 'boolean', short: 'v' },
|
|
44
|
+
framework: { type: 'string' },
|
|
45
|
+
example: { type: 'string' },
|
|
46
|
+
app: { type: 'string' },
|
|
47
|
+
install: { type: 'boolean' },
|
|
48
|
+
'no-install': { type: 'boolean' },
|
|
49
|
+
yes: { type: 'boolean', short: 'y' },
|
|
50
|
+
'dry-run': { type: 'boolean' },
|
|
51
|
+
json: { type: 'boolean' },
|
|
52
|
+
check: { type: 'boolean' },
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
const [first, second, third] = positionals;
|
|
56
|
+
let command;
|
|
57
|
+
let maximum;
|
|
58
|
+
let allowed;
|
|
59
|
+
const addFlags = ['install', 'no-install', 'yes', 'dry-run'];
|
|
60
|
+
if (!first || first === 'help') {
|
|
61
|
+
command = 'help';
|
|
62
|
+
maximum = first ? 1 : 0;
|
|
63
|
+
allowed = [];
|
|
64
|
+
}
|
|
65
|
+
else if (first === 'add') {
|
|
66
|
+
if (!second) {
|
|
67
|
+
command = 'add';
|
|
68
|
+
maximum = 1;
|
|
69
|
+
allowed = addFlags;
|
|
70
|
+
}
|
|
71
|
+
else if (second === 'app') {
|
|
72
|
+
command = 'add-app';
|
|
73
|
+
maximum = 3;
|
|
74
|
+
allowed = [...addFlags, 'framework', 'example'];
|
|
75
|
+
}
|
|
76
|
+
else if (second === 'auth') {
|
|
77
|
+
command = 'add-auth';
|
|
78
|
+
maximum = 3;
|
|
79
|
+
allowed = addFlags;
|
|
80
|
+
}
|
|
81
|
+
else
|
|
82
|
+
throw new Error('Use add app [name] or add auth [clerk].');
|
|
83
|
+
}
|
|
84
|
+
else if (first === 'doctor') {
|
|
85
|
+
command = 'doctor';
|
|
86
|
+
maximum = 1;
|
|
87
|
+
allowed = ['json'];
|
|
88
|
+
}
|
|
89
|
+
else if (first === 'env' && second === 'sync') {
|
|
90
|
+
command = 'env-sync';
|
|
91
|
+
maximum = 2;
|
|
92
|
+
allowed = ['app', 'dry-run'];
|
|
93
|
+
}
|
|
94
|
+
else if (first === 'upgrade') {
|
|
95
|
+
command = 'upgrade';
|
|
96
|
+
maximum = 1;
|
|
97
|
+
allowed = ['check', 'json'];
|
|
98
|
+
}
|
|
99
|
+
else
|
|
100
|
+
throw new Error(`Unknown command: ${positionals.join(' ')}. Run convex-monorepo --help.`);
|
|
101
|
+
if (positionals.length > maximum)
|
|
102
|
+
throw new Error('Unexpected positional arguments. Run convex-monorepo --help.');
|
|
103
|
+
for (const flag of Object.keys(values)) {
|
|
104
|
+
if (!['help', 'version', ...allowed].includes(flag))
|
|
105
|
+
throw new Error(`--${flag} is not supported for ${first ?? 'this command'}.`);
|
|
106
|
+
}
|
|
107
|
+
if (values.install && values['no-install'])
|
|
108
|
+
throw new Error('Choose either --install or --no-install.');
|
|
109
|
+
if (values.framework !== undefined &&
|
|
110
|
+
!frameworks.includes(values.framework))
|
|
111
|
+
throw new Error(`Unknown framework: ${values.framework}. Choose ${frameworks.join(', ')}.`);
|
|
112
|
+
if (values.example !== undefined &&
|
|
113
|
+
values.example !== 'none' &&
|
|
114
|
+
values.example !== 'messages')
|
|
115
|
+
throw new Error('Choose --example none or --example messages.');
|
|
116
|
+
if (command === 'add-auth' && third !== undefined && third !== 'clerk')
|
|
117
|
+
throw new Error('Only Clerk authentication is supported. Use add auth clerk.');
|
|
118
|
+
if (command === 'upgrade' && !values.check && !values.help && !values.version)
|
|
119
|
+
throw new Error('Use convex-monorepo upgrade --check to check versions. Automatic upgrades are not supported.');
|
|
120
|
+
return {
|
|
121
|
+
command,
|
|
122
|
+
help: !!values.help || (command === 'help' && !values.version),
|
|
123
|
+
version: !!values.version,
|
|
124
|
+
yes: !!values.yes,
|
|
125
|
+
dryRun: !!values['dry-run'],
|
|
126
|
+
json: !!values.json,
|
|
127
|
+
...(command === 'add-app' && third !== undefined ? { name: third } : {}),
|
|
128
|
+
...(command === 'add-auth' && third === 'clerk' ? { provider: third } : {}),
|
|
129
|
+
...(values.framework !== undefined
|
|
130
|
+
? { framework: values.framework }
|
|
131
|
+
: {}),
|
|
132
|
+
...(values.example !== undefined
|
|
133
|
+
? { example: values.example }
|
|
134
|
+
: {}),
|
|
135
|
+
...(values.app !== undefined ? { app: values.app } : {}),
|
|
136
|
+
...(values.install || values['no-install']
|
|
137
|
+
? { install: !values['no-install'] }
|
|
138
|
+
: {}),
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function answer(value) {
|
|
142
|
+
if (prompts.isCancel(value))
|
|
143
|
+
throw new Error('Workspace command cancelled.');
|
|
144
|
+
return value;
|
|
145
|
+
}
|
|
146
|
+
export async function runWorkspace(args, version, signal) {
|
|
147
|
+
const options = parseWorkspaceCommand(args);
|
|
148
|
+
if (options.help) {
|
|
149
|
+
console.log(workspaceHelp);
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (options.version) {
|
|
153
|
+
console.log(version);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
signal?.throwIfAborted();
|
|
157
|
+
const interactive = !!process.stdin.isTTY && !!process.stdout.isTTY && !options.yes;
|
|
158
|
+
if (options.command === 'add') {
|
|
159
|
+
if (!interactive)
|
|
160
|
+
throw new Error('Choose add app <name> --framework <name> or add auth clerk when prompts are disabled.');
|
|
161
|
+
options.command = answer(await prompts.select({
|
|
162
|
+
message: 'What would you like to add?',
|
|
163
|
+
options: [
|
|
164
|
+
{ value: 'add-app', label: 'Application' },
|
|
165
|
+
{ value: 'add-auth', label: 'Clerk authentication' },
|
|
166
|
+
],
|
|
167
|
+
}));
|
|
168
|
+
}
|
|
169
|
+
if (options.command === 'add-app') {
|
|
170
|
+
if (!options.name && interactive)
|
|
171
|
+
options.name = answer(await prompts.text({
|
|
172
|
+
message: 'Application name?',
|
|
173
|
+
validate: (value) => validateProjectName(value ?? ''),
|
|
174
|
+
}));
|
|
175
|
+
if (!options.framework && interactive)
|
|
176
|
+
options.framework = answer(await prompts.select({
|
|
177
|
+
message: 'Application framework?',
|
|
178
|
+
options: frameworks.map((value) => ({ value, label: value })),
|
|
179
|
+
}));
|
|
180
|
+
if (!options.name || !options.framework)
|
|
181
|
+
throw new Error('Without prompts, use add app <name> --framework <next|vite|tanstack-start|expo>.');
|
|
182
|
+
}
|
|
183
|
+
signal?.throwIfAborted();
|
|
184
|
+
const workspace = await loadWorkspace(process.cwd());
|
|
185
|
+
if (options.command === 'add-app' &&
|
|
186
|
+
options.example === undefined &&
|
|
187
|
+
interactive) {
|
|
188
|
+
options.example = answer(await prompts.select({
|
|
189
|
+
message: 'Starter content?',
|
|
190
|
+
initialValue: workspace.config.example,
|
|
191
|
+
options: [
|
|
192
|
+
{ value: 'messages', label: 'Messages example' },
|
|
193
|
+
{ value: 'none', label: 'Blank application' },
|
|
194
|
+
],
|
|
195
|
+
}));
|
|
196
|
+
}
|
|
197
|
+
if (options.command === 'doctor') {
|
|
198
|
+
const result = await doctor(workspace, signal ? { signal } : {});
|
|
199
|
+
if (options.json)
|
|
200
|
+
console.log(JSON.stringify(result, null, 2));
|
|
201
|
+
else {
|
|
202
|
+
for (const check of result.checks)
|
|
203
|
+
console.log(check);
|
|
204
|
+
for (const issue of result.issues)
|
|
205
|
+
console.log(`${issue.severity}: ${issue.message}\n Fix: ${issue.fix}`);
|
|
206
|
+
if (!result.issues.length)
|
|
207
|
+
console.log('No workspace issues found.');
|
|
208
|
+
}
|
|
209
|
+
if (result.issues.some((issue) => issue.severity === 'error'))
|
|
210
|
+
process.exitCode = 1;
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (options.command === 'upgrade') {
|
|
214
|
+
const result = await checkUpgrade(workspace, signal ? { signal } : {});
|
|
215
|
+
if (options.json)
|
|
216
|
+
console.log(JSON.stringify(result, null, 2));
|
|
217
|
+
else {
|
|
218
|
+
console.log(`CLI: ${result.cliVersion}\nProject generator: ${result.projectGenerator}\nLatest stable: ${result.latestStable}`);
|
|
219
|
+
console.log(result.updateAvailable
|
|
220
|
+
? 'A newer CLI version is available.'
|
|
221
|
+
: 'The CLI is up to date.');
|
|
222
|
+
if (result.projectBehind)
|
|
223
|
+
console.log('The workspace was created with an older generator. Review changes before updating dependencies.');
|
|
224
|
+
}
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
const plan = options.command === 'env-sync'
|
|
228
|
+
? await planEnvSync(workspace, options.app !== undefined ? { app: options.app } : {})
|
|
229
|
+
: options.command === 'add-app'
|
|
230
|
+
? await planAddApp(workspace, {
|
|
231
|
+
name: options.name,
|
|
232
|
+
framework: options.framework,
|
|
233
|
+
...(options.example !== undefined
|
|
234
|
+
? { example: options.example }
|
|
235
|
+
: {}),
|
|
236
|
+
})
|
|
237
|
+
: await planAddAuth(workspace, 'clerk');
|
|
238
|
+
console.log(options.dryRun ? 'Dry run. Planned changes:' : 'Planned changes:');
|
|
239
|
+
for (const change of plan.changes)
|
|
240
|
+
console.log(` ${change.before === null ? 'create' : 'update'} ${change.path}`);
|
|
241
|
+
for (const note of plan.notes)
|
|
242
|
+
console.log(note);
|
|
243
|
+
if (!plan.changes.length)
|
|
244
|
+
console.log('No changes needed.');
|
|
245
|
+
if (options.dryRun) {
|
|
246
|
+
await applyPlan(plan, { dryRun: true, ...(signal ? { signal } : {}) });
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
signal?.throwIfAborted();
|
|
250
|
+
let install = options.install ?? options.yes;
|
|
251
|
+
if (options.command !== 'env-sync' &&
|
|
252
|
+
plan.changes.length &&
|
|
253
|
+
options.install === undefined &&
|
|
254
|
+
interactive) {
|
|
255
|
+
install = answer(await prompts.confirm({
|
|
256
|
+
message: 'Install dependencies after applying these changes?',
|
|
257
|
+
initialValue: false,
|
|
258
|
+
}));
|
|
259
|
+
}
|
|
260
|
+
signal?.throwIfAborted();
|
|
261
|
+
await applyPlan(plan, signal ? { signal } : {});
|
|
262
|
+
if (options.command !== 'env-sync' && install && plan.changes.length) {
|
|
263
|
+
try {
|
|
264
|
+
await pnpm.install(workspace.root, signal);
|
|
265
|
+
}
|
|
266
|
+
catch (error) {
|
|
267
|
+
throw new Error(`Workspace files were updated, but dependency installation failed. Run pnpm install from the workspace root to retry. ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
console.log('Workspace changes applied.');
|
|
271
|
+
}
|
|
272
|
+
//# sourceMappingURL=workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/commands/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B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,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAChD,IAAI,OAAO,CAAC,OAAO,KAAK,UAAU,IAAI,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACrE,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC7C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CACb,wHAAwH,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAChL,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AAC5C,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,3 +3,13 @@ export { normalizeOptions } from './generator/options.js';
|
|
|
3
3
|
export type { GeneratorContext, ProjectOptions, AppSpec, AppTemplate, AuthAdapter, Framework, Auth, Example, } from './generator/types.js';
|
|
4
4
|
export type { RawOptions } from './generator/options.js';
|
|
5
5
|
export type { GenerateSettings } from './generator/index.js';
|
|
6
|
+
export { loadWorkspace, parseWorkspaceConfig } from './workspace/project.js';
|
|
7
|
+
export type { Workspace, WorkspaceApp, WorkspaceConfig, } from './workspace/project.js';
|
|
8
|
+
export { applyPlan } from './workspace/changes.js';
|
|
9
|
+
export type { ChangePlan, FileChange, ApplySettings, } from './workspace/changes.js';
|
|
10
|
+
export { planAddApp, planAddAuth } from './workspace/add.js';
|
|
11
|
+
export { planEnvSync } from './workspace/env.js';
|
|
12
|
+
export { doctor } from './workspace/doctor.js';
|
|
13
|
+
export type { DoctorResult, DoctorIssue } from './workspace/doctor.js';
|
|
14
|
+
export { checkUpgrade } from './workspace/upgrade.js';
|
|
15
|
+
export type { UpgradeCheck } from './workspace/upgrade.js';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
export { generateProject } from './generator/index.js';
|
|
2
2
|
export { normalizeOptions } from './generator/options.js';
|
|
3
|
+
export { loadWorkspace, parseWorkspaceConfig } from './workspace/project.js';
|
|
4
|
+
export { applyPlan } from './workspace/changes.js';
|
|
5
|
+
export { planAddApp, planAddAuth } from './workspace/add.js';
|
|
6
|
+
export { planEnvSync } from './workspace/env.js';
|
|
7
|
+
export { doctor } from './workspace/doctor.js';
|
|
8
|
+
export { checkUpgrade } from './workspace/upgrade.js';
|
|
3
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAe1D,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAM7E,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAMnD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Example, Framework } from '../generator/types.js';
|
|
2
|
+
import { type Workspace } from './project.js';
|
|
3
|
+
import type { ChangePlan } from './changes.js';
|
|
4
|
+
export declare function planAddApp(workspace: Workspace, options: {
|
|
5
|
+
name: string;
|
|
6
|
+
framework: Framework;
|
|
7
|
+
example?: Example;
|
|
8
|
+
}): Promise<ChangePlan>;
|
|
9
|
+
export declare function planAddAuth(workspace: Workspace, provider: 'clerk'): Promise<ChangePlan>;
|