sitevision-cli 1.0.0-beta.32 → 1.0.0-beta.33
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 +50 -0
- package/LICENSE +21 -0
- package/dist/cli.js +56 -35
- package/dist/commands/TaskScreen.js +32 -0
- package/dist/commands/build.js +6 -185
- package/dist/commands/deploy.js +85 -238
- package/dist/commands/dev.js +34 -37
- package/dist/commands/info.js +1 -1
- package/dist/commands/setup-signing.js +43 -28
- package/dist/commands/sign.js +9 -86
- package/dist/commands/use-finish.js +17 -0
- package/dist/commands/watch.js +0 -8
- package/dist/components/AuthLoginScreen.js +27 -12
- package/dist/shell/ConfigForm.js +90 -29
- package/dist/shell/Frame.js +4 -1
- package/dist/shell/Help.js +2 -1
- package/dist/shell/Settings.js +59 -6
- package/dist/shell/Shell.js +124 -41
- package/dist/shell/Tabs.js +8 -2
- package/dist/shell/actions.js +0 -0
- package/dist/utils/config.js +46 -3
- package/dist/utils/create-app.js +9 -2
- package/dist/utils/i18n.js +36 -13
- package/dist/utils/jsonc.js +2 -1
- package/dist/utils/keychain.js +44 -4
- package/dist/utils/oauth2-auth.js +35 -7
- package/dist/utils/password-prompt.js +23 -3
- package/dist/utils/process-runner.js +4 -2
- package/dist/utils/project-detection.js +84 -33
- package/dist/utils/session-cookie-auth.js +5 -4
- package/dist/utils/sitevision-api.js +21 -14
- package/dist/utils/sitevision-scripts-runner.js +32 -15
- package/dist/utils/tasks.js +130 -64
- package/dist/utils/version-check.js +3 -3
- package/dist/utils/webpack-runner.js +6 -5
- package/dist/utils/workspace.js +41 -3
- package/dist/utils/zip.js +18 -19
- package/package.json +24 -3
- package/readme.md +11 -4
- package/dist/app.d.ts +0 -6
- package/dist/app.js +0 -321
- package/dist/cli.d.ts +0 -2
- package/dist/commands/build.d.ts +0 -12
- package/dist/commands/deploy.d.ts +0 -17
- package/dist/commands/dev.d.ts +0 -14
- package/dist/commands/index.d.ts +0 -4
- package/dist/commands/info.d.ts +0 -2
- package/dist/commands/setup-signing.d.ts +0 -2
- package/dist/commands/sign.d.ts +0 -14
- package/dist/commands/types.d.ts +0 -18
- package/dist/commands/watch.d.ts +0 -2
- package/dist/components/AnimatedLogo.d.ts +0 -10
- package/dist/components/AuthLoginScreen.d.ts +0 -21
- package/dist/components/DevPropertiesForm.d.ts +0 -11
- package/dist/components/DevPropertiesForm.js +0 -246
- package/dist/components/InfoScreen.d.ts +0 -7
- package/dist/components/InfoScreen.js +0 -14
- package/dist/components/KeychainPasswordChoice.d.ts +0 -8
- package/dist/components/KeychainPasswordChoice.js +0 -30
- package/dist/components/MainMenu.d.ts +0 -7
- package/dist/components/MainMenu.js +0 -88
- package/dist/components/PasswordInput.d.ts +0 -10
- package/dist/components/ProcessOutput.d.ts +0 -6
- package/dist/components/ProcessOutput.js +0 -30
- package/dist/components/SetupFlow.d.ts +0 -8
- package/dist/components/SetupFlow.js +0 -233
- package/dist/components/SigningPropertiesForm.d.ts +0 -7
- package/dist/components/SigningPropertiesForm.js +0 -38
- package/dist/components/StatusIndicator.d.ts +0 -8
- package/dist/components/TextInput.d.ts +0 -10
- package/dist/components/TextInput.js +0 -29
- package/dist/components/WelcomeScreen.d.ts +0 -14
- package/dist/scaffold/inquirer-stub.d.ts +0 -6
- package/dist/scaffold/register.d.ts +0 -1
- package/dist/shell/AddonPicker.d.ts +0 -14
- package/dist/shell/Changelog.d.ts +0 -10
- package/dist/shell/CommandPalette.d.ts +0 -12
- package/dist/shell/ConfigForm.d.ts +0 -42
- package/dist/shell/Frame.d.ts +0 -59
- package/dist/shell/Help.d.ts +0 -9
- package/dist/shell/Popover.d.ts +0 -12
- package/dist/shell/Settings.d.ts +0 -6
- package/dist/shell/Shell.d.ts +0 -11
- package/dist/shell/Tabs.d.ts +0 -36
- package/dist/shell/actions.d.ts +0 -49
- package/dist/types/index.d.ts +0 -295
- package/dist/utils/branding.d.ts +0 -28
- package/dist/utils/config.d.ts +0 -27
- package/dist/utils/create-app.d.ts +0 -53
- package/dist/utils/environments.d.ts +0 -20
- package/dist/utils/i18n.d.ts +0 -12
- package/dist/utils/jsonc.d.ts +0 -19
- package/dist/utils/keychain.d.ts +0 -15
- package/dist/utils/oauth2-auth.d.ts +0 -64
- package/dist/utils/password-prompt.d.ts +0 -14
- package/dist/utils/process-runner.d.ts +0 -32
- package/dist/utils/project-detection.d.ts +0 -210
- package/dist/utils/session-cookie-auth.d.ts +0 -35
- package/dist/utils/signing-password.d.ts +0 -12
- package/dist/utils/signing-step.d.ts +0 -15
- package/dist/utils/signing-step.js +0 -16
- package/dist/utils/sitevision-api.d.ts +0 -155
- package/dist/utils/sitevision-scripts-runner.d.ts +0 -84
- package/dist/utils/tasks.d.ts +0 -61
- package/dist/utils/version-check.d.ts +0 -9
- package/dist/utils/webpack-runner.d.ts +0 -76
- package/dist/utils/workspace.d.ts +0 -17
- package/dist/utils/zip.d.ts +0 -71
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
import type { SitevisionManifest, DevProperties, ProjectInfo, ProjectPaths, SimpleAppType, ApiEndpoints, LocalizedString } from '../types/index.js';
|
|
2
|
-
export type { SitevisionManifest, DevProperties, ProjectInfo, } from '../types/index.js';
|
|
3
|
-
/**
|
|
4
|
-
* Resolve a manifest text field that may be a plain string or a localized
|
|
5
|
-
* object (e.g. `{sv: 'Namn', en: 'Name'}`) to a single display string.
|
|
6
|
-
*
|
|
7
|
-
* Preference order: Swedish, then English, then any available language. Returns
|
|
8
|
-
* an empty string for missing/empty values. This guards the UI from rendering a
|
|
9
|
-
* raw object as a React child, which Sitevision's localized manifests would
|
|
10
|
-
* otherwise trigger.
|
|
11
|
-
*/
|
|
12
|
-
export declare function localizedText(value: LocalizedString | undefined, preferred?: string): string;
|
|
13
|
-
/**
|
|
14
|
-
* Get standard project paths for a given root directory
|
|
15
|
-
*/
|
|
16
|
-
export declare function getProjectPaths(root: string, manifestPath: string, devPropertiesPath: string | null): ProjectPaths;
|
|
17
|
-
/**
|
|
18
|
-
* Find the dev properties file path (supports both naming conventions)
|
|
19
|
-
*/
|
|
20
|
-
export declare function findDevPropertiesPath(root: string): string | null;
|
|
21
|
-
/**
|
|
22
|
-
* Get the default dev properties path (for creating new files)
|
|
23
|
-
*/
|
|
24
|
-
export declare function getDefaultDevPropertiesPath(root: string): string;
|
|
25
|
-
/** A bare host: no scheme, no path, no stray spaces. */
|
|
26
|
-
export declare function normalizeDomain(value: string): string;
|
|
27
|
-
/**
|
|
28
|
-
* The dev properties a workspace root defines (its own file merged over any
|
|
29
|
-
* ancestors'), with the deploy password resolved from the keychain like an
|
|
30
|
-
* app's would be. Used to edit shared config from the shell.
|
|
31
|
-
*/
|
|
32
|
-
export declare function readWorkspaceDevProperties(root: string): Partial<DevProperties>;
|
|
33
|
-
/** Ancestor directories' .dev_properties.json merged, nearest wins (no own file). */
|
|
34
|
-
export declare function readAncestorDevProperties(root: string): Partial<DevProperties>;
|
|
35
|
-
/** Shared defaults from package.json: the workspace root's first, the app's on top. */
|
|
36
|
-
export declare function readPackageDefaultsChain(root: string): Partial<DevProperties>;
|
|
37
|
-
/**
|
|
38
|
-
* Everything an app's own .dev_properties.json sits on top of: package.json
|
|
39
|
-
* defaults (root, then app), then ancestor .dev_properties.json files.
|
|
40
|
-
*/
|
|
41
|
-
export declare function readInheritedDevProperties(root: string): Partial<DevProperties>;
|
|
42
|
-
/**
|
|
43
|
-
* Get the full app ID including any prefix/suffix from environment
|
|
44
|
-
*
|
|
45
|
-
* This combines: prefix + baseId + suffix
|
|
46
|
-
* Used for generating zip filenames and deployment identifiers
|
|
47
|
-
*/
|
|
48
|
-
export declare function getFullAppId(baseId: string): string;
|
|
49
|
-
/**
|
|
50
|
-
* Get the zip filename for an app
|
|
51
|
-
*/
|
|
52
|
-
export declare function getZipFilename(manifest: SitevisionManifest): string;
|
|
53
|
-
/**
|
|
54
|
-
* Get the signed zip filename for an app
|
|
55
|
-
*/
|
|
56
|
-
export declare function getSignedZipFilename(manifest: SitevisionManifest): string;
|
|
57
|
-
/**
|
|
58
|
-
* Get the full path to the zip file in dist/
|
|
59
|
-
*/
|
|
60
|
-
export declare function getZipPath(projectRoot: string, manifest: SitevisionManifest): string;
|
|
61
|
-
/**
|
|
62
|
-
* Get the full path to the signed zip file in dist/
|
|
63
|
-
*/
|
|
64
|
-
export declare function getSignedZipPath(projectRoot: string, manifest: SitevisionManifest): string;
|
|
65
|
-
/**
|
|
66
|
-
* The zip a non-production deploy uploads: the signed one when it is at least
|
|
67
|
-
* as new as the build, since some sites reject unsigned apps even on dev.
|
|
68
|
-
*/
|
|
69
|
-
export declare function getDeployZipPath(projectRoot: string, manifest: SitevisionManifest): string;
|
|
70
|
-
/**
|
|
71
|
-
* Get API endpoints for the given app type
|
|
72
|
-
*/
|
|
73
|
-
export declare function getApiEndpoints(appType: SimpleAppType): ApiEndpoints;
|
|
74
|
-
/**
|
|
75
|
-
* Build the base URL for API requests
|
|
76
|
-
*/
|
|
77
|
-
export declare function buildApiBaseUrl(domain: string, siteName: string, useHTTP?: boolean): string;
|
|
78
|
-
/**
|
|
79
|
-
* Build the addon endpoint URL
|
|
80
|
-
*/
|
|
81
|
-
export declare function buildAddonEndpointUrl(domain: string, siteName: string, appType: SimpleAppType, useHTTP?: boolean): string;
|
|
82
|
-
/**
|
|
83
|
-
* Build the import endpoint URL
|
|
84
|
-
*/
|
|
85
|
-
export declare function buildImportEndpointUrl(domain: string, siteName: string, addonName: string, appType: SimpleAppType, useHTTP?: boolean): string;
|
|
86
|
-
/**
|
|
87
|
-
* Thrown when a manifest.json is present but cannot be parsed. Kept distinct from
|
|
88
|
-
* a plain "no project here" (null) so the CLI can tell the user their manifest is
|
|
89
|
-
* malformed instead of the misleading "Not a Sitevision project".
|
|
90
|
-
*/
|
|
91
|
-
export declare class ManifestParseError extends Error {
|
|
92
|
-
constructor(manifestPath: string, cause: unknown);
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Read manifest.json from its supported locations (root, static/, src/).
|
|
96
|
-
* Throws ManifestParseError on malformed JSON.
|
|
97
|
-
*/
|
|
98
|
-
export declare function readManifest(cwd: string): {
|
|
99
|
-
manifestPath: string;
|
|
100
|
-
manifest: SitevisionManifest;
|
|
101
|
-
} | null;
|
|
102
|
-
/**
|
|
103
|
-
* Set one text field of manifest.json, or one language of a localized field.
|
|
104
|
-
* An empty value removes the key. A value that is already a string is replaced
|
|
105
|
-
* in the text, so comments and formatting survive; anything else rewrites the
|
|
106
|
-
* file, which is refused when that would drop comments.
|
|
107
|
-
*/
|
|
108
|
-
export declare function writeManifestField(manifestPath: string, key: string, value: string, lang?: string): void;
|
|
109
|
-
/**
|
|
110
|
-
* Detect if the current directory is a Sitevision project
|
|
111
|
-
*/
|
|
112
|
-
export declare function detectProject(cwd?: string): ProjectInfo | null;
|
|
113
|
-
/**
|
|
114
|
-
* Fill the runtime-only credential fields for the given domain/username:
|
|
115
|
-
* deploy password (env var > keychain), OAuth2 access token (env var), and
|
|
116
|
-
* session cookie (env var > keychain). Mutates and returns `dev`.
|
|
117
|
-
*/
|
|
118
|
-
export declare function resolveRuntimeSecrets(dev: DevProperties): DevProperties;
|
|
119
|
-
/**
|
|
120
|
-
* Validate that we're in a Sitevision project directory
|
|
121
|
-
*/
|
|
122
|
-
export declare function requireProject(cwd?: string): ProjectInfo;
|
|
123
|
-
/**
|
|
124
|
-
* The app type (web, widget, rest, mcp), or undefined for a manifest type
|
|
125
|
-
* this CLI does not know. Display code uses this so one odd app never takes
|
|
126
|
-
* the whole shell down.
|
|
127
|
-
*/
|
|
128
|
-
export declare function appTypeOf(manifest: SitevisionManifest): SimpleAppType | undefined;
|
|
129
|
-
/**
|
|
130
|
-
* Get the app type (web, widget, rest, mcp). Throws for unknown types, since
|
|
131
|
-
* build and deploy cannot proceed without knowing the endpoints.
|
|
132
|
-
*/
|
|
133
|
-
export declare function getAppType(manifest: SitevisionManifest): SimpleAppType;
|
|
134
|
-
/**
|
|
135
|
-
* Check if the app uses webpack bundling
|
|
136
|
-
*/
|
|
137
|
-
export declare function isBundledApp(manifest: SitevisionManifest): boolean;
|
|
138
|
-
/**
|
|
139
|
-
* Read and parse the dev properties file
|
|
140
|
-
*/
|
|
141
|
-
export declare function readDevProperties(projectRoot: string): DevProperties | null;
|
|
142
|
-
/**
|
|
143
|
-
* Write dev properties to file. Secrets are never persisted — `password`,
|
|
144
|
-
* `accessToken` and `sessionCookie` are held in the OS keychain / resolved at
|
|
145
|
-
* runtime instead.
|
|
146
|
-
*/
|
|
147
|
-
export declare function writeDevProperties(projectRoot: string, properties: DevProperties, { complete }?: {
|
|
148
|
-
complete?: boolean;
|
|
149
|
-
}): void;
|
|
150
|
-
/**
|
|
151
|
-
* CLI preferences stored in .svcconfig at the project root. Unknown keys are
|
|
152
|
-
* preserved on write so hand-edited entries survive.
|
|
153
|
-
*/
|
|
154
|
-
export interface SvcConfig {
|
|
155
|
-
syncPackageJson?: boolean;
|
|
156
|
-
environment?: string;
|
|
157
|
-
[key: string]: unknown;
|
|
158
|
-
}
|
|
159
|
-
export declare function readSvcConfig(projectRoot: string): SvcConfig;
|
|
160
|
-
export declare function writeSvcConfig(projectRoot: string, updates: SvcConfig): void;
|
|
161
|
-
/**
|
|
162
|
-
* Values tied to the person running svc. They stay in .dev_properties.json and
|
|
163
|
-
* never go into package.json.
|
|
164
|
-
*/
|
|
165
|
-
export declare const USER_KEYS: string[];
|
|
166
|
-
export interface PackageJsonSyncChange {
|
|
167
|
-
key: string;
|
|
168
|
-
from?: string;
|
|
169
|
-
to: string;
|
|
170
|
-
}
|
|
171
|
-
/** The shared defaults one directory's package.json provides. */
|
|
172
|
-
export declare function readPackageDefaults(dir: string): Partial<DevProperties>;
|
|
173
|
-
/** What an unset field means, so spelling out the default is not a change. */
|
|
174
|
-
export declare const IMPLICIT_VALUES: Record<string, unknown>;
|
|
175
|
-
/** What syncing this directory would change in its package.json. */
|
|
176
|
-
export declare function getPackageJsonSyncChanges(dir: string): PackageJsonSyncChange[];
|
|
177
|
-
export declare function hasPackageJson(dir: string): boolean;
|
|
178
|
-
/**
|
|
179
|
-
* Copy the pending shared values from .dev_properties.json, and the manifest
|
|
180
|
-
* fields package.json mirrors, into package.json, creating package.json when
|
|
181
|
-
* the directory has none. Throws if it cannot be
|
|
182
|
-
* read or written.
|
|
183
|
-
*/
|
|
184
|
-
export declare function syncDevPropertiesToPackageJson(dir: string): boolean;
|
|
185
|
-
/**
|
|
186
|
-
* Edit package.json in place, keeping its indentation and trailing newline. A
|
|
187
|
-
* missing file is created; an unreadable or invalid one throws, so the caller
|
|
188
|
-
* can warn instead of dropping the change silently.
|
|
189
|
-
*/
|
|
190
|
-
export declare function updatePackageJson(dir: string, mutate: (packageJson: Record<string, unknown>) => void): void;
|
|
191
|
-
/**
|
|
192
|
-
* Move a plaintext password from .dev_properties.json into the OS keychain and
|
|
193
|
-
* strip it from the file. Returns true if the password was migrated.
|
|
194
|
-
*
|
|
195
|
-
* The in-memory `project.devProperties.password` is intentionally left intact
|
|
196
|
-
* so the current invocation can keep using it; only the on-disk copy is removed.
|
|
197
|
-
*/
|
|
198
|
-
export declare function migrateLegacyPassword(project: ProjectInfo): boolean;
|
|
199
|
-
/**
|
|
200
|
-
* Ensure the dist directory exists
|
|
201
|
-
*/
|
|
202
|
-
export declare function ensureDistDir(projectRoot: string): string;
|
|
203
|
-
/**
|
|
204
|
-
* Ensure the build directory exists
|
|
205
|
-
*/
|
|
206
|
-
export declare function ensureBuildDir(projectRoot: string): string;
|
|
207
|
-
/**
|
|
208
|
-
* Clean the build directory
|
|
209
|
-
*/
|
|
210
|
-
export declare function cleanBuildDir(projectRoot: string): void;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { DevProperties } from '../types/index.js';
|
|
2
|
-
interface RawCookie {
|
|
3
|
-
name: string;
|
|
4
|
-
value: string;
|
|
5
|
-
domain: string;
|
|
6
|
-
}
|
|
7
|
-
export interface CaptureResult {
|
|
8
|
-
cookie?: string;
|
|
9
|
-
note?: string;
|
|
10
|
-
error?: string;
|
|
11
|
-
}
|
|
12
|
-
export interface CookieLoginSession {
|
|
13
|
-
capture: () => Promise<CaptureResult>;
|
|
14
|
-
close: () => Promise<void>;
|
|
15
|
-
loginUrl: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Pick the session from a cookie jar: find JSESSIONID (preferring the deploy
|
|
19
|
-
* host), then return every cookie on that host as a `Cookie:` header. On miss,
|
|
20
|
-
* return diagnostics naming the domains actually seen. Pure — no keychain, no
|
|
21
|
-
* browser — so it's unit-testable.
|
|
22
|
-
*/
|
|
23
|
-
export declare function selectSessionCookie(all: RawCookie[], siteDomain: string): CaptureResult;
|
|
24
|
-
/**
|
|
25
|
-
* Launch a real browser at the login URL for an interactive SAML/SSO login and
|
|
26
|
-
* return handles to capture the session and close the browser. UI-agnostic: the
|
|
27
|
-
* Ink login screen decides when to `capture()` (on the user's keypress) and
|
|
28
|
-
* `close()`. Returns null if the browser can't be launched.
|
|
29
|
-
*
|
|
30
|
-
* `capture()` reads the whole cookie jar via CDP (httponly and secure included),
|
|
31
|
-
* stores the session in the keychain on success, and otherwise returns
|
|
32
|
-
* diagnostics naming the cookie domains it actually saw.
|
|
33
|
-
*/
|
|
34
|
-
export declare function beginCookieLogin(dev: DevProperties): Promise<CookieLoginSession | null>;
|
|
35
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolve the signing password for the given user.
|
|
3
|
-
*
|
|
4
|
-
* Priority:
|
|
5
|
-
* 1. `SITEVISION_SIGNING_PASSWORD` env var (non-interactive override, no prompts).
|
|
6
|
-
* 2. A password saved in the OS keychain — the user is asked whether to use it
|
|
7
|
-
* or set a new one. Choosing "new" optionally updates the saved password.
|
|
8
|
-
* 3. An interactive prompt — optionally saved to the keychain.
|
|
9
|
-
*
|
|
10
|
-
* Returns an empty string if no password could be obtained.
|
|
11
|
-
*/
|
|
12
|
-
export declare function resolveSigningPassword(signingUsername: string): Promise<string>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export type SigningStep = 'proceed' | 'choice' | 'input';
|
|
2
|
-
/**
|
|
3
|
-
* Decide what to do when a signing password is needed.
|
|
4
|
-
*
|
|
5
|
-
* - `proceed`: a password is already available this session — use it.
|
|
6
|
-
* - `choice`: a password is saved in the keychain — ask whether to use it or
|
|
7
|
-
* enter a new one.
|
|
8
|
-
* - `input`: prompt for a password (nothing saved, or a saved one just failed
|
|
9
|
-
* and we're retrying).
|
|
10
|
-
*/
|
|
11
|
-
export declare function decideSigningStep(options: {
|
|
12
|
-
hasSessionPassword: boolean;
|
|
13
|
-
hasStoredPassword: boolean;
|
|
14
|
-
isRetry: boolean;
|
|
15
|
-
}): SigningStep;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Decide what to do when a signing password is needed.
|
|
3
|
-
*
|
|
4
|
-
* - `proceed`: a password is already available this session — use it.
|
|
5
|
-
* - `choice`: a password is saved in the keychain — ask whether to use it or
|
|
6
|
-
* enter a new one.
|
|
7
|
-
* - `input`: prompt for a password (nothing saved, or a saved one just failed
|
|
8
|
-
* and we're retrying).
|
|
9
|
-
*/
|
|
10
|
-
export function decideSigningStep(options) {
|
|
11
|
-
if (options.hasSessionPassword)
|
|
12
|
-
return 'proceed';
|
|
13
|
-
if (options.hasStoredPassword && !options.isRetry)
|
|
14
|
-
return 'choice';
|
|
15
|
-
return 'input';
|
|
16
|
-
}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sitevision API Client
|
|
3
|
-
*
|
|
4
|
-
* Handles all API interactions with Sitevision servers:
|
|
5
|
-
* - Signing apps via developer.sitevision.se
|
|
6
|
-
* - Deploying to development environments
|
|
7
|
-
* - Deploying to production environments
|
|
8
|
-
* - Creating addons
|
|
9
|
-
* - Activating production apps
|
|
10
|
-
*/
|
|
11
|
-
import type { SigningCredentials, DeployConfig, ProductionDeployConfig, SigningResponse, DeployResponse, CreateAddonResponse, ActivationResponse, SimpleAppType } from '../types/index.js';
|
|
12
|
-
/**
|
|
13
|
-
* Create Basic Auth header value
|
|
14
|
-
*/
|
|
15
|
-
declare function createBasicAuth(username: string, password: string): string;
|
|
16
|
-
type RequestAuth = {
|
|
17
|
-
username: string;
|
|
18
|
-
password: string;
|
|
19
|
-
} | {
|
|
20
|
-
token: string;
|
|
21
|
-
} | {
|
|
22
|
-
cookie: string;
|
|
23
|
-
};
|
|
24
|
-
type AuthKind = 'basic' | 'bearer' | 'cookie';
|
|
25
|
-
/** Single source of the 401 message, worded for the auth kind actually used. */
|
|
26
|
-
declare function unauthorizedMessage(kind: AuthKind): string;
|
|
27
|
-
/** Pick cookie > bearer > basic based on what the deploy config carries. */
|
|
28
|
-
declare function configAuth(config: {
|
|
29
|
-
username: string;
|
|
30
|
-
password?: string;
|
|
31
|
-
accessToken?: string;
|
|
32
|
-
sessionCookie?: string;
|
|
33
|
-
}): {
|
|
34
|
-
auth: RequestAuth;
|
|
35
|
-
kind: AuthKind;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Make an HTTP/HTTPS request
|
|
39
|
-
*/
|
|
40
|
-
export declare function makeRequest(url: string, options: {
|
|
41
|
-
method: string;
|
|
42
|
-
headers?: Record<string, string>;
|
|
43
|
-
body?: Buffer;
|
|
44
|
-
auth?: RequestAuth;
|
|
45
|
-
timeoutMs?: number;
|
|
46
|
-
}): Promise<{
|
|
47
|
-
statusCode: number;
|
|
48
|
-
body: Buffer;
|
|
49
|
-
headers: Record<string, string>;
|
|
50
|
-
}>;
|
|
51
|
-
/**
|
|
52
|
-
* Whether an HTTP status is worth retrying (transient server-side failures).
|
|
53
|
-
*/
|
|
54
|
-
export declare function isRetryableStatus(statusCode: number): boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Summarize a non-success response body for error messages.
|
|
57
|
-
* Avoids dumping raw bytes (e.g. an HTML error page or a binary blob) by
|
|
58
|
-
* trimming text bodies and labelling binary ones by their content type.
|
|
59
|
-
*/
|
|
60
|
-
export declare function summarizeErrorBody(body: Buffer, headers: Record<string, string>): string;
|
|
61
|
-
/**
|
|
62
|
-
* Check that a buffer begins with the ZIP magic bytes. Used to fail fast when
|
|
63
|
-
* the signing endpoint returns an error page with HTTP 200.
|
|
64
|
-
*/
|
|
65
|
-
export declare function looksLikeZip(body: Buffer): boolean;
|
|
66
|
-
/**
|
|
67
|
-
* A stale Sitevision session usually answers with a redirect to the login page
|
|
68
|
-
* or a 200 carrying an HTML login form — not a clean 401. Detect both so cookie
|
|
69
|
-
* auth can drop the dead session and re-login instead of showing a generic error.
|
|
70
|
-
*/
|
|
71
|
-
export declare function looksLikeAuthExpired(statusCode: number, body: Buffer, headers: Record<string, string>): boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Sign an app via developer.sitevision.se
|
|
74
|
-
*
|
|
75
|
-
* @param zipPath - Path to the unsigned zip file
|
|
76
|
-
* @param credentials - Signing credentials
|
|
77
|
-
* @param outputPath - Path to write the signed zip file
|
|
78
|
-
*/
|
|
79
|
-
export declare function signApp(zipPath: string, credentials: SigningCredentials, outputPath: string): Promise<SigningResponse>;
|
|
80
|
-
/**
|
|
81
|
-
* Deploy an app to a development environment
|
|
82
|
-
*
|
|
83
|
-
* @param zipPath - Path to the zip file (signed or unsigned)
|
|
84
|
-
* @param config - Deployment configuration
|
|
85
|
-
* @param appType - The app type (web, widget, rest)
|
|
86
|
-
* @param force - Whether to force deploy (overwrite existing)
|
|
87
|
-
*/
|
|
88
|
-
export declare function deployApp(zipPath: string, config: DeployConfig, appType: SimpleAppType, force?: boolean): Promise<DeployResponse>;
|
|
89
|
-
/**
|
|
90
|
-
* Deploy an app to production
|
|
91
|
-
*
|
|
92
|
-
* @param signedZipPath - Path to the SIGNED zip file (required for production)
|
|
93
|
-
* @param config - Production deployment configuration
|
|
94
|
-
* @param appType - The app type (web, widget, rest)
|
|
95
|
-
*/
|
|
96
|
-
export declare function deployProduction(signedZipPath: string, config: ProductionDeployConfig, appType: SimpleAppType): Promise<DeployResponse>;
|
|
97
|
-
/**
|
|
98
|
-
* Create a new addon on a Sitevision site
|
|
99
|
-
*
|
|
100
|
-
* @param config - Deployment configuration
|
|
101
|
-
* @param appType - The app type (web, widget, rest)
|
|
102
|
-
*/
|
|
103
|
-
export declare function createAddon(config: DeployConfig, appType: SimpleAppType): Promise<CreateAddonResponse>;
|
|
104
|
-
/**
|
|
105
|
-
* Activate a deployed production app
|
|
106
|
-
*
|
|
107
|
-
* @param executableId - The executable ID returned from deployment
|
|
108
|
-
* @param config - Deployment configuration
|
|
109
|
-
* @param appType - The app type (web, widget, rest)
|
|
110
|
-
*/
|
|
111
|
-
export declare function activateApp(executableId: string, config: DeployConfig, _appType: SimpleAppType): Promise<ActivationResponse>;
|
|
112
|
-
/**
|
|
113
|
-
* A version uploaded to a custom module, as reported by the
|
|
114
|
-
* ActivateCustomModuleExecutable GET endpoint.
|
|
115
|
-
*/
|
|
116
|
-
export interface Executable {
|
|
117
|
-
id: string;
|
|
118
|
-
name: string;
|
|
119
|
-
appIdentifier: string;
|
|
120
|
-
appVersion: string;
|
|
121
|
-
active: boolean;
|
|
122
|
-
}
|
|
123
|
-
export interface ListExecutablesResponse {
|
|
124
|
-
success: boolean;
|
|
125
|
-
executables?: Executable[];
|
|
126
|
-
error?: string;
|
|
127
|
-
authExpired?: boolean;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* List the executables (uploaded versions) of the configured addon.
|
|
131
|
-
*/
|
|
132
|
-
export declare function listExecutables(config: DeployConfig): Promise<ListExecutablesResponse>;
|
|
133
|
-
export interface AddonNode {
|
|
134
|
-
id: string;
|
|
135
|
-
name: string;
|
|
136
|
-
type: string;
|
|
137
|
-
appType?: SimpleAppType;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* List the addons (custom modules) in the site's Addon Repository.
|
|
141
|
-
*/
|
|
142
|
-
export declare function listAddons(config: DeployConfig): Promise<{
|
|
143
|
-
success: boolean;
|
|
144
|
-
addons?: AddonNode[];
|
|
145
|
-
error?: string;
|
|
146
|
-
}>;
|
|
147
|
-
/**
|
|
148
|
-
* Whether an addon exists, judged from a listAddons result. A failed or empty
|
|
149
|
-
* listing is "unknown": a dead session can look exactly like an empty site.
|
|
150
|
-
*/
|
|
151
|
-
export declare function classifyAddon(listed: {
|
|
152
|
-
success: boolean;
|
|
153
|
-
addons?: AddonNode[];
|
|
154
|
-
}, name: string): 'missing' | 'present' | 'unknown';
|
|
155
|
-
export { createBasicAuth, configAuth, unauthorizedMessage };
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sitevision Scripts Runner
|
|
3
|
-
*
|
|
4
|
-
* Delegates the compile/build step to the official sitevision-scripts npm
|
|
5
|
-
* package when a project has no local webpack config of its own.
|
|
6
|
-
*
|
|
7
|
-
* Sitevision WebApp builds are tightly coupled to the platform runtime (a
|
|
8
|
-
* dual server/client multi-compiler, AMD externals for React and the sitevision
|
|
9
|
-
* api packages, an embedded ES5 server engine, and a precise addon zip layout).
|
|
10
|
-
* Rather than
|
|
11
|
-
* reproduce that contract — which lives in proprietary babel presets and an
|
|
12
|
-
* undocumented internal config — we shell out to the package's public CLI, which
|
|
13
|
-
* is the canonical, maintained source of that build pipeline.
|
|
14
|
-
*
|
|
15
|
-
* `sitevision-scripts build` runs build + zip + cleanup and writes the archive to
|
|
16
|
-
* `dist/<appId>.zip` — the exact path the CLI's own sign/deploy steps already use.
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* Resolve the path to the sitevision-scripts CLI entry inside a project.
|
|
20
|
-
* Returns null if the package is not installed.
|
|
21
|
-
*/
|
|
22
|
-
export declare function getSitevisionScriptsBin(projectRoot: string): string | null;
|
|
23
|
-
/**
|
|
24
|
-
* Whether the sitevision-scripts package is available in the project.
|
|
25
|
-
*/
|
|
26
|
-
export declare function hasSitevisionScripts(projectRoot: string): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Path of the zip that `sitevision-scripts build` writes.
|
|
29
|
-
*
|
|
30
|
-
* IMPORTANT: this mirrors sitevision-scripts' own app-id convention
|
|
31
|
-
* (`APP_ID_PREFIX`/`APP_ID_SUFFIX` env vars + `dist/<appId>.zip`), which differs
|
|
32
|
-
* from the CLI's own `getZipPath` env vars (`SITEVISION_APP_ID_*`). For delegated
|
|
33
|
-
* builds the package is the one writing the file, so its convention is the source
|
|
34
|
-
* of truth — using `getZipPath` here would look for the wrong filename whenever a
|
|
35
|
-
* prefix/suffix is configured.
|
|
36
|
-
*/
|
|
37
|
-
export declare function getDelegatedZipPath(projectRoot: string, manifestId: string): string;
|
|
38
|
-
/**
|
|
39
|
-
* Range of the sitevision-scripts package the CLI's build delegation has been
|
|
40
|
-
* validated against. The delegation depends on the package's CLI commands, its
|
|
41
|
-
* `dist/<appId>.zip` output, and the app-id convention — all stable within a
|
|
42
|
-
* major. A new major may change that contract, so we warn rather than assume.
|
|
43
|
-
*
|
|
44
|
-
* Bump these (and re-validate) when adopting a new sitevision-scripts major.
|
|
45
|
-
*/
|
|
46
|
-
export declare const SUPPORTED_SITEVISION_SCRIPTS_MIN = "8.0.0";
|
|
47
|
-
/** Human-readable supported range, e.g. ">=8.0.0 <9.0.0". */
|
|
48
|
-
export declare const SUPPORTED_SITEVISION_SCRIPTS_RANGE = ">=8.0.0 <9.0.0";
|
|
49
|
-
export type SitevisionScriptsCompatStatus = 'ok' | 'too-old' | 'too-new' | 'not-installed' | 'unknown';
|
|
50
|
-
export interface SitevisionScriptsCompat {
|
|
51
|
-
installed: string | null;
|
|
52
|
-
supportedRange: string;
|
|
53
|
-
status: SitevisionScriptsCompatStatus;
|
|
54
|
-
/** Populated for 'too-old'/'too-new' — a ready-to-display warning. */
|
|
55
|
-
warning?: string;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Read the installed sitevision-scripts version from the project, or null if it
|
|
59
|
-
* is not installed / unreadable.
|
|
60
|
-
*/
|
|
61
|
-
export declare function getSitevisionScriptsVersion(projectRoot: string): string | null;
|
|
62
|
-
/**
|
|
63
|
-
* Check the project's installed sitevision-scripts against the supported range.
|
|
64
|
-
* Use the `warning` field to surface a message when the version has drifted.
|
|
65
|
-
*/
|
|
66
|
-
export declare function checkSitevisionScriptsCompatibility(projectRoot: string): SitevisionScriptsCompat;
|
|
67
|
-
export interface SitevisionBuildResult {
|
|
68
|
-
success: boolean;
|
|
69
|
-
/** Combined stdout/stderr (tail-trimmed) for error reporting. */
|
|
70
|
-
output: string;
|
|
71
|
-
error?: string;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Run `sitevision-scripts build` (build + zip + cleanup) as a subprocess.
|
|
75
|
-
*
|
|
76
|
-
* The package's own webpack pipeline produces the deployable `dist/<appId>.zip`.
|
|
77
|
-
* Invoked via the current Node binary so it works cross-platform without relying
|
|
78
|
-
* on the `node_modules/.bin` shims or shell PATH resolution.
|
|
79
|
-
*
|
|
80
|
-
* @param projectRoot - Project root directory (used as cwd)
|
|
81
|
-
* @param onOutput - Optional callback for streaming output chunks
|
|
82
|
-
* @param signal - Aborting kills the build and everything it started
|
|
83
|
-
*/
|
|
84
|
-
export declare function runSitevisionScriptsBuild(projectRoot: string, onOutput?: (chunk: string) => void, signal?: AbortSignal): Promise<SitevisionBuildResult>;
|
package/dist/utils/tasks.d.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { ProjectInfo, SigningCredentials, DeployConfig } from '../types/index.js';
|
|
2
|
-
export type TaskKind = 'dev' | 'watch' | 'build' | 'sign' | 'deploy' | 'activate' | 'install' | 'create';
|
|
3
|
-
export type TaskStatus = 'running' | 'success' | 'error' | 'stopped';
|
|
4
|
-
export type LogLevel = 'info' | 'ok' | 'warn' | 'error';
|
|
5
|
-
export interface LogLine {
|
|
6
|
-
time: number;
|
|
7
|
-
tag: string;
|
|
8
|
-
level: LogLevel;
|
|
9
|
-
text: string;
|
|
10
|
-
}
|
|
11
|
-
export interface Task {
|
|
12
|
-
id: number;
|
|
13
|
-
kind: TaskKind;
|
|
14
|
-
appRoot: string;
|
|
15
|
-
appName: string;
|
|
16
|
-
label: string;
|
|
17
|
-
status: TaskStatus;
|
|
18
|
-
phase: string;
|
|
19
|
-
startedAt: number;
|
|
20
|
-
endedAt?: number;
|
|
21
|
-
lines: LogLine[];
|
|
22
|
-
error?: string;
|
|
23
|
-
stop: () => void;
|
|
24
|
-
}
|
|
25
|
-
export declare function getTasks(): Task[];
|
|
26
|
-
export declare function useTasks(): Task[];
|
|
27
|
-
export declare function runningTasks(appRoot?: string): Task[];
|
|
28
|
-
export declare function clearFinished(): void;
|
|
29
|
-
type Log = (tag: string, text: string, level?: LogLevel) => void;
|
|
30
|
-
export declare function createTask(kind: TaskKind, project: {
|
|
31
|
-
root: string;
|
|
32
|
-
manifest: Pick<ProjectInfo['manifest'], 'name' | 'id'>;
|
|
33
|
-
}, label: string, stop?: () => void): {
|
|
34
|
-
task: Task;
|
|
35
|
-
log: Log;
|
|
36
|
-
finish: (status: TaskStatus, error?: string) => void;
|
|
37
|
-
};
|
|
38
|
-
export declare function setPhase(task: Task, phase: string): void;
|
|
39
|
-
export interface DeployOptions {
|
|
40
|
-
force?: boolean;
|
|
41
|
-
production?: boolean;
|
|
42
|
-
activate?: boolean;
|
|
43
|
-
onAddonMissing?: (addonName: string) => Promise<boolean>;
|
|
44
|
-
}
|
|
45
|
-
export declare function startBuild(project: ProjectInfo): Task;
|
|
46
|
-
export declare function startSign(project: ProjectInfo, credentials: SigningCredentials): Task;
|
|
47
|
-
export declare function startDeploy(project: ProjectInfo, config: DeployConfig, options: DeployOptions): Task;
|
|
48
|
-
export declare function startActivate(project: ProjectInfo, config: DeployConfig, executableId: string, versionLabel: string): Task;
|
|
49
|
-
export declare function startInstall(project: ProjectInfo): Task;
|
|
50
|
-
export interface DevOptions {
|
|
51
|
-
deploy: boolean;
|
|
52
|
-
signingCredentials?: SigningCredentials;
|
|
53
|
-
deployConfig?: DeployConfig;
|
|
54
|
-
onAddonMissing?: DeployOptions['onAddonMissing'];
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Dev / watch loop: build on every source change, then optionally sign and
|
|
58
|
-
* deploy. Runs until `task.stop()`; the task stays in the registry meanwhile.
|
|
59
|
-
*/
|
|
60
|
-
export declare function startDev(project: ProjectInfo, options: DevOptions): Task;
|
|
61
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Check the npm registry for a newer published version of `packageName`.
|
|
3
|
-
*
|
|
4
|
-
* Resolves to the latest version string when it is newer than
|
|
5
|
-
* `currentVersion`, otherwise `null`. Never rejects — network errors,
|
|
6
|
-
* timeouts, non-200 responses and parse failures all resolve to `null`, so a
|
|
7
|
-
* failed check never blocks startup or surfaces an error to the user.
|
|
8
|
-
*/
|
|
9
|
-
export declare function checkForUpdate(packageName: string, currentVersion: string, timeoutMs?: number): Promise<string | null>;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Webpack Runner
|
|
3
|
-
*
|
|
4
|
-
* Handles webpack compilation for Sitevision apps.
|
|
5
|
-
* Dynamically loads webpack from the target project's node_modules.
|
|
6
|
-
*/
|
|
7
|
-
import type { BuildOptions, BuildResult } from '../types/index.js';
|
|
8
|
-
/**
|
|
9
|
-
* Find the project's own webpack config, or null if it has none.
|
|
10
|
-
*/
|
|
11
|
-
export declare function findLocalWebpackConfig(projectRoot: string): string | null;
|
|
12
|
-
/**
|
|
13
|
-
* Whether the project ships its own webpack config (in-house build path),
|
|
14
|
-
* as opposed to relying on the sitevision-scripts package.
|
|
15
|
-
*/
|
|
16
|
-
export declare function hasLocalWebpackConfig(projectRoot: string): boolean;
|
|
17
|
-
export declare class WebpackRunner {
|
|
18
|
-
private webpack;
|
|
19
|
-
private config;
|
|
20
|
-
private compiler;
|
|
21
|
-
private watcher;
|
|
22
|
-
private readonly projectRoot;
|
|
23
|
-
private readonly options;
|
|
24
|
-
constructor(projectRoot: string, options: BuildOptions);
|
|
25
|
-
/**
|
|
26
|
-
* Initialize webpack by loading it from the project's node_modules
|
|
27
|
-
*/
|
|
28
|
-
private initialize;
|
|
29
|
-
/**
|
|
30
|
-
* Load webpack configuration from the project
|
|
31
|
-
*/
|
|
32
|
-
private loadConfig;
|
|
33
|
-
/**
|
|
34
|
-
* Convert webpack stats to BuildResult
|
|
35
|
-
*/
|
|
36
|
-
private statsToResult;
|
|
37
|
-
/**
|
|
38
|
-
* Run a single webpack build
|
|
39
|
-
*/
|
|
40
|
-
run(): Promise<BuildResult>;
|
|
41
|
-
/**
|
|
42
|
-
* Start webpack in watch mode
|
|
43
|
-
*
|
|
44
|
-
* @param callback - Called after each compilation
|
|
45
|
-
*/
|
|
46
|
-
watch(callback?: (result: BuildResult) => void): Promise<void>;
|
|
47
|
-
/**
|
|
48
|
-
* Stop watching and close the compiler
|
|
49
|
-
*/
|
|
50
|
-
close(): Promise<void>;
|
|
51
|
-
/**
|
|
52
|
-
* Check if webpack is available in the project
|
|
53
|
-
*/
|
|
54
|
-
static isWebpackAvailable(projectRoot: string): boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Get the webpack version from the project
|
|
57
|
-
*/
|
|
58
|
-
static getWebpackVersion(projectRoot: string): string | null;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Run a single webpack build
|
|
62
|
-
*
|
|
63
|
-
* @param projectRoot - Project root directory
|
|
64
|
-
* @param options - Build options
|
|
65
|
-
* @returns Build result
|
|
66
|
-
*/
|
|
67
|
-
export declare function runWebpackBuild(projectRoot: string, options: BuildOptions): Promise<BuildResult>;
|
|
68
|
-
/**
|
|
69
|
-
* Start webpack in watch mode
|
|
70
|
-
*
|
|
71
|
-
* @param projectRoot - Project root directory
|
|
72
|
-
* @param options - Build options
|
|
73
|
-
* @param callback - Called after each compilation
|
|
74
|
-
* @returns WebpackRunner instance (call .close() to stop)
|
|
75
|
-
*/
|
|
76
|
-
export declare function startWebpackWatch(projectRoot: string, options: BuildOptions, callback?: (result: BuildResult) => void): Promise<WebpackRunner>;
|