@shipstatic/ship 0.3.3 → 0.3.4
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 +13 -9
- package/dist/browser.d.ts +4 -4
- package/dist/browser.js +4 -4
- package/dist/browser.js.map +1 -1
- package/dist/cli.cjs +16 -16
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -231,14 +231,21 @@ await ship.deployments.get(id)
|
|
|
231
231
|
|
|
232
232
|
#### Deploy Input Types
|
|
233
233
|
|
|
234
|
-
**Node.js Environment:**
|
|
235
234
|
```typescript
|
|
236
|
-
type
|
|
235
|
+
type DeployInput = File[] | string | string[];
|
|
237
236
|
```
|
|
238
237
|
|
|
238
|
+
**Node.js Environment:**
|
|
239
|
+
- `string` - Single file or directory path
|
|
240
|
+
- `string[]` - Multiple file/directory paths
|
|
241
|
+
|
|
239
242
|
**Browser Environment:**
|
|
243
|
+
- `File[]` - Array of File objects
|
|
244
|
+
|
|
245
|
+
**Note:** For `<input type="file">` elements, convert FileList to File[]:
|
|
240
246
|
```typescript
|
|
241
|
-
|
|
247
|
+
const files = Array.from(fileInput.files);
|
|
248
|
+
await ship.deploy(files);
|
|
242
249
|
```
|
|
243
250
|
|
|
244
251
|
#### Deploy Options
|
|
@@ -335,17 +342,14 @@ const ship = new Ship({
|
|
|
335
342
|
apiKey: 'ship-your-64-char-hex-string' // 69 chars total
|
|
336
343
|
});
|
|
337
344
|
|
|
338
|
-
// From file input
|
|
345
|
+
// From file input - convert FileList to File[]
|
|
339
346
|
const fileInput = document.getElementById('fileInput') as HTMLInputElement;
|
|
340
|
-
const
|
|
347
|
+
const files: File[] = Array.from(fileInput.files || []);
|
|
348
|
+
const result = await ship.deployments.create(files, {
|
|
341
349
|
onProgress: (progress) => {
|
|
342
350
|
document.getElementById('progress').textContent = `${progress}%`;
|
|
343
351
|
}
|
|
344
352
|
});
|
|
345
|
-
|
|
346
|
-
// From File objects
|
|
347
|
-
const files: File[] = Array.from(fileInput.files || []);
|
|
348
|
-
const result2 = await ship.deployments.create(files);
|
|
349
353
|
```
|
|
350
354
|
|
|
351
355
|
## Event System
|
package/dist/browser.d.ts
CHANGED
|
@@ -561,15 +561,15 @@ declare function getCurrentConfig(): ConfigResponse;
|
|
|
561
561
|
*/
|
|
562
562
|
|
|
563
563
|
/**
|
|
564
|
-
* Processes browser files
|
|
564
|
+
* Processes browser files into an array of StaticFile objects ready for deploy.
|
|
565
565
|
* Calculates MD5, filters junk files, and applies automatic path optimization.
|
|
566
566
|
*
|
|
567
|
-
* @param browserFiles -
|
|
567
|
+
* @param browserFiles - File[] to process for deploy.
|
|
568
568
|
* @param options - Processing options including pathDetect for automatic path optimization.
|
|
569
569
|
* @returns Promise resolving to an array of StaticFile objects.
|
|
570
570
|
* @throws {ShipClientError} If called outside a browser or with invalid input.
|
|
571
571
|
*/
|
|
572
|
-
declare function processFilesForBrowser(browserFiles:
|
|
572
|
+
declare function processFilesForBrowser(browserFiles: File[], options?: DeploymentOptions): Promise<StaticFile[]>;
|
|
573
573
|
|
|
574
574
|
/**
|
|
575
575
|
* @file Ship SDK for browser environments with streamlined configuration.
|
|
@@ -590,7 +590,7 @@ declare function processFilesForBrowser(browserFiles: FileList | File[], options
|
|
|
590
590
|
* });
|
|
591
591
|
*
|
|
592
592
|
* // Deploy files from input element
|
|
593
|
-
* const files = fileInput.files;
|
|
593
|
+
* const files = Array.from(fileInput.files);
|
|
594
594
|
* await ship.deploy(files);
|
|
595
595
|
* ```
|
|
596
596
|
*/
|