bundo-appgen 0.0.12 → 0.0.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.
- package/lib/bin/bin.mjs +12 -3
- package/lib/bin/plugin-sandbox-runner.mjs +1 -0
- package/package.json +1 -1
- package/src/_bin/_main/_exec-plugin-runner/_spawn-plugin-sandbox-runner.mts +5 -0
- package/src/_bin/_main/_init-template/_init-apple/init-apple.mts +18 -3
- package/src/_bin/plugin-sandbox-runner/_exec-plugins.mts +2 -0
package/lib/bin/bin.mjs
CHANGED
|
@@ -381,6 +381,10 @@ async function spawnPluginSandboxRunner(registry, permissions, metadata) {
|
|
|
381
381
|
message = clientMessage;
|
|
382
382
|
}
|
|
383
383
|
});
|
|
384
|
+
pluginRunner.stdout?.on("data", (data) => {
|
|
385
|
+
const textDecoder = new TextDecoder("utf-8");
|
|
386
|
+
console.log(textDecoder.decode(data));
|
|
387
|
+
});
|
|
384
388
|
pluginRunner.on("exit", (code) => {
|
|
385
389
|
if (code == 0) {
|
|
386
390
|
if (message) {
|
|
@@ -477,6 +481,7 @@ import * as node_path18 from "node:path";
|
|
|
477
481
|
// src/_bin/_main/_init-template/_init-apple/init-apple.mts
|
|
478
482
|
import * as node_fs12 from "node:fs";
|
|
479
483
|
import * as node_path17 from "node:path";
|
|
484
|
+
import * as node_util from "node:util";
|
|
480
485
|
|
|
481
486
|
// src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/create-asset-catalogs.mts
|
|
482
487
|
import * as node_fs6 from "node:fs";
|
|
@@ -1147,10 +1152,14 @@ function initApple(platform) {
|
|
|
1147
1152
|
if (!appleData) {
|
|
1148
1153
|
throw new Error(`"${platform}" config is empty.`);
|
|
1149
1154
|
}
|
|
1150
|
-
const projectDirectory = node_path17.dirname(GlobalVars.configFilePath.get()), nativeProjectDirectory = node_path17.join(projectDirectory, platform), templateDir = node_path17.join(GlobalVars.appgenRoot.get(), "template", platform), projectName = getProjectName(config, platform);
|
|
1151
|
-
if (!node_fs12.existsSync(nativeProjectDirectory)) {
|
|
1155
|
+
const projectDirectory = node_path17.dirname(GlobalVars.configFilePath.get()), nativeProjectDirectory = node_path17.join(projectDirectory, platform), templateDir = node_path17.join(GlobalVars.appgenRoot.get(), "template", platform), projectName = getProjectName(config, platform), nativeTargetProjectDirectory = node_path17.join(nativeProjectDirectory, projectName), projectNameHasChanged = !node_fs12.existsSync(nativeTargetProjectDirectory);
|
|
1156
|
+
if (!node_fs12.existsSync(nativeProjectDirectory) || projectNameHasChanged) {
|
|
1157
|
+
if (projectNameHasChanged) {
|
|
1158
|
+
console.log(node_util.styleText("yellow", "Rewriting the native project due to a project name change"));
|
|
1159
|
+
node_fs12.rmSync(nativeProjectDirectory, { recursive: true, force: true });
|
|
1160
|
+
}
|
|
1152
1161
|
node_fs12.cpSync(templateDir, nativeProjectDirectory, { recursive: true });
|
|
1153
|
-
node_fs12.renameSync(node_path17.join(nativeProjectDirectory, "HelloWorld"),
|
|
1162
|
+
node_fs12.renameSync(node_path17.join(nativeProjectDirectory, "HelloWorld"), nativeTargetProjectDirectory);
|
|
1154
1163
|
}
|
|
1155
1164
|
modFiles(platform);
|
|
1156
1165
|
createAssetCatalogs(appleData.assetCatalogs, {
|
package/package.json
CHANGED
|
@@ -118,6 +118,11 @@ export async function spawnPluginSandboxRunner(
|
|
|
118
118
|
}
|
|
119
119
|
})
|
|
120
120
|
|
|
121
|
+
pluginRunner.stdout?.on("data", (data: ArrayBuffer) => {
|
|
122
|
+
const textDecoder = new TextDecoder("utf-8")
|
|
123
|
+
console.log(textDecoder.decode(data))
|
|
124
|
+
})
|
|
125
|
+
|
|
121
126
|
pluginRunner.on("exit", code => {
|
|
122
127
|
if(code == 0) {
|
|
123
128
|
if(message) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as node_fs from "node:fs"
|
|
2
2
|
import * as node_path from "node:path"
|
|
3
|
+
import * as node_util from "node:util"
|
|
3
4
|
|
|
4
5
|
import {
|
|
5
6
|
GlobalVars,
|
|
@@ -53,16 +54,30 @@ export function initApple(
|
|
|
53
54
|
node_path.join(GlobalVars.appgenRoot.get(), "template", platform),
|
|
54
55
|
|
|
55
56
|
projectName =
|
|
56
|
-
ConfigHelpers.getProjectName(config, platform)
|
|
57
|
+
ConfigHelpers.getProjectName(config, platform)!, // config object is already validated
|
|
58
|
+
|
|
59
|
+
nativeTargetProjectDirectory =
|
|
60
|
+
node_path.join(nativeProjectDirectory, projectName),
|
|
61
|
+
|
|
62
|
+
projectNameHasChanged =
|
|
63
|
+
!node_fs.existsSync(nativeTargetProjectDirectory)
|
|
64
|
+
|
|
65
|
+
if(
|
|
66
|
+
!node_fs.existsSync(nativeProjectDirectory) ||
|
|
67
|
+
projectNameHasChanged
|
|
68
|
+
) {
|
|
69
|
+
if(projectNameHasChanged) {
|
|
70
|
+
console.log(node_util.styleText("yellow", "Rewriting the native project due to a project name change"))
|
|
71
|
+
node_fs.rmSync(nativeProjectDirectory, { recursive: true, force: true })
|
|
72
|
+
}
|
|
57
73
|
|
|
58
|
-
if(!node_fs.existsSync(nativeProjectDirectory)) {
|
|
59
74
|
// TODO : cache strategy
|
|
60
75
|
// copy the template directory to the user project directory
|
|
61
76
|
node_fs.cpSync(templateDir, nativeProjectDirectory, { recursive: true })
|
|
62
77
|
|
|
63
78
|
node_fs.renameSync(
|
|
64
79
|
node_path.join(nativeProjectDirectory, "HelloWorld"),
|
|
65
|
-
|
|
80
|
+
nativeTargetProjectDirectory,
|
|
66
81
|
)
|
|
67
82
|
}
|
|
68
83
|
|