@expofp/offline 3.0.0-alpha.13 → 3.0.0-alpha.15

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
@@ -1,20 +1,14 @@
1
- # @expofp/offline
1
+ ## Offline: generating ZIPs
2
2
 
3
- CLI and programmatic API for creating offline ZIP archives of ExpoFP floor plans.
3
+ The `@expofp/offline` package provides a CLI (`expofp-offline`) that creates self-contained ZIP archives of floor plans. The ZIP can be opened in any browser without internet connectivity.
4
4
 
5
- ## CLI
5
+ ### Usage
6
6
 
7
7
  ```bash
8
- npx expofp-offline <manifest-url> [options]
8
+ npx @expofp/offline@<tag-or-version> <manifest-url> [options]
9
9
  ```
10
10
 
11
- ### Arguments
12
-
13
- | Argument | Description |
14
- | -------------- | ----------------------------------- |
15
- | `manifest-url` | URL to the floor plan manifest JSON |
16
-
17
- ### Options
11
+ Use a dist-tag or exact version to match the deployed floor plan (e.g. `@latest`, `@next`, `@customer1`, `@3.0.0-alpha.9`).
18
12
 
19
13
  | Option | Description | Default |
20
14
  | ----------------- | ------------------- | ------------- |
@@ -25,55 +19,13 @@ npx expofp-offline <manifest-url> [options]
25
19
  ### Example
26
20
 
27
21
  ```bash
28
- npx expofp-offline https://demo.expofp.com/manifest.json -o demo-offline.zip
29
- ```
30
-
31
- ## Programmatic API
32
-
33
- ### `buildOfflineZip(manifest, options): Promise<Blob>`
34
-
35
- Generates a complete offline ZIP archive as a `Blob`. Works in both browser and Node.js.
36
-
37
- ```ts
38
- import { buildOfflineZip } from '@expofp/offline';
39
-
40
- const blob = await buildOfflineZip(
41
- { $ref: 'https://demo.expofp.com/manifest.json' },
42
- { runtimeBaseUrl: 'https://cdn.expofp.com/runtime/' },
43
- );
44
- ```
45
-
46
- ### `downloadOfflineZip(manifest, options): Promise<void>`
47
-
48
- Builds the ZIP and triggers a browser download. Browser-only.
49
-
50
- ```ts
51
- import { downloadOfflineZip } from '@expofp/offline';
52
-
53
- await downloadOfflineZip(manifest, {
54
- runtimeBaseUrl: 'https://cdn.expofp.com/runtime/',
55
- });
22
+ npx @expofp/offline@next https://demo.expofp.com/manifest.json -o offline.zip
56
23
  ```
57
24
 
58
- ### `saveOfflineZip(manifest, path, options): Promise<void>`
59
-
60
- Builds the ZIP and writes it to disk. Node.js-only.
25
+ ### Debugging
61
26
 
62
- ```ts
63
- import { saveOfflineZip } from '@expofp/offline';
27
+ Enable debug output with the `DEBUG` env variable:
64
28
 
65
- await saveOfflineZip({ $ref: 'https://demo.expofp.com/manifest.json' }, './offline.zip', {
66
- runtimeBaseUrl: 'https://cdn.expofp.com/runtime/',
67
- });
68
- ```
69
-
70
- ### Options
71
-
72
- ```ts
73
- interface OfflineOptions {
74
- /** Base URL of the @expofp/floorplan runtime assets */
75
- runtimeBaseUrl: string;
76
- /** AbortSignal to cancel the operation */
77
- signal?: AbortSignal;
78
- }
29
+ ```bash
30
+ DEBUG=efp:offline:* npx @expofp/offline https://...
79
31
  ```
@@ -46,13 +46,17 @@ export async function buildOfflineZip(manifest, options) {
46
46
  const files = dataToFiles(data, { signal: options.signal });
47
47
  return await buildZipArchive(files);
48
48
  }
49
+ /** Known path — file lives in `packages/floorplan/public/` and is copied to dist by Vite. */
50
+ const COMPAT_HELPER = 'compat-helper.js';
49
51
  function getIndexHtml(entry, manifest) {
52
+ // entry is "./runtime/index.js", derive the runtime base path
53
+ const runtimeBase = entry.slice(0, entry.lastIndexOf('/') + 1);
50
54
  return `\
51
55
  <!DOCTYPE html>
56
+ <script src="${runtimeBase}${COMPAT_HELPER}"></script>
52
57
  <script type="module">
53
58
  import { load } from ${JSON.stringify(entry)};
54
59
  await load(${JSON.stringify(manifest)});
55
- console.info('loaded');
56
60
  </script>
57
61
  `;
58
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expofp/offline",
3
- "version": "3.0.0-alpha.13",
3
+ "version": "3.0.0-alpha.15",
4
4
  "type": "module",
5
5
  "description": "CLI tool for creating offline copies of ExpoFP floor plans",
6
6
  "license": "MIT",
@@ -30,9 +30,9 @@
30
30
  "dependencies": {
31
31
  "debug": "^4.4.3",
32
32
  "tslib": "^2.3.0",
33
- "@expofp/floorplan": "3.0.0-alpha.13",
34
- "@expofp/resolve": "3.0.0-alpha.13",
35
- "@expofp/data": "3.0.0-alpha.13",
36
- "@expofp/utils": "3.0.0-alpha.13"
33
+ "@expofp/data": "3.0.0-alpha.15",
34
+ "@expofp/floorplan": "3.0.0-alpha.15",
35
+ "@expofp/resolve": "3.0.0-alpha.15",
36
+ "@expofp/utils": "3.0.0-alpha.15"
37
37
  }
38
38
  }