sitevision-cli 1.0.0-beta.9 → 1.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.
Files changed (100) hide show
  1. package/CHANGELOG.md +138 -0
  2. package/LICENSE +21 -0
  3. package/dist/cli.js +194 -70
  4. package/dist/commands/TaskScreen.js +32 -0
  5. package/dist/commands/build.js +6 -185
  6. package/dist/commands/deploy.js +95 -212
  7. package/dist/commands/dev.js +87 -416
  8. package/dist/commands/info.js +1 -1
  9. package/dist/commands/setup-signing.js +50 -33
  10. package/dist/commands/sign.js +9 -86
  11. package/dist/commands/use-finish.js +17 -0
  12. package/dist/commands/watch.js +5 -31
  13. package/dist/components/AnimatedLogo.js +8 -2
  14. package/dist/components/AuthLoginScreen.js +33 -15
  15. package/dist/components/PasswordInput.js +2 -1
  16. package/dist/scaffold/inquirer-stub.js +119 -0
  17. package/dist/scaffold/register.js +15 -0
  18. package/dist/shell/AddonPicker.js +54 -0
  19. package/dist/shell/Changelog.js +44 -0
  20. package/dist/shell/CommandPalette.js +63 -0
  21. package/dist/shell/ConfigForm.js +703 -0
  22. package/dist/shell/Frame.js +138 -0
  23. package/dist/shell/Help.js +96 -0
  24. package/dist/shell/Popover.js +15 -0
  25. package/dist/shell/Settings.js +149 -0
  26. package/dist/shell/Shell.js +953 -0
  27. package/dist/shell/Tabs.js +96 -0
  28. package/dist/shell/actions.js +493 -0
  29. package/dist/utils/config.js +62 -2
  30. package/dist/utils/create-app.js +231 -0
  31. package/dist/utils/debug.js +32 -0
  32. package/dist/utils/environments.js +74 -0
  33. package/dist/utils/i18n.js +369 -0
  34. package/dist/utils/jsonc.js +2 -1
  35. package/dist/utils/keychain.js +54 -6
  36. package/dist/utils/oauth2-auth.js +146 -43
  37. package/dist/utils/password-prompt.js +37 -3
  38. package/dist/utils/process-runner.js +77 -38
  39. package/dist/utils/project-detection.js +457 -112
  40. package/dist/utils/session-cookie-auth.js +10 -6
  41. package/dist/utils/sitevision-api.js +134 -25
  42. package/dist/utils/sitevision-scripts-runner.js +50 -22
  43. package/dist/utils/tasks.js +510 -0
  44. package/dist/utils/version-check.js +3 -3
  45. package/dist/utils/webpack-runner.js +9 -5
  46. package/dist/utils/workspace.js +105 -0
  47. package/dist/utils/zip.js +18 -19
  48. package/package.json +27 -4
  49. package/readme.md +113 -141
  50. package/dist/app.d.ts +0 -6
  51. package/dist/app.js +0 -307
  52. package/dist/cli.d.ts +0 -2
  53. package/dist/commands/build.d.ts +0 -12
  54. package/dist/commands/deploy.d.ts +0 -16
  55. package/dist/commands/dev.d.ts +0 -16
  56. package/dist/commands/index.d.ts +0 -4
  57. package/dist/commands/info.d.ts +0 -2
  58. package/dist/commands/setup-signing.d.ts +0 -2
  59. package/dist/commands/sign.d.ts +0 -14
  60. package/dist/commands/types.d.ts +0 -18
  61. package/dist/commands/watch.d.ts +0 -2
  62. package/dist/components/AnimatedLogo.d.ts +0 -10
  63. package/dist/components/AuthLoginScreen.d.ts +0 -21
  64. package/dist/components/DevPropertiesForm.d.ts +0 -10
  65. package/dist/components/DevPropertiesForm.js +0 -210
  66. package/dist/components/InfoScreen.d.ts +0 -7
  67. package/dist/components/InfoScreen.js +0 -14
  68. package/dist/components/KeychainPasswordChoice.d.ts +0 -8
  69. package/dist/components/KeychainPasswordChoice.js +0 -30
  70. package/dist/components/MainMenu.d.ts +0 -7
  71. package/dist/components/MainMenu.js +0 -83
  72. package/dist/components/PasswordInput.d.ts +0 -10
  73. package/dist/components/ProcessOutput.d.ts +0 -6
  74. package/dist/components/ProcessOutput.js +0 -30
  75. package/dist/components/SetupFlow.d.ts +0 -8
  76. package/dist/components/SetupFlow.js +0 -233
  77. package/dist/components/SigningPropertiesForm.d.ts +0 -7
  78. package/dist/components/SigningPropertiesForm.js +0 -38
  79. package/dist/components/StatusIndicator.d.ts +0 -8
  80. package/dist/components/TextInput.d.ts +0 -10
  81. package/dist/components/TextInput.js +0 -29
  82. package/dist/components/WelcomeScreen.d.ts +0 -14
  83. package/dist/types/index.d.ts +0 -284
  84. package/dist/utils/branding.d.ts +0 -28
  85. package/dist/utils/config.d.ts +0 -17
  86. package/dist/utils/jsonc.d.ts +0 -19
  87. package/dist/utils/keychain.d.ts +0 -15
  88. package/dist/utils/oauth2-auth.d.ts +0 -27
  89. package/dist/utils/password-prompt.d.ts +0 -14
  90. package/dist/utils/process-runner.d.ts +0 -22
  91. package/dist/utils/project-detection.d.ts +0 -151
  92. package/dist/utils/session-cookie-auth.d.ts +0 -34
  93. package/dist/utils/signing-password.d.ts +0 -12
  94. package/dist/utils/signing-step.d.ts +0 -15
  95. package/dist/utils/signing-step.js +0 -16
  96. package/dist/utils/sitevision-api.d.ts +0 -112
  97. package/dist/utils/sitevision-scripts-runner.d.ts +0 -83
  98. package/dist/utils/version-check.d.ts +0 -9
  99. package/dist/utils/webpack-runner.d.ts +0 -76
  100. package/dist/utils/zip.d.ts +0 -71
