handoff-app 1.2.2-6 → 2.0.0-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/Changelog.md +37 -15
- package/README.md +372 -118
- package/dist/app-builder/build.d.ts +41 -2
- package/dist/app-builder/build.js +455 -18
- package/dist/app-builder/client-config.d.ts +15 -2
- package/dist/app-builder/client-config.js +43 -4
- package/dist/app-builder/config-diff/snapshot.d.ts +1 -6
- package/dist/app-builder/config-diff/snapshot.js +2 -9
- package/dist/app-builder/index.d.ts +1 -1
- package/dist/app-builder/index.js +3 -1
- package/dist/app-builder/nav-shell.d.ts +23 -0
- package/dist/app-builder/nav-shell.js +80 -0
- package/dist/app-builder/static-export.d.ts +17 -0
- package/dist/app-builder/static-export.js +181 -0
- package/dist/app-builder/vercel-output.d.ts +39 -0
- package/dist/app-builder/vercel-output.js +259 -0
- package/dist/app-builder/watchers/utils.d.ts +2 -0
- package/dist/app-builder/watchers.d.ts +14 -4
- package/dist/app-builder/watchers.js +123 -28
- package/dist/app-builder/websocket.js +1 -1
- package/dist/artifacts/index.d.ts +2 -0
- package/dist/artifacts/index.js +13 -0
- package/dist/artifacts/types.d.ts +136 -0
- package/dist/artifacts/types.js +24 -0
- package/dist/artifacts/url.d.ts +49 -0
- package/dist/artifacts/url.js +86 -0
- package/dist/cache/build-cache.js +48 -4
- package/dist/commands/build/app.js +1 -2
- package/dist/commands/build/index.d.ts +17 -0
- package/dist/commands/build/index.js +66 -0
- package/dist/commands/checkout/index.d.ts +24 -0
- package/dist/commands/checkout/index.js +71 -0
- package/dist/commands/db/migrate.d.ts +11 -0
- package/dist/commands/db/migrate.js +33 -0
- package/dist/commands/index.js +8 -0
- package/dist/commands/publish/index.d.ts +21 -0
- package/dist/commands/publish/index.js +68 -0
- package/dist/config/defaults.js +15 -1
- package/dist/config/loader.js +6 -1
- package/dist/config/normalizers/declaration.js +4 -1
- package/dist/config/normalizers/page.d.ts +18 -0
- package/dist/config/normalizers/page.js +34 -0
- package/dist/config/normalizers/pattern.js +7 -1
- package/dist/config/runtime.d.ts +4 -0
- package/dist/config/runtime.js +53 -5
- package/dist/index.d.ts +65 -1
- package/dist/index.js +123 -3
- package/dist/nav/index.d.ts +83 -0
- package/dist/nav/index.js +9 -0
- package/dist/nav/registry.d.ts +15 -0
- package/dist/nav/registry.js +42 -0
- package/dist/nav/resolver.d.ts +8 -0
- package/dist/nav/resolver.js +192 -0
- package/dist/nav/workspace.d.ts +18 -0
- package/dist/nav/workspace.js +103 -0
- package/dist/pipeline/styles.js +7 -35
- package/dist/pipeline/token-transformers.d.ts +45 -0
- package/dist/pipeline/token-transformers.js +71 -0
- package/dist/registry/asset-storage/adapters/vercel-blob.d.ts +17 -0
- package/dist/registry/asset-storage/adapters/vercel-blob.js +87 -0
- package/dist/registry/asset-storage/define.d.ts +10 -0
- package/dist/registry/asset-storage/define.js +13 -0
- package/dist/registry/asset-storage/resolve.d.ts +45 -0
- package/dist/registry/asset-storage/resolve.js +36 -0
- package/dist/registry/asset-storage/types.d.ts +51 -0
- package/dist/registry/asset-storage/types.js +9 -0
- package/dist/registry/assets/layout.d.ts +22 -0
- package/dist/registry/assets/layout.js +30 -0
- package/dist/registry/assets/sets.d.ts +18 -0
- package/dist/registry/assets/sets.js +44 -0
- package/dist/registry/assets/transfer.d.ts +45 -0
- package/dist/registry/assets/transfer.js +11 -0
- package/dist/registry/checkout/assets.d.ts +16 -0
- package/dist/registry/checkout/assets.js +150 -0
- package/dist/registry/checkout/index.d.ts +33 -0
- package/dist/registry/checkout/index.js +610 -0
- package/dist/registry/checkout/tokens.d.ts +15 -0
- package/dist/registry/checkout/tokens.js +171 -0
- package/dist/registry/client.d.ts +61 -0
- package/dist/registry/client.js +211 -0
- package/dist/registry/connection.d.ts +30 -0
- package/dist/registry/connection.js +36 -0
- package/dist/registry/db/adapter.d.ts +43 -0
- package/dist/registry/db/adapter.js +59 -0
- package/dist/registry/db/client.d.ts +35 -0
- package/dist/registry/db/client.js +94 -0
- package/dist/registry/db/index.d.ts +5 -0
- package/dist/registry/db/index.js +24 -0
- package/dist/registry/db/migrate.d.ts +23 -0
- package/dist/registry/db/migrate.js +64 -0
- package/dist/registry/db/schema.d.ts +4869 -0
- package/dist/registry/db/schema.js +347 -0
- package/dist/registry/path.d.ts +4 -0
- package/dist/registry/path.js +31 -0
- package/dist/registry/publish/artifacts.d.ts +16 -0
- package/dist/registry/publish/artifacts.js +132 -0
- package/dist/registry/publish/assets.d.ts +16 -0
- package/dist/registry/publish/assets.js +129 -0
- package/dist/registry/publish/errors.d.ts +5 -0
- package/dist/registry/publish/errors.js +26 -0
- package/dist/registry/publish/index.d.ts +27 -0
- package/dist/registry/publish/index.js +126 -0
- package/dist/registry/publish/package.d.ts +27 -0
- package/dist/registry/publish/package.js +257 -0
- package/dist/registry/publish/publish-build.d.ts +12 -0
- package/dist/registry/publish/publish-build.js +43 -0
- package/dist/registry/publish/tokens.d.ts +18 -0
- package/dist/registry/publish/tokens.js +112 -0
- package/dist/registry/tokens/sets.d.ts +59 -0
- package/dist/registry/tokens/sets.js +109 -0
- package/dist/registry/tokens/transfer.d.ts +48 -0
- package/dist/registry/tokens/transfer.js +10 -0
- package/dist/registry/transfer.d.ts +75 -0
- package/dist/registry/transfer.js +11 -0
- package/dist/store/filesystem-assets.d.ts +17 -0
- package/dist/store/filesystem-assets.js +147 -0
- package/dist/store/filesystem.d.ts +76 -0
- package/dist/store/filesystem.js +208 -0
- package/dist/store/index.d.ts +20 -0
- package/dist/store/index.js +38 -0
- package/dist/store/registry.d.ts +77 -0
- package/dist/store/registry.js +350 -0
- package/dist/store/source-files.d.ts +24 -0
- package/dist/store/source-files.js +147 -0
- package/dist/store/types.d.ts +185 -0
- package/dist/store/types.js +12 -0
- package/dist/transformers/plugins/csf-render.js +17 -8
- package/dist/transformers/plugins/handlebars-previews.js +10 -3
- package/dist/transformers/plugins/ssr-render.js +116 -49
- package/dist/transformers/preview/component/api.js +3 -1
- package/dist/transformers/preview/component/artifacts.js +8 -1
- package/dist/transformers/preview/component/builder.js +13 -5
- package/dist/transformers/preview/component/css.js +9 -1
- package/dist/transformers/preview/component/javascript.d.ts +9 -3
- package/dist/transformers/preview/component/javascript.js +45 -17
- package/dist/transformers/preview/component/shared-artifacts.d.ts +83 -0
- package/dist/transformers/preview/component/shared-artifacts.js +92 -0
- package/dist/transformers/preview/component.js +5 -2
- package/dist/transformers/preview/pattern/builder.js +28 -9
- package/dist/transformers/preview/pattern/html.d.ts +13 -10
- package/dist/transformers/preview/pattern/html.js +62 -27
- package/dist/transformers/preview/types.d.ts +38 -0
- package/dist/transformers/utils/handlebars.d.ts +3 -0
- package/dist/transformers/utils/handlebars.js +19 -5
- package/dist/types/config.d.ts +118 -25
- package/dist/utils/menu-shell.d.ts +60 -0
- package/dist/utils/menu-shell.js +221 -0
- package/dist/utils/stable-stringify.d.ts +2 -0
- package/dist/utils/stable-stringify.js +8 -0
- package/docs/cli.md +4 -2
- package/drizzle/0000_init_registry_storage.sql +95 -0
- package/drizzle/0001_add_review_metadata.sql +2 -0
- package/drizzle/0002_add_pages.sql +28 -0
- package/drizzle/0003_add_tokens.sql +29 -0
- package/drizzle/0004_add_assets.sql +37 -0
- package/drizzle/meta/0000_snapshot.json +642 -0
- package/drizzle/meta/0001_snapshot.json +654 -0
- package/drizzle/meta/0002_snapshot.json +835 -0
- package/drizzle/meta/0003_snapshot.json +1023 -0
- package/drizzle/meta/0004_snapshot.json +1252 -0
- package/drizzle/meta/_journal.json +41 -0
- package/drizzle.config.ts +16 -0
- package/package.json +10 -1
- package/src/app/components/Component/ComponentLists.tsx +102 -102
- package/src/app/components/Component/Preview.tsx +3 -2
- package/src/app/components/Component/RegistryActions.tsx +150 -0
- package/src/app/components/Foundations/DisplayLogo.tsx +5 -3
- package/src/app/components/Layout/Header.tsx +21 -3
- package/src/app/components/Layout/Main.tsx +11 -3
- package/src/app/components/Navigation/MainNav.tsx +4 -2
- package/src/app/components/Navigation/MobileNav.tsx +4 -2
- package/src/app/components/Navigation/SideNav.tsx +46 -11
- package/src/app/components/NotFound.tsx +24 -0
- package/src/app/components/context/NavProvider.tsx +71 -0
- package/src/app/components/old/Header.tsx +3 -3
- package/src/app/components/util/index.ts +203 -380
- package/src/app/components/util/useCollectionAssets.ts +125 -0
- package/src/app/components/util/useFoundationTokens.ts +67 -0
- package/src/app/generated/default-pages.json +1 -0
- package/src/app/generated/nav-shell.json +1 -0
- package/src/app/lib/api/query.ts +6 -0
- package/src/app/lib/api/redact.ts +46 -0
- package/src/app/lib/asset-storage.ts +81 -0
- package/src/app/lib/docs-api/artifacts.ts +116 -0
- package/src/app/lib/docs-api/backend.ts +151 -0
- package/src/app/lib/docs-api/errors.ts +52 -0
- package/src/app/lib/docs-api/handler.ts +34 -0
- package/src/app/lib/docs-api/index.ts +7 -0
- package/src/app/lib/docs-api/records.ts +189 -0
- package/src/app/lib/docs-api/registry.ts +130 -0
- package/src/app/lib/docs-api/runtime-config.ts +173 -0
- package/src/app/lib/docs-api/serve.ts +37 -0
- package/src/app/lib/docs-api/token-detail.ts +19 -0
- package/src/app/lib/registry-api/allowlist.ts +163 -0
- package/src/app/lib/registry-api/asset-transfer.ts +363 -0
- package/src/app/lib/registry-api/auth.ts +68 -0
- package/src/app/lib/registry-api/entity-routes.ts +197 -0
- package/src/app/lib/registry-api/errors.ts +51 -0
- package/src/app/lib/registry-api/files.ts +135 -0
- package/src/app/lib/registry-api/handler.ts +96 -0
- package/src/app/lib/registry-api/index.ts +4 -0
- package/src/app/lib/registry-api/meta.ts +87 -0
- package/src/app/lib/registry-api/revalidate.ts +36 -0
- package/src/app/lib/registry-api/store.ts +348 -0
- package/src/app/lib/registry-api/token-transfer.ts +231 -0
- package/src/app/lib/registry-api/transfer.ts +513 -0
- package/src/app/lib/registry-api/validation.ts +74 -0
- package/src/app/lib/registry-connection.ts +58 -0
- package/src/app/lib/utils.ts +14 -0
- package/src/app/next.config.mjs +72 -13
- package/src/app/pages/[...slug]/index.tsx +74 -20
- package/src/app/pages/_app.tsx +5 -2
- package/src/app/pages/api/docs/artifacts/[...artifactPath].ts +16 -0
- package/src/app/pages/api/docs/assets/[collection]/[...path].ts +50 -0
- package/src/app/pages/api/docs/assets/[collection]/index.ts +22 -0
- package/src/app/pages/api/docs/components/[id]/assets/[asset].ts +33 -0
- package/src/app/pages/api/docs/components/[id]/inspect/[previewId].ts +20 -0
- package/src/app/pages/api/docs/components/[id]/previews/[previewId].ts +21 -0
- package/src/app/pages/api/docs/components/[id].ts +24 -0
- package/src/app/pages/api/docs/components.json.ts +12 -0
- package/src/app/pages/api/docs/nav.json.ts +48 -0
- package/src/app/pages/api/docs/patterns/[id]/preview.ts +19 -0
- package/src/app/pages/api/docs/patterns/[id].ts +24 -0
- package/src/app/pages/api/docs/patterns.json.ts +12 -0
- package/src/app/pages/api/docs/tokens/components/[id].ts +30 -0
- package/src/app/pages/api/docs/tokens/foundations/[type].ts +32 -0
- package/src/app/pages/api/registry/components/[id]/files/[...filePath].ts +19 -0
- package/src/app/pages/api/registry/components/[id]/files/index.ts +19 -0
- package/src/app/pages/api/registry/components/[id].ts +20 -0
- package/src/app/pages/api/registry/components/index.ts +19 -0
- package/src/app/pages/api/registry/health.ts +20 -0
- package/src/app/pages/api/registry/patterns/[id]/files/[...filePath].ts +19 -0
- package/src/app/pages/api/registry/patterns/[id]/files/index.ts +19 -0
- package/src/app/pages/api/registry/patterns/[id].ts +20 -0
- package/src/app/pages/api/registry/patterns/index.ts +19 -0
- package/src/app/pages/api/registry/transfer/[kind]/[id].ts +39 -0
- package/src/app/pages/api/registry/transfer/assets/[collection].ts +24 -0
- package/src/app/pages/api/registry/transfer/assets/blobs/[hash].ts +23 -0
- package/src/app/pages/api/registry/transfer/assets/blobs/have.ts +11 -0
- package/src/app/pages/api/registry/transfer/assets/index.ts +10 -0
- package/src/app/pages/api/registry/transfer/tokens/[...setId].ts +26 -0
- package/src/app/pages/api/registry/transfer/tokens/index.ts +11 -0
- package/src/app/pages/assets/fonts.tsx +41 -17
- package/src/app/pages/assets/index.tsx +2 -2
- package/src/app/pages/assets/logos.tsx +2 -2
- package/src/app/pages/foundations/colors.tsx +18 -8
- package/src/app/pages/foundations/effects.tsx +18 -8
- package/src/app/pages/foundations/icons/[name]/index.tsx +26 -14
- package/src/app/pages/foundations/icons/index.tsx +13 -9
- package/src/app/pages/foundations/index.tsx +1 -1
- package/src/app/pages/foundations/logo.tsx +7 -4
- package/src/app/pages/foundations/typography.tsx +19 -9
- package/src/app/pages/index.tsx +1 -1
- package/src/app/pages/system/component/[component]/index.tsx +87 -17
- package/src/app/pages/system/index.tsx +13 -4
- package/src/app/pages/system/pattern/[pattern]/index.tsx +70 -14
- package/src/app/pages/system/tokens/components/[component]/index.tsx +42 -14
- package/src/app/pages/system/tokens/foundations/colors.tsx +7 -5
- package/src/app/pages/system/tokens/foundations/effects.tsx +7 -5
- package/src/app/pages/system/tokens/foundations/typography.tsx +8 -4
- package/src/app/tsconfig.json +2 -3
- package/src/app-builder/build.ts +555 -11
- package/src/app-builder/client-config.ts +61 -4
- package/src/app-builder/config-diff/snapshot.ts +1 -11
- package/src/app-builder/index.ts +1 -1
- package/src/app-builder/nav-shell.ts +74 -0
- package/src/app-builder/static-export.ts +215 -0
- package/src/app-builder/vercel-output.ts +297 -0
- package/src/app-builder/watchers/utils.ts +2 -0
- package/src/app-builder/watchers.ts +149 -25
- package/src/app-builder/websocket.ts +2 -2
- package/src/artifacts/README.md +14 -0
- package/src/artifacts/index.ts +17 -0
- package/src/artifacts/types.ts +146 -0
- package/src/artifacts/url.ts +90 -0
- package/src/cache/build-cache.ts +47 -2
- package/src/commands/build/app.ts +1 -2
- package/src/commands/build/index.ts +61 -0
- package/src/commands/checkout/index.ts +66 -0
- package/src/commands/db/migrate.ts +25 -0
- package/src/commands/index.ts +8 -0
- package/src/commands/publish/index.ts +63 -0
- package/src/config/defaults.ts +15 -0
- package/src/config/loader.ts +10 -1
- package/src/config/normalizers/declaration.ts +3 -0
- package/src/config/normalizers/page.ts +45 -0
- package/src/config/normalizers/pattern.ts +4 -1
- package/src/config/runtime.ts +48 -2
- package/src/index.ts +126 -3
- package/src/nav/index.ts +94 -0
- package/src/nav/registry.ts +54 -0
- package/src/nav/resolver.ts +217 -0
- package/src/nav/workspace.ts +87 -0
- package/src/pipeline/styles.ts +4 -35
- package/src/pipeline/token-transformers.ts +97 -0
- package/src/registry/asset-storage/adapters/vercel-blob.ts +51 -0
- package/src/registry/asset-storage/define.ts +15 -0
- package/src/registry/asset-storage/resolve.ts +72 -0
- package/src/registry/asset-storage/types.ts +46 -0
- package/src/registry/assets/layout.ts +38 -0
- package/src/registry/assets/sets.ts +48 -0
- package/src/registry/assets/transfer.ts +50 -0
- package/src/registry/checkout/assets.ts +126 -0
- package/src/registry/checkout/index.ts +596 -0
- package/src/registry/checkout/tokens.ts +152 -0
- package/src/registry/client.ts +234 -0
- package/src/registry/connection.ts +50 -0
- package/src/registry/db/adapter.ts +74 -0
- package/src/registry/db/client.ts +88 -0
- package/src/registry/db/index.ts +35 -0
- package/src/registry/db/migrate.ts +56 -0
- package/src/registry/db/schema.ts +444 -0
- package/src/registry/path.ts +26 -0
- package/src/registry/publish/artifacts.ts +147 -0
- package/src/registry/publish/assets.ts +129 -0
- package/src/registry/publish/errors.ts +34 -0
- package/src/registry/publish/index.ts +128 -0
- package/src/registry/publish/package.ts +272 -0
- package/src/registry/publish/publish-build.ts +51 -0
- package/src/registry/publish/tokens.ts +119 -0
- package/src/registry/tokens/sets.ts +132 -0
- package/src/registry/tokens/transfer.ts +53 -0
- package/src/registry/transfer.ts +82 -0
- package/src/store/filesystem-assets.ts +152 -0
- package/src/store/filesystem.ts +237 -0
- package/src/store/index.ts +62 -0
- package/src/store/registry.ts +334 -0
- package/src/store/source-files.ts +155 -0
- package/src/store/types.ts +210 -0
- package/src/transformers/plugins/csf-render.ts +31 -7
- package/src/transformers/plugins/handlebars-previews.ts +22 -3
- package/src/transformers/plugins/ssr-render.ts +145 -57
- package/src/transformers/preview/component/api.ts +2 -1
- package/src/transformers/preview/component/artifacts.ts +10 -1
- package/src/transformers/preview/component/builder.ts +9 -2
- package/src/transformers/preview/component/css.ts +10 -1
- package/src/transformers/preview/component/javascript.ts +55 -20
- package/src/transformers/preview/component/shared-artifacts.ts +146 -0
- package/src/transformers/preview/component.ts +5 -2
- package/src/transformers/preview/pattern/builder.ts +33 -7
- package/src/transformers/preview/pattern/html.ts +71 -27
- package/src/transformers/preview/types.ts +42 -0
- package/src/transformers/utils/handlebars.ts +31 -5
- package/src/types/config.ts +123 -25
- package/src/utils/menu-shell.ts +241 -0
- package/src/utils/stable-stringify.ts +7 -0
- package/templates/default/package.json.tpl +1 -1
- package/handoff.config.js +0 -90
- package/src/app/components/ComponentSearch.tsx +0 -93
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CommandModule } from 'yargs';
|
|
2
|
+
import { SharedArgs } from '../types';
|
|
3
|
+
/** Entity kinds publishable from a connected workspace. */
|
|
4
|
+
declare const ENTITY_KINDS: readonly ["component", "pattern", "page", "tokens", "assets"];
|
|
5
|
+
export interface PublishArgs extends SharedArgs {
|
|
6
|
+
type: (typeof ENTITY_KINDS)[number];
|
|
7
|
+
id?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* `handoff-app publish <component|pattern|page> <id>` — fresh targeted local build + upload of the
|
|
11
|
+
* selected entity to the connected registry.
|
|
12
|
+
*
|
|
13
|
+
* `handoff-app publish tokens [setId]` — fresh token build + upload of every logical token set, or
|
|
14
|
+
* only the named set (`foundation/colors`, `component/button`).
|
|
15
|
+
*
|
|
16
|
+
* `handoff-app publish assets [collection]` runs a fresh build and uploads every asset collection, or
|
|
17
|
+
* only the named one (`icons`, `logos`, `fonts`). Available only from a connected workspace
|
|
18
|
+
* (`runtime.mode: workspace` + a configured `registryConnection`).
|
|
19
|
+
*/
|
|
20
|
+
declare const command: CommandModule<{}, PublishArgs>;
|
|
21
|
+
export default command;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const __1 = __importDefault(require("../../"));
|
|
16
|
+
const logger_1 = require("../../utils/logger");
|
|
17
|
+
const utils_1 = require("../utils");
|
|
18
|
+
/** Entity kinds publishable from a connected workspace. */
|
|
19
|
+
const ENTITY_KINDS = ['component', 'pattern', 'page', 'tokens', 'assets'];
|
|
20
|
+
/**
|
|
21
|
+
* `handoff-app publish <component|pattern|page> <id>` — fresh targeted local build + upload of the
|
|
22
|
+
* selected entity to the connected registry.
|
|
23
|
+
*
|
|
24
|
+
* `handoff-app publish tokens [setId]` — fresh token build + upload of every logical token set, or
|
|
25
|
+
* only the named set (`foundation/colors`, `component/button`).
|
|
26
|
+
*
|
|
27
|
+
* `handoff-app publish assets [collection]` runs a fresh build and uploads every asset collection, or
|
|
28
|
+
* only the named one (`icons`, `logos`, `fonts`). Available only from a connected workspace
|
|
29
|
+
* (`runtime.mode: workspace` + a configured `registryConnection`).
|
|
30
|
+
*/
|
|
31
|
+
const command = {
|
|
32
|
+
command: 'publish <type> [id]',
|
|
33
|
+
describe: 'Build and publish a component, pattern, page, design tokens, or assets to the connected registry',
|
|
34
|
+
builder: (yargs) => {
|
|
35
|
+
return (0, utils_1.getSharedOptions)(yargs)
|
|
36
|
+
.positional('type', {
|
|
37
|
+
describe: 'The kind of entity to publish',
|
|
38
|
+
choices: ENTITY_KINDS,
|
|
39
|
+
type: 'string',
|
|
40
|
+
})
|
|
41
|
+
.positional('id', {
|
|
42
|
+
describe: 'The stable id of the entity (component/pattern/page id, token set id, or asset collection); optional for tokens/assets',
|
|
43
|
+
type: 'string',
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
handler: (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
+
const handoff = new __1.default(args.debug, args.force);
|
|
48
|
+
try {
|
|
49
|
+
if (args.type === 'tokens') {
|
|
50
|
+
yield handoff.publishTokens(args.id);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (args.type === 'assets') {
|
|
54
|
+
yield handoff.publishAssets(args.id);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (!args.id) {
|
|
58
|
+
throw new Error(`An id is required to publish a ${args.type} (e.g. "handoff-app publish ${args.type} <id>").`);
|
|
59
|
+
}
|
|
60
|
+
yield handoff.publish(args.type, args.id);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
logger_1.Logger.error(error instanceof Error ? error.message : String(error));
|
|
64
|
+
process.exitCode = 1;
|
|
65
|
+
}
|
|
66
|
+
}),
|
|
67
|
+
};
|
|
68
|
+
exports.default = command;
|
package/dist/config/defaults.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getClientConfig = exports.defaultConfig = void 0;
|
|
4
|
+
const connection_1 = require("../registry/connection");
|
|
4
5
|
const defaultConfig = () => {
|
|
5
6
|
var _a, _b, _c, _d;
|
|
6
7
|
return ({
|
|
7
8
|
dev_access_token: (_a = process.env.HANDOFF_DEV_ACCESS_TOKEN) !== null && _a !== void 0 ? _a : null,
|
|
8
9
|
figma_project_id: (_b = process.env.HANDOFF_FIGMA_PROJECT_ID) !== null && _b !== void 0 ? _b : null,
|
|
10
|
+
runtime: {
|
|
11
|
+
mode: 'workspace',
|
|
12
|
+
},
|
|
9
13
|
exportsOutputDirectory: (_c = process.env.HANDOFF_OUTPUT_DIR) !== null && _c !== void 0 ? _c : 'exported',
|
|
10
14
|
sitesOutputDirectory: (_d = process.env.HANDOFF_SITES_DIR) !== null && _d !== void 0 ? _d : 'out',
|
|
11
15
|
useVariables: process.env.HANDOFF_USE_VARIABLES === 'true',
|
|
@@ -56,13 +60,23 @@ exports.defaultConfig = defaultConfig;
|
|
|
56
60
|
* @returns The client configuration object.
|
|
57
61
|
*/
|
|
58
62
|
const getClientConfig = (config) => {
|
|
59
|
-
|
|
63
|
+
var _a;
|
|
64
|
+
const { app, exportsOutputDirectory, sitesOutputDirectory, assets_zip_links = { icons: null, logos: null }, useVariables, runtime, } = Object.assign(Object.assign({}, (0, exports.defaultConfig)()), config);
|
|
65
|
+
const mode = (_a = runtime === null || runtime === void 0 ? void 0 : runtime.mode) !== null && _a !== void 0 ? _a : 'workspace';
|
|
66
|
+
// Connected-workspace affordance: only a workspace with a resolvable registry URL is "connected".
|
|
67
|
+
// URL-only threshold (no token required) so the publish hint surfaces before the access token is
|
|
68
|
+
// set. Never project the URL/token value itself — only this boolean crosses to the browser.
|
|
69
|
+
const connected = mode === 'workspace' && Boolean((0, connection_1.resolveRegistryConnection)(config).url);
|
|
60
70
|
return {
|
|
61
71
|
app,
|
|
62
72
|
exportsOutputDirectory,
|
|
63
73
|
sitesOutputDirectory,
|
|
64
74
|
assets_zip_links,
|
|
65
75
|
useVariables,
|
|
76
|
+
runtime: {
|
|
77
|
+
mode,
|
|
78
|
+
connected,
|
|
79
|
+
},
|
|
66
80
|
};
|
|
67
81
|
};
|
|
68
82
|
exports.getClientConfig = getClientConfig;
|
package/dist/config/loader.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.initConfig = exports.initConfigWithMetadata = void 0;
|
|
7
7
|
const esbuild_1 = __importDefault(require("esbuild"));
|
|
8
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
+
const merge_1 = __importDefault(require("lodash/merge"));
|
|
9
10
|
const module_1 = require("module");
|
|
10
11
|
const path_1 = __importDefault(require("path"));
|
|
11
12
|
const logger_1 = require("../utils/logger");
|
|
@@ -94,7 +95,11 @@ const initConfigWithMetadata = (configOverride) => {
|
|
|
94
95
|
}
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
|
-
const
|
|
98
|
+
const defaults = (0, defaults_1.defaultConfig)();
|
|
99
|
+
// Top-level merge stays shallow to preserve 1.x semantics, except for the `runtime`
|
|
100
|
+
// block which is deep-merged so a partial user `runtime` (e.g. only `mode`) does not
|
|
101
|
+
// wipe the defaults supplied for the rest of the block.
|
|
102
|
+
const resolvedConfig = Object.assign(Object.assign(Object.assign({}, defaults), config), { runtime: (0, merge_1.default)({}, defaults.runtime, config.runtime) });
|
|
98
103
|
return { config: resolvedConfig, configPath };
|
|
99
104
|
};
|
|
100
105
|
exports.initConfigWithMetadata = initConfigWithMetadata;
|
|
@@ -114,6 +114,9 @@ const normalizeComponentDeclaration = (raw, options) => {
|
|
|
114
114
|
}
|
|
115
115
|
const normalizedPreviews = normalizePreviews(normalizedRaw.previews, options.declarationPath, options.warn);
|
|
116
116
|
const explicitId = typeof normalizedRaw.id === 'string' && normalizedRaw.id.trim().length > 0 ? normalizedRaw.id.trim() : undefined;
|
|
117
|
-
return Object.assign(Object.assign({}, normalizedRaw), { id: explicitId || options.fallbackId, title: normalizedRaw.name || normalizedRaw.title || '', renderer: resolvedRenderer, entries, previews: normalizedPreviews
|
|
117
|
+
return Object.assign(Object.assign({}, normalizedRaw), { id: explicitId || options.fallbackId, title: normalizedRaw.name || normalizedRaw.title || '', renderer: resolvedRenderer, entries, previews: normalizedPreviews,
|
|
118
|
+
// Source location of the entity (declaration directory), retained so the store can expose a
|
|
119
|
+
// stable source reference for checkout/publish.
|
|
120
|
+
path: path_1.default.dirname(options.declarationPath) });
|
|
118
121
|
};
|
|
119
122
|
exports.normalizeComponentDeclaration = normalizeComponentDeclaration;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PageListObject } from '../../transformers/preview/types';
|
|
2
|
+
type RawPageFrontmatter = Record<string, any>;
|
|
3
|
+
type NormalizePageOptions = {
|
|
4
|
+
/** The page id — its slug path (e.g. `guides/setup`), derived from the file location. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Logical route the page is served at (e.g. `/guides/setup`). */
|
|
7
|
+
routePath: string;
|
|
8
|
+
/** Absolute filesystem path of the source `.md` (workspace-only, stripped on publish). */
|
|
9
|
+
sourcePath: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Normalize a page's parsed markdown frontmatter into a {@link PageListObject}. Pages have no
|
|
13
|
+
* required authored fields (a bare `.md` is valid); the title falls back to a humanized last slug
|
|
14
|
+
* segment. The id is always the slug path (a page is addressed by its URL, so id ≡ route): the file
|
|
15
|
+
* location is the single source of identity for both filesystem and registry serving.
|
|
16
|
+
*/
|
|
17
|
+
export declare const normalizePageDeclaration: (raw: RawPageFrontmatter, options: NormalizePageOptions) => PageListObject;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizePageDeclaration = void 0;
|
|
4
|
+
/** Humanize a slug segment (`getting-started` → `Getting Started`) for a default title. */
|
|
5
|
+
const humanize = (segment) => segment
|
|
6
|
+
.replace(/[-_]/g, ' ')
|
|
7
|
+
.replace(/\b\w/g, (c) => c.toUpperCase())
|
|
8
|
+
.trim();
|
|
9
|
+
/**
|
|
10
|
+
* Normalize a page's parsed markdown frontmatter into a {@link PageListObject}. Pages have no
|
|
11
|
+
* required authored fields (a bare `.md` is valid); the title falls back to a humanized last slug
|
|
12
|
+
* segment. The id is always the slug path (a page is addressed by its URL, so id ≡ route): the file
|
|
13
|
+
* location is the single source of identity for both filesystem and registry serving.
|
|
14
|
+
*/
|
|
15
|
+
const normalizePageDeclaration = (raw, options) => {
|
|
16
|
+
var _a;
|
|
17
|
+
const lastSegment = (_a = options.id.split('/').pop()) !== null && _a !== void 0 ? _a : options.id;
|
|
18
|
+
return {
|
|
19
|
+
id: options.id,
|
|
20
|
+
path: options.routePath,
|
|
21
|
+
sourcePath: options.sourcePath,
|
|
22
|
+
title: typeof raw.title === 'string' && raw.title.trim() ? raw.title : humanize(lastSegment),
|
|
23
|
+
description: typeof raw.description === 'string' ? raw.description : undefined,
|
|
24
|
+
group: typeof raw.group === 'string' ? raw.group : undefined,
|
|
25
|
+
weight: typeof raw.weight === 'number' ? raw.weight : undefined,
|
|
26
|
+
menuTitle: typeof raw.menuTitle === 'string' ? raw.menuTitle : undefined,
|
|
27
|
+
metaTitle: typeof raw.metaTitle === 'string' ? raw.metaTitle : undefined,
|
|
28
|
+
metaDescription: typeof raw.metaDescription === 'string' ? raw.metaDescription : undefined,
|
|
29
|
+
enabled: typeof raw.enabled === 'boolean' ? raw.enabled : undefined,
|
|
30
|
+
external: typeof raw.external === 'string' || typeof raw.external === 'boolean' ? raw.external : undefined,
|
|
31
|
+
menu: raw.menu && typeof raw.menu === 'object' ? raw.menu : undefined,
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
exports.normalizePageDeclaration = normalizePageDeclaration;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.normalizePatternDeclaration = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
4
8
|
const normalizePatternDeclaration = (raw, options) => {
|
|
5
9
|
if (!raw.name || typeof raw.name !== 'string') {
|
|
6
10
|
throw new Error(`Pattern "${options.fallbackId}" in "${options.declarationPath}" is missing a required "name" field.`);
|
|
@@ -29,7 +33,9 @@ const normalizePatternDeclaration = (raw, options) => {
|
|
|
29
33
|
group: typeof raw.group === 'string' ? raw.group : undefined,
|
|
30
34
|
tags: Array.isArray(raw.tags) ? raw.tags.filter((t) => typeof t === 'string') : undefined,
|
|
31
35
|
components,
|
|
32
|
-
|
|
36
|
+
// Source location of the pattern (declaration directory), retained so the store can expose a
|
|
37
|
+
// stable source reference for checkout/publish.
|
|
38
|
+
path: path_1.default.dirname(options.declarationPath),
|
|
33
39
|
};
|
|
34
40
|
};
|
|
35
41
|
exports.normalizePatternDeclaration = normalizePatternDeclaration;
|
package/dist/config/runtime.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ interface HandoffContext {
|
|
|
8
8
|
workingPath: string;
|
|
9
9
|
modulePath: string;
|
|
10
10
|
}
|
|
11
|
+
type DeclarationResolution = {
|
|
12
|
+
fileName: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const resolveComponentDeclaration: (componentDir: string, componentBaseName: string) => DeclarationResolution | null;
|
|
11
15
|
/**
|
|
12
16
|
* Initializes the runtime configuration by resolving component entries,
|
|
13
17
|
* SCSS/JS paths, and transformer options from the handoff config.
|
package/dist/config/runtime.js
CHANGED
|
@@ -3,9 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.toLowerCaseKeysAndValues = exports.getItemsForPath = exports.getComponentsForPath = exports.initRuntimeConfig = void 0;
|
|
6
|
+
exports.toLowerCaseKeysAndValues = exports.getItemsForPath = exports.getComponentsForPath = exports.initRuntimeConfig = exports.resolveComponentDeclaration = void 0;
|
|
7
7
|
const esbuild_1 = __importDefault(require("esbuild"));
|
|
8
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
+
const gray_matter_1 = __importDefault(require("gray-matter"));
|
|
9
10
|
const module_1 = require("module");
|
|
10
11
|
const path_1 = __importDefault(require("path"));
|
|
11
12
|
const csf_1 = require("../transformers/utils/csf");
|
|
@@ -13,6 +14,7 @@ const module_2 = require("../transformers/utils/module");
|
|
|
13
14
|
const logger_1 = require("../utils/logger");
|
|
14
15
|
const path_2 = require("../utils/path");
|
|
15
16
|
const declaration_1 = require("./normalizers/declaration");
|
|
17
|
+
const page_1 = require("./normalizers/page");
|
|
16
18
|
const pattern_1 = require("./normalizers/pattern");
|
|
17
19
|
const MODERN_EXTENSIONS = ['ts', 'js', 'cjs', 'json'];
|
|
18
20
|
const getLegacyDeclarationFiles = (componentBaseName) => [
|
|
@@ -54,6 +56,7 @@ const resolveComponentDeclaration = (componentDir, componentBaseName) => {
|
|
|
54
56
|
}
|
|
55
57
|
return null;
|
|
56
58
|
};
|
|
59
|
+
exports.resolveComponentDeclaration = resolveComponentDeclaration;
|
|
57
60
|
const evaluateTypeScriptDeclaration = (filePath, handoffModulePath) => {
|
|
58
61
|
var _a, _b;
|
|
59
62
|
const buildResult = esbuild_1.default.buildSync({
|
|
@@ -137,6 +140,7 @@ const initRuntimeConfig = (handoff) => {
|
|
|
137
140
|
js: undefined,
|
|
138
141
|
components: {},
|
|
139
142
|
patterns: {},
|
|
143
|
+
pages: {},
|
|
140
144
|
},
|
|
141
145
|
};
|
|
142
146
|
if (!!((_a = handoff.config.entries) === null || _a === void 0 ? void 0 : _a.scss)) {
|
|
@@ -150,7 +154,7 @@ const initRuntimeConfig = (handoff) => {
|
|
|
150
154
|
for (const componentPath of componentPaths) {
|
|
151
155
|
const resolvedComponentPath = path_1.default.resolve(handoff.workingPath, componentPath);
|
|
152
156
|
const componentBaseName = path_1.default.basename(resolvedComponentPath);
|
|
153
|
-
const declaration = resolveComponentDeclaration(resolvedComponentPath, componentBaseName);
|
|
157
|
+
const declaration = (0, exports.resolveComponentDeclaration)(resolvedComponentPath, componentBaseName);
|
|
154
158
|
if (!declaration) {
|
|
155
159
|
const modernFiles = getModernDeclarationFiles(componentBaseName);
|
|
156
160
|
const legacyFiles = getLegacyDeclarationFiles(componentBaseName);
|
|
@@ -201,7 +205,7 @@ const initRuntimeConfig = (handoff) => {
|
|
|
201
205
|
for (const patternPath of patternPaths) {
|
|
202
206
|
const resolvedPatternPath = path_1.default.resolve(handoff.workingPath, patternPath);
|
|
203
207
|
const patternBaseName = path_1.default.basename(resolvedPatternPath);
|
|
204
|
-
const declaration = resolveComponentDeclaration(resolvedPatternPath, patternBaseName);
|
|
208
|
+
const declaration = (0, exports.resolveComponentDeclaration)(resolvedPatternPath, patternBaseName);
|
|
205
209
|
if (!declaration) {
|
|
206
210
|
const modernFiles = getModernDeclarationFiles(patternBaseName);
|
|
207
211
|
const legacyFiles = getLegacyDeclarationFiles(patternBaseName);
|
|
@@ -220,7 +224,12 @@ const initRuntimeConfig = (handoff) => {
|
|
|
220
224
|
});
|
|
221
225
|
}
|
|
222
226
|
catch (err) {
|
|
223
|
-
|
|
227
|
+
// Treat as a warning rather than an error: the file may be empty or
|
|
228
|
+
// mid-edit. It is already tracked in configFiles above, so
|
|
229
|
+
// watchRuntimeConfiguration will pick it up once the file is saved
|
|
230
|
+
// with valid content.
|
|
231
|
+
logger_1.Logger.warn(`Pattern config skipped (incomplete or invalid) — will retry on next save: ${resolvedPatternConfigPath}`);
|
|
232
|
+
logger_1.Logger.debug(`Pattern parse detail:`, err);
|
|
224
233
|
continue;
|
|
225
234
|
}
|
|
226
235
|
configFileIndex.set((0, path_2.normalizePathForCompare)(resolvedPatternConfigPath), { kind: 'pattern', entityId: pattern.id });
|
|
@@ -228,12 +237,51 @@ const initRuntimeConfig = (handoff) => {
|
|
|
228
237
|
}
|
|
229
238
|
}
|
|
230
239
|
// -------------------------------------------------------------------------
|
|
240
|
+
// Discover markdown pages
|
|
241
|
+
// -------------------------------------------------------------------------
|
|
242
|
+
// Working pages under `<workingPath>/pages/` are first-class registry entities (publish/checkout).
|
|
243
|
+
// Discovery mirrors the catch-all/static-path walk: every `.md` except `index.md` becomes a page
|
|
244
|
+
// keyed by its slug path. Package `config/docs` defaults are NOT entities (they ship with the tool).
|
|
245
|
+
const pagesRoot = path_1.default.resolve(handoff.workingPath, 'pages');
|
|
246
|
+
for (const segments of collectPageMarkdownPaths(pagesRoot)) {
|
|
247
|
+
const slug = segments.join('/');
|
|
248
|
+
const sourcePath = path_1.default.resolve(pagesRoot, `${slug}.md`);
|
|
249
|
+
try {
|
|
250
|
+
const { data: frontmatter } = (0, gray_matter_1.default)(fs_extra_1.default.readFileSync(sourcePath, 'utf-8'));
|
|
251
|
+
const page = (0, page_1.normalizePageDeclaration)(frontmatter, { id: slug, routePath: `/${slug}`, sourcePath });
|
|
252
|
+
result.entries.pages[page.id] = page;
|
|
253
|
+
}
|
|
254
|
+
catch (err) {
|
|
255
|
+
logger_1.Logger.warn(`Page skipped (unreadable or invalid frontmatter): ${sourcePath}`);
|
|
256
|
+
logger_1.Logger.debug(`Page parse detail:`, err);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
// -------------------------------------------------------------------------
|
|
231
260
|
// Inject synthetic previews from patterns onto components
|
|
232
261
|
// -------------------------------------------------------------------------
|
|
233
262
|
injectPatternPreviews(result);
|
|
234
263
|
return [result, Array.from(configFiles), configFileIndex];
|
|
235
264
|
};
|
|
236
265
|
exports.initRuntimeConfig = initRuntimeConfig;
|
|
266
|
+
/**
|
|
267
|
+
* Recursively collect `.md` files under a root, returning slug segments (relative path without the
|
|
268
|
+
* `.md`). `index.md` is excluded — section index content is served by dedicated/home routes.
|
|
269
|
+
*/
|
|
270
|
+
const collectPageMarkdownPaths = (rootDir, relativeParts = []) => {
|
|
271
|
+
if (!fs_extra_1.default.existsSync(rootDir))
|
|
272
|
+
return [];
|
|
273
|
+
const results = [];
|
|
274
|
+
for (const entry of fs_extra_1.default.readdirSync(rootDir)) {
|
|
275
|
+
const fullPath = path_1.default.join(rootDir, entry);
|
|
276
|
+
if (fs_extra_1.default.lstatSync(fullPath).isDirectory()) {
|
|
277
|
+
results.push(...collectPageMarkdownPaths(fullPath, [...relativeParts, entry]));
|
|
278
|
+
}
|
|
279
|
+
else if (entry.endsWith('.md') && entry !== 'index.md') {
|
|
280
|
+
results.push([...relativeParts, entry.replace(/\.md$/, '')]);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return results;
|
|
284
|
+
};
|
|
237
285
|
/**
|
|
238
286
|
* Returns a list of component directories for a given path.
|
|
239
287
|
*
|
|
@@ -249,7 +297,7 @@ exports.initRuntimeConfig = initRuntimeConfig;
|
|
|
249
297
|
*/
|
|
250
298
|
const getComponentsForPath = (searchPath) => {
|
|
251
299
|
const dirName = path_1.default.basename(searchPath);
|
|
252
|
-
const hasOwnConfig = !!resolveComponentDeclaration(searchPath, dirName);
|
|
300
|
+
const hasOwnConfig = !!(0, exports.resolveComponentDeclaration)(searchPath, dirName);
|
|
253
301
|
// Check if searchPath itself is a component directory (has a config file named after the directory)
|
|
254
302
|
if (hasOwnConfig) {
|
|
255
303
|
// This directory is a single component
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import 'dotenv/config';
|
|
2
2
|
import { Types as CoreTypes, Handoff as HandoffRunner } from 'handoff-core';
|
|
3
|
+
import { type BuildPackage, type BuildTarget } from './app-builder';
|
|
4
|
+
import { type HandoffStore } from './store';
|
|
3
5
|
import { Config, ConfigFileEntry, RuntimeConfig } from './types/config';
|
|
4
6
|
declare class Handoff {
|
|
5
7
|
config: Config | null;
|
|
@@ -15,6 +17,12 @@ declare class Handoff {
|
|
|
15
17
|
effects: {};
|
|
16
18
|
typography: {};
|
|
17
19
|
};
|
|
20
|
+
private _store?;
|
|
21
|
+
/**
|
|
22
|
+
* Normalized store over the current workspace runtime for components, patterns, pages, tokens,
|
|
23
|
+
* and assets. It is created lazily and reads live from `runtimeConfig`.
|
|
24
|
+
*/
|
|
25
|
+
get store(): HandoffStore;
|
|
18
26
|
private _initialArgs;
|
|
19
27
|
private _configFilePaths;
|
|
20
28
|
private _configFileIndex;
|
|
@@ -29,7 +37,55 @@ declare class Handoff {
|
|
|
29
37
|
fetch(): Promise<Handoff>;
|
|
30
38
|
component(name: string | null): Promise<Handoff>;
|
|
31
39
|
pattern(): Promise<Handoff>;
|
|
32
|
-
build(skipComponents?: boolean): Promise<Handoff>;
|
|
40
|
+
build(target?: BuildTarget, skipComponents?: boolean, buildPackage?: BuildPackage): Promise<Handoff>;
|
|
41
|
+
/**
|
|
42
|
+
* Runs the package-owned registry database migrations against the configured PostgreSQL/Neon
|
|
43
|
+
* database. Independent of {@link build} — it only reads config + DB env vars and applies the
|
|
44
|
+
* bundled migration set.
|
|
45
|
+
*/
|
|
46
|
+
dbMigrate(): Promise<Handoff>;
|
|
47
|
+
/**
|
|
48
|
+
* Publish a single component, pattern, or page from this connected workspace to the configured
|
|
49
|
+
* remote registry. Components and patterns receive a fresh targeted build before upload. Pages
|
|
50
|
+
* upload their record and markdown source because they render at runtime. The publish module is
|
|
51
|
+
* loaded lazily so the registry client and build code never enter the docs app bundle.
|
|
52
|
+
*/
|
|
53
|
+
publish(kind: 'component' | 'pattern' | 'page', id: string): Promise<Handoff>;
|
|
54
|
+
/**
|
|
55
|
+
* Checkout a single component, pattern, or page from the connected remote registry. The checkout
|
|
56
|
+
* module is loaded lazily so the registry client never enters the docs app bundle.
|
|
57
|
+
*/
|
|
58
|
+
checkout(kind: 'component' | 'pattern' | 'page', id: string): Promise<Handoff>;
|
|
59
|
+
/**
|
|
60
|
+
* Publish design token sets from this connected workspace to the configured remote registry. Runs a
|
|
61
|
+
* fresh token build (Figma extract + style transformers), discovers the logical sets, and uploads
|
|
62
|
+
* each changed set (its extracted record + generated artifacts). Publishes every set when `setId` is
|
|
63
|
+
* omitted, or only the named set (`foundation/colors`, `component/<id>`). Loaded lazily so the
|
|
64
|
+
* registry client/build code never enters the docs app bundle.
|
|
65
|
+
*/
|
|
66
|
+
publishTokens(setId?: string): Promise<Handoff>;
|
|
67
|
+
/**
|
|
68
|
+
* Checkout design token sets from the connected remote registry into this workspace: reconstruct
|
|
69
|
+
* the canonical local `tokens.json` and restore the generated token files to their configured output
|
|
70
|
+
* paths. Checks out every published set when `setId` is omitted, or only the named set. Loaded lazily
|
|
71
|
+
* so the registry client never enters the docs app bundle.
|
|
72
|
+
*/
|
|
73
|
+
checkoutTokens(setId?: string): Promise<Handoff>;
|
|
74
|
+
/**
|
|
75
|
+
* Publish asset collections (icons/logos/fonts) from this connected workspace to the configured
|
|
76
|
+
* remote registry. Runs a fresh build (Figma extract + asset generation), discovers the collections,
|
|
77
|
+
* uploads only content hashes the registry lacks, and finalizes each collection manifest atomically.
|
|
78
|
+
* Publishes every collection when `collection` is omitted, or only the named one. Loaded lazily so
|
|
79
|
+
* the registry client/build code never enters the docs app bundle.
|
|
80
|
+
*/
|
|
81
|
+
publishAssets(collection?: string): Promise<Handoff>;
|
|
82
|
+
/**
|
|
83
|
+
* Checkout asset collections from the connected remote registry into this workspace: recreate the
|
|
84
|
+
* standard workspace asset files, collection JSON, icon sprite/manifest, and downloadable archives.
|
|
85
|
+
* Checks out every published collection when `collection` is omitted, or only the named one. Loaded
|
|
86
|
+
* lazily so the registry client never enters the docs app bundle.
|
|
87
|
+
*/
|
|
88
|
+
checkoutAssets(collection?: string): Promise<Handoff>;
|
|
33
89
|
ejectConfig(): Promise<Handoff>;
|
|
34
90
|
ejectPages(): Promise<Handoff>;
|
|
35
91
|
ejectTheme(): Promise<Handoff>;
|
|
@@ -70,6 +126,12 @@ declare class Handoff {
|
|
|
70
126
|
* @returns {string} The absolute path to the tokens directory
|
|
71
127
|
*/
|
|
72
128
|
getVariablesFilePath(): string;
|
|
129
|
+
/**
|
|
130
|
+
* Gets the generated docs API root (`<workingPath>/public/api`) — the tree holding the asset
|
|
131
|
+
* collection JSON, per-asset icon/logo bodies, and the icon sprite + manifest.
|
|
132
|
+
* @returns {string} The absolute path to the public docs API directory
|
|
133
|
+
*/
|
|
134
|
+
getAssetsApiPath(): string;
|
|
73
135
|
/**
|
|
74
136
|
* Gets the path to the icons.zip file
|
|
75
137
|
* @returns {string} The absolute path to the icons.zip file
|
|
@@ -106,6 +168,8 @@ export type { ComponentObject as Component } from './transformers/preview/types'
|
|
|
106
168
|
export type { Config, RegisterHandlebarsHelpersContext } from './types/config';
|
|
107
169
|
export { defineConfig } from './config';
|
|
108
170
|
export { defineComponent, defineCsfComponent, defineHandlebarsComponent, definePattern, defineReactComponent, } from './declarations';
|
|
171
|
+
export { defineAssetStorage } from './registry/asset-storage/define';
|
|
172
|
+
export type { AssetStorage, AssetStorageContext, AssetStorageFactory, AssetStorageInput, AssetStorageReadResult, } from './registry/asset-storage/types';
|
|
109
173
|
export type { CsfDeclarationConfig, DeclarationPreview, GenericDeclarationConfig, GenericPatternDeclarationConfig, HandlebarsDeclarationConfig, PatternComponentRef, ReactDeclarationConfig, RendererKind, } from './declarations';
|
|
110
174
|
export { Transformers as CoreTransformers, TransformerUtils as CoreTransformerUtils, Types as CoreTypes } from 'handoff-core';
|
|
111
175
|
export default Handoff;
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.CoreTypes = exports.CoreTransformerUtils = exports.CoreTransformers = exports.defineReactComponent = exports.definePattern = exports.defineHandlebarsComponent = exports.defineCsfComponent = exports.defineComponent = exports.defineConfig = void 0;
|
|
38
|
+
exports.CoreTypes = exports.CoreTransformerUtils = exports.CoreTransformers = exports.defineAssetStorage = exports.defineReactComponent = exports.definePattern = exports.defineHandlebarsComponent = exports.defineCsfComponent = exports.defineComponent = exports.defineConfig = void 0;
|
|
39
39
|
require("dotenv/config");
|
|
40
40
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
41
41
|
const handoff_core_1 = require("handoff-core");
|
|
@@ -45,11 +45,22 @@ const eject_1 = require("./cli/eject");
|
|
|
45
45
|
const make_1 = require("./cli/make");
|
|
46
46
|
const config_1 = require("./config");
|
|
47
47
|
const pipeline_1 = __importStar(require("./pipeline"));
|
|
48
|
+
const store_1 = require("./store");
|
|
48
49
|
const builder_1 = __importStar(require("./transformers/preview/component/builder"));
|
|
49
50
|
const logger_1 = require("./utils/logger");
|
|
50
51
|
const path_2 = require("./utils/path");
|
|
51
52
|
const path_3 = require("./utils/path");
|
|
52
53
|
class Handoff {
|
|
54
|
+
/**
|
|
55
|
+
* Normalized store over the current workspace runtime for components, patterns, pages, tokens,
|
|
56
|
+
* and assets. It is created lazily and reads live from `runtimeConfig`.
|
|
57
|
+
*/
|
|
58
|
+
get store() {
|
|
59
|
+
if (!this._store) {
|
|
60
|
+
this._store = (0, store_1.createFilesystemStore)(this);
|
|
61
|
+
}
|
|
62
|
+
return this._store;
|
|
63
|
+
}
|
|
53
64
|
constructor(debug, force, config) {
|
|
54
65
|
this.debug = false;
|
|
55
66
|
this.force = false;
|
|
@@ -125,10 +136,109 @@ class Handoff {
|
|
|
125
136
|
return this;
|
|
126
137
|
});
|
|
127
138
|
}
|
|
128
|
-
build(
|
|
139
|
+
build() {
|
|
140
|
+
return __awaiter(this, arguments, void 0, function* (target = 'static', skipComponents, buildPackage) {
|
|
141
|
+
this.preRunner();
|
|
142
|
+
yield (0, app_builder_1.default)(this, target, skipComponents, buildPackage);
|
|
143
|
+
return this;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Runs the package-owned registry database migrations against the configured PostgreSQL/Neon
|
|
148
|
+
* database. Independent of {@link build} — it only reads config + DB env vars and applies the
|
|
149
|
+
* bundled migration set.
|
|
150
|
+
*/
|
|
151
|
+
dbMigrate() {
|
|
152
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
if (!this.config) {
|
|
154
|
+
throw Error('Handoff not initialized');
|
|
155
|
+
}
|
|
156
|
+
const { runRegistryMigrations } = yield Promise.resolve().then(() => __importStar(require('./registry/db/migrate')));
|
|
157
|
+
yield runRegistryMigrations(this);
|
|
158
|
+
return this;
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Publish a single component, pattern, or page from this connected workspace to the configured
|
|
163
|
+
* remote registry. Components and patterns receive a fresh targeted build before upload. Pages
|
|
164
|
+
* upload their record and markdown source because they render at runtime. The publish module is
|
|
165
|
+
* loaded lazily so the registry client and build code never enter the docs app bundle.
|
|
166
|
+
*/
|
|
167
|
+
publish(kind, id) {
|
|
168
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
this.preRunner();
|
|
170
|
+
const { publishEntity } = yield Promise.resolve().then(() => __importStar(require('./registry/publish')));
|
|
171
|
+
yield publishEntity(this, kind, id);
|
|
172
|
+
return this;
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Checkout a single component, pattern, or page from the connected remote registry. The checkout
|
|
177
|
+
* module is loaded lazily so the registry client never enters the docs app bundle.
|
|
178
|
+
*/
|
|
179
|
+
checkout(kind, id) {
|
|
129
180
|
return __awaiter(this, void 0, void 0, function* () {
|
|
130
181
|
this.preRunner();
|
|
131
|
-
yield (
|
|
182
|
+
const { checkoutEntity } = yield Promise.resolve().then(() => __importStar(require('./registry/checkout')));
|
|
183
|
+
yield checkoutEntity(this, kind, id);
|
|
184
|
+
return this;
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Publish design token sets from this connected workspace to the configured remote registry. Runs a
|
|
189
|
+
* fresh token build (Figma extract + style transformers), discovers the logical sets, and uploads
|
|
190
|
+
* each changed set (its extracted record + generated artifacts). Publishes every set when `setId` is
|
|
191
|
+
* omitted, or only the named set (`foundation/colors`, `component/<id>`). Loaded lazily so the
|
|
192
|
+
* registry client/build code never enters the docs app bundle.
|
|
193
|
+
*/
|
|
194
|
+
publishTokens(setId) {
|
|
195
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
196
|
+
this.preRunner();
|
|
197
|
+
const { publishTokens } = yield Promise.resolve().then(() => __importStar(require('./registry/publish/tokens')));
|
|
198
|
+
yield publishTokens(this, setId);
|
|
199
|
+
return this;
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Checkout design token sets from the connected remote registry into this workspace: reconstruct
|
|
204
|
+
* the canonical local `tokens.json` and restore the generated token files to their configured output
|
|
205
|
+
* paths. Checks out every published set when `setId` is omitted, or only the named set. Loaded lazily
|
|
206
|
+
* so the registry client never enters the docs app bundle.
|
|
207
|
+
*/
|
|
208
|
+
checkoutTokens(setId) {
|
|
209
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
210
|
+
this.preRunner();
|
|
211
|
+
const { checkoutTokens } = yield Promise.resolve().then(() => __importStar(require('./registry/checkout/tokens')));
|
|
212
|
+
yield checkoutTokens(this, setId);
|
|
213
|
+
return this;
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Publish asset collections (icons/logos/fonts) from this connected workspace to the configured
|
|
218
|
+
* remote registry. Runs a fresh build (Figma extract + asset generation), discovers the collections,
|
|
219
|
+
* uploads only content hashes the registry lacks, and finalizes each collection manifest atomically.
|
|
220
|
+
* Publishes every collection when `collection` is omitted, or only the named one. Loaded lazily so
|
|
221
|
+
* the registry client/build code never enters the docs app bundle.
|
|
222
|
+
*/
|
|
223
|
+
publishAssets(collection) {
|
|
224
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
225
|
+
this.preRunner();
|
|
226
|
+
const { publishAssets } = yield Promise.resolve().then(() => __importStar(require('./registry/publish/assets')));
|
|
227
|
+
yield publishAssets(this, collection);
|
|
228
|
+
return this;
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Checkout asset collections from the connected remote registry into this workspace: recreate the
|
|
233
|
+
* standard workspace asset files, collection JSON, icon sprite/manifest, and downloadable archives.
|
|
234
|
+
* Checks out every published collection when `collection` is omitted, or only the named one. Loaded
|
|
235
|
+
* lazily so the registry client never enters the docs app bundle.
|
|
236
|
+
*/
|
|
237
|
+
checkoutAssets(collection) {
|
|
238
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
239
|
+
this.preRunner();
|
|
240
|
+
const { checkoutAssets } = yield Promise.resolve().then(() => __importStar(require('./registry/checkout/assets')));
|
|
241
|
+
yield checkoutAssets(this, collection);
|
|
132
242
|
return this;
|
|
133
243
|
});
|
|
134
244
|
}
|
|
@@ -283,6 +393,14 @@ class Handoff {
|
|
|
283
393
|
getVariablesFilePath() {
|
|
284
394
|
return path_1.default.join(this.getOutputPath(), 'tokens');
|
|
285
395
|
}
|
|
396
|
+
/**
|
|
397
|
+
* Gets the generated docs API root (`<workingPath>/public/api`) — the tree holding the asset
|
|
398
|
+
* collection JSON, per-asset icon/logo bodies, and the icon sprite + manifest.
|
|
399
|
+
* @returns {string} The absolute path to the public docs API directory
|
|
400
|
+
*/
|
|
401
|
+
getAssetsApiPath() {
|
|
402
|
+
return path_1.default.resolve(this.workingPath, 'public', 'api');
|
|
403
|
+
}
|
|
286
404
|
/**
|
|
287
405
|
* Gets the path to the icons.zip file
|
|
288
406
|
* @returns {string} The absolute path to the icons.zip file
|
|
@@ -345,6 +463,8 @@ Object.defineProperty(exports, "defineCsfComponent", { enumerable: true, get: fu
|
|
|
345
463
|
Object.defineProperty(exports, "defineHandlebarsComponent", { enumerable: true, get: function () { return declarations_1.defineHandlebarsComponent; } });
|
|
346
464
|
Object.defineProperty(exports, "definePattern", { enumerable: true, get: function () { return declarations_1.definePattern; } });
|
|
347
465
|
Object.defineProperty(exports, "defineReactComponent", { enumerable: true, get: function () { return declarations_1.defineReactComponent; } });
|
|
466
|
+
var define_1 = require("./registry/asset-storage/define");
|
|
467
|
+
Object.defineProperty(exports, "defineAssetStorage", { enumerable: true, get: function () { return define_1.defineAssetStorage; } });
|
|
348
468
|
// Export transformers and types from handoff-core
|
|
349
469
|
var handoff_core_2 = require("handoff-core");
|
|
350
470
|
Object.defineProperty(exports, "CoreTransformers", { enumerable: true, get: function () { return handoff_core_2.Transformers; } });
|