@intelligo-dev/cli 1.0.0-beta.1 → 1.0.0-beta.14
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/NOTICE +6 -0
- package/README.md +102 -0
- package/dist/bin.js +122 -37
- package/dist/bin.js.map +1 -1
- package/dist/commands/add.d.ts +26 -1
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +70 -4
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/create-flow.d.ts +37 -0
- package/dist/commands/create-flow.d.ts.map +1 -0
- package/dist/commands/create-flow.js +212 -0
- package/dist/commands/create-flow.js.map +1 -0
- package/dist/commands/create.d.ts +27 -6
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +53 -13
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/doctor.d.ts +14 -3
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +295 -37
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/migrate-check.d.ts +73 -1
- package/dist/commands/migrate-check.d.ts.map +1 -1
- package/dist/commands/migrate-check.js +130 -5
- package/dist/commands/migrate-check.js.map +1 -1
- package/dist/commands/migrate.d.ts +97 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +141 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/sync-messages.d.ts +37 -0
- package/dist/commands/sync-messages.d.ts.map +1 -0
- package/dist/commands/sync-messages.js +88 -0
- package/dist/commands/sync-messages.js.map +1 -0
- package/dist/commands/sync-scaffold.d.ts +36 -0
- package/dist/commands/sync-scaffold.d.ts.map +1 -0
- package/dist/commands/sync-scaffold.js +53 -0
- package/dist/commands/sync-scaffold.js.map +1 -0
- package/dist/commands/sync.d.ts +103 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +361 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/upgrade-check.d.ts +5 -5
- package/dist/commands/upgrade-check.d.ts.map +1 -1
- package/dist/commands/upgrade-check.js +22 -6
- package/dist/commands/upgrade-check.js.map +1 -1
- package/dist/env-files.d.ts +12 -0
- package/dist/env-files.d.ts.map +1 -0
- package/dist/env-files.js +29 -0
- package/dist/env-files.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/manifest.d.ts +36 -15
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +32 -16
- package/dist/manifest.js.map +1 -1
- package/dist/migrations.d.ts +3 -6
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +3 -6
- package/dist/migrations.js.map +1 -1
- package/dist/model-catalogue.d.ts +14 -0
- package/dist/model-catalogue.d.ts.map +1 -0
- package/dist/model-catalogue.js +34 -0
- package/dist/model-catalogue.js.map +1 -0
- package/dist/module-exports.d.ts +63 -0
- package/dist/module-exports.d.ts.map +1 -0
- package/dist/module-exports.js +231 -0
- package/dist/module-exports.js.map +1 -0
- package/dist/registry-bundle.d.ts +43 -0
- package/dist/registry-bundle.d.ts.map +1 -0
- package/dist/registry-bundle.js +74 -0
- package/dist/registry-bundle.js.map +1 -0
- package/dist/registry-items.d.ts +84 -0
- package/dist/registry-items.d.ts.map +1 -0
- package/dist/registry-items.js +187 -0
- package/dist/registry-items.js.map +1 -0
- package/package.json +36 -10
- package/src/bin.ts +316 -0
- package/src/commands/add.ts +255 -0
- package/src/commands/create-flow.ts +284 -0
- package/src/commands/create.ts +149 -0
- package/src/commands/doctor.ts +487 -0
- package/src/commands/migrate-check.ts +298 -0
- package/src/commands/migrate.ts +228 -0
- package/src/commands/sync-messages.ts +114 -0
- package/src/commands/sync-scaffold.ts +83 -0
- package/src/commands/sync.ts +534 -0
- package/src/commands/upgrade-check.ts +160 -0
- package/src/env-files.ts +31 -0
- package/src/index.ts +39 -0
- package/src/manifest.ts +147 -0
- package/src/migrations-dir.ts +25 -0
- package/src/migrations.ts +133 -0
- package/src/model-catalogue.ts +35 -0
- package/src/module-exports.ts +266 -0
- package/src/registry-bundle.ts +103 -0
- package/src/registry-items.ts +237 -0
- package/templates/admin-page/admin-page.tsx.tpl +2 -3
- package/templates/app-scaffold/assistant-route.ts.tpl +2 -2
- package/templates/app-scaffold/auth-route.ts.tpl +10 -0
- package/templates/app-scaffold/components.json.tpl +6 -2
- package/templates/app-scaffold/db-schema.ts.tpl +29 -0
- package/templates/app-scaffold/drizzle-journal.json.tpl +5 -0
- package/templates/app-scaffold/drizzle.config.ts.tpl +45 -0
- package/templates/app-scaffold/env.example.tpl +65 -1
- package/templates/app-scaffold/globals.css.tpl +172 -281
- package/templates/app-scaffold/i18n-request.ts.tpl +25 -0
- package/templates/app-scaffold/instrumentation.ts.tpl +21 -0
- package/templates/app-scaffold/intelligo.ts.tpl +95 -41
- package/templates/app-scaffold/layout.tsx.tpl +18 -1
- package/templates/app-scaffold/lib-utils.ts.tpl +1 -6
- package/templates/app-scaffold/next.config.mjs.tpl +2 -0
- package/templates/app-scaffold/package.json.tpl +31 -17
- package/templates/app-scaffold/page.tsx.tpl +16 -0
- package/templates/app-scaffold/plans.ts.tpl +32 -13
- package/templates/app-scaffold/{middleware.ts.tpl → proxy.ts.tpl} +6 -0
- package/templates/app-scaffold/sonner.tsx.tpl +42 -20
- package/templates/app-scaffold/stripe-webhook-route.ts.tpl +24 -0
- package/templates/app-scaffold/theme-provider.tsx.tpl +6 -4
- package/templates/app-scaffold/tsconfig.json.tpl +20 -4
- package/templates/app-scaffold/use-mobile.ts.tpl +19 -0
- package/templates/app-scaffold/workspace-bootstrap.ts.tpl +30 -0
- package/templates/maintenance/maintenance-route.ts.tpl +119 -0
- package/templates/manifest.json +75 -17
- package/templates/registry/ai-agent-activity.json +23 -0
- package/templates/registry/ai-agent-progress.json +21 -0
- package/templates/registry/ai-approval-card.json +27 -0
- package/templates/registry/ai-artifact.json +22 -0
- package/templates/registry/ai-branch.json +21 -0
- package/templates/registry/ai-citations.json +24 -0
- package/templates/registry/ai-code-block.json +23 -0
- package/templates/registry/ai-composer-menu.json +19 -0
- package/templates/registry/ai-file-diff.json +25 -0
- package/templates/registry/ai-image-generation.json +23 -0
- package/templates/registry/ai-markdown.json +23 -0
- package/templates/registry/ai-message-bubble.json +23 -0
- package/templates/registry/ai-message-scroller.json +22 -0
- package/templates/registry/ai-message.json +21 -0
- package/templates/registry/ai-motion.json +19 -0
- package/templates/registry/ai-prompt-input.json +28 -0
- package/templates/registry/ai-reasoning-text.json +22 -0
- package/templates/registry/ai-reasoning.json +22 -0
- package/templates/registry/ai-shimmer-text.json +19 -0
- package/templates/registry/ai-sidebar.json +25 -0
- package/templates/registry/ai-speech-input.json +21 -0
- package/templates/registry/ai-streaming-response.json +24 -0
- package/templates/registry/ai-suggestion.json +19 -0
- package/templates/registry/ai-todo-list.json +22 -0
- package/templates/registry/ai-tool-approval.json +26 -0
- package/templates/registry/ai-tool-result.json +25 -0
- package/templates/registry/alert-dialog.json +23 -0
- package/templates/registry/animated-list.json +21 -0
- package/templates/registry/app-shell.json +93 -0
- package/templates/registry/artifacts.json +82 -0
- package/templates/registry/attachment.json +22 -0
- package/templates/registry/auth-email-verification.json +39 -0
- package/templates/registry/auth-login.json +72 -0
- package/templates/registry/auth-password-reset.json +53 -0
- package/templates/registry/auth-signup.json +41 -0
- package/templates/registry/billing-settings.json +60 -0
- package/templates/registry/button.json +22 -0
- package/templates/registry/chat-eve.json +19 -0
- package/templates/registry/chat-panel.json +30 -0
- package/templates/registry/chat-share.json +42 -0
- package/templates/registry/chat-widget.json +34 -0
- package/templates/registry/chat.json +326 -0
- package/templates/registry/checkbox.json +22 -0
- package/templates/registry/checkout.json +40 -0
- package/templates/registry/collapsible.json +19 -0
- package/templates/registry/command.json +23 -0
- package/templates/registry/copy-button.json +21 -0
- package/templates/registry/dashboard.json +69 -0
- package/templates/registry/dialog.json +24 -0
- package/templates/registry/document-viewer.json +22 -0
- package/templates/registry/dropdown-menu.json +23 -0
- package/templates/registry/expandable-tabs.json +22 -0
- package/templates/registry/feature-gating.json +73 -0
- package/templates/registry/file-upload.json +24 -0
- package/templates/registry/hold-action-button.json +22 -0
- package/templates/registry/input-group.json +23 -0
- package/templates/registry/input.json +19 -0
- package/templates/registry/intelligo.json +187 -0
- package/templates/registry/invitation-accept.json +64 -0
- package/templates/registry/language-switcher.json +29 -0
- package/templates/registry/morphing-modal.json +24 -0
- package/templates/registry/notification-stack.json +24 -0
- package/templates/registry/notifications.json +87 -0
- package/templates/registry/onboarding.json +83 -0
- package/templates/registry/otp-input.json +22 -0
- package/templates/registry/page-header.json +15 -0
- package/templates/registry/payment-poll.json +52 -0
- package/templates/registry/popover-morph.json +22 -0
- package/templates/registry/popover.json +22 -0
- package/templates/registry/pricing.json +111 -0
- package/templates/registry/privacy-settings.json +65 -0
- package/templates/registry/profile-settings.json +68 -0
- package/templates/registry/progress.json +19 -0
- package/templates/registry/radio-group.json +22 -0
- package/templates/registry/registry.json +2945 -0
- package/templates/registry/route-error.json +65 -0
- package/templates/registry/select-morph.json +23 -0
- package/templates/registry/select.json +23 -0
- package/templates/registry/settings-shell.json +47 -0
- package/templates/registry/sheet.json +24 -0
- package/templates/registry/sidebar.json +28 -0
- package/templates/registry/smoke.json +34 -0
- package/templates/registry/spinner.json +16 -0
- package/templates/registry/stat-card.json +18 -0
- package/templates/registry/status-badge.json +18 -0
- package/templates/registry/switch.json +20 -0
- package/templates/registry/tabs.json +23 -0
- package/templates/registry/team-settings.json +97 -0
- package/templates/registry/textarea.json +16 -0
- package/templates/registry/tooltip.json +22 -0
- package/templates/registry/trial-banner.json +43 -0
- package/templates/registry/usage.json +84 -0
- package/templates/registry/workspace-settings.json +71 -0
- package/templates/registry-items.json +116 -0
- package/templates/registry-requires.json +180 -0
- package/templates/usage-page/usage-page.tsx.tpl +23 -8
- package/templates/vitest/server-only.ts.tpl +7 -0
- package/templates/vitest/vitest.config.ts.tpl +37 -0
- package/templates/billing-page/billing-page.tsx.tpl +0 -72
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scaffold files a registry install replaces. `intelligo create`
|
|
3
|
+
* writes app/globals.css, the theme provider and lib/utils.ts; the
|
|
4
|
+
* design-system base and the items overwrite them, and the scaffold's
|
|
5
|
+
* record has to let go of them or `upgrade --check` reports them as
|
|
6
|
+
* the app's own edits forever.
|
|
7
|
+
*/
|
|
8
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
import { readManifest } from "../manifest.js";
|
|
11
|
+
/** The `intelligo create` feature whose files an install may replace. */
|
|
12
|
+
export const SCAFFOLD_FEATURE = "app-scaffold";
|
|
13
|
+
/**
|
|
14
|
+
* Scaffold files the install extends in place rather than replaces:
|
|
15
|
+
* shadcn adds dependencies to package.json and style fields to
|
|
16
|
+
* components.json, and both stay the app's.
|
|
17
|
+
*/
|
|
18
|
+
const EDITED_IN_PLACE = new Set([
|
|
19
|
+
"package.json",
|
|
20
|
+
"components.json",
|
|
21
|
+
]);
|
|
22
|
+
/**
|
|
23
|
+
* The scaffold files an install has made the registry's: a file an
|
|
24
|
+
* installed item ships, the Tailwind stylesheet once the design-system
|
|
25
|
+
* base is in (it rewrites the tokens), or any scaffold file the install
|
|
26
|
+
* changed (shadcn's own `utils`, `sonner`). Seams stay the app's, and
|
|
27
|
+
* so do the files shadcn only extends. Left in the scaffold's record,
|
|
28
|
+
* each would read `customized` in `upgrade --check` forever.
|
|
29
|
+
*/
|
|
30
|
+
export function scaffoldHandover(input) {
|
|
31
|
+
return input.scaffold.filter((file) => !(file in input.seams) &&
|
|
32
|
+
!EDITED_IN_PLACE.has(file) &&
|
|
33
|
+
(input.shipped.has(file) || file === input.css || input.changed.has(file)));
|
|
34
|
+
}
|
|
35
|
+
function readIfExists(file) {
|
|
36
|
+
return existsSync(file) ? readFileSync(file, "utf8") : null;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The scaffold's recorded files as they are before an install, and
|
|
40
|
+
* afterwards the ones the install made the registry's.
|
|
41
|
+
*/
|
|
42
|
+
export function snapshotScaffold(appRoot) {
|
|
43
|
+
const scaffold = (readManifest(appRoot)?.features[SCAFFOLD_FEATURE]?.files ?? []).map((f) => f.path);
|
|
44
|
+
const before = new Map(scaffold.map((f) => [f, readIfExists(path.join(appRoot, f))]));
|
|
45
|
+
return {
|
|
46
|
+
handedOver: (input) => scaffoldHandover({
|
|
47
|
+
...input,
|
|
48
|
+
scaffold,
|
|
49
|
+
changed: new Set(scaffold.filter((f) => readIfExists(path.join(appRoot, f)) !== before.get(f))),
|
|
50
|
+
}),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=sync-scaffold.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-scaffold.js","sourceRoot":"","sources":["../../src/commands/sync-scaffold.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,yEAAyE;AACzE,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAE/C;;;;GAIG;AACH,MAAM,eAAe,GAAwB,IAAI,GAAG,CAAC;IACnD,cAAc;IACd,iBAAiB;CAClB,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAMhC;IACC,OAAO,KAAK,CAAC,QAAQ,CAAC,MAAM,CAC1B,CAAC,IAAI,EAAE,EAAE,CACP,CAAC,CAAC,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC;QACtB,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC;QAC1B,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAC7E,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC9D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAO9C,MAAM,QAAQ,GAAG,CACf,YAAY,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,KAAK,IAAI,EAAE,CAC/D,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACrB,MAAM,MAAM,GAAG,IAAI,GAAG,CACpB,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAC9D,CAAC;IACF,OAAO;QACL,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CACpB,gBAAgB,CAAC;YACf,GAAG,KAAK;YACR,QAAQ;YACR,OAAO,EAAE,IAAI,GAAG,CACd,QAAQ,CAAC,MAAM,CACb,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAC7D,CACF;SACF,CAAC;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `intelligo sync [items…] [--check] [--force]`
|
|
3
|
+
*
|
|
4
|
+
* Keeps an app's installed registry pages exactly what the framework
|
|
5
|
+
* ships. Installing stays the shadcn CLI's job — every item goes in with
|
|
6
|
+
* `shadcn add <item> --yes --overwrite` — and this command adds what
|
|
7
|
+
* shadcn cannot know:
|
|
8
|
+
*
|
|
9
|
+
* - the version: items come from the registry bundled with this CLI, so
|
|
10
|
+
* they match the `@intelligo-dev/*` packages of the same release;
|
|
11
|
+
* - the order: an item that imports a sibling's files lands after it
|
|
12
|
+
* (requires.json `items`);
|
|
13
|
+
* - the seams: files an item ships once for the deployment to own
|
|
14
|
+
* (requires.json `seams`) are put back after the install, and message
|
|
15
|
+
* files are merged key by key, the app's copy winning;
|
|
16
|
+
* - the record: intelligo.manifest.json keeps each installed file's
|
|
17
|
+
* hash, so `--check` can tell a file edited by hand from one a newer
|
|
18
|
+
* registry replaced. Scaffold files an install replaces (globals.css,
|
|
19
|
+
* the theme provider) leave the `app-scaffold` record for this one,
|
|
20
|
+
* so `upgrade --check` stops calling them customized.
|
|
21
|
+
*
|
|
22
|
+
* `--check` installs nothing and exits 1 when any installed file is
|
|
23
|
+
* missing, edited or behind the registry — the gate CI runs.
|
|
24
|
+
*/
|
|
25
|
+
import type { RegistryRequires } from "./doctor.js";
|
|
26
|
+
export { appLocales, mergeMessages, missingMessageKeys, } from "./sync-messages.js";
|
|
27
|
+
export { SCAFFOLD_FEATURE, scaffoldHandover } from "./sync-scaffold.js";
|
|
28
|
+
/** The design-system base: no marker file, installed before any page. */
|
|
29
|
+
export declare const BASE_ITEM = "intelligo";
|
|
30
|
+
export type SyncFileState =
|
|
31
|
+
/** identical to the registry */
|
|
32
|
+
"current"
|
|
33
|
+
/** untouched since the last sync; the registry has a newer version */
|
|
34
|
+
| "outdated"
|
|
35
|
+
/** changed by hand since it was installed */
|
|
36
|
+
| "edited"
|
|
37
|
+
/** differs from the registry, and no sync ever recorded it */
|
|
38
|
+
| "differs"
|
|
39
|
+
/** the registry ships it and the app does not have it */
|
|
40
|
+
| "missing"
|
|
41
|
+
/** a seam: the app's own from the first install on */
|
|
42
|
+
| "seam"
|
|
43
|
+
/** a message file that lacks keys the registry's has */
|
|
44
|
+
| "messages-behind"
|
|
45
|
+
/** another locale's copy of a shipped namespace lacks keys the app's English has */
|
|
46
|
+
| "locale-behind";
|
|
47
|
+
export type SyncEntry = {
|
|
48
|
+
item: string;
|
|
49
|
+
path: string;
|
|
50
|
+
state: SyncFileState;
|
|
51
|
+
/** For `messages-behind` / `locale-behind`: the dotted keys the copy lacks. */
|
|
52
|
+
missingKeys?: string[];
|
|
53
|
+
};
|
|
54
|
+
export type SyncReport = {
|
|
55
|
+
/** The framework version of the bundled registry. */
|
|
56
|
+
version: string;
|
|
57
|
+
/** The items checked, in install order (Intelligo components included). */
|
|
58
|
+
items: string[];
|
|
59
|
+
entries: SyncEntry[];
|
|
60
|
+
};
|
|
61
|
+
export type SyncSelection = {
|
|
62
|
+
ok: true;
|
|
63
|
+
items: string[];
|
|
64
|
+
} | {
|
|
65
|
+
ok: false;
|
|
66
|
+
message: string;
|
|
67
|
+
};
|
|
68
|
+
export type SyncContext = {
|
|
69
|
+
appRoot: string;
|
|
70
|
+
registryDir: string;
|
|
71
|
+
requires: RegistryRequires & {
|
|
72
|
+
seams?: Record<string, string>;
|
|
73
|
+
};
|
|
74
|
+
frameworkVersion: string;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* The items to sync: the ones named, else the ones the manifest
|
|
78
|
+
* recorded. With neither, nothing is guessed — a page at an item's
|
|
79
|
+
* marker path may be the product's own (a custom dashboard), and a sync
|
|
80
|
+
* would replace it — so the message lists what looks installed and asks
|
|
81
|
+
* for names.
|
|
82
|
+
*/
|
|
83
|
+
export declare function selectItems(names: readonly string[], context: SyncContext): SyncSelection;
|
|
84
|
+
/** Blocks in requires.json order, the design-system base first. */
|
|
85
|
+
export declare function installOrder(items: readonly string[], requires: RegistryRequires): string[];
|
|
86
|
+
/** Compare the app against the bundled registry; writes nothing. */
|
|
87
|
+
export declare function syncCheck(items: readonly string[], context: SyncContext): SyncReport;
|
|
88
|
+
export declare function syncCheckExitCode(report: SyncReport): number;
|
|
89
|
+
export declare function formatSyncReport(report: SyncReport): string;
|
|
90
|
+
/** The package version the app resolves for `@intelligo-dev/core`, if any. */
|
|
91
|
+
export declare function installedFrameworkVersion(appRoot: string): string | null;
|
|
92
|
+
export type SyncApplyOptions = {
|
|
93
|
+
force?: boolean;
|
|
94
|
+
log?: (line: string) => void;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Install `items` from the bundled registry, keep the seams, merge the
|
|
98
|
+
* messages and record what was written. Refuses to overwrite a file
|
|
99
|
+
* edited by hand unless `force` — the edit belongs in a seam, and the
|
|
100
|
+
* refusal says which files.
|
|
101
|
+
*/
|
|
102
|
+
export declare function syncApply(names: readonly string[], context: SyncContext, options?: SyncApplyOptions): Promise<number>;
|
|
103
|
+
//# sourceMappingURL=sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAQH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA0BpD,OAAO,EACL,UAAU,EACV,aAAa,EACb,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAExE,yEAAyE;AACzE,eAAO,MAAM,SAAS,cAAc,CAAC;AAErC,MAAM,MAAM,aAAa;AACvB,gCAAgC;AAC9B,SAAS;AACX,sEAAsE;GACpE,UAAU;AACZ,6CAA6C;GAC3C,QAAQ;AACV,8DAA8D;GAC5D,SAAS;AACX,yDAAyD;GACvD,SAAS;AACX,sDAAsD;GACpD,MAAM;AACR,wDAAwD;GACtD,iBAAiB;AACnB,oFAAoF;GAClF,eAAe,CAAC;AAEpB,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC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,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAWxE;AAsGD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,EAAE,WAAW,EACpB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,CAyHjB"}
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `intelligo sync [items…] [--check] [--force]`
|
|
3
|
+
*
|
|
4
|
+
* Keeps an app's installed registry pages exactly what the framework
|
|
5
|
+
* ships. Installing stays the shadcn CLI's job — every item goes in with
|
|
6
|
+
* `shadcn add <item> --yes --overwrite` — and this command adds what
|
|
7
|
+
* shadcn cannot know:
|
|
8
|
+
*
|
|
9
|
+
* - the version: items come from the registry bundled with this CLI, so
|
|
10
|
+
* they match the `@intelligo-dev/*` packages of the same release;
|
|
11
|
+
* - the order: an item that imports a sibling's files lands after it
|
|
12
|
+
* (requires.json `items`);
|
|
13
|
+
* - the seams: files an item ships once for the deployment to own
|
|
14
|
+
* (requires.json `seams`) are put back after the install, and message
|
|
15
|
+
* files are merged key by key, the app's copy winning;
|
|
16
|
+
* - the record: intelligo.manifest.json keeps each installed file's
|
|
17
|
+
* hash, so `--check` can tell a file edited by hand from one a newer
|
|
18
|
+
* registry replaced. Scaffold files an install replaces (globals.css,
|
|
19
|
+
* the theme provider) leave the `app-scaffold` record for this one,
|
|
20
|
+
* so `upgrade --check` stops calling them customized.
|
|
21
|
+
*
|
|
22
|
+
* `--check` installs nothing and exits 1 when any installed file is
|
|
23
|
+
* missing, edited or behind the registry — the gate CI runs.
|
|
24
|
+
*/
|
|
25
|
+
import { spawn } from "node:child_process";
|
|
26
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
27
|
+
import { createServer } from "node:http";
|
|
28
|
+
import path from "node:path";
|
|
29
|
+
import { emptyManifest, handOver, hashContents, readManifest, writeManifest, } from "../manifest.js";
|
|
30
|
+
import { asInstalled, hasRegistryItem, installedPath, readRegistryItem, registryClosure, } from "../registry-bundle.js";
|
|
31
|
+
import { withDependencies } from "../registry-items.js";
|
|
32
|
+
import { isMessages, localeEntries, mergeMessages, missingMessageKeys, } from "./sync-messages.js";
|
|
33
|
+
import { SCAFFOLD_FEATURE, snapshotScaffold } from "./sync-scaffold.js";
|
|
34
|
+
export { appLocales, mergeMessages, missingMessageKeys, } from "./sync-messages.js";
|
|
35
|
+
export { SCAFFOLD_FEATURE, scaffoldHandover } from "./sync-scaffold.js";
|
|
36
|
+
/** The design-system base: no marker file, installed before any page. */
|
|
37
|
+
export const BASE_ITEM = "intelligo";
|
|
38
|
+
const FAILING = new Set([
|
|
39
|
+
"outdated",
|
|
40
|
+
"edited",
|
|
41
|
+
"differs",
|
|
42
|
+
"missing",
|
|
43
|
+
"messages-behind",
|
|
44
|
+
"locale-behind",
|
|
45
|
+
]);
|
|
46
|
+
/**
|
|
47
|
+
* The items to sync: the ones named, else the ones the manifest
|
|
48
|
+
* recorded. With neither, nothing is guessed — a page at an item's
|
|
49
|
+
* marker path may be the product's own (a custom dashboard), and a sync
|
|
50
|
+
* would replace it — so the message lists what looks installed and asks
|
|
51
|
+
* for names.
|
|
52
|
+
*/
|
|
53
|
+
export function selectItems(names, context) {
|
|
54
|
+
const unknown = names.filter((n) => n === "registry" || !hasRegistryItem(context.registryDir, n));
|
|
55
|
+
if (unknown.length > 0) {
|
|
56
|
+
return {
|
|
57
|
+
ok: false,
|
|
58
|
+
message: `Unknown registry item(s): ${unknown.join(", ")}. Available: ${[
|
|
59
|
+
BASE_ITEM,
|
|
60
|
+
...Object.keys(context.requires.items),
|
|
61
|
+
].join(", ")}`,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
if (names.length > 0)
|
|
65
|
+
return { ok: true, items: [...names] };
|
|
66
|
+
const recorded = readManifest(context.appRoot)?.registry?.items;
|
|
67
|
+
if (recorded && recorded.length > 0)
|
|
68
|
+
return { ok: true, items: recorded };
|
|
69
|
+
const looksInstalled = Object.entries(context.requires.items)
|
|
70
|
+
.filter(([, item]) => existsSync(path.join(context.appRoot, item.marker)))
|
|
71
|
+
.map(([name]) => name);
|
|
72
|
+
return {
|
|
73
|
+
ok: false,
|
|
74
|
+
message: [
|
|
75
|
+
"No synced items are recorded in intelligo.manifest.json yet.",
|
|
76
|
+
"Name the items this app installs from the registry, once:",
|
|
77
|
+
"",
|
|
78
|
+
` intelligo sync ${[BASE_ITEM, ...looksInstalled].join(" ")}`,
|
|
79
|
+
"",
|
|
80
|
+
"(these are the items whose files are present — leave out any whose",
|
|
81
|
+
"path your product uses for a page of its own)",
|
|
82
|
+
].join("\n"),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/** Blocks in requires.json order, the design-system base first. */
|
|
86
|
+
export function installOrder(items, requires) {
|
|
87
|
+
const blocks = items.filter((n) => n in requires.items);
|
|
88
|
+
const others = items.filter((n) => !(n in requires.items));
|
|
89
|
+
const ordered = withDependencies(blocks, requires);
|
|
90
|
+
return [
|
|
91
|
+
...others.filter((n) => n === BASE_ITEM),
|
|
92
|
+
...others.filter((n) => n !== BASE_ITEM),
|
|
93
|
+
...ordered,
|
|
94
|
+
];
|
|
95
|
+
}
|
|
96
|
+
function shippedFiles(context, items) {
|
|
97
|
+
const closure = registryClosure(context.registryDir, items);
|
|
98
|
+
const byTarget = new Map();
|
|
99
|
+
for (const name of closure) {
|
|
100
|
+
const item = readRegistryItem(context.registryDir, name);
|
|
101
|
+
for (const file of item.files ?? []) {
|
|
102
|
+
const target = installedPath(item, file);
|
|
103
|
+
if (!target || file.content === undefined)
|
|
104
|
+
continue;
|
|
105
|
+
byTarget.set(target, { item: name, target, content: file.content });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return { closure, files: [...byTarget.values()] };
|
|
109
|
+
}
|
|
110
|
+
/** Compare the app against the bundled registry; writes nothing. */
|
|
111
|
+
export function syncCheck(items, context) {
|
|
112
|
+
const { closure, files } = shippedFiles(context, items);
|
|
113
|
+
const seams = context.requires.seams ?? {};
|
|
114
|
+
const recorded = readManifest(context.appRoot)?.registry?.files ?? {};
|
|
115
|
+
const entries = files.map(({ item, target, content }) => {
|
|
116
|
+
const abs = path.join(context.appRoot, target);
|
|
117
|
+
if (!existsSync(abs))
|
|
118
|
+
return { item, path: target, state: "missing" };
|
|
119
|
+
if (target in seams)
|
|
120
|
+
return { item, path: target, state: "seam" };
|
|
121
|
+
const local = readFileSync(abs, "utf8");
|
|
122
|
+
if (isMessages(target)) {
|
|
123
|
+
const missingKeys = missingMessageKeys(JSON.parse(content), JSON.parse(local));
|
|
124
|
+
return missingKeys.length > 0
|
|
125
|
+
? { item, path: target, state: "messages-behind", missingKeys }
|
|
126
|
+
: { item, path: target, state: "current" };
|
|
127
|
+
}
|
|
128
|
+
if (asInstalled(local) === asInstalled(content)) {
|
|
129
|
+
return { item, path: target, state: "current" };
|
|
130
|
+
}
|
|
131
|
+
const hash = recorded[target];
|
|
132
|
+
if (hash === undefined)
|
|
133
|
+
return { item, path: target, state: "differs" };
|
|
134
|
+
return {
|
|
135
|
+
item,
|
|
136
|
+
path: target,
|
|
137
|
+
state: hashContents(asInstalled(local)) === hash ? "outdated" : "edited",
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
entries.push(...localeEntries(context.appRoot, files));
|
|
141
|
+
return { version: context.frameworkVersion, items: closure, entries };
|
|
142
|
+
}
|
|
143
|
+
export function syncCheckExitCode(report) {
|
|
144
|
+
return report.entries.some((e) => FAILING.has(e.state)) ? 1 : 0;
|
|
145
|
+
}
|
|
146
|
+
export function formatSyncReport(report) {
|
|
147
|
+
const counts = new Map();
|
|
148
|
+
for (const e of report.entries) {
|
|
149
|
+
counts.set(e.state, (counts.get(e.state) ?? 0) + 1);
|
|
150
|
+
}
|
|
151
|
+
const lines = [
|
|
152
|
+
`Registry ${report.version}: ${report.items.length} item(s), ${report.entries.length} file(s) — ` +
|
|
153
|
+
[...counts].map(([state, n]) => `${n} ${state}`).join(", "),
|
|
154
|
+
];
|
|
155
|
+
const HINT = {
|
|
156
|
+
outdated: "a newer registry version — `intelligo sync` replaces it",
|
|
157
|
+
edited: "edited by hand — move the change into a seam, or ask for one upstream",
|
|
158
|
+
differs: "not what the registry ships, and never synced",
|
|
159
|
+
missing: "not installed",
|
|
160
|
+
"messages-behind": "lacks registry keys — `intelligo sync` adds them",
|
|
161
|
+
"locale-behind": "lacks keys the app's English copy has — translate them; sync never writes another locale",
|
|
162
|
+
};
|
|
163
|
+
for (const state of FAILING) {
|
|
164
|
+
const group = report.entries.filter((e) => e.state === state);
|
|
165
|
+
if (group.length === 0)
|
|
166
|
+
continue;
|
|
167
|
+
lines.push("", `${state} (${HINT[state]}):`);
|
|
168
|
+
for (const e of group) {
|
|
169
|
+
const keys = e.missingKeys
|
|
170
|
+
? ` — ${e.missingKeys.slice(0, 5).join(", ")}${e.missingKeys.length > 5 ? `, +${e.missingKeys.length - 5}` : ""}`
|
|
171
|
+
: "";
|
|
172
|
+
lines.push(` ${e.path} [${e.item}]${keys}`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (!report.entries.some((e) => FAILING.has(e.state))) {
|
|
176
|
+
lines.push("✓ every installed file is the registry's, seams aside");
|
|
177
|
+
}
|
|
178
|
+
return lines.join("\n");
|
|
179
|
+
}
|
|
180
|
+
/** The package version the app resolves for `@intelligo-dev/core`, if any. */
|
|
181
|
+
export function installedFrameworkVersion(appRoot) {
|
|
182
|
+
const manifest = path.join(appRoot, "node_modules", "@intelligo-dev", "core", "package.json");
|
|
183
|
+
if (!existsSync(manifest))
|
|
184
|
+
return null;
|
|
185
|
+
return JSON.parse(readFileSync(manifest, "utf8"))
|
|
186
|
+
.version;
|
|
187
|
+
}
|
|
188
|
+
function serveRegistry(dir) {
|
|
189
|
+
return new Promise((resolve, reject) => {
|
|
190
|
+
const server = createServer((req, res) => {
|
|
191
|
+
const name = decodeURIComponent((req.url ?? "").split("?")[0]).replace(/^\//, "");
|
|
192
|
+
const file = path.join(dir, name);
|
|
193
|
+
if (!/^[a-z0-9-]+\.json$/.test(name) || !existsSync(file)) {
|
|
194
|
+
res.writeHead(404);
|
|
195
|
+
res.end();
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
res.writeHead(200, { "content-type": "application/json" });
|
|
199
|
+
res.end(readFileSync(file));
|
|
200
|
+
});
|
|
201
|
+
server.once("error", reject);
|
|
202
|
+
server.listen(0, "127.0.0.1", () => {
|
|
203
|
+
const { port } = server.address();
|
|
204
|
+
resolve({ server, url: `http://127.0.0.1:${port}` });
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
function run(command, args, cwd) {
|
|
209
|
+
return new Promise((resolve) => {
|
|
210
|
+
const child = spawn(command, args, {
|
|
211
|
+
cwd,
|
|
212
|
+
// pnpm, npx and friends are .cmd shims on Windows.
|
|
213
|
+
shell: process.platform === "win32",
|
|
214
|
+
env: process.env,
|
|
215
|
+
});
|
|
216
|
+
let output = "";
|
|
217
|
+
child.stdout.on("data", (d) => (output += String(d)));
|
|
218
|
+
child.stderr.on("data", (d) => (output += String(d)));
|
|
219
|
+
child.on("close", (code) => resolve({ code: code ?? 1, output }));
|
|
220
|
+
child.on("error", (error) => resolve({ code: 1, output: `${output}${error.message}` }));
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
/** Put the kept seams back, and merge kept messages over the registry's. */
|
|
224
|
+
function restoreKept(appRoot, kept, shipped) {
|
|
225
|
+
for (const [target, content] of kept) {
|
|
226
|
+
const abs = path.join(appRoot, target);
|
|
227
|
+
mkdirSync(path.dirname(abs), { recursive: true });
|
|
228
|
+
if (isMessages(target) && shipped.has(target)) {
|
|
229
|
+
const merged = mergeMessages(JSON.parse(shipped.get(target)), JSON.parse(content));
|
|
230
|
+
writeFileSync(abs, `${JSON.stringify(merged, null, 2)}\n`);
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
writeFileSync(abs, content);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Write the synced items and each installed file's hash (seams and
|
|
239
|
+
* message files aside) into the manifest.
|
|
240
|
+
*/
|
|
241
|
+
function recordSync(context, names, after, { manifest }) {
|
|
242
|
+
const files = {};
|
|
243
|
+
for (const e of after.entries) {
|
|
244
|
+
if (e.state === "seam" || e.state === "missing" || isMessages(e.path)) {
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
files[e.path] = hashContents(asInstalled(readFileSync(path.join(context.appRoot, e.path), "utf8")));
|
|
248
|
+
}
|
|
249
|
+
const recordedItems = new Set([
|
|
250
|
+
...(manifest.registry?.items ?? []),
|
|
251
|
+
...names,
|
|
252
|
+
]);
|
|
253
|
+
writeManifest(context.appRoot, {
|
|
254
|
+
...manifest,
|
|
255
|
+
registry: {
|
|
256
|
+
version: context.frameworkVersion,
|
|
257
|
+
items: installOrder([...recordedItems], context.requires),
|
|
258
|
+
files: { ...manifest.registry?.files, ...files },
|
|
259
|
+
},
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Install `items` from the bundled registry, keep the seams, merge the
|
|
264
|
+
* messages and record what was written. Refuses to overwrite a file
|
|
265
|
+
* edited by hand unless `force` — the edit belongs in a seam, and the
|
|
266
|
+
* refusal says which files.
|
|
267
|
+
*/
|
|
268
|
+
export async function syncApply(names, context, options = {}) {
|
|
269
|
+
const log = options.log ?? console.log;
|
|
270
|
+
const { appRoot } = context;
|
|
271
|
+
const shadcn = path.join(appRoot, "node_modules", ".bin", "shadcn");
|
|
272
|
+
if (!existsSync(shadcn)) {
|
|
273
|
+
log("shadcn is not installed in this app — add it as a devDependency (the scaffold declares it) and install.");
|
|
274
|
+
return 1;
|
|
275
|
+
}
|
|
276
|
+
const componentsPath = path.join(appRoot, "components.json");
|
|
277
|
+
if (!existsSync(componentsPath)) {
|
|
278
|
+
log("No components.json — run from the app's root.");
|
|
279
|
+
return 1;
|
|
280
|
+
}
|
|
281
|
+
const items = installOrder(names, context.requires);
|
|
282
|
+
const before = syncCheck(items, context);
|
|
283
|
+
const shippedTargets = new Set(shippedFiles(context, items).files.map((f) => f.target));
|
|
284
|
+
const edited = before.entries.filter((e) => e.state === "edited" || e.state === "differs");
|
|
285
|
+
if (edited.length > 0 && !options.force) {
|
|
286
|
+
log([
|
|
287
|
+
`${edited.length} installed file(s) differ from the registry and would be overwritten:`,
|
|
288
|
+
...edited.map((e) => ` ${e.path} [${e.item}]`),
|
|
289
|
+
"",
|
|
290
|
+
"Move what the change does into a seam (lib/*-config, messages/), then re-run",
|
|
291
|
+
"with --force to replace these files with the registry's.",
|
|
292
|
+
].join("\n"));
|
|
293
|
+
return 1;
|
|
294
|
+
}
|
|
295
|
+
// What the install must not lose: the app's seams and message files.
|
|
296
|
+
const seams = context.requires.seams ?? {};
|
|
297
|
+
const kept = new Map();
|
|
298
|
+
for (const e of before.entries) {
|
|
299
|
+
if (e.state === "missing" || !shippedTargets.has(e.path))
|
|
300
|
+
continue;
|
|
301
|
+
if (e.path in seams || isMessages(e.path)) {
|
|
302
|
+
kept.set(e.path, readFileSync(path.join(appRoot, e.path), "utf8"));
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
const componentsBefore = JSON.parse(readFileSync(componentsPath, "utf8"));
|
|
306
|
+
// The scaffold's files as they are now, to see which the install replaces.
|
|
307
|
+
const scaffold = snapshotScaffold(appRoot);
|
|
308
|
+
const originalRegistry = componentsBefore.registries?.["@intelligo"];
|
|
309
|
+
const { server, url } = await serveRegistry(context.registryDir);
|
|
310
|
+
const setRegistry = (value) => {
|
|
311
|
+
// Read fresh: the base item rewrites components.json's style fields,
|
|
312
|
+
// and those changes are the point — only the registry URL is ours.
|
|
313
|
+
const current = JSON.parse(readFileSync(componentsPath, "utf8"));
|
|
314
|
+
const registries = { ...current.registries };
|
|
315
|
+
if (value === undefined)
|
|
316
|
+
delete registries["@intelligo"];
|
|
317
|
+
else
|
|
318
|
+
registries["@intelligo"] = value;
|
|
319
|
+
const next = { ...current, registries };
|
|
320
|
+
if (Object.keys(registries).length === 0)
|
|
321
|
+
delete next.registries;
|
|
322
|
+
writeFileSync(componentsPath, `${JSON.stringify(next, null, 2)}\n`);
|
|
323
|
+
};
|
|
324
|
+
let failed = null;
|
|
325
|
+
try {
|
|
326
|
+
setRegistry(`${url}/{name}.json`);
|
|
327
|
+
for (const item of items) {
|
|
328
|
+
log(`› shadcn add ${item}`);
|
|
329
|
+
const result = await run(shadcn, ["add", `${url}/${item}.json`, "--yes", "--overwrite"], appRoot);
|
|
330
|
+
if (result.code !== 0) {
|
|
331
|
+
failed = { item, output: result.output };
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
finally {
|
|
337
|
+
setRegistry(originalRegistry);
|
|
338
|
+
server.close();
|
|
339
|
+
}
|
|
340
|
+
// Seams back as they were; messages merged over the registry's.
|
|
341
|
+
const shipped = new Map(shippedFiles(context, items).files.map((f) => [f.target, f.content]));
|
|
342
|
+
restoreKept(appRoot, kept, shipped);
|
|
343
|
+
if (failed) {
|
|
344
|
+
log(`shadcn add ${failed.item} failed:\n${failed.output.trim().split("\n").slice(-20).join("\n")}`);
|
|
345
|
+
return 1;
|
|
346
|
+
}
|
|
347
|
+
// Record what is on disk now, so the next check can tell an edit.
|
|
348
|
+
const after = syncCheck(items, context);
|
|
349
|
+
recordSync(context, names, after, {
|
|
350
|
+
manifest: handOver(readManifest(appRoot) ?? emptyManifest(context.frameworkVersion), SCAFFOLD_FEATURE, scaffold.handedOver({
|
|
351
|
+
shipped: new Set(shipped.keys()),
|
|
352
|
+
seams,
|
|
353
|
+
css: items.includes(BASE_ITEM)
|
|
354
|
+
? (componentsBefore.tailwind?.css ?? null)
|
|
355
|
+
: null,
|
|
356
|
+
})),
|
|
357
|
+
});
|
|
358
|
+
log(formatSyncReport(after));
|
|
359
|
+
return syncCheckExitCode(after);
|
|
360
|
+
}
|
|
361
|
+
//# sourceMappingURL=sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAe,MAAM,WAAW,CAAC;AAEtD,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EACL,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,aAAa,GAEd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,WAAW,EACX,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,UAAU,EACV,aAAa,EACb,aAAa,EACb,kBAAkB,GAEnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EACL,UAAU,EACV,aAAa,EACb,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAExE,yEAAyE;AACzE,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;AA8CrC,MAAM,OAAO,GAA+B,IAAI,GAAG,CAAC;IAClD,UAAU;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,CAChB,YAAY,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAChE,gBAAgB,EAChB,QAAQ,CAAC,UAAU,CAAC;YAClB,OAAO,EAAE,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAChC,KAAK;YACL,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC;gBAC5B,CAAC,CAAC,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG,IAAI,IAAI,CAAC;gBAC1C,CAAC,CAAC,IAAI;SACT,CAAC,CACH;KACF,CAAC,CAAC;IAEH,GAAG,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7B,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `intelligo upgrade --check`
|
|
3
3
|
*
|
|
4
|
-
* Reports what a template upgrade would do, and does nothing.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* changed upstream" but "these changed upstream AND you have edited
|
|
4
|
+
* Reports what a template upgrade would do, and does nothing. Upgrades
|
|
5
|
+
* never overwrite consumer source, so the interesting output is not
|
|
6
|
+
* "these templates changed" but "these changed AND you have edited
|
|
8
7
|
* them" — the set where the consumer has to make a decision.
|
|
9
8
|
*/
|
|
10
9
|
export type UpgradeItem = {
|
|
@@ -17,8 +16,9 @@ export type UpgradeItem = {
|
|
|
17
16
|
* - `conflict` — template changed AND the consumer edited the file
|
|
18
17
|
* - `customized` — consumer edited it; template unchanged
|
|
19
18
|
* - `deleted` — consumer removed it
|
|
19
|
+
* - `new` — the template has a file this app was never given
|
|
20
20
|
*/
|
|
21
|
-
state: "current" | "outdated" | "conflict" | "customized" | "deleted";
|
|
21
|
+
state: "current" | "outdated" | "conflict" | "customized" | "deleted" | "new";
|
|
22
22
|
};
|
|
23
23
|
export type UpgradeReport = {
|
|
24
24
|
installedVersion: Record<string, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade-check.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade-check.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"upgrade-check.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade-check.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;;;OAQG;IACH,KAAK,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,KAAK,CAAC;CAC/E,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,aAAa,CAqExE;AAaD,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,CA2B5D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,CAE7D"}
|