@shipstatic/ship 0.3.5 → 0.3.6
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 +8 -8
- package/dist/browser.d.ts +52 -20
- package/dist/browser.js +3 -3
- package/dist/browser.js.map +1 -1
- package/dist/cli.cjs +8 -8
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -20
- package/dist/index.d.ts +52 -20
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ const ship = new Ship({
|
|
|
76
76
|
|
|
77
77
|
// Deploy project - SDK automatically fetches platform configuration
|
|
78
78
|
const result = await ship.deployments.create(['./dist'], {
|
|
79
|
-
onProgress: (
|
|
79
|
+
onProgress: ({ percent }) => console.log(`${percent}%`)
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
console.log(`Deployed: ${result.deployment}`);
|
|
@@ -201,6 +201,7 @@ interface ShipOptions {
|
|
|
201
201
|
apiKey?: string; // API key: ship- prefix + 64-char hex (69 chars total)
|
|
202
202
|
deployToken?: string; // Deploy token: token- prefix + 64-char hex (70 chars total)
|
|
203
203
|
timeout?: number; // Request timeout (ms)
|
|
204
|
+
useCredentials?: boolean; // Use HTTP-only cookies for auth (skips token check)
|
|
204
205
|
}
|
|
205
206
|
```
|
|
206
207
|
|
|
@@ -259,8 +260,7 @@ interface DeployOptions {
|
|
|
259
260
|
signal?: AbortSignal; // Cancellation
|
|
260
261
|
subdomain?: string; // Custom subdomain
|
|
261
262
|
onCancel?: () => void;
|
|
262
|
-
onProgress?: (
|
|
263
|
-
progress?: (stats: ProgressStats) => void;
|
|
263
|
+
onProgress?: (info: ProgressInfo) => void; // Progress with percent (0-100), loaded, total bytes
|
|
264
264
|
maxConcurrency?: number;
|
|
265
265
|
timeout?: number;
|
|
266
266
|
stripCommonPrefix?: boolean; // Remove common path prefix
|
|
@@ -321,8 +321,8 @@ const result = await ship.deployments.create([
|
|
|
321
321
|
'./public'
|
|
322
322
|
], {
|
|
323
323
|
stripCommonPrefix: true,
|
|
324
|
-
onProgress: (
|
|
325
|
-
console.log(`Deployment: ${
|
|
324
|
+
onProgress: ({ percent }) => {
|
|
325
|
+
console.log(`Deployment: ${percent}% complete`);
|
|
326
326
|
}
|
|
327
327
|
});
|
|
328
328
|
|
|
@@ -346,8 +346,8 @@ const ship = new Ship({
|
|
|
346
346
|
const fileInput = document.getElementById('fileInput') as HTMLInputElement;
|
|
347
347
|
const files: File[] = Array.from(fileInput.files || []);
|
|
348
348
|
const result = await ship.deployments.create(files, {
|
|
349
|
-
onProgress: (
|
|
350
|
-
document.getElementById('progress').textContent = `${
|
|
349
|
+
onProgress: ({ percent }) => {
|
|
350
|
+
document.getElementById('progress').textContent = `${percent}%`;
|
|
351
351
|
}
|
|
352
352
|
});
|
|
353
353
|
```
|
|
@@ -691,7 +691,7 @@ import type {
|
|
|
691
691
|
BrowserDeployInput,
|
|
692
692
|
DeployOptions,
|
|
693
693
|
DeploySuccessResponse,
|
|
694
|
-
|
|
694
|
+
ProgressInfo,
|
|
695
695
|
StaticFile,
|
|
696
696
|
ShipError,
|
|
697
697
|
ErrorType
|
package/dist/browser.d.ts
CHANGED
|
@@ -35,10 +35,8 @@ interface DeploymentOptions {
|
|
|
35
35
|
spaDetect?: boolean;
|
|
36
36
|
/** Optional array of tags for categorization and filtering (lowercase, alphanumeric with separators). */
|
|
37
37
|
tags?: string[];
|
|
38
|
-
/** Callback for
|
|
39
|
-
onProgress?: (
|
|
40
|
-
/** Callback for detailed progress statistics. */
|
|
41
|
-
onProgressStats?: (progressStats: ProgressStats) => void;
|
|
38
|
+
/** Callback for deploy progress with detailed statistics. */
|
|
39
|
+
onProgress?: (info: ProgressInfo) => void;
|
|
42
40
|
}
|
|
43
41
|
/**
|
|
44
42
|
* Options for configuring an deploy operation via `apiClient.deployFiles`.
|
|
@@ -46,16 +44,17 @@ interface DeploymentOptions {
|
|
|
46
44
|
*/
|
|
47
45
|
type ApiDeployOptions = Omit<DeploymentOptions, 'pathDetect'>;
|
|
48
46
|
/**
|
|
49
|
-
*
|
|
47
|
+
* Progress information for deploy operations.
|
|
48
|
+
* Provides consistent percentage-based progress with byte-level details.
|
|
50
49
|
*/
|
|
51
|
-
interface
|
|
52
|
-
/**
|
|
50
|
+
interface ProgressInfo {
|
|
51
|
+
/** Progress percentage (0-100). */
|
|
52
|
+
percent: number;
|
|
53
|
+
/** Number of bytes loaded so far. */
|
|
53
54
|
loaded: number;
|
|
54
|
-
/**
|
|
55
|
+
/** Total number of bytes to be loaded. May be 0 if unknown initially. */
|
|
55
56
|
total: number;
|
|
56
|
-
/**
|
|
57
|
-
progress: number;
|
|
58
|
-
/** Optional identifier for the file this progress pertains to, if applicable. */
|
|
57
|
+
/** Current file being processed (optional). */
|
|
59
58
|
file?: string;
|
|
60
59
|
}
|
|
61
60
|
/**
|
|
@@ -72,15 +71,10 @@ interface ShipClientOptions {
|
|
|
72
71
|
/** Path to custom config file. */
|
|
73
72
|
configFile?: string | undefined;
|
|
74
73
|
/**
|
|
75
|
-
* Default callback for
|
|
76
|
-
* @param
|
|
74
|
+
* Default callback for deploy progress for deploys made with this client.
|
|
75
|
+
* @param info - Progress information including percentage and byte counts.
|
|
77
76
|
*/
|
|
78
|
-
onProgress?: ((
|
|
79
|
-
/**
|
|
80
|
-
* Default callback for detailed progress statistics for deploys made with this client.
|
|
81
|
-
* @param progressStats - Progress statistics object.
|
|
82
|
-
*/
|
|
83
|
-
onProgressStats?: ((progressStats: ProgressStats) => void) | undefined;
|
|
77
|
+
onProgress?: ((info: ProgressInfo) => void) | undefined;
|
|
84
78
|
/**
|
|
85
79
|
* Default for maximum concurrent deploys.
|
|
86
80
|
* Used if an deploy operation doesn't specify its own `maxConcurrency`.
|
|
@@ -92,6 +86,15 @@ interface ShipClientOptions {
|
|
|
92
86
|
* Used if an deploy operation doesn't specify its own timeout.
|
|
93
87
|
*/
|
|
94
88
|
timeout?: number | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* When true, indicates the client should use HTTP-only cookies for authentication
|
|
91
|
+
* instead of explicit tokens. This is useful for internal browser applications
|
|
92
|
+
* where authentication is handled via secure cookies set by the API.
|
|
93
|
+
*
|
|
94
|
+
* When set, the pre-request authentication check is skipped, allowing requests
|
|
95
|
+
* to proceed with cookie-based credentials.
|
|
96
|
+
*/
|
|
97
|
+
useCredentials?: boolean | undefined;
|
|
95
98
|
}
|
|
96
99
|
/**
|
|
97
100
|
* Event map for Ship SDK events
|
|
@@ -401,6 +404,35 @@ declare const JUNK_DIRECTORIES: readonly ["__MACOSX", ".Trashes", ".fseventsd",
|
|
|
401
404
|
*
|
|
402
405
|
* @param filePaths - An array of file path strings to filter
|
|
403
406
|
* @returns A new array containing only non-junk file paths
|
|
407
|
+
*
|
|
408
|
+
* @example
|
|
409
|
+
* ```typescript
|
|
410
|
+
* import { filterJunk } from '@shipstatic/ship';
|
|
411
|
+
*
|
|
412
|
+
* // Filter an array of file paths
|
|
413
|
+
* const paths = ['index.html', '.DS_Store', '__MACOSX/file.txt', 'app.js'];
|
|
414
|
+
* const clean = filterJunk(paths);
|
|
415
|
+
* // Result: ['index.html', 'app.js']
|
|
416
|
+
* ```
|
|
417
|
+
*
|
|
418
|
+
* @example
|
|
419
|
+
* ```typescript
|
|
420
|
+
* // Use with browser File objects
|
|
421
|
+
* import { filterJunk } from '@shipstatic/ship';
|
|
422
|
+
*
|
|
423
|
+
* const files: File[] = [...]; // From input or drag-drop
|
|
424
|
+
*
|
|
425
|
+
* // Extract paths from File objects
|
|
426
|
+
* const filePaths = files.map(f => f.webkitRelativePath || f.name);
|
|
427
|
+
*
|
|
428
|
+
* // Filter out junk paths
|
|
429
|
+
* const validPaths = new Set(filterJunk(filePaths));
|
|
430
|
+
*
|
|
431
|
+
* // Filter the original File array
|
|
432
|
+
* const validFiles = files.filter(f =>
|
|
433
|
+
* validPaths.has(f.webkitRelativePath || f.name)
|
|
434
|
+
* );
|
|
435
|
+
* ```
|
|
404
436
|
*/
|
|
405
437
|
declare function filterJunk(filePaths: string[]): string[];
|
|
406
438
|
|
|
@@ -625,4 +657,4 @@ declare class Ship extends Ship$1 {
|
|
|
625
657
|
protected processInput(input: DeployInput, options: DeploymentOptions): Promise<StaticFile[]>;
|
|
626
658
|
}
|
|
627
659
|
|
|
628
|
-
export { type ApiDeployOptions, ApiHttp, type Config, type DeployFile, type DeploymentOptions, type ExecutionEnvironment, FILE_VALIDATION_STATUS, type FileValidationResult, type FileValidationStatus, JUNK_DIRECTORIES, type MD5Result, type
|
|
660
|
+
export { type ApiDeployOptions, ApiHttp, type Config, type DeployFile, type DeploymentOptions, type ExecutionEnvironment, FILE_VALIDATION_STATUS, type FileValidationResult, type FileValidationStatus, JUNK_DIRECTORIES, type MD5Result, type ProgressInfo, Ship, type ShipClientOptions, type ShipEvents, type ValidatableFile, type ValidationError, __setTestEnvironment, allValidFilesReady, calculateMD5, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, filterJunk, formatFileSize, getCurrentConfig, getENV, getValidFiles, loadConfig, mergeDeployOptions, optimizeDeployPaths, pluralize, processFilesForBrowser, resolveConfig, setConfig as setPlatformConfig, validateFiles };
|