@contentful/experience-design-system-cli 2.37.1-dev-build-932fd115.0 → 2.37.1-dev-build-91b5f8aa.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/dist/app.js +341 -154
- package/dist/index.js +436 -163
- package/dist/package.json +1 -1
- package/dist/src/tui/import/shared/error-step/controls.d.ts +7 -0
- package/dist/src/tui/import/shared/error-step/error-step.d.ts +10 -0
- package/dist/src/tui/import/shared/error-step/logic.d.ts +15 -0
- package/dist/src/tui/import/shared/gate-step/controls.d.ts +8 -0
- package/dist/src/tui/import/shared/gate-step/gate-step.d.ts +14 -0
- package/dist/src/tui/import/shared/gate-step/logic.d.ts +11 -0
- package/dist/src/tui/import/shared/index.d.ts +3 -0
- package/dist/src/tui/import/shared/running-step/logic.d.ts +12 -0
- package/dist/src/tui/import/shared/running-step/running-step.d.ts +11 -0
- package/dist/src/tui/import/shared/running-step/theme.d.ts +3 -0
- package/dist/src/tui/import/shared/running-step/use-elapsed.d.ts +1 -0
- package/dist/src/tui/import/spawn-v1-import.d.ts +3 -0
- package/dist/src/tui/import/steps/05-token-reuse/logic.d.ts +22 -0
- package/dist/src/tui/import/steps/05-token-reuse/screen.d.ts +10 -0
- package/dist/src/tui/import/steps/index.d.ts +1 -0
- package/legacy/dist/src/index.js +26 -79
- package/legacy/package.json +1 -1
- package/package.json +3 -3
package/dist/package.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ErrorStepProps {
|
|
3
|
+
stepName: string;
|
|
4
|
+
message: string;
|
|
5
|
+
onExit: () => void;
|
|
6
|
+
onRetryCredentials?: () => void;
|
|
7
|
+
onAcknowledgeBreakingChanges?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function ErrorStep({ stepName, message, onExit, onRetryCredentials, onAcknowledgeBreakingChanges, }: ErrorStepProps): React.ReactElement;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface Key {
|
|
2
|
+
return: boolean;
|
|
3
|
+
escape: boolean;
|
|
4
|
+
}
|
|
5
|
+
export type ErrorAction = 'exit' | 'retry' | 'acknowledge' | null;
|
|
6
|
+
interface Available {
|
|
7
|
+
canRetry: boolean;
|
|
8
|
+
canAcknowledge: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function errorAction(input: string, key: Key, available: Available): ErrorAction;
|
|
11
|
+
export declare function errorControls(available: Available): {
|
|
12
|
+
keys: string;
|
|
13
|
+
label: string;
|
|
14
|
+
}[];
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface GateStepProps {
|
|
3
|
+
message: string;
|
|
4
|
+
onContinue: () => void;
|
|
5
|
+
onQuit: () => void;
|
|
6
|
+
summary?: string;
|
|
7
|
+
context?: string;
|
|
8
|
+
continueLabel?: string;
|
|
9
|
+
skipLabel?: string;
|
|
10
|
+
onSkip?: () => void;
|
|
11
|
+
intent?: 'success' | 'error';
|
|
12
|
+
}
|
|
13
|
+
export declare function GateStep({ message, onContinue, onQuit, summary, context, continueLabel, skipLabel, onSkip, intent, }: GateStepProps): React.ReactElement;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface Key {
|
|
2
|
+
return: boolean;
|
|
3
|
+
escape: boolean;
|
|
4
|
+
}
|
|
5
|
+
export type GateAction = 'continue' | 'skip' | 'quit' | null;
|
|
6
|
+
export declare function gateAction(input: string, key: Key, canSkip: boolean): GateAction;
|
|
7
|
+
export declare function gateControls(continueLabel: string, skipLabel: string, canSkip: boolean): {
|
|
8
|
+
keys: string;
|
|
9
|
+
label: string;
|
|
10
|
+
}[];
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface Progress {
|
|
2
|
+
done: number;
|
|
3
|
+
total: number;
|
|
4
|
+
}
|
|
5
|
+
export interface RunningLine {
|
|
6
|
+
text: string;
|
|
7
|
+
complete?: boolean;
|
|
8
|
+
progress?: Progress;
|
|
9
|
+
}
|
|
10
|
+
export declare function progressPercent(progress: Progress): number;
|
|
11
|
+
export declare function formatElapsed(totalSeconds: number): string;
|
|
12
|
+
export declare function stepLabel(stepNumber: number, totalSteps: number, title: string): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type RunningLine } from './logic.js';
|
|
3
|
+
interface RunningStepProps {
|
|
4
|
+
stepNumber: number;
|
|
5
|
+
totalSteps: number;
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
lines?: readonly RunningLine[];
|
|
9
|
+
}
|
|
10
|
+
export declare function RunningStep({ stepNumber, totalSteps, title, description, lines, }: RunningStepProps): React.ReactElement;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useElapsed(): string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ImportOptions } from '../../commands/import-options.js';
|
|
2
|
+
import type { TokenStrategy } from './steps/05-token-reuse/logic.js';
|
|
2
3
|
interface StepResult {
|
|
3
4
|
step: string;
|
|
4
5
|
status: 'complete' | 'failed' | 'skipped';
|
|
@@ -20,6 +21,7 @@ export interface SpawnV1ImportOptions extends Partial<ImportOptions> {
|
|
|
20
21
|
tokens?: string;
|
|
21
22
|
filePaths?: string[];
|
|
22
23
|
skipCredentials?: boolean;
|
|
24
|
+
tokenStrategy?: TokenStrategy;
|
|
23
25
|
onProgress?: (line: string) => void;
|
|
24
26
|
}
|
|
25
27
|
export interface SpawnV1ImportResult {
|
|
@@ -29,5 +31,6 @@ export interface SpawnV1ImportResult {
|
|
|
29
31
|
stderr: string;
|
|
30
32
|
}
|
|
31
33
|
export declare function buildArgs(options: SpawnV1ImportOptions): string[];
|
|
34
|
+
export declare function buildEnv(options: SpawnV1ImportOptions, base?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
32
35
|
export declare function spawnV1Import(options?: SpawnV1ImportOptions): Promise<SpawnV1ImportResult>;
|
|
33
36
|
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type TokenStrategy = 'reuse' | 'regenerate' | 'generate';
|
|
2
|
+
export type TokensState = {
|
|
3
|
+
kind: 'none';
|
|
4
|
+
} | {
|
|
5
|
+
kind: 'cached';
|
|
6
|
+
tokensPath: string;
|
|
7
|
+
sourceChanged: boolean;
|
|
8
|
+
};
|
|
9
|
+
interface InspectInput {
|
|
10
|
+
rawTokensPath: string;
|
|
11
|
+
outDir: string;
|
|
12
|
+
cache: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function inspectTokens({ rawTokensPath, outDir, cache }: InspectInput): Promise<TokensState>;
|
|
15
|
+
export declare function gateText({ tokensPath, sourceChanged }: {
|
|
16
|
+
tokensPath: string;
|
|
17
|
+
sourceChanged: boolean;
|
|
18
|
+
}): {
|
|
19
|
+
summary: string;
|
|
20
|
+
context?: string;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface TokenReuseScreenProps {
|
|
3
|
+
tokensPath: string;
|
|
4
|
+
sourceChanged: boolean;
|
|
5
|
+
onReuse: () => void;
|
|
6
|
+
onRegenerate: () => void;
|
|
7
|
+
onQuit: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function TokenReuseScreen({ tokensPath, sourceChanged, onReuse, onRegenerate, onQuit, }: TokenReuseScreenProps): React.ReactElement;
|
|
10
|
+
export {};
|
|
@@ -2,3 +2,4 @@ export { WelcomeScreen } from './01-welcome/screen.js';
|
|
|
2
2
|
export { TokenInputScreen } from './02-token-input/screen.js';
|
|
3
3
|
export { PathValidationScreen } from './03-path-validation/screen.js';
|
|
4
4
|
export { CredentialsScreen } from './04-credentials/screen.js';
|
|
5
|
+
export { TokenReuseScreen } from './05-token-reuse/screen.js';
|
package/legacy/dist/src/index.js
CHANGED
|
@@ -16569,10 +16569,10 @@ function extractSlotsFromSetupFunction(options) {
|
|
|
16569
16569
|
if (!body)
|
|
16570
16570
|
return [];
|
|
16571
16571
|
const slotsByName = /* @__PURE__ */ new Map();
|
|
16572
|
-
for (const
|
|
16573
|
-
if (
|
|
16572
|
+
for (const access8 of body.getDescendantsOfKind(SyntaxKind11.PropertyAccessExpression)) {
|
|
16573
|
+
if (access8.getExpression().getText() !== slotsName)
|
|
16574
16574
|
continue;
|
|
16575
|
-
const slotName =
|
|
16575
|
+
const slotName = access8.getName();
|
|
16576
16576
|
if (!slotsByName.has(slotName)) {
|
|
16577
16577
|
slotsByName.set(slotName, {
|
|
16578
16578
|
name: slotName,
|
|
@@ -27475,7 +27475,7 @@ import { useEffect as useEffect14, useRef as useRef9, useState as useState19 } f
|
|
|
27475
27475
|
import { Box as Box38, Text as Text40 } from "ink";
|
|
27476
27476
|
import { join as join20, resolve as resolve18 } from "node:path";
|
|
27477
27477
|
import { appendFileSync as appendFileSync2, writeFileSync } from "node:fs";
|
|
27478
|
-
import {
|
|
27478
|
+
import { writeFile as writeFile5 } from "node:fs/promises";
|
|
27479
27479
|
import { tmpdir } from "node:os";
|
|
27480
27480
|
import { execFile as execFile2, spawn as spawn5 } from "node:child_process";
|
|
27481
27481
|
import { mkdir as mkdir4 } from "node:fs/promises";
|
|
@@ -27646,7 +27646,6 @@ function WizardApp({
|
|
|
27646
27646
|
outDir: initialOutDir,
|
|
27647
27647
|
rawTokensPath: rawTokensEntryReady ? initialRawTokensPath : "",
|
|
27648
27648
|
tokensPath: "",
|
|
27649
|
-
tokenSourceChanged: null,
|
|
27650
27649
|
skipComponents: false,
|
|
27651
27650
|
tokenSessionId: null,
|
|
27652
27651
|
tokenGenerationStatus: "idle",
|
|
@@ -28903,49 +28902,30 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28903
28902
|
void runPreview(extractSessionId, tokensPath, state.spaceId, state.environmentId, state.cmaToken, state.host);
|
|
28904
28903
|
}
|
|
28905
28904
|
};
|
|
28906
|
-
const
|
|
28907
|
-
const [tokenReuseSettled, setTokenReuseSettled] = useState19(!state.rawTokensPath);
|
|
28905
|
+
const tokenStrategyApplied = useRef9(false);
|
|
28908
28906
|
useEffect14(() => {
|
|
28909
|
-
if (state.rawTokensPath)
|
|
28910
|
-
|
|
28911
|
-
|
|
28912
|
-
|
|
28913
|
-
|
|
28914
|
-
|
|
28915
|
-
|
|
28916
|
-
|
|
28917
|
-
|
|
28918
|
-
|
|
28919
|
-
}
|
|
28920
|
-
(async () => {
|
|
28921
|
-
try {
|
|
28922
|
-
await access7(existingTokensPath);
|
|
28923
|
-
const [tokensStat, sourceStat] = await Promise.all([
|
|
28924
|
-
stat5(existingTokensPath),
|
|
28925
|
-
stat5(state.rawTokensPath).catch(() => null)
|
|
28926
|
-
]);
|
|
28927
|
-
const sourceChanged = sourceStat ? sourceStat.mtimeMs > tokensStat.mtimeMs : false;
|
|
28928
|
-
update({
|
|
28929
|
-
step: "token-reuse-gate",
|
|
28930
|
-
tokensPath: existingTokensPath,
|
|
28931
|
-
tokenSourceChanged: sourceChanged
|
|
28932
|
-
});
|
|
28933
|
-
} catch {
|
|
28934
|
-
tokenGenerationPromiseRef.current = runAgentAuthCheck("credentials").then(
|
|
28935
|
-
(ok2) => ok2 ? runGenerateTokens(state.rawTokensPath, state.outDir) : false
|
|
28936
|
-
);
|
|
28937
|
-
setTokenReuseSettled(true);
|
|
28938
|
-
}
|
|
28939
|
-
})();
|
|
28907
|
+
if (!state.rawTokensPath || tokenStrategyApplied.current) return;
|
|
28908
|
+
tokenStrategyApplied.current = true;
|
|
28909
|
+
const strategy = process.env["EDS_IMPORT_TOKENS"];
|
|
28910
|
+
if (strategy === "reuse") {
|
|
28911
|
+
update({
|
|
28912
|
+
tokensPath: join20(state.outDir, "tokens.json"),
|
|
28913
|
+
tokenSessionId: null,
|
|
28914
|
+
tokenGenerationStatus: "complete"
|
|
28915
|
+
});
|
|
28916
|
+
return;
|
|
28940
28917
|
}
|
|
28918
|
+
tokenGenerationPromiseRef.current = runAgentAuthCheck("credentials").then(
|
|
28919
|
+
(ok2) => ok2 ? runGenerateTokens(state.rawTokensPath, state.outDir, strategy === "regenerate") : false
|
|
28920
|
+
);
|
|
28941
28921
|
}, [state.rawTokensPath]);
|
|
28942
28922
|
const credentialsHandedOff = useRef9(false);
|
|
28943
28923
|
useEffect14(() => {
|
|
28944
|
-
if (state.step !== "credentials" ||
|
|
28924
|
+
if (state.step !== "credentials" || credentialsHandedOff.current) return;
|
|
28945
28925
|
credentialsHandedOff.current = true;
|
|
28946
28926
|
if (process.env["EDS_IMPORT_SKIP_CREDENTIALS"] === "1") update({ credentialsSkipped: true });
|
|
28947
28927
|
void advanceAfterCredentialsValidated();
|
|
28948
|
-
}, [state.step
|
|
28928
|
+
}, [state.step]);
|
|
28949
28929
|
const noQuitSteps = [
|
|
28950
28930
|
"checking-claude-auth",
|
|
28951
28931
|
"validating-credentials",
|
|
@@ -28963,39 +28943,6 @@ If using a custom host configuration, make sure the space exists on that host.`
|
|
|
28963
28943
|
const totalSteps = 3 + (hasTokenStage ? 1 : 0) + (hasComponents ? 2 : 0) + (state.mapTokensEligible === true ? 1 : 0);
|
|
28964
28944
|
const stepContent = (() => {
|
|
28965
28945
|
switch (state.step) {
|
|
28966
|
-
case "token-reuse-gate":
|
|
28967
|
-
return /* @__PURE__ */ jsx47(
|
|
28968
|
-
GateStep,
|
|
28969
|
-
{
|
|
28970
|
-
successMessage: "Existing tokens.json found",
|
|
28971
|
-
summary: state.tokenSourceChanged ? `Source file has been modified since tokens were last generated.
|
|
28972
|
-
|
|
28973
|
-
Tokens Path: ${state.tokensPath}` : `Source file has not changed since tokens were last generated.
|
|
28974
|
-
|
|
28975
|
-
Tokens Path: ${state.tokensPath}`,
|
|
28976
|
-
context: state.tokenSourceChanged ? "The source tokens file changed \u2014 regenerating is recommended." : void 0,
|
|
28977
|
-
continueLabel: "Reuse existing tokens",
|
|
28978
|
-
skipLabel: "Regenerate tokens",
|
|
28979
|
-
showSkip: true,
|
|
28980
|
-
onContinue: () => {
|
|
28981
|
-
setTokenReuseSettled(true);
|
|
28982
|
-
update({
|
|
28983
|
-
step: "credentials",
|
|
28984
|
-
tokenSessionId: null,
|
|
28985
|
-
tokenGenerationStatus: "complete"
|
|
28986
|
-
});
|
|
28987
|
-
},
|
|
28988
|
-
onSkip: async () => {
|
|
28989
|
-
update({ tokenSourceChanged: null });
|
|
28990
|
-
setTokenReuseSettled(true);
|
|
28991
|
-
update({ step: "credentials" });
|
|
28992
|
-
if (await runAgentAuthCheck("credentials")) {
|
|
28993
|
-
tokenGenerationPromiseRef.current = runGenerateTokens(state.rawTokensPath, state.outDir, true);
|
|
28994
|
-
}
|
|
28995
|
-
},
|
|
28996
|
-
onQuit: () => process.exit(0)
|
|
28997
|
-
}
|
|
28998
|
-
);
|
|
28999
28946
|
case "checking-claude-auth":
|
|
29000
28947
|
return /* @__PURE__ */ jsx47(
|
|
29001
28948
|
RunningStep,
|
|
@@ -29469,9 +29416,9 @@ function registerImportCommand(program) {
|
|
|
29469
29416
|
).option("--no-cache", "Re-run all steps even if output already exists").action(async (opts) => {
|
|
29470
29417
|
const interactiveTerminalSupported = getInteractiveTerminalSupport().supported;
|
|
29471
29418
|
if (opts.tokens !== void 0) {
|
|
29472
|
-
const { access:
|
|
29419
|
+
const { access: access8 } = await import("node:fs/promises");
|
|
29473
29420
|
try {
|
|
29474
|
-
await
|
|
29421
|
+
await access8(normalizePath(opts.tokens));
|
|
29475
29422
|
} catch {
|
|
29476
29423
|
process.stderr.write(`Error: --tokens: file not found: ${opts.tokens}
|
|
29477
29424
|
`);
|
|
@@ -29577,7 +29524,7 @@ var init_agent_definitions = __esm({
|
|
|
29577
29524
|
|
|
29578
29525
|
// packages/experience-design-system-cli-legacy/src/setup/lib/shell.ts
|
|
29579
29526
|
import { execFile as execFile3, spawn as spawn6 } from "node:child_process";
|
|
29580
|
-
import { access as
|
|
29527
|
+
import { access as access7 } from "node:fs/promises";
|
|
29581
29528
|
import { promisify as promisify2 } from "node:util";
|
|
29582
29529
|
async function binaryExists(name) {
|
|
29583
29530
|
try {
|
|
@@ -29588,7 +29535,7 @@ async function binaryExists(name) {
|
|
|
29588
29535
|
}
|
|
29589
29536
|
}
|
|
29590
29537
|
async function pathExists3(path) {
|
|
29591
|
-
return
|
|
29538
|
+
return access7(path).then(() => true).catch(() => false);
|
|
29592
29539
|
}
|
|
29593
29540
|
function runSpawn(cmd, args, opts = {}) {
|
|
29594
29541
|
return new Promise((resolve22) => {
|
|
@@ -31500,7 +31447,7 @@ var init_manifest_doc_evidence = __esm({
|
|
|
31500
31447
|
});
|
|
31501
31448
|
|
|
31502
31449
|
// packages/experience-design-system-cli-legacy/src/analyze/extract-command.ts
|
|
31503
|
-
import { mkdir as mkdir5, readdir as readdir3, readFile as readFile18, stat as
|
|
31450
|
+
import { mkdir as mkdir5, readdir as readdir3, readFile as readFile18, stat as stat5 } from "node:fs/promises";
|
|
31504
31451
|
import { isAbsolute as isAbsolute2, join as join25, relative as relative2, resolve as resolve20 } from "node:path";
|
|
31505
31452
|
function resolveExtractNoCache(opts) {
|
|
31506
31453
|
return opts.noCache === true || opts.cache === false;
|
|
@@ -31526,7 +31473,7 @@ function resolveFromProjectRoot(projectRoot, inputPath) {
|
|
|
31526
31473
|
return isAbsolute2(inputPath) ? inputPath : resolve20(projectRoot, inputPath);
|
|
31527
31474
|
}
|
|
31528
31475
|
async function pathExists4(path) {
|
|
31529
|
-
return Boolean(await
|
|
31476
|
+
return Boolean(await stat5(path).catch(() => null));
|
|
31530
31477
|
}
|
|
31531
31478
|
async function collectSourceFiles(directory, onProgress) {
|
|
31532
31479
|
const files = [];
|
package/legacy/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.37.1-dev-build-
|
|
3
|
+
"version": "2.37.1-dev-build-91b5f8aa.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"ts-morph": "^27.0.2",
|
|
45
45
|
"typescript": "^5.9.3",
|
|
46
46
|
"zod": "^4.6.5",
|
|
47
|
-
"@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-
|
|
48
|
-
"@contentful/experience-design-system-types": "2.37.1-dev-build-
|
|
47
|
+
"@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-91b5f8aa.0",
|
|
48
|
+
"@contentful/experience-design-system-types": "2.37.1-dev-build-91b5f8aa.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@tsconfig/node24": "^24.0.4",
|