bundo-appgen 0.0.11 → 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 +16 -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/_create-asset-catalogs/create-asset-catalogs.mts +20 -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";
|
|
@@ -785,6 +790,10 @@ function createAssetCatalogs(assetCatalogs, metadata) {
|
|
|
785
790
|
recursive: true,
|
|
786
791
|
force: true
|
|
787
792
|
});
|
|
793
|
+
node_fs6.cpSync(node_path11.join(GlobalVars.appgenRoot.get(), "template", metadata.platform, "HelloWorld", "Assets.xcassets"), xcassetsPath, {
|
|
794
|
+
recursive: true,
|
|
795
|
+
force: true
|
|
796
|
+
});
|
|
788
797
|
}
|
|
789
798
|
if (node_fs6.existsSync(assetCatalogsTrackerFilePath)) {
|
|
790
799
|
node_fs6.rmSync(assetCatalogsTrackerFilePath);
|
|
@@ -1143,10 +1152,14 @@ function initApple(platform) {
|
|
|
1143
1152
|
if (!appleData) {
|
|
1144
1153
|
throw new Error(`"${platform}" config is empty.`);
|
|
1145
1154
|
}
|
|
1146
|
-
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);
|
|
1147
|
-
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
|
+
}
|
|
1148
1161
|
node_fs12.cpSync(templateDir, nativeProjectDirectory, { recursive: true });
|
|
1149
|
-
node_fs12.renameSync(node_path17.join(nativeProjectDirectory, "HelloWorld"),
|
|
1162
|
+
node_fs12.renameSync(node_path17.join(nativeProjectDirectory, "HelloWorld"), nativeTargetProjectDirectory);
|
|
1150
1163
|
}
|
|
1151
1164
|
modFiles(platform);
|
|
1152
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) {
|
package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/create-asset-catalogs.mts
CHANGED
|
@@ -5,6 +5,10 @@ import type {
|
|
|
5
5
|
Config,
|
|
6
6
|
} from "../../../../../index.mts"
|
|
7
7
|
|
|
8
|
+
import {
|
|
9
|
+
GlobalVars,
|
|
10
|
+
} from "../../../../_global-vars/index.mts"
|
|
11
|
+
|
|
8
12
|
import {
|
|
9
13
|
ConfigHelpers,
|
|
10
14
|
} from "../../../_helpers/index.mts"
|
|
@@ -52,6 +56,22 @@ export function createAssetCatalogs(
|
|
|
52
56
|
force: true,
|
|
53
57
|
},
|
|
54
58
|
)
|
|
59
|
+
|
|
60
|
+
// restore the Contents.json inside of the Assets.xcassets
|
|
61
|
+
node_fs.cpSync(
|
|
62
|
+
node_path.join(
|
|
63
|
+
GlobalVars.appgenRoot.get(),
|
|
64
|
+
"template",
|
|
65
|
+
metadata.platform,
|
|
66
|
+
"HelloWorld",
|
|
67
|
+
"Assets.xcassets",
|
|
68
|
+
),
|
|
69
|
+
xcassetsPath,
|
|
70
|
+
{
|
|
71
|
+
recursive: true,
|
|
72
|
+
force: true,
|
|
73
|
+
},
|
|
74
|
+
)
|
|
55
75
|
}
|
|
56
76
|
|
|
57
77
|
if(node_fs.existsSync(assetCatalogsTrackerFilePath)) {
|
|
@@ -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
|
|