@geastack/cli 0.1.110 → 0.1.112

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/README.md CHANGED
@@ -17,6 +17,7 @@ gea setup
17
17
  gea dev
18
18
  gea build --target web
19
19
  gea build --target ios
20
+ gea build --target tvos
20
21
  gea flash --board amoled --monitor
21
22
  gea screenshot board.png --board amoled
22
23
  gea monitor --board amoled
@@ -37,7 +38,7 @@ flowchart TD
37
38
  emptyTarget -->|"ESP32 board"| emptyEsp["Generate native entry<br/>Ask whether to enable Bluetooth updates"]
38
39
  emptyTarget -->|"Other native target"| emptyNative["Generate native entry for the selected platform"]
39
40
 
40
- starter -->|"Example application"| pickExample["Pick from the example gallery<br/>web, ESP32, GeaOS, iOS, macOS, Android"]
41
+ starter -->|"Example application"| pickExample["Pick from the example gallery<br/>web, ESP32, GeaOS, iOS, tvOS, macOS, Android"]
41
42
  pickExample --> fetchExample["Fetch selected app from GitHub"]
42
43
  fetchExample --> copyExample["Copy fetched example files"]
43
44
  copyExample --> rewriteExample["Rewrite package name and gea manifest"]
@@ -192,7 +193,7 @@ First implementation is in place:
192
193
  - `flash`, `monitor`, WiFi OTA, and BLE OTA through `@geastack/targets`;
193
194
  - `list` and `inspect` helpers;
194
195
  - `create-geastack` with a bundled counter starter, a blank application, and a
195
- GitHub-backed rich example flow for web, embedded, GeaOS, iOS, macOS, and Android apps,
196
+ GitHub-backed rich example flow for web, embedded, GeaOS, iOS, tvOS, macOS, and Android apps,
196
197
  all with `.gea/boards.json`, plus `gea boards` for machine-wide aliases in
197
198
  `~/.geastack/boards.json`.
198
199
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geastack/cli",
3
- "version": "0.1.110",
3
+ "version": "0.1.112",
4
4
  "description": "Command-line front door for GeaStack apps, targets, and local toolchains.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -38,14 +38,14 @@
38
38
  "dependencies": {
39
39
  "@clack/prompts": "^1.8.0",
40
40
  "@geastack/simulator": "^0.1.15",
41
- "@geastack/targets": "^0.1.108",
41
+ "@geastack/targets": "^0.1.109",
42
42
  "picocolors": "^1.1.1",
43
43
  "serialport": "^13.0.0"
44
44
  },
45
45
  "starterDependencies": {
46
46
  "@geastack/core": "^0.1.40",
47
47
  "@geastack/targets": "^0.1.101",
48
- "@geastack/apple": "^0.2.15"
48
+ "@geastack/apple": "^0.2.20"
49
49
  },
