@flexacms/cli 0.2.0 → 0.3.1

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
@@ -3,7 +3,7 @@
3
3
  Generate TypeScript types from the content models of your [Flexa](https://github.com/flexacms) workspace.
4
4
 
5
5
  ```bash
6
- FLEXA_URL=https://cms.example.com FLEXA_API_KEY=flx_... npx @flexacms/cli generate --out src/flexa.d.ts
6
+ FLEXA_API_KEY=flx_... npx @flexacms/cli generate --out src/flexa.d.ts
7
7
  ```
8
8
 
9
9
  The file contains one `<Entity>Values` interface per content model and a `FlexaSchema` map. Pass it to any Flexa SDK:
@@ -18,6 +18,6 @@ Field types map to their API values: translatable fields become `Localized<T>`,
18
18
 
19
19
  | Option | Default |
20
20
  | ------- | ------------------------------- |
21
- | `--url` | `$FLEXA_URL` |
21
+ | `--url` | `$FLEXA_URL`, then `https://flexacms.com` |
22
22
  | `--key` | `$FLEXA_API_KEY` (Read ability) |
23
23
  | `--out` | `flexa.d.ts` |
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@
4
4
  import { mkdir, writeFile } from "fs/promises";
5
5
  import { dirname, resolve } from "path";
6
6
  import { parseArgs } from "util";
7
- import { createClient, isFlexaError } from "@flexacms/client";
7
+ import { createClient, DEFAULT_URL, isFlexaError } from "@flexacms/client";
8
8
 
9
9
  // src/generate.ts
10
10
  function generateTypes(schemas) {
@@ -148,7 +148,7 @@ var HELP = `Usage: flexa generate [options]
148
148
  Generate TypeScript types for your Flexa workspace's content models.
149
149
 
150
150
  Options:
151
- --url <url> Flexa URL (default: $FLEXA_URL)
151
+ --url <url> Flexa URL (default: $FLEXA_URL, then ${DEFAULT_URL})
152
152
  --key <key> API key with the Read ability (default: $FLEXA_API_KEY)
153
153
  --out <file> Output file (default: flexa.d.ts)
154
154
  -h, --help Show this help
@@ -168,11 +168,11 @@ async function main(argv) {
168
168
  process.stdout.write(HELP);
169
169
  return values.help ? 0 : 1;
170
170
  }
171
- const url = values.url ?? process.env.FLEXA_URL;
171
+ const url = values.url ?? process.env.FLEXA_URL ?? DEFAULT_URL;
172
172
  const apiKey = values.key ?? process.env.FLEXA_API_KEY;
173
- if (!url || !apiKey) {
173
+ if (!apiKey) {
174
174
  process.stderr.write(
175
- "Missing --url/--key (or the FLEXA_URL and FLEXA_API_KEY environment variables).\n"
175
+ "Missing --key (or the FLEXA_API_KEY environment variable).\n"
176
176
  );
177
177
  return 1;
178
178
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flexacms/cli",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Generate TypeScript types from your Flexa CMS content models.",
5
5
  "keywords": [
6
6
  "cms",
@@ -42,7 +42,7 @@
42
42
  "typecheck": "tsc -p tsconfig.json"
43
43
  },
44
44
  "dependencies": {
45
- "@flexacms/client": "^0.2.0"
45
+ "@flexacms/client": "^0.3.1"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=20"