@shipstatic/ship 0.2.5 → 0.2.7-alpha.1

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/README.md CHANGED
@@ -90,6 +90,9 @@ ship ./dist
90
90
  # Or deploy current directory
91
91
  ship
92
92
 
93
+ # Deploy with tags
94
+ ship deployments create ./dist --tag production --tag v1.0.0
95
+
93
96
  # Explicit commands
94
97
  ship deploy ./build # Deploy project from path
95
98
  ship list # List deployments
@@ -97,8 +100,12 @@ ship get abc123 # Get deployment details
97
100
  ship remove abc123 # Remove deployment
98
101
 
99
102
  # Manage aliases
100
- ship aliases # List aliases
101
- ship alias staging abc123 # Set alias to deployment
103
+ ship aliases list # List aliases
104
+ ship aliases set staging abc123 # Set alias to deployment
105
+ ship aliases set prod abc123 --tag production # Set alias with tag
106
+ ship aliases set prod abc123 --tag prod --tag v1 # Set alias with multiple tags
107
+ ship aliases confirm www.example.com # Trigger DNS confirmation
108
+ ship aliases remove staging # Remove alias
102
109
 
103
110
  # Account
104
111
  ship account # Get account details
@@ -190,17 +197,49 @@ interface DeployOptions {
190
197
  apiUrl?: string;
191
198
  apiKey?: string; // API key: ship- prefix + 64-char hex (69 chars total)
192
199
  deployToken?: string; // Deploy token: token- prefix + 64-char hex (70 chars total)
193
- signal?: AbortSignal; // Cancellation
194
- subdomain?: string; // Custom subdomain
200
+ tags?: string[]; // Optional array of tags for categorization
201
+ signal?: AbortSignal; // Cancellation
202
+ subdomain?: string; // Custom subdomain
195
203
  onCancel?: () => void;
196
204
  onProgress?: (progress: number) => void;
197
205
  progress?: (stats: ProgressStats) => void;
198
206
  maxConcurrency?: number;
199
207
  timeout?: number;
200
- stripCommonPrefix?: boolean; // Remove common path prefix
208
+ stripCommonPrefix?: boolean; // Remove common path prefix
201
209
  }
