@gjsify/cli 0.64.31 → 0.64.32

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.
@@ -512,7 +512,10 @@ async function assemble(args) {
512
512
  : undefined;
513
513
  if (icon !== undefined)
514
514
  console.log(`${LOG} icon: ${iconSizes(icon).join('/')} px, ${icon.source}`);
515
- const staged = placeStage(layout, { ...settings, icon }, planned, [...runtime.files, ...subordinates.files]);
515
+ const staged = placeStage(layout, { ...settings, icon, categories: metadata.categories }, planned, [
516
+ ...runtime.files,
517
+ ...subordinates.files,
518
+ ]);
516
519
  writeStage(stageDir, staged);
517
520
  console.log(`${LOG} staged ${staged.length} file(s) for ${layout.name} in ${relative(projectDir, stageDir)}/`);
518
521
  if (args.verbose)
@@ -66,6 +66,8 @@ export interface LayoutMetadataInput extends LayoutIdentity {
66
66
  arch: string;
67
67
  /** `'app'` or `'cli'`: whether the layout is owed an icon at all. */
68
68
  kind: 'app' | 'cli';
69
+ /** Freedesktop menu categories from the app metadata — `LSApplicationCategoryType` is derived from them. */
70
+ categories?: readonly string[];
69
71
  /**
70
72
  * The app icon's rasters, or `undefined` for a `kind: 'cli'` project.
71
73
  *
@@ -4,6 +4,8 @@ export declare const BUNDLE_INFO_PLIST = "Contents/Info.plist";
4
4
  export declare const BUNDLE_PKGINFO = "Contents/PkgInfo";
5
5
  /** Where `CFBundleIconFile` is resolved: the bundle's resources directory, and nowhere else. */
6
6
  export declare const BUNDLE_RESOURCES = "Contents/Resources";
7
+ /** The first mappable category in the author's order, or `undefined`. */
8
+ export declare function appleCategoryFor(categories: readonly string[] | undefined): string | undefined;
7
9
  /**
8
10
  * Render `Contents/Info.plist`.
9
11
  *
@@ -17,9 +17,12 @@
17
17
  // produced or consumes, or — for the two MECHANISM keys, `ATSApplicationFontsPath`
18
18
  // and `CFBundleIconFile` — to Apple's own key reference plus a measurement on a
19
19
  // Mac. Keys that are merely plausible — `LSMinimumSystemVersion`,
20
- // `NSHighResolutionCapable`, `LSApplicationCategoryType`,
21
- // `NSHumanReadableCopyright` — are not emitted, because nothing a reader here can
22
- // open contains them.
20
+ // `NSHighResolutionCapable`, `NSHumanReadableCopyright` — are not emitted, because
21
+ // nothing a reader here can open contains them. `LSApplicationCategoryType` is the
22
+ // exception that is DERIVED rather than invented: it is emitted only when the
23
+ // project's own freedesktop `categories` map to an Apple category, and omitted
24
+ // otherwise. `NSHumanReadableCopyright` stays out: the metainfo carries no
25
+ // copyright holder field, and a holder is never made up.
23
26
  //
24
27
  // AND THE SCOPE OF THAT MEASUREMENT IS PART OF IT, because `grep -r … refs/` is a
25
28
  // command that answers cheerfully after reading almost nothing: 89 of the 95
@@ -106,6 +109,29 @@ function assertPlistText(value, field, configKey) {
106
109
  }
107
110
  return value;
108
111
  }
112
+ /**
113
+ * Freedesktop main category → Apple `LSApplicationCategoryType` UTI. Only the
114
+ * unambiguous rows: `AudioVideo` (music or video?), `Network` and `Science` have
115
+ * no single Apple category, so they map to nothing rather than to a guess.
116
+ */
117
+ const APPLE_CATEGORIES = new Map([
118
+ ['Development', 'public.app-category.developer-tools'],
119
+ ['Education', 'public.app-category.education'],
120
+ ['Game', 'public.app-category.games'],
121
+ ['Graphics', 'public.app-category.graphics-design'],
122
+ ['Office', 'public.app-category.productivity'],
123
+ ['System', 'public.app-category.utilities'],
124
+ ['Utility', 'public.app-category.utilities'],
125
+ ]);
126
+ /** The first mappable category in the author's order, or `undefined`. */
127
+ export function appleCategoryFor(categories) {
128
+ for (const category of categories ?? []) {
129
+ const mapped = APPLE_CATEGORIES.get(category);
130
+ if (mapped !== undefined)
131
+ return mapped;
132
+ }
133
+ return undefined;
134
+ }
109
135
  /** One `<key>…</key><string>…</string>` pair, indented to sit inside the top-level `<dict>`. */
110
136
  function stringEntry(key, value) {
111
137
  return `\t<key>${key}</key>\n\t<string>${xmlText(value)}</string>`;
@@ -188,6 +214,7 @@ export function renderInfoPlist(input, fontsPath, iconFile) {
188
214
  const name = assertPlistText(input.name, 'CFBundleName', 'gjsify.ship.name');
189
215
  const executable = assertPlistText(input.binaryName, 'CFBundleExecutable', 'gjsify.ship.binaryName');
190
216
  const appId = assertPlistText(input.appId, 'CFBundleIdentifier', 'gjsify.ship.appId');
217
+ const appleCategory = appleCategoryFor(input.categories);
191
218
  return [
192
219
  '<?xml version="1.0" encoding="UTF-8"?>',
193
220
  '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">',
@@ -220,6 +247,7 @@ export function renderInfoPlist(input, fontsPath, iconFile) {
220
247
  stringEntry('CFBundleSignature', SIGNATURE),
221
248
  arrayEntry('CFBundleSupportedPlatforms', ['MacOSX']),
222
249
  stringEntry('CFBundleVersion', `${input.version}-${input.release}`),
250
+ ...(appleCategory === undefined ? [] : [stringEntry('LSApplicationCategoryType', appleCategory)]),
223
251
  '</dict>',
224
252
  '</plist>',
225
253
  '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/cli",
3
- "version": "0.64.31",
3
+ "version": "0.64.32",
4
4
  "description": "CLI for Gjsify",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -142,22 +142,22 @@
142
142
  "cli"
143
143
  ],
144
144
  "dependencies": {
145
- "@gjsify/blueprint": "^0.64.31",
146
- "@gjsify/buffer": "^0.64.31",
147
- "@gjsify/create-app": "^0.64.31",
148
- "@gjsify/node-globals": "^0.64.31",
149
- "@gjsify/node-polyfills": "^0.64.31",
150
- "@gjsify/npm-registry": "^0.64.31",
151
- "@gjsify/resolve-npm": "^0.64.31",
152
- "@gjsify/rolldown-plugin-gjsify": "^0.64.31",
153
- "@gjsify/vite-plugin-blueprint": "^0.64.31",
154
- "@gjsify/rolldown-plugin-pnp": "^0.64.31",
155
- "@gjsify/semver": "^0.64.31",
156
- "@gjsify/tar": "^0.64.31",
157
- "@gjsify/tsc": "^0.64.31",
158
- "@gjsify/utils": "^0.64.31",
159
- "@gjsify/web-polyfills": "^0.64.31",
160
- "@gjsify/workspace": "^0.64.31",
145
+ "@gjsify/blueprint": "^0.64.32",
146
+ "@gjsify/buffer": "^0.64.32",
147
+ "@gjsify/create-app": "^0.64.32",
148
+ "@gjsify/node-globals": "^0.64.32",
149
+ "@gjsify/node-polyfills": "^0.64.32",
150
+ "@gjsify/npm-registry": "^0.64.32",
151
+ "@gjsify/resolve-npm": "^0.64.32",
152
+ "@gjsify/rolldown-plugin-gjsify": "^0.64.32",
153
+ "@gjsify/vite-plugin-blueprint": "^0.64.32",
154
+ "@gjsify/rolldown-plugin-pnp": "^0.64.32",
155
+ "@gjsify/semver": "^0.64.32",
156
+ "@gjsify/tar": "^0.64.32",
157
+ "@gjsify/tsc": "^0.64.32",
158
+ "@gjsify/utils": "^0.64.32",
159
+ "@gjsify/web-polyfills": "^0.64.32",
160
+ "@gjsify/workspace": "^0.64.32",
161
161
  "acorn": "^8.17.0",
162
162
  "cosmiconfig": "^9.0.2",
163
163
  "get-tsconfig": "^4.14.0",
@@ -166,13 +166,13 @@
166
166
  "yargs": "^18.0.0"
167
167
  },
168
168
  "devDependencies": {
169
- "@gjsify/unit": "^0.64.31",
169
+ "@gjsify/unit": "^0.64.32",
170
170
  "@types/yargs": "^17.0.35",
171
171
  "typescript": "^6.0.3"
172
172
  },
173
173
  "peerDependencies": {
174
- "@gjsify/oxfmt-native": "^0.64.31",
175
- "@gjsify/rolldown-native": "^0.64.31"
174
+ "@gjsify/oxfmt-native": "^0.64.32",
175
+ "@gjsify/rolldown-native": "^0.64.32"
176
176
  },
177
177
  "peerDependenciesMeta": {
178
178
  "@gjsify/oxfmt-native": {