mygo-cli 0.1.1 → 0.1.3

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.
Files changed (3) hide show
  1. package/index.d.ts +11 -2
  2. package/index.js +27 -2
  3. package/package.json +7 -7
package/index.d.ts CHANGED
@@ -86,8 +86,10 @@ export interface Config {
86
86
  frontendDist?: string;
87
87
 
88
88
  /**
89
- * Files and directories copied into the app under their base names, next
90
- * to the contents of the project's resources directory.
89
+ * Files and directories copied into the app of every platform under their
90
+ * base names, next to the contents of the project's resources directory,
91
+ * whose directories named after a platform, such as
92
+ * `resources/linux-amd64`, hold the files of one platform.
91
93
  */
92
94
  resources?: string[];
93
95
  /** The URL schemes the app opens, such as `myapp` for `myapp://…`, which reach `App.OnOpenURL`. */
@@ -140,6 +142,13 @@ export interface MacOSConfig {
140
142
  signingIdentity?: string;
141
143
  /** A property list of entitlements to sign the app with. */
142
144
  entitlements?: string;
145
+ /**
146
+ * Property lists of entitlements for code among the resources, by its path
147
+ * there, e.g. `{ "bin/server": "server.entitlements.plist" }` for a helper
148
+ * that needs `com.apple.security.cs.allow-jit` under the hardened runtime.
149
+ * Other code keeps the entitlements it is signed with.
150
+ */
151
+ helperEntitlements?: Record<string, string>;
143
152
  /** Keys added to the app's Info.plist, replacing MyGo's, e.g. `NSCameraUsageDescription`. */
144
153
  infoPlist?: Record<string, unknown>;
145
154
  /** The volume name of the disk image (default: the name). */
package/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  import { execFileSync } from "node:child_process";
7
7
  import { accessSync, chmodSync, constants, existsSync, readFileSync } from "node:fs";
8
8
  import { createRequire } from "node:module";
9
- import { dirname, join } from "node:path";
9
+ import { basename, dirname, join, sep } from "node:path";
10
10
  import { fileURLToPath } from "node:url";
11
11
 
12
12
  const require = createRequire(import.meta.url);
@@ -53,7 +53,7 @@ export function binaryPath() {
53
53
  } catch {
54
54
  throw new Error(
55
55
  `mygo-cli: ${pkg}, the package with the mygo binary of this platform, is not installed. ` +
56
- `Reinstall mygo-cli without omitting optional dependencies, or install the CLI with Go: ${goInstall}`,
56
+ `${reinstallHint(pkg)} Or install the CLI with Go: ${goInstall}`,
57
57
  );
58
58
  }
59
59
  const bin = join(dir, "bin", exe);
@@ -76,6 +76,31 @@ export function defineConfig(config) {
76
76
  return config;
77
77
  }
78
78
 
79
+ /**
80
+ * Says how to install pkg, the missing package of the mygo binary. Package
81
+ * managers skip an optional dependency they fail to fetch, as when npm does
82
+ * not serve it yet, and bun keeps skipping it while bun.lock lacks it, even
83
+ * with --force.
84
+ */
85
+ function reinstallHint(pkg) {
86
+ // The directory whose node_modules holds mygo-cli, at any depth.
87
+ const i = here.indexOf(`${sep}node_modules${sep}`);
88
+ const root = i < 0 ? here : here.slice(0, i);
89
+ const runner = basename(root).startsWith("bunx-") ? "bunx" : basename(dirname(root)) === "_npx" ? "npx" : "";
90
+ if (runner) {
91
+ return `${runner} installed mygo-cli without it in ${root}: remove that directory, then run ${runner} again.`;
92
+ }
93
+ const lockfile = join(root, "bun.lock");
94
+ let lock = "";
95
+ try {
96
+ lock = readFileSync(lockfile, "utf8");
97
+ } catch {}
98
+ if (lock && !lock.includes(`"${pkg}": [`)) {
99
+ return `bun installed mygo-cli without it, and does so again while ${lockfile} lacks it, even with --force: remove that file, then install again.`;
100
+ }
101
+ return "Reinstall mygo-cli without omitting optional dependencies.";
102
+ }
103
+
79
104
  /** Reports whether dir is a checkout of the MyGo repository. */
80
105
  function isCheckout(dir) {
81
106
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mygo-cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "The mygo command line tool: create, develop and package MyGo desktop apps",
5
5
  "keywords": [
6
6
  "mygo",
@@ -40,11 +40,11 @@
40
40
  "test": "bun test"
41
41
  },
42
42
  "optionalDependencies": {
43
- "@egoist/mygo-cli-darwin-arm64": "0.1.1",
44
- "@egoist/mygo-cli-darwin-x64": "0.1.1",
45
- "@egoist/mygo-cli-linux-arm64": "0.1.1",
46
- "@egoist/mygo-cli-linux-x64": "0.1.1",
47
- "@egoist/mygo-cli-win32-arm64": "0.1.1",
48
- "@egoist/mygo-cli-win32-x64": "0.1.1"
43
+ "@egoist/mygo-cli-darwin-arm64": "0.1.3",
44
+ "@egoist/mygo-cli-darwin-x64": "0.1.3",
45
+ "@egoist/mygo-cli-linux-arm64": "0.1.3",
46
+ "@egoist/mygo-cli-linux-x64": "0.1.3",
47
+ "@egoist/mygo-cli-win32-arm64": "0.1.3",
48
+ "@egoist/mygo-cli-win32-x64": "0.1.3"
49
49
  }
50
50
  }