@expofp/offline 3.0.0-alpha.11 → 3.0.0-alpha.13
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.
|
@@ -9,20 +9,35 @@ const log = debug('efp:offline:generate-offline-data');
|
|
|
9
9
|
export async function* generateOfflineData(inputManifest, options) {
|
|
10
10
|
const manifest = deepClone(await resolve(inputManifest));
|
|
11
11
|
log(`Generating offline files for expo: ${manifest.expo}`);
|
|
12
|
+
const pathPrefix = manifest.expo;
|
|
13
|
+
// this is a requirement of mobile SDK, paths in the ZIP must be prefixed with the expo name
|
|
14
|
+
// TODO: make sure SDK works with unprefixed paths, and remove the prefixing logic from this function
|
|
15
|
+
const prefixPath = (path) => `${pathPrefix}/${path}`;
|
|
12
16
|
if (manifest.legacyDataUrlBase) {
|
|
13
|
-
|
|
17
|
+
for await (const d of generateOfflineDataLegacy(manifest, options)) {
|
|
18
|
+
yield { ...d, targetFilePath: prefixPath(d.targetFilePath) };
|
|
19
|
+
}
|
|
14
20
|
}
|
|
15
21
|
// transform entire manifest + assets
|
|
16
22
|
const data = await offlinizeAssetsInPlace(manifest, options);
|
|
17
23
|
for (const d of data) {
|
|
18
|
-
yield d;
|
|
24
|
+
yield { ...d, targetFilePath: prefixPath(d.targetFilePath) };
|
|
19
25
|
}
|
|
20
|
-
// add runtime files
|
|
21
|
-
const
|
|
26
|
+
// add runtime files — manually iterate to prefix paths while capturing return value
|
|
27
|
+
const runtimeGen = generateRuntimeFilesData(options.runtimeBaseUrl);
|
|
28
|
+
let runtimeResult = await runtimeGen.next();
|
|
29
|
+
while (!runtimeResult.done) {
|
|
30
|
+
yield {
|
|
31
|
+
...runtimeResult.value,
|
|
32
|
+
targetFilePath: prefixPath(runtimeResult.value.targetFilePath),
|
|
33
|
+
};
|
|
34
|
+
runtimeResult = await runtimeGen.next();
|
|
35
|
+
}
|
|
36
|
+
const { entry } = runtimeResult.value;
|
|
22
37
|
// generate index.html
|
|
23
38
|
yield {
|
|
24
39
|
text: getIndexHtml(entry, manifest),
|
|
25
|
-
targetFilePath: 'index.html',
|
|
40
|
+
targetFilePath: prefixPath('index.html'),
|
|
26
41
|
};
|
|
27
42
|
}
|
|
28
43
|
/** Build a complete offline ZIP archive from a manifest. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expofp/offline",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.13",
|
|
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/
|
|
34
|
-
"@expofp/resolve": "3.0.0-alpha.
|
|
35
|
-
"@expofp/
|
|
36
|
-
"@expofp/utils": "3.0.0-alpha.
|
|
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"
|
|
37
37
|
}
|
|
38
38
|
}
|