202
210
  ```
203
211
 
212
+ ### Aliases Resource
213
+
214
+ ```typescript
215
+ // Set or update an alias (with optional tags)
216
+ await ship.aliases.set(aliasName, deploymentId, tags?)
217
+
218
+ // Get alias details
219
+ await ship.aliases.get(aliasName)
220
+
221
+ // List all aliases
222
+ await ship.aliases.list()
223
+
224
+ // Remove alias
225
+ await ship.aliases.remove(aliasName)
226
+
227
+ // Trigger DNS confirmation for external alias
228
+ await ship.aliases.confirm(aliasName)
229
+ ```
230
+
231
+ **Examples:**
232
+ ```javascript
233
+ // Set alias without tags
234
+ await ship.aliases.set('staging', 'dep_abc123');
235
+
236
+ // Set alias with tags
237
+ await ship.aliases.set('production', 'dep_xyz789', ['prod', 'v1.0.0']);
238
+
239
+ // Confirm DNS for external alias
240
+ await ship.aliases.confirm('www.example.com');
241
+ ```
242
+
204
243
  ### Environment-Specific Examples
205
244
 
206
245
  #### Node.js File Deployment
package/dist/browser.d.ts CHANGED
@@ -25,14 +25,16 @@ interface DeploymentOptions {
25
25
  maxConcurrency?: number;
26
26
  /** Timeout in milliseconds for the deploy request. */
27
27
  timeout?: number;
28
- /** API key for this specific deploy. Overrides client's default. */
28
+ /** API key for this specific deploy. Overrides client's default (format: ship-<64-char-hex>, total 69 chars). */
29
29
  apiKey?: string;
30
- /** Deploy token for this specific deploy. Overrides client's default. */
30
+ /** Deploy token for this specific deploy. Overrides client's default (format: token-<64-char-hex>, total 70 chars). */
31
31
  deployToken?: string;
32
32
  /** Whether to auto-detect and optimize file paths by flattening common directories. Defaults to true. */
33
33
  pathDetect?: boolean;
34
34
  /** Whether to auto-detect SPAs and generate ship.json configuration. Defaults to true. */
35
35
  spaDetect?: boolean;
36
+ /** Optional array of tags for categorization and filtering (lowercase, alphanumeric with separators). */
37
+ tags?: string[];
36
38
  /** Callback for overall deploy progress (0-100). */
37
39
  onProgress?: (progress: number) => void;
38
40
  /** Callback for detailed progress statistics. */
@@ -63,9 +65,9 @@ interface ProgressStats {
63
65
  interface ShipClientOptions {
64
66
  /** Default API URL for the client instance. */
65
67
  apiUrl?: string | undefined;
66
- /** API key for authenticated deployments. */
68
+ /** API key for authenticated deployments (format: ship-<64-char-hex>, total 69 chars). */
67
69
  apiKey?: string | undefined;
68
- /** Deploy token for single-use deployments. */
70
+ /** Deploy token for single-use deployments (format: token-<64-char-hex>, total 70 chars). */
69
71
  deployToken?: string | undefined;
70
72
  /** Path to custom config file. */
71
73
  configFile?: string | undefined;
@@ -199,13 +201,25 @@ declare class ApiHttp extends SimpleEvents {
199
201
  listDeployments(): Promise<DeploymentListResponse>;
200
202
  getDeployment(id: string): Promise<Deployment>;
201
203
  removeDeployment(id: string): Promise<void>;
202
- setAlias(name: string, deployment: string): Promise<Alias>;
204
+ setAlias(name: string, deployment: string, tags?: string[]): Promise<Alias>;
203
205
  getAlias(name: string): Promise<Alias>;
204
206
  listAliases(): Promise<AliasListResponse>;
205
207
  removeAlias(name: string): Promise<void>;
206
- checkAlias(name: string): Promise<{
208
+ confirmAlias(name: string): Promise<{
207
209
  message: string;
208
210
  }>;
211
+ getAliasDns(name: string): Promise<{
212
+ alias: string;
213
+ dns: any;
214
+ }>;
215
+ getAliasRecords(name: string): Promise<{
216
+ alias: string;
217
+ records: any[];
218
+ }>;
219
+ getAliasShare(name: string): Promise<{
220
+ alias: string;
221
+ hash: string;
222
+ }>;
209
223
  getAccount(): Promise<Account>;
210
224
  checkSPA(files: StaticFile[]): Promise<boolean>;
211
225
  private validateFiles;
@@ -412,16 +426,29 @@ declare function getENV(): ExecutionEnvironment;
412
426
 
413
427
  /**
414
428
  * @file Browser configuration implementation - no file system access.
429
+ * Browser environment receives all config through constructor options.
415
430
  */
416
431
 
417
432
  /**
418
- * Browser config loading - only uses provided options.
433
+ * Browser config loading - always returns empty (no file system access).
434
+ * All configuration must be provided through Ship constructor options.
419
435
  */
420
436
  declare function loadConfig(configFile?: string): Promise<Config>;
437
+
438
+ /**
439
+ * @file Platform configuration management for the Ship SDK.
440
+ * Implements fail-fast dynamic configuration with mandatory API fetch.
441
+ */
442
+
443
+ /**
444
+ * Set the current config (called after fetching from API)
445
+ */
446
+ declare function setConfig(config: ConfigResponse): void;
421
447
  /**
422
- * Set platform config in browser.
448
+ * Get current config - throws if not initialized (fail-fast approach)
449
+ * @throws {ShipError.config} If configuration hasn't been fetched from API
423
450
  */
424
- declare function setConfig(config: any): void;
451
+ declare function getCurrentConfig(): ConfigResponse;
425
452
 
426
453
  /**
427
454
  * @file Browser-specific file utilities for the Ship SDK.
@@ -470,4 +497,4 @@ declare class Ship extends Ship$1 {
470
497
  protected processInput(input: DeployInput, options: DeploymentOptions): Promise<StaticFile[]>;
471
498
  }
472
499
 
473
- export { type ApiDeployOptions, ApiHttp, type Config, type DeployFile, type DeploymentOptions, type ExecutionEnvironment, JUNK_DIRECTORIES, type MD5Result, type ProgressStats, Ship, type ShipClientOptions, type ShipEvents, __setTestEnvironment, calculateMD5, createAccountResource, createAliasResource, createDeploymentResource, Ship as default, filterJunk, getENV, loadConfig, mergeDeployOptions, optimizeDeployPaths, pluralize, processFilesForBrowser, resolveConfig, setConfig };
500
+ export { type ApiDeployOptions, ApiHttp, type Config, type DeployFile, type DeploymentOptions, type ExecutionEnvironment, JUNK_DIRECTORIES, type MD5Result, type ProgressStats, Ship, type ShipClientOptions, type ShipEvents, __setTestEnvironment, calculateMD5, createAccountResource, createAliasResource, createDeploymentResource, Ship as default, filterJunk, getCurrentConfig, getENV, loadConfig, mergeDeployOptions, optimizeDeployPaths, pluralize, processFilesForBrowser, resolveConfig, setConfig as setPlatformConfig };