@hot-updater/plugin-core 0.13.0 → 0.13.2
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/dist/createZip.d.ts +7 -0
- package/dist/index.cjs +48 -5
- package/dist/index.js +43 -1
- package/package.json +2 -2
package/dist/createZip.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
export declare const createZipTargetFiles: ({ outfile, targetFiles, }: {
|
|
2
|
+
targetFiles: {
|
|
3
|
+
path: string;
|
|
4
|
+
name: string;
|
|
5
|
+
}[];
|
|
6
|
+
outfile: string;
|
|
7
|
+
}) => Promise<string>;
|
|
1
8
|
export declare const createZip: ({ outfile, targetDir, excludeExts, }: {
|
|
2
9
|
targetDir: string;
|
|
3
10
|
outfile: string;
|
package/dist/index.cjs
CHANGED
|
@@ -83256,18 +83256,19 @@ var __webpack_exports__ = {};
|
|
|
83256
83256
|
__webpack_require__.r(__webpack_exports__);
|
|
83257
83257
|
__webpack_require__.d(__webpack_exports__, {
|
|
83258
83258
|
transformTemplate: ()=>transformTemplate,
|
|
83259
|
-
|
|
83259
|
+
copyDirToTmp: ()=>copyDirToTmp,
|
|
83260
|
+
transformEnv: ()=>transformEnv,
|
|
83261
|
+
createZipTargetFiles: ()=>createZipTargetFiles,
|
|
83262
|
+
banner: ()=>banner,
|
|
83263
|
+
loadConfig: ()=>loadConfig,
|
|
83260
83264
|
log: ()=>log,
|
|
83261
83265
|
createDatabasePlugin: ()=>createDatabasePlugin,
|
|
83262
83266
|
makeEnv: ()=>makeEnv,
|
|
83263
83267
|
printBanner: ()=>printBanner,
|
|
83264
83268
|
link: ()=>banner_link,
|
|
83265
|
-
copyDirToTmp: ()=>copyDirToTmp,
|
|
83266
|
-
transformEnv: ()=>transformEnv,
|
|
83267
83269
|
createZip: ()=>createZip,
|
|
83268
83270
|
getCwd: ()=>getCwd,
|
|
83269
|
-
|
|
83270
|
-
banner: ()=>banner,
|
|
83271
|
+
transformTsEnv: ()=>transformTsEnv,
|
|
83271
83272
|
loadConfigSync: ()=>loadConfigSync
|
|
83272
83273
|
});
|
|
83273
83274
|
var picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.0.0/node_modules/picocolors/picocolors.js");
|
|
@@ -84935,6 +84936,48 @@ var __webpack_exports__ = {};
|
|
|
84935
84936
|
};
|
|
84936
84937
|
var jszip_lib = __webpack_require__("../../node_modules/.pnpm/jszip@3.10.1/node_modules/jszip/lib/index.js");
|
|
84937
84938
|
var jszip_lib_default = /*#__PURE__*/ __webpack_require__.n(jszip_lib);
|
|
84939
|
+
const createZipTargetFiles = async ({ outfile, targetFiles })=>{
|
|
84940
|
+
const zip = new (jszip_lib_default())();
|
|
84941
|
+
await promises_default().rm(outfile, {
|
|
84942
|
+
force: true
|
|
84943
|
+
});
|
|
84944
|
+
async function addFiles(dir, zipFolder) {
|
|
84945
|
+
const files = await promises_default().readdir(dir);
|
|
84946
|
+
files.sort();
|
|
84947
|
+
for (const file of files){
|
|
84948
|
+
const fullPath = external_path_default().join(dir, file);
|
|
84949
|
+
const stats = await promises_default().stat(fullPath);
|
|
84950
|
+
if (stats.isDirectory()) {
|
|
84951
|
+
const folder = zipFolder.folder(file);
|
|
84952
|
+
if (!folder) continue;
|
|
84953
|
+
await addFiles(fullPath, folder);
|
|
84954
|
+
} else {
|
|
84955
|
+
const data = await promises_default().readFile(fullPath);
|
|
84956
|
+
zipFolder.file(file, data);
|
|
84957
|
+
}
|
|
84958
|
+
}
|
|
84959
|
+
}
|
|
84960
|
+
for (const target of targetFiles){
|
|
84961
|
+
const stats = await promises_default().stat(target.path);
|
|
84962
|
+
if (stats.isDirectory()) {
|
|
84963
|
+
const folder = zip.folder(target.name);
|
|
84964
|
+
if (folder) await addFiles(target.path, folder);
|
|
84965
|
+
} else {
|
|
84966
|
+
const data = await promises_default().readFile(target.path);
|
|
84967
|
+
zip.file(target.name, data);
|
|
84968
|
+
}
|
|
84969
|
+
}
|
|
84970
|
+
const content = await zip.generateAsync({
|
|
84971
|
+
type: "nodebuffer",
|
|
84972
|
+
compression: "DEFLATE",
|
|
84973
|
+
compressionOptions: {
|
|
84974
|
+
level: 9
|
|
84975
|
+
},
|
|
84976
|
+
platform: "UNIX"
|
|
84977
|
+
});
|
|
84978
|
+
await promises_default().writeFile(outfile, content);
|
|
84979
|
+
return outfile;
|
|
84980
|
+
};
|
|
84938
84981
|
const createZip = async ({ outfile, targetDir, excludeExts = [] })=>{
|
|
84939
84982
|
const zip = new (jszip_lib_default())();
|
|
84940
84983
|
await promises_default().rm(outfile, {
|
package/dist/index.js
CHANGED
|
@@ -84450,6 +84450,48 @@ const makeEnv = async (newEnvVars, filePath = ".env")=>{
|
|
|
84450
84450
|
};
|
|
84451
84451
|
var jszip_lib = __webpack_require__("../../node_modules/.pnpm/jszip@3.10.1/node_modules/jszip/lib/index.js");
|
|
84452
84452
|
var jszip_lib_default = /*#__PURE__*/ __webpack_require__.n(jszip_lib);
|
|
84453
|
+
const createZipTargetFiles = async ({ outfile, targetFiles })=>{
|
|
84454
|
+
const zip = new (jszip_lib_default())();
|
|
84455
|
+
await promises_["default"].rm(outfile, {
|
|
84456
|
+
force: true
|
|
84457
|
+
});
|
|
84458
|
+
async function addFiles(dir, zipFolder) {
|
|
84459
|
+
const files = await promises_["default"].readdir(dir);
|
|
84460
|
+
files.sort();
|
|
84461
|
+
for (const file of files){
|
|
84462
|
+
const fullPath = external_path_["default"].join(dir, file);
|
|
84463
|
+
const stats = await promises_["default"].stat(fullPath);
|
|
84464
|
+
if (stats.isDirectory()) {
|
|
84465
|
+
const folder = zipFolder.folder(file);
|
|
84466
|
+
if (!folder) continue;
|
|
84467
|
+
await addFiles(fullPath, folder);
|
|
84468
|
+
} else {
|
|
84469
|
+
const data = await promises_["default"].readFile(fullPath);
|
|
84470
|
+
zipFolder.file(file, data);
|
|
84471
|
+
}
|
|
84472
|
+
}
|
|
84473
|
+
}
|
|
84474
|
+
for (const target of targetFiles){
|
|
84475
|
+
const stats = await promises_["default"].stat(target.path);
|
|
84476
|
+
if (stats.isDirectory()) {
|
|
84477
|
+
const folder = zip.folder(target.name);
|
|
84478
|
+
if (folder) await addFiles(target.path, folder);
|
|
84479
|
+
} else {
|
|
84480
|
+
const data = await promises_["default"].readFile(target.path);
|
|
84481
|
+
zip.file(target.name, data);
|
|
84482
|
+
}
|
|
84483
|
+
}
|
|
84484
|
+
const content = await zip.generateAsync({
|
|
84485
|
+
type: "nodebuffer",
|
|
84486
|
+
compression: "DEFLATE",
|
|
84487
|
+
compressionOptions: {
|
|
84488
|
+
level: 9
|
|
84489
|
+
},
|
|
84490
|
+
platform: "UNIX"
|
|
84491
|
+
});
|
|
84492
|
+
await promises_["default"].writeFile(outfile, content);
|
|
84493
|
+
return outfile;
|
|
84494
|
+
};
|
|
84453
84495
|
const createZip = async ({ outfile, targetDir, excludeExts = [] })=>{
|
|
84454
84496
|
const zip = new (jszip_lib_default())();
|
|
84455
84497
|
await promises_["default"].rm(outfile, {
|
|
@@ -84487,4 +84529,4 @@ const createZip = async ({ outfile, targetDir, excludeExts = [] })=>{
|
|
|
84487
84529
|
await promises_["default"].writeFile(outfile, content);
|
|
84488
84530
|
return outfile;
|
|
84489
84531
|
};
|
|
84490
|
-
export { banner, copyDirToTmp, createDatabasePlugin, createZip, getCwd, banner_link as link, loadConfig, loadConfigSync, log, makeEnv, printBanner, transformEnv, transformTemplate, transformTsEnv };
|
|
84532
|
+
export { banner, copyDirToTmp, createDatabasePlugin, createZip, createZipTargetFiles, getCwd, banner_link as link, loadConfig, loadConfigSync, log, makeEnv, printBanner, transformEnv, transformTemplate, transformTsEnv };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/plugin-core",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@hot-updater/core": "0.13.
|
|
41
|
+
"@hot-updater/core": "0.13.2",
|
|
42
42
|
"cosmiconfig": "^9.0.0",
|
|
43
43
|
"cosmiconfig-typescript-loader": "^5.0.0"
|
|
44
44
|
},
|