@elliemae/pui-cli 7.27.2 → 7.27.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.
|
@@ -40,10 +40,14 @@ __export(utils_exports, {
|
|
|
40
40
|
});
|
|
41
41
|
module.exports = __toCommonJS(utils_exports);
|
|
42
42
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
43
|
-
var
|
|
44
|
-
var import_promises = require("fs/promises");
|
|
43
|
+
var import_node_fs = require("node:fs");
|
|
44
|
+
var import_promises = require("node:fs/promises");
|
|
45
|
+
var import_node_zlib = require("node:zlib");
|
|
46
|
+
var import_node_stream = require("node:stream");
|
|
47
|
+
var import_node_util = require("node:util");
|
|
45
48
|
var import_execa = require("execa");
|
|
46
49
|
var import_chalk = __toESM(require("chalk"), 1);
|
|
50
|
+
var import_fast_glob = __toESM(require("fast-glob"), 1);
|
|
47
51
|
var import_helpers = require("../webpack/helpers.js");
|
|
48
52
|
const browsersMapping = {
|
|
49
53
|
and_chr: "Chrome for Android",
|
|
@@ -141,6 +145,37 @@ const updateManifestWithVersionInfo = async (dest) => {
|
|
|
141
145
|
manifestData = manifestData.replace(/latest\//g, `${(0, import_helpers.getAppVersion)()}/`);
|
|
142
146
|
await (0, import_promises.writeFile)(manifestFile, manifestData);
|
|
143
147
|
};
|
|
148
|
+
const updateRuntimeFile = async (src, dest, version) => {
|
|
149
|
+
const latestJSFolder = "latest/js";
|
|
150
|
+
const pipe = (0, import_node_util.promisify)(import_node_stream.pipeline);
|
|
151
|
+
const results = await (0, import_fast_glob.default)([import_node_path.default.join(src, "runtime~app.*.js")]);
|
|
152
|
+
if (!results?.length)
|
|
153
|
+
throw new Error("Runtime file not found");
|
|
154
|
+
const runtimeFilePath = results[0];
|
|
155
|
+
const runtimeFileName = import_node_path.default.basename(runtimeFilePath);
|
|
156
|
+
const destRuntimeFilePath = import_node_path.default.join(dest, runtimeFileName);
|
|
157
|
+
const runtimeFileData = await (0, import_promises.readFile)(runtimeFilePath, "utf8");
|
|
158
|
+
if (runtimeFileData.includes(latestJSFolder)) {
|
|
159
|
+
await (0, import_promises.writeFile)(
|
|
160
|
+
destRuntimeFilePath,
|
|
161
|
+
runtimeFileData.replace(latestJSFolder, `${version}/js`)
|
|
162
|
+
);
|
|
163
|
+
const sourceMapFile = `${runtimeFilePath}.map`;
|
|
164
|
+
const sourcemap = await (0, import_promises.readFile)(sourceMapFile, "utf8");
|
|
165
|
+
await (0, import_promises.writeFile)(
|
|
166
|
+
`${destRuntimeFilePath}.map`,
|
|
167
|
+
sourcemap.replace(latestJSFolder, `${version}/js`)
|
|
168
|
+
);
|
|
169
|
+
const gzip = (0, import_node_zlib.createGzip)();
|
|
170
|
+
let source = (0, import_node_fs.createReadStream)(destRuntimeFilePath);
|
|
171
|
+
let destination = (0, import_node_fs.createWriteStream)(`${destRuntimeFilePath}.gz`);
|
|
172
|
+
await pipe(source, gzip, destination);
|
|
173
|
+
const brotli = (0, import_node_zlib.createBrotliCompress)();
|
|
174
|
+
source = (0, import_node_fs.createReadStream)(destRuntimeFilePath);
|
|
175
|
+
destination = (0, import_node_fs.createWriteStream)(`${destRuntimeFilePath}.br`);
|
|
176
|
+
await pipe(source, brotli, destination);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
144
179
|
const copyBuildAssetsToVersionedFolder = async () => {
|
|
145
180
|
const appVersion = (0, import_helpers.getAppVersion)();
|
|
146
181
|
const isVersionedApp = (0, import_helpers.isAppLoaderEnabled)() && appVersion !== import_helpers.LATEST_VERSION;
|
|
@@ -150,10 +185,15 @@ const copyBuildAssetsToVersionedFolder = async () => {
|
|
|
150
185
|
const dest = import_node_path.default.resolve(process.cwd(), `build/public/${appVersion}`);
|
|
151
186
|
await copyDir(src, dest);
|
|
152
187
|
await updateManifestWithVersionInfo(dest);
|
|
188
|
+
await updateRuntimeFile(
|
|
189
|
+
import_node_path.default.join(src, "js"),
|
|
190
|
+
import_node_path.default.join(dest, "js"),
|
|
191
|
+
appVersion
|
|
192
|
+
);
|
|
153
193
|
};
|
|
154
194
|
const isPathExist = async (pathToCheck) => {
|
|
155
195
|
try {
|
|
156
|
-
await (0, import_promises.access)(pathToCheck,
|
|
196
|
+
await (0, import_promises.access)(pathToCheck, import_node_fs.constants.F_OK);
|
|
157
197
|
return true;
|
|
158
198
|
} catch (err) {
|
|
159
199
|
return false;
|
|
@@ -152,13 +152,20 @@ const plugins = [
|
|
|
152
152
|
}),
|
|
153
153
|
new import_favicons_webpack_plugin.default({
|
|
154
154
|
outputPath: "./latest/assets",
|
|
155
|
+
prefix: "latest/assets/",
|
|
155
156
|
logo: "./app/view/images/favicon.png",
|
|
156
157
|
favicons: {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
appName: "",
|
|
159
|
+
appShortName: "",
|
|
160
|
+
appDescription: "",
|
|
161
|
+
developerURL: "",
|
|
162
|
+
developerName: "ICE",
|
|
160
163
|
icons: {
|
|
161
|
-
|
|
164
|
+
favicons: true,
|
|
165
|
+
android: false,
|
|
166
|
+
appleIcon: false,
|
|
167
|
+
appleStartup: false,
|
|
168
|
+
windows: false,
|
|
162
169
|
yandex: false
|
|
163
170
|
}
|
|
164
171
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { constants } from "fs";
|
|
2
|
+
import { constants, createReadStream, createWriteStream } from "node:fs";
|
|
3
3
|
import {
|
|
4
4
|
readFile,
|
|
5
5
|
writeFile,
|
|
@@ -7,9 +7,13 @@ import {
|
|
|
7
7
|
readdir,
|
|
8
8
|
copyFile,
|
|
9
9
|
access
|
|
10
|
-
} from "fs/promises";
|
|
10
|
+
} from "node:fs/promises";
|
|
11
|
+
import { createGzip, createBrotliCompress } from "node:zlib";
|
|
12
|
+
import { pipeline } from "node:stream";
|
|
13
|
+
import { promisify } from "node:util";
|
|
11
14
|
import { execaCommand } from "execa";
|
|
12
15
|
import chalk from "chalk";
|
|
16
|
+
import fg from "fast-glob";
|
|
13
17
|
import {
|
|
14
18
|
getPaths,
|
|
15
19
|
isAppLoaderEnabled,
|
|
@@ -112,6 +116,37 @@ const updateManifestWithVersionInfo = async (dest) => {
|
|
|
112
116
|
manifestData = manifestData.replace(/latest\//g, `${getAppVersion()}/`);
|
|
113
117
|
await writeFile(manifestFile, manifestData);
|
|
114
118
|
};
|
|
119
|
+
const updateRuntimeFile = async (src, dest, version) => {
|
|
120
|
+
const latestJSFolder = "latest/js";
|
|
121
|
+
const pipe = promisify(pipeline);
|
|
122
|
+
const results = await fg([path.join(src, "runtime~app.*.js")]);
|
|
123
|
+
if (!results?.length)
|
|
124
|
+
throw new Error("Runtime file not found");
|
|
125
|
+
const runtimeFilePath = results[0];
|
|
126
|
+
const runtimeFileName = path.basename(runtimeFilePath);
|
|
127
|
+
const destRuntimeFilePath = path.join(dest, runtimeFileName);
|
|
128
|
+
const runtimeFileData = await readFile(runtimeFilePath, "utf8");
|
|
129
|
+
if (runtimeFileData.includes(latestJSFolder)) {
|
|
130
|
+
await writeFile(
|
|
131
|
+
destRuntimeFilePath,
|
|
132
|
+
runtimeFileData.replace(latestJSFolder, `${version}/js`)
|
|
133
|
+
);
|
|
134
|
+
const sourceMapFile = `${runtimeFilePath}.map`;
|
|
135
|
+
const sourcemap = await readFile(sourceMapFile, "utf8");
|
|
136
|
+
await writeFile(
|
|
137
|
+
`${destRuntimeFilePath}.map`,
|
|
138
|
+
sourcemap.replace(latestJSFolder, `${version}/js`)
|
|
139
|
+
);
|
|
140
|
+
const gzip = createGzip();
|
|
141
|
+
let source = createReadStream(destRuntimeFilePath);
|
|
142
|
+
let destination = createWriteStream(`${destRuntimeFilePath}.gz`);
|
|
143
|
+
await pipe(source, gzip, destination);
|
|
144
|
+
const brotli = createBrotliCompress();
|
|
145
|
+
source = createReadStream(destRuntimeFilePath);
|
|
146
|
+
destination = createWriteStream(`${destRuntimeFilePath}.br`);
|
|
147
|
+
await pipe(source, brotli, destination);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
115
150
|
const copyBuildAssetsToVersionedFolder = async () => {
|
|
116
151
|
const appVersion = getAppVersion();
|
|
117
152
|
const isVersionedApp = isAppLoaderEnabled() && appVersion !== LATEST_VERSION;
|
|
@@ -121,6 +156,11 @@ const copyBuildAssetsToVersionedFolder = async () => {
|
|
|
121
156
|
const dest = path.resolve(process.cwd(), `build/public/${appVersion}`);
|
|
122
157
|
await copyDir(src, dest);
|
|
123
158
|
await updateManifestWithVersionInfo(dest);
|
|
159
|
+
await updateRuntimeFile(
|
|
160
|
+
path.join(src, "js"),
|
|
161
|
+
path.join(dest, "js"),
|
|
162
|
+
appVersion
|
|
163
|
+
);
|
|
124
164
|
};
|
|
125
165
|
const isPathExist = async (pathToCheck) => {
|
|
126
166
|
try {
|
|
@@ -125,13 +125,20 @@ const plugins = [
|
|
|
125
125
|
}),
|
|
126
126
|
new FaviconsWebpackPlugin({
|
|
127
127
|
outputPath: "./latest/assets",
|
|
128
|
+
prefix: "latest/assets/",
|
|
128
129
|
logo: "./app/view/images/favicon.png",
|
|
129
130
|
favicons: {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
appName: "",
|
|
132
|
+
appShortName: "",
|
|
133
|
+
appDescription: "",
|
|
134
|
+
developerURL: "",
|
|
135
|
+
developerName: "ICE",
|
|
133
136
|
icons: {
|
|
134
|
-
|
|
137
|
+
favicons: true,
|
|
138
|
+
android: false,
|
|
139
|
+
appleIcon: false,
|
|
140
|
+
appleStartup: false,
|
|
141
|
+
windows: false,
|
|
135
142
|
yandex: false
|
|
136
143
|
}
|
|
137
144
|
}
|