@imagina-build/ias-cli 0.1.1 → 0.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imagina-build/ias-cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "The command line of Imagina Application Services (IAS): ias.json, OTA updates, internal distribution and the checks of a project.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,15 +13,18 @@ const PROFILE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,49}$/;
13
13
 
14
14
  /** Why a field of eas.json does not go to ias.json. */
15
15
  const LEFT_OUT = {
16
- env: 'variables go to ias env (track 1D), sealed when they are secret',
17
- credentialsSource: 'credentials go to the vault (ias credentials, track 1D)',
18
- ascApiKeyPath: 'credentials go to the vault (ias credentials, track 1D)',
19
- ascApiKeyId: 'credentials go to the vault (ias credentials, track 1D)',
20
- ascApiKeyIssuerId: 'credentials go to the vault (ias credentials, track 1D)',
21
- serviceAccountKeyPath: 'credentials go to the vault (ias credentials, track 1D)',
22
- appleId: 'credentials go to the vault (ias credentials, track 1D)',
16
+ env: 'variables go to ias env, sealed when they are secret: ias migrate eas env brings those of EAS',
17
+ credentialsSource: 'credentials go to the vault: ias credentials import, or ias migrate eas',
18
+ ascApiKeyPath: 'credentials go to the vault: ias credentials import, or ias migrate eas',
19
+ ascApiKeyId: 'credentials go to the vault: ias credentials import, or ias migrate eas',
20
+ ascApiKeyIssuerId: 'credentials go to the vault: ias credentials import, or ias migrate eas',
21
+ serviceAccountKeyPath: 'credentials go to the vault: ias credentials import, or ias migrate eas',
22
+ appleId: 'credentials go to the vault: ias credentials import, or ias migrate eas',
23
23
  };
24
- const leftOutReason = (key) => LEFT_OUT[key] ?? 'ias.json has no field for it yet (phase 2 completes the build and submit profiles)';
24
+ const leftOutReason = (key) => LEFT_OUT[key] ?? 'ias.json has no field for it (schema/ias.schema.json lists what its profiles take)';
25
+
26
+ /** Why eas.json › cli stays out, and where the build numbers go: IAS keeps them on its server (ias version). */
27
+ const cliReason = (cli) => `it configures eas-cli; IAS keeps the build numbers on its server, and autoIncrement takes the next: ${cli?.appVersionSource === 'remote' ? 'EAS keeps them now (appVersionSource remote), and ias migrate eas version brings them' : 'ias version set --from-app-json brings those of app.json'}`;
25
28
 
26
29
  /** The code of an application made from a slug: lowercase letters, digits and hyphens, up to 32. */
27
30
  const codeFromSlug = (slug) => (typeof slug === 'string' ? slug.toLowerCase().replace(/[^a-z0-9-]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 32) : undefined);
@@ -114,7 +117,7 @@ export function initialConfig(dir, { app: appOption } = {}) {
114
117
  config.submit = submit;
115
118
  from.submit = 'eas.json';
116
119
  }
117
- for (const key of Object.keys(eas ?? {}).filter((candidate) => !['build', 'submit'].includes(candidate))) leave(`eas.json › ${key}`, key === 'cli' ? 'it configures eas-cli (and with appVersionSource remote, EAS keeps the build numbers: phase 2 decides where IAS keeps them)' : leftOutReason(key));
120
+ for (const key of Object.keys(eas ?? {}).filter((candidate) => !['build', 'submit'].includes(candidate))) leave(`eas.json › ${key}`, key === 'cli' ? cliReason(eas.cli) : leftOutReason(key));
118
121
 
119
122
  const secrets = writtenSecrets(config);
120
123
  const errors = validate(config);
@@ -32,7 +32,15 @@ export function vaultItem(context, project, server) {
32
32
  return { reference, vault: match[1], title: match[2] };
33
33
  }
34
34
 
35
- const op = (args, { env, input } = {}) => spawnSync('op', args, { encoding: 'utf8', env, input, maxBuffer: 1024 * 1024, stdio: ['pipe', 'pipe', 'pipe'] });
35
+ /**
36
+ * Runs op. With `input`, through cat: Node gives a child a socket for stdin, not a pipe, and op only reads a template
37
+ * from a pipe ("provide the item category with '--category' flag" otherwise). The template never touches the disk nor
38
+ * the arguments.
39
+ */
40
+ const op = (args, { env, input } = {}) => {
41
+ const [command, commandArgs] = input === undefined ? ['op', args] : ['/bin/sh', ['-c', 'cat | op "$@"', 'sh', ...args]];
42
+ return spawnSync(command, commandArgs, { encoding: 'utf8', env, input, maxBuffer: 1024 * 1024, stdio: ['pipe', 'pipe', 'pipe'] });
43
+ };
36
44
 
37
45
  /** The first line of what op said, which names the reference and never a value. */
38
46
  const opReason = (result) => (result.error ? result.error.message : (result.stderr || '').trim().split('\n').at(-1) || `exit ${result.status}`);