@@ -1,17 +0,0 @@
1
- /**
2
- * True until the user has completed the first-run welcome at least once.
3
- */
4
- export declare function isFirstRun(): boolean;
5
- /**
6
- * Persist that the first-run welcome has been seen.
7
- */
8
- export declare function markFirstRunComplete(): void;
9
- /**
10
- * The CLI version that was last run, or undefined if never recorded (a fresh
11
- * install, or a user who completed first-run before version tracking existed).
12
- */
13
- export declare function getLastSeenVersion(): string | undefined;
14
- /**
15
- * Persist the CLI version that just ran, so the next run can detect an upgrade.
16
- */
17
- export declare function setLastSeenVersion(version: string): void;
@@ -1,19 +0,0 @@
1
- /**
2
- * JSONC helpers.
3
- *
4
- * Sitevision's own manifest documentation shows manifest.json with line and
5
- * block comments (e.g. `"name": { // Multilingual-manifest requires SV 10.1`),
6
- * so real-world manifests copied from the docs contain them. Strict JSON.parse
7
- * rejects those, so we strip comments before parsing.
8
- */
9
- /**
10
- * Remove line comments (//...) and block comments from a JSON string, leaving
11
- * everything inside string literals untouched (so values like
12
- * `"https://example.com"` survive).
13
- */
14
- export declare function stripJsonComments(input: string): string;
15
- /**
16
- * Parse a JSON string that may contain comments (JSONC). Throws the underlying
17
- * SyntaxError if the content is invalid even after comments are removed.
18
- */
19
- export declare function parseJsonc<T>(input: string): T;
@@ -1,15 +0,0 @@
1
- export declare function getDeployPassword(domain: string, username: string): string | null;
2
- export declare function setDeployPassword(domain: string, username: string, password: string): boolean;
3
- export declare function deleteDeployPassword(domain: string, username: string): void;
4
- export declare function getSigningPassword(username: string): string | null;
5
- export declare function setSigningPassword(username: string, password: string): boolean;
6
- export declare function deleteSigningPassword(username: string): void;
7
- export declare function getOAuth2RefreshToken(domain: string, clientId: string): string | null;
8
- export declare function setOAuth2RefreshToken(domain: string, clientId: string, token: string): boolean;
9
- export declare function deleteOAuth2RefreshToken(domain: string, clientId: string): void;
10
- export declare function getOAuth2ClientSecret(domain: string, clientId: string): string | null;
11
- export declare function setOAuth2ClientSecret(domain: string, clientId: string, secret: string): boolean;
12
- export declare function deleteOAuth2ClientSecret(domain: string, clientId: string): void;
13
- export declare function getSessionCookie(domain: string, username: string): string | null;
14
- export declare function setSessionCookie(domain: string, username: string, cookie: string): boolean;
15
- export declare function deleteSessionCookie(domain: string, username: string): void;
@@ -1,27 +0,0 @@
1
- import type { DevProperties } from '../types/index.js';
2
- /** Default loopback port. Fixed so a single redirect URI can be whitelisted. */
3
- export declare const DEFAULT_REDIRECT_PORT = 8137;
4
- /** RFC 7636 S256 pair. Exported for testing the challenge derivation. */
5
- export declare function createPkcePair(): {
6
- verifier: string;
7
- challenge: string;
8
- };
9
- export declare function openBrowser(url: string): void;
10
- /**
11
- * Start an interactive OAuth2 login. Returns the authorize URL to open and a
12
- * `complete()` that awaits the loopback redirect, exchanges the code, stores the
13
- * refresh token, and resolves the access token. UI-agnostic, so an Ink screen
14
- * can drive it without owning the terminal.
15
- */
16
- export declare function beginOAuth2Login(dev: DevProperties): {
17
- authUrl: string;
18
- complete: () => Promise<string | null>;
19
- cancel: () => void;
20
- } | null;
21
- /**
22
- * Silently resolve an access token by refreshing the keychain refresh token.
23
- * Returns null when there's no refresh token or it's expired/revoked (in which
24
- * case the stale token is dropped). Interactive login lives in `beginOAuth2Login`,
25
- * driven by the Ink login screen — the access token is never persisted.
26
- */
27
- export declare function resolveOAuth2AccessToken(dev: DevProperties): Promise<string | null>;
@@ -1,14 +0,0 @@
1
- /**
2
- * Prompt for a yes/no answer. Returns true for y/Y.
3
- * Pressing Enter (empty answer) returns `defaultYes` (default: false).
4
- */
5
- export declare function promptYesNo(prompt: string, defaultYes?: boolean): Promise<boolean>;
6
- /**
7
- * Wait for the user to press Enter (or Ctrl+C). Used to hand control to an
8
- * external browser and resume once the user says they're done.
9
- */
10
- export declare function promptEnter(prompt: string): Promise<void>;
11
- /**
12
- * Prompt for password input with masked display
13
- */
14
- export declare function promptPassword(prompt: string): Promise<string>;
@@ -1,22 +0,0 @@
1
- import { EventEmitter } from 'events';
2
- export interface ProcessOutput {
3
- type: 'stdout' | 'stderr';
4
- data: string;
5
- }
6
- export interface ProcessResult {
7
- exitCode: number;
8
- output: ProcessOutput[];
9
- }
10
- export declare class ProcessRunner extends EventEmitter {
11
- private process;
12
- private output;
13
- private readonly command;
14
- private readonly args;
15
- private readonly cwd?;
16
- private readonly interactive;
17
- private readonly customEnv?;
18
- constructor(command: string, args?: string[], cwd?: string, interactive?: boolean, customEnv?: Record<string, string>);
19
- run(): Promise<ProcessResult>;
20
- kill(): void;
21
- getOutput(): ProcessOutput[];
22
- }
@@ -1,151 +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
- /**
26
- * Get the full app ID including any prefix/suffix from environment
27
- *
28
- * This combines: prefix + baseId + suffix
29
- * Used for generating zip filenames and deployment identifiers
30
- */
31
- export declare function getFullAppId(baseId: string): string;
32
- /**
33
- * Get the zip filename for an app
34
- */
35
- export declare function getZipFilename(manifest: SitevisionManifest): string;
36
- /**
37
- * Get the signed zip filename for an app
38
- */
39
- export declare function getSignedZipFilename(manifest: SitevisionManifest): string;
40
- /**
41
- * Get the full path to the zip file in dist/
42
- */
43
- export declare function getZipPath(projectRoot: string, manifest: SitevisionManifest): string;
44
- /**
45
- * Get the full path to the signed zip file in dist/
46
- */
47
- export declare function getSignedZipPath(projectRoot: string, manifest: SitevisionManifest): string;
48
- /**
49
- * Get API endpoints for the given app type
50
- */
51
- export declare function getApiEndpoints(appType: SimpleAppType): ApiEndpoints;
52
- /**
53
- * Build the base URL for API requests
54
- */
55
- export declare function buildApiBaseUrl(domain: string, siteName: string, useHTTP?: boolean): string;
56
- /**
57
- * Build the addon endpoint URL
58
- */
59
- export declare function buildAddonEndpointUrl(domain: string, siteName: string, appType: SimpleAppType, useHTTP?: boolean): string;
60
- /**
61
- * Build the import endpoint URL
62
- */
63
- export declare function buildImportEndpointUrl(domain: string, siteName: string, addonName: string, appType: SimpleAppType, useHTTP?: boolean): string;
64
- /**
65
- * Thrown when a manifest.json is present but cannot be parsed. Kept distinct from
66
- * a plain "no project here" (null) so the CLI can tell the user their manifest is
67
- * malformed instead of the misleading "Not a Sitevision project".
68
- */
69
- export declare class ManifestParseError extends Error {
70
- constructor(manifestPath: string, cause: unknown);
71
- }
72
- /**
73
- * Read manifest.json from its supported locations (root, static/, src/).
74
- * Throws ManifestParseError on malformed JSON.
75
- */
76
- export declare function readManifest(cwd: string): {
77
- manifestPath: string;
78
- manifest: SitevisionManifest;
79
- } | null;
80
- /**
81
- * Detect if the current directory is a Sitevision project
82
- */
83
- export declare function detectProject(cwd?: string): ProjectInfo | null;
84
- /**
85
- * Validate that we're in a Sitevision project directory
86
- */
87
- export declare function requireProject(cwd?: string): ProjectInfo;
88
- /**
89
- * Get the app type (web, widget, rest)
90
- */
91
- export declare function getAppType(manifest: SitevisionManifest): SimpleAppType;
92
- /**
93
- * Check if the app uses webpack bundling
94
- */
95
- export declare function isBundledApp(manifest: SitevisionManifest): boolean;
96
- /**
97
- * Read and parse the dev properties file
98
- */
99
- export declare function readDevProperties(projectRoot: string): DevProperties | null;
100
- /**
101
- * Write dev properties to file. Secrets are never persisted — `password`,
102
- * `accessToken` and `sessionCookie` are held in the OS keychain / resolved at
103
- * runtime instead.
104
- */
105
- export declare function writeDevProperties(projectRoot: string, properties: DevProperties): void;
106
- /**
107
- * CLI preferences stored in .svcconfig at the project root. Unknown keys are
108
- * preserved on write so hand-edited entries survive.
109
- */
110
- export interface SvcConfig {
111
- syncPackageJson?: boolean;
112
- [key: string]: unknown;
113
- }
114
- export declare function readSvcConfig(projectRoot: string): SvcConfig;
115
- export declare function writeSvcConfig(projectRoot: string, updates: SvcConfig): void;
116
- export interface PackageJsonSyncChange {
117
- key: string;
118
- from?: string;
119
- to: string;
120
- }
121
- /**
122
- * Which of the shared fields package.json is missing or disagrees on, relative
123
- * to the given dev properties. Reads package.json from disk — an earlier
124
- * `npm install` in the same session may have rewritten it.
125
- */
126
- export declare function getPackageJsonSyncChanges(projectRoot: string, properties: DevProperties): PackageJsonSyncChange[];
127
- /**
128
- * Copy the shared fields from dev properties into package.json, preserving the
129
- * file's existing indentation and trailing newline.
130
- */
131
- export declare function syncDevPropertiesToPackageJson(projectRoot: string, properties: DevProperties): boolean;
132
- /**
133
- * Move a plaintext password from .dev_properties.json into the OS keychain and
134
- * strip it from the file. Returns true if the password was migrated.
135
- *
136
- * The in-memory `project.devProperties.password` is intentionally left intact
137
- * so the current invocation can keep using it; only the on-disk copy is removed.
138
- */
139
- export declare function migrateLegacyPassword(project: ProjectInfo): boolean;
140
- /**
141
- * Ensure the dist directory exists
142
- */
143
- export declare function ensureDistDir(projectRoot: string): string;
144
- /**
145
- * Ensure the build directory exists
146
- */
147
- export declare function ensureBuildDir(projectRoot: string): string;
148
- /**
149
- * Clean the build directory
150
- */
151
- export declare function cleanBuildDir(projectRoot: string): void;
@@ -1,34 +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
- }
16
- /**
17
- * Pick the session from a cookie jar: find JSESSIONID (preferring the deploy
18
- * host), then return every cookie on that host as a `Cookie:` header. On miss,
19
- * return diagnostics naming the domains actually seen. Pure — no keychain, no
20
- * browser — so it's unit-testable.
21
- */
22
- export declare function selectSessionCookie(all: RawCookie[], siteDomain: string): CaptureResult;
23
- /**
24
- * Launch a real browser at the login URL for an interactive SAML/SSO login and
25
- * return handles to capture the session and close the browser. UI-agnostic: the
26
- * Ink login screen decides when to `capture()` (on the user's keypress) and
27
- * `close()`. Returns null if the browser can't be launched.
28
- *
29
- * `capture()` reads the whole cookie jar via CDP (httponly and secure included),
30
- * stores the session in the keychain on success, and otherwise returns
31
- * diagnostics naming the cookie domains it actually saw.
32
- */
33
- export declare function beginCookieLogin(dev: DevProperties): Promise<CookieLoginSession | null>;
34
- 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,112 +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
- export { createBasicAuth, configAuth, unauthorizedMessage };
@@ -1,83 +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
- */
83
- export declare function runSitevisionScriptsBuild(projectRoot: string, onOutput?: (chunk: string) => void): Promise<SitevisionBuildResult>;
@@ -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>;