50
50
  "scripts": {
51
51
  "check": "node --check bin/gea.mjs && node --check bin/create-geastack.mjs && find src test packages -name '*.mjs' -print0 | xargs -0 -n1 node --check",
@@ -1,4 +1,4 @@
1
- import { syncNativeResources } from '../native-resources.mjs'
1
+ import { nativeResourceTargets, syncNativeResources } from '../native-resources.mjs'
2
2
  import { readdirSync } from 'node:fs'
3
3
  import path from 'node:path'
4
4
 
@@ -18,7 +18,7 @@ export async function appsCommand(ctx, parsed, rest, options) {
18
18
  case 'sync-native-resources': {
19
19
  const app=resolveRequestedApp(ctx,parsed,args);assertValidApp(app);const target=option(parsed,'target',''),output=option(parsed,'output','');
20
20
  if(!target||!output)fail('sync-native-resources requires --target and --output',ExitCode.usage);
21
- if(!app.targets[target]||!['macos','raspberry-pi-os'].includes(target))fail('Unsupported or disabled native resource target',ExitCode.usage);
21
+ if(!app.targets[target]||!nativeResourceTargets.includes(target))fail('Unsupported or disabled native resource target',ExitCode.usage);
22
22
  options.stdout(JSON.stringify(syncNativeResources(app.root,target,app.targetConfig[target]?.nativeResources||{},path.resolve(output))));return 0
23
23
  }
24
24
  case 'inspect': return inspectApp(ctx, parsed, args, options)
@@ -283,6 +283,11 @@ async function chooseBlankTarget(prompt, { back }) {
283
283
  label: 'iPhone or iPad',
284
284
  description: 'A native iOS application.'
285
285
  },
286
+ {
287
+ value: 'tvos',
288
+ label: 'Apple TV',
289
+ description: 'A native tvOS application.'
290
+ },
286
291
  {
287
292
  value: 'android',
288
293
  label: 'Android',
@@ -315,6 +320,7 @@ function targetManifest(requestedTargets) {
315
320
  geaos: enabled.has('geaos'),
316
321
  macos: enabled.has('macos'),
317
322
  ios: enabled.has('ios'),
323
+ tvos: enabled.has('tvos'),
318
324
  android: enabled.has('android'),
319
325
  windows: enabled.has('windows')
320
326
  }
@@ -329,6 +335,7 @@ function targetManifestFromObject(targets = {}) {
329
335
  geaos: targets.geaos === true,
330
336
  macos: targets.macos === true,
331
337
  ios: targets.ios === true,
338
+ tvos: targets.tvos === true,
332
339
  android: targets.android === true,
333
340
  windows: targets.windows === true
334
341
  }
@@ -361,7 +368,7 @@ function packageJson({ appId, displayName, targets, entry, coreDependency, cliDe
361
368
  '@geastack/cli': cliDependency,
362
369
  ...(needsTargetsPackage(targets) ? { '@geastack/targets': sourcePackage.dependencies?.['@geastack/targets'] || targetsDependencyDefault } : {}),
363
370
  ...(targets.windows ? { '@geastack/windows': sourcePackage.dependencies?.['@geastack/windows'] || windowsDependencyDefault } : {}),
364
- ...(targets.macos || targets.ios ? { '@geastack/apple': sourcePackage.dependencies?.['@geastack/apple'] || appleDependencyDefault } : {})
371
+ ...(targets.macos || targets.ios || targets.tvos ? { '@geastack/apple': sourcePackage.dependencies?.['@geastack/apple'] || appleDependencyDefault } : {})
365
372
  },
366
373
  devDependencies: {
367
374
  ...(sourcePackage.devDependencies || {}),
@@ -385,9 +392,9 @@ function needsTargetsPackage(targets) {
385
392
  // own dependencies by `gea build --target windows`.
386
393
  const windowsDependencyDefault = '^0.1.0'
387
394
 
388
- // The macOS and iOS targets ship inside @geastack/apple, resolved the same way
389
- // by `gea build --target macos` and `gea build --target ios`. An app that
390
- // declares either target without the package has nothing to build with.
395
+ // The macOS, iOS and tvOS targets ship inside @geastack/apple, resolved the
396
+ // same way by `gea build --target macos|ios|tvos`. An app that declares any of
397
+ // them without the package has nothing to build with.
391
398
  const appleDependencyDefault = starterDependencies['@geastack/apple'] || '^0.2.9'
392
399
 
393
400
  function indexTsx(displayName) {
@@ -529,7 +536,11 @@ npx gea run --target windows`
529
536
  ? `npx gea setup
530
537
  npx gea build --target ios
531
538
  npx gea run --target ios`
532
- : `npx gea setup
539
+ : targets.tvos && !targets.macos
540
+ ? `npx gea setup
541
+ npx gea build --target tvos
542
+ npx gea run --target tvos`
543
+ : `npx gea setup
533
544
  npx gea build`
534
545
  return `# ${displayName}
535
546
 
@@ -614,7 +625,7 @@ Automation options:
614
625
  --name <display-name>
615
626
  --examples-repo <git-url-or-local-path>
616
627
  --examples-ref <git-ref>
617
- --targets web,esp32,rp2350,geaos,macos,ios,android,windows
628
+ --targets web,esp32,rp2350,geaos,macos,ios,tvos,android,windows
618
629
  --core-dependency <specifier>
619
630
  --cli-dependency <specifier>
620
631
  --install
package/src/manifest.mjs CHANGED
@@ -365,7 +365,7 @@ export function resolveAppSourcePath(root, source) {
365
365
  // staged with the executable) and gea.targets.<target>.tsconfig (the
366
366
  // TypeScript project the compiler reads the program under). The other targets
367
367
  // take gea.nativeSources only.
368
- const TARGET_NATIVE_SOURCE_TARGETS = ['windows']
368
+ const TARGET_NATIVE_SOURCE_TARGETS = ['windows', 'ios', 'tvos']
369
369
  const TARGET_PROVIDER_TARGETS = ['windows']
370
370
 
371
371
  export function normalizeNativeSources(raw) {
@@ -10,9 +10,10 @@ export function resolveNativeLink(root, target, config = {}) {
10
10
  for (const [name, values] of [['nativeLibraries', libraries], ['frameworks', frameworks], ['nativeIncludeDirectories', includeDirectories], ['nativeSystemLibraries', systemLibraries]]) {
11
11
  if (!Array.isArray(values) || values.some(value => typeof value !== 'string' || !value)) throw new Error(`${name} must be an array of nonempty strings`)
12
12
  }
13
- if (libraries.length && !['macos', 'raspberry-pi-os'].includes(target)) throw new Error(`nativeLibraries are not supported by ${target}`)
14
- if (frameworks.length && target !== 'macos') throw new Error('frameworks are supported only by macos')
15
- if ((includeDirectories.length || systemLibraries.length) && !['raspberry-pi-os', 'windows'].includes(target)) throw new Error('Native include/system library extensions are supported only by raspberry-pi-os and windows')
13
+ if (libraries.length && !['macos', 'raspberry-pi-os', 'ios', 'tvos'].includes(target)) throw new Error(`nativeLibraries are not supported by ${target}`)
14
+ if (frameworks.length && !['macos', 'ios', 'tvos'].includes(target)) throw new Error('frameworks are supported only by macos, ios and tvos')
15
+ if (includeDirectories.length && !['raspberry-pi-os', 'windows', 'ios', 'tvos'].includes(target)) throw new Error('nativeIncludeDirectories are supported only by raspberry-pi-os, windows, ios and tvos')
16
+ if (systemLibraries.length && !['raspberry-pi-os', 'windows', 'macos', 'ios', 'tvos'].includes(target)) throw new Error('nativeSystemLibraries are supported only by raspberry-pi-os, windows, macos, ios and tvos')
16
17
  const includes = includeDirectories.map(value => {
17
18
  if (path.isAbsolute(value) || value.split(/[\\/]/).includes('..') || /[\x00-\x1f\x7f]/.test(value)) throw new Error('Invalid nativeIncludeDirectories entry')
18
19
  const directory = fs.realpathSync(path.join(realRoot,value)), relative=path.relative(realRoot,directory)
@@ -4,9 +4,10 @@ import crypto from 'node:crypto'
4
4
  const exists=file=>{try{fs.lstatSync(file);return true}catch(error){if(error.code==='ENOENT')return false;throw error}}
5
5
  function fileHash(file){const fd=fs.openSync(file,'r'),hash=crypto.createHash('sha256'),buffer=Buffer.alloc(1048576);try{for(;;){const count=fs.readSync(fd,buffer,0,buffer.length,null);if(!count)break;hash.update(buffer.subarray(0,count))}return hash.digest('hex')}finally{fs.closeSync(fd)}}
6
6
  const safeName=value=>typeof value==='string' && /^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(value) && !['Fonts','FontLicenses','Frameworks','MacOS'].includes(value)
7
+ export const nativeResourceTargets=['macos','raspberry-pi-os','windows','ios','tvos']
7
8
  export function resolveNativeResources(root, target, raw = {}) {
8
9
  if(!raw||typeof raw!=='object'||Array.isArray(raw))throw Error('nativeResources must be a destination-to-directory object')
9
- if(Object.keys(raw).length && !['macos','raspberry-pi-os','windows'].includes(target))throw Error(`nativeResources are not supported by ${target}`)
10
+ if(Object.keys(raw).length && !nativeResourceTargets.includes(target))throw Error(`nativeResources are not supported by ${target}`)
10
11
  const base=fs.realpathSync(root),result={};let count=0,total=0
11
12
  for(const [name,value]of Object.entries(raw)){
12
13
  if(!safeName(name)||typeof value!=='string'||!value||path.isAbsolute(value)||value.split(/[\\/]/).includes('..')||/[\x00-\x1f\x7f]/.test(value))throw Error('Invalid nativeResources destination or source')