···11+### 0.3.0
22+33+- New package `@typelex/cli`
44+- See new recommended workflow on https://typelex.org/#install
55+16### 0.2.0
2738- Add `@external` support
+1-30
DOCS.md
···258258259259The `@external` decorator tells the emitter to skip JSON output for that namespace. This is useful when referencing definitions from other Lexicons that you don't want to re-emit.
260260261261-You could collect external stubs in one file and import them:
262262-263263-```typescript
264264-import "@typelex/emitter";
265265-import "../atproto-stubs.tsp";
266266-267267-namespace app.bsky.actor.profile {
268268- model Main {
269269- labels?: (com.atproto.label.defs.SelfLabels | unknown);
270270- }
271271-}
272272-```
273273-274274-Then in `atproto-stubs.tsp`:
275275-276276-```typescript
277277-import "@typelex/emitter";
278278-279279-@external
280280-namespace com.atproto.label.defs {
281281- model SelfLabels { }
282282-}
283283-284284-@external
285285-namespace com.atproto.repo.defs {
286286- model StrongRef { }
287287- @token model SomeToken { } // Note: Tokens still need @token
288288-}
289289-// ... more stubs
290290-```
261261+Starting with 0.3.0, typelex will automatically generate a `typelex/externals.tsp` file based on the JSON files in your `lexicons/` folder, and enforce that it's imported into your `typelex/main.tsp` entry point. However, this will *not* include Lexicons from your app's namespace, but only external ones.
291262292263You'll want to ensure the real JSON for external Lexicons is available before running codegen.
293264
···58585959 return new Promise((resolve) => {
6060 rl.question(
6161- `Enter your app's root namespace (e.g. ${pc.cyan("com.example.*")}): `,
6161+ `Which Lexicons do you want to write in typelex (e.g. ${pc.cyan("com.example.*")})? `,
6262 (answer) => {
6363 rl.close();
6464 resolve(answer.trim());
···9090 return initSetup();
9191 }
92929393- console.log(`Adding ${gradientText("typelex")}...\n`);
9393+ console.log(gradientText("Adding typelex...") + "\n");
94949595 // Detect package manager
9696 let packageManager = "npm";
···240240241241 // Inform about external lexicons
242242 console.log(
243243- `\nLexicons other than ${pc.cyan(namespace)} will be considered external.`,
243243+ `\nLexicons for ${pc.cyan(namespace)} will now be managed by typelex.`,
244244 );
245245+ console.log(`You can begin writing them in ${pc.cyan("typelex/main.tsp")}.`);
245246 console.log(
246246- `Put them into the ${pc.cyan(displayLexiconsPath)} folder as JSON.\n`,
247247+ `Any external lexicons should remain in ${pc.cyan(displayLexiconsPath)}.\n`,
247248 );
248249249250 // Create typelex directory
···321322 console.log(`\n${pc.green("✓")} ${pc.bold("All set!")}`);
322323 console.log(`\n${pc.bold("Next steps:")}`);
323324 console.log(
324324- ` ${pc.dim("1.")} Edit ${pc.cyan("typelex/main.tsp")} to define your lexicons`,
325325+ ` ${pc.dim("1.")} Edit ${pc.cyan("typelex/main.tsp")} to define the ${pc.cyan(namespace)} lexicons`,
325326 );
326327 console.log(
327328 ` ${pc.dim("2.")} Keep putting external lexicons into ${pc.cyan(displayLexiconsPath)}`,