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 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"), node_path17.join(nativeProjectDirectory, projectName));
1162
+ node_fs12.renameSync(node_path17.join(nativeProjectDirectory, "HelloWorld"), nativeTargetProjectDirectory);
1154
1163
  }
1155
1164
  modFiles(platform);
1156
1165
  createAssetCatalogs(appleData.assetCatalogs, {
@@ -34,6 +34,7 @@ async function execPlugins({
34
34
  const pluginMainFn = await import(plugin.mainPath).then((mod) => {
35
35
  return mod.default;
36
36
  });
37
+ console.log(`Executing plugin: ${plugin.name}`);
37
38
  try {
38
39
  await pluginMainFn({
39
40
  get macos() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bundo-appgen",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "Native app generator for React Native macOS",
5
5
  "license": "MIT",
6
6
  "author": "RakaDoank <rakaaudira@gmail.com> (https://github.com/RakaDoank)",
@@ -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)! // config object is already validated
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
- node_path.join(nativeProjectDirectory, projectName),
80
+ nativeTargetProjectDirectory,
66
81
  )
67
82
  }
68
83
 
@@ -66,6 +66,8 @@ export async function execPlugins({
66
66
  return mod.default
67
67
  })
68
68
 
69
+ console.log(`Executing plugin: ${plugin.name}`)
70
+
69
71
  try {
70
72
  await pluginMainFn({
71
73