a collection of lightweight TypeScript packages for AT Protocol, the protocol powering Bluesky
atproto bluesky typescript npm
101
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(lex-cli): add `clean` option to generate command

Mary f652050b d01ad16e

+43 -12
+5
.changeset/all-pandas-sniff.md
··· 1 + --- 2 + '@atcute/lex-cli': minor 3 + --- 4 + 5 + add `clean` option to generate command
+1
packages/definitions/atproto/lex.config.js
··· 5 5 outdir: 'lib/lexicons/', 6 6 modules: { importSuffix: '.ts' }, 7 7 formatter: { type: 'lsp', command: 'oxfmt --lsp' }, 8 + generate: { clean: true }, 8 9 9 10 pull: { 10 11 outdir: 'lexicons/',
+1 -1
packages/definitions/atproto/package.json
··· 28 28 "scripts": { 29 29 "build": "tsgo", 30 30 "pull": "lex-cli pull", 31 - "generate": "rm -r ./lib/lexicons/; lex-cli generate", 31 + "generate": "lex-cli generate", 32 32 "prepublish": "rm -rf dist; pnpm run build" 33 33 }, 34 34 "dependencies": {
+1
packages/definitions/bluemoji/lex.config.js
··· 5 5 outdir: 'lib/lexicons/', 6 6 modules: { importSuffix: '.ts' }, 7 7 formatter: { type: 'lsp', command: 'oxfmt --lsp' }, 8 + generate: { clean: true }, 8 9 imports: ['@atcute/atproto', '@atcute/bluesky'], 9 10 10 11 // pull: {
+1 -1
packages/definitions/bluemoji/package.json
··· 23 23 }, 24 24 "scripts": { 25 25 "build": "tsgo", 26 - "generate": "rm -r ./lib/lexicons/; lex-cli generate", 26 + "generate": "lex-cli generate", 27 27 "prepublish": "rm -rf dist; pnpm run build" 28 28 }, 29 29 "dependencies": {
+1
packages/definitions/frontpage/lex.config.js
··· 5 5 outdir: 'lib/lexicons/', 6 6 modules: { importSuffix: '.ts' }, 7 7 formatter: { type: 'lsp', command: 'oxfmt --lsp' }, 8 + generate: { clean: true }, 8 9 imports: ['@atcute/atproto'], 9 10 10 11 pull: {
+1 -1
packages/definitions/frontpage/package.json
··· 29 29 "scripts": { 30 30 "build": "tsgo", 31 31 "pull": "lex-cli pull", 32 - "generate": "rm -r ./lib/lexicons/; lex-cli generate", 32 + "generate": "lex-cli generate", 33 33 "prepublish": "rm -rf dist; pnpm run build" 34 34 }, 35 35 "dependencies": {
+1
packages/definitions/leaflet/lex.config.js
··· 5 5 outdir: 'lib/lexicons/', 6 6 modules: { importSuffix: '.ts' }, 7 7 formatter: { type: 'lsp', command: 'oxfmt --lsp' }, 8 + generate: { clean: true }, 8 9 imports: ['@atcute/atproto'], 9 10 10 11 pull: {
+1 -1
packages/definitions/leaflet/package.json
··· 29 29 "scripts": { 30 30 "build": "tsgo", 31 31 "pull": "lex-cli pull", 32 - "generate": "rm -r ./lib/lexicons/; lex-cli generate", 32 + "generate": "lex-cli generate", 33 33 "prepublish": "rm -rf dist; pnpm run build" 34 34 }, 35 35 "dependencies": {
+1
packages/definitions/lexicon-community/lex.config.js
··· 5 5 outdir: 'lib/lexicons/', 6 6 modules: { importSuffix: '.ts' }, 7 7 formatter: { type: 'lsp', command: 'oxfmt --lsp' }, 8 + generate: { clean: true }, 8 9 imports: ['@atcute/atproto'], 9 10 10 11 pull: {
+1 -1
packages/definitions/lexicon-community/package.json
··· 24 24 "scripts": { 25 25 "build": "tsgo", 26 26 "pull": "lex-cli pull", 27 - "generate": "rm -r ./lib/lexicons/; lex-cli generate", 27 + "generate": "lex-cli generate", 28 28 "prepublish": "rm -rf dist; pnpm run build" 29 29 }, 30 30 "dependencies": {
+1
packages/definitions/microcosm/lex.config.js
··· 5 5 outdir: 'lib/lexicons/', 6 6 modules: { importSuffix: '.ts' }, 7 7 formatter: { type: 'lsp', command: 'oxfmt --lsp' }, 8 + generate: { clean: true }, 8 9 export: { 9 10 outdir: 'lexicons/', 10 11 clean: true,
+1 -1
packages/definitions/microcosm/package.json
··· 24 24 }, 25 25 "scripts": { 26 26 "build": "tsgo -b", 27 - "generate": "rm -r ./lib/lexicons/; lex-cli generate", 27 + "generate": "lex-cli generate", 28 28 "export": "lex-cli export", 29 29 "prepublish": "rm -rf dist; pnpm run build" 30 30 },
+1
packages/definitions/ozone/lex.config.js
··· 5 5 outdir: 'lib/lexicons/', 6 6 modules: { importSuffix: '.ts' }, 7 7 formatter: { type: 'lsp', command: 'oxfmt --lsp' }, 8 + generate: { clean: true }, 8 9 imports: ['@atcute/atproto', '@atcute/bluesky'], 9 10 10 11 pull: {
+1 -1
packages/definitions/ozone/package.json
··· 30 30 "scripts": { 31 31 "build": "tsgo", 32 32 "pull": "lex-cli pull", 33 - "generate": "rm -r ./lib/lexicons/; lex-cli generate", 33 + "generate": "lex-cli generate", 34 34 "prepublish": "rm -rf dist; pnpm run build" 35 35 }, 36 36 "dependencies": {
+1
packages/definitions/pckt/lex.config.js
··· 5 5 outdir: 'lib/lexicons/', 6 6 modules: { importSuffix: '.ts' }, 7 7 formatter: { type: 'lsp', command: 'oxfmt --lsp' }, 8 + generate: { clean: true }, 8 9 imports: ['@atcute/atproto'], 9 10 10 11 pull: {
+1 -1
packages/definitions/pckt/package.json
··· 29 29 "scripts": { 30 30 "build": "tsgo", 31 31 "pull": "lex-cli pull", 32 - "generate": "rm -r ./lib/lexicons/; lex-cli generate", 32 + "generate": "lex-cli generate", 33 33 "prepublish": "rm -rf dist; pnpm run build" 34 34 }, 35 35 "dependencies": {
+1
packages/definitions/standard-site/lex.config.js
··· 5 5 outdir: 'lib/lexicons/', 6 6 modules: { importSuffix: '.ts' }, 7 7 formatter: { type: 'lsp', command: 'oxfmt --lsp' }, 8 + generate: { clean: true }, 8 9 imports: ['@atcute/atproto'], 9 10 10 11 pull: {
+1 -1
packages/definitions/standard-site/package.json
··· 29 29 "scripts": { 30 30 "build": "tsgo", 31 31 "pull": "lex-cli pull", 32 - "generate": "rm -r ./lib/lexicons/; lex-cli generate", 32 + "generate": "lex-cli generate", 33 33 "prepublish": "rm -rf dist; pnpm run build" 34 34 }, 35 35 "dependencies": {
+1
packages/definitions/tangled/lex.config.js
··· 5 5 outdir: 'lib/lexicons/', 6 6 modules: { importSuffix: '.ts' }, 7 7 formatter: { type: 'lsp', command: 'oxfmt --lsp' }, 8 + generate: { clean: true }, 8 9 imports: ['@atcute/atproto'], 9 10 10 11 pull: {
+1 -1
packages/definitions/tangled/package.json
··· 29 29 "scripts": { 30 30 "build": "tsgo", 31 31 "pull": "lex-cli pull", 32 - "generate": "rm -r ./lib/lexicons/; lex-cli generate", 32 + "generate": "lex-cli generate", 33 33 "prepublish": "rm -rf dist; pnpm run build" 34 34 }, 35 35 "dependencies": {
+1
packages/definitions/whitewind/lex.config.js
··· 5 5 outdir: 'lib/lexicons/', 6 6 modules: { importSuffix: '.ts' }, 7 7 formatter: { type: 'lsp', command: 'oxfmt --lsp' }, 8 + generate: { clean: true }, 8 9 9 10 pull: { 10 11 outdir: 'lexicons/',
+1 -1
packages/definitions/whitewind/package.json
··· 29 29 "scripts": { 30 30 "build": "tsgo", 31 31 "pull": "lex-cli pull", 32 - "generate": "rm -r ./lib/lexicons/; lex-cli generate", 32 + "generate": "lex-cli generate", 33 33 "prepublish": "rm -rf dist; pnpm run build" 34 34 }, 35 35 "dependencies": {
+10 -1
packages/lexicons/lex-cli/src/commands/generate.ts
··· 9 9 import pc from 'picocolors'; 10 10 11 11 import { generateLexiconApi, type ImportMapping } from '../codegen.ts'; 12 - import { loadConfig } from '../config.ts'; 12 + import { loadConfig, type GenerateConfig, type NormalizedConfig } from '../config.ts'; 13 13 import { createFormatter } from '../formatter.ts'; 14 14 import { loadLexicons } from '../lexicon-loader.ts'; 15 15 import { packageJsonSchema } from '../lexicon-metadata.ts'; ··· 145 145 146 146 export type GenerateCommand = InferValue<typeof generateCommandSchema>; 147 147 148 + const ensureGenerateConfig = (config: NormalizedConfig): GenerateConfig => { 149 + return config.generate ?? {}; 150 + }; 151 + 148 152 /** 149 153 * runs the generate command to create type definitions from lexicon documents 150 154 * @param args parsed command arguments 151 155 */ 152 156 export const runGenerate = async (args: GenerateCommand): Promise<void> => { 153 157 const config = await loadConfig(args.config); 158 + const generateConfig = ensureGenerateConfig(config); 154 159 155 160 // resolve imports to mappings 156 161 const importMappings = config.imports ? await resolveImportsToMappings(config.imports, config.root) : []; ··· 162 167 163 168 const outdir = path.join(config.root, config.outdir); 164 169 const formatter = await createFormatter(config.formatter, config.root); 170 + 171 + if (generateConfig.clean) { 172 + await fs.rm(outdir, { recursive: true, force: true }); 173 + } 165 174 166 175 try { 167 176 const pending: Promise<void>[] = [];
+6
packages/lexicons/lex-cli/src/config.ts
··· 79 79 }), 80 80 ); 81 81 82 + const generateConfigSchema = v.object({ 83 + clean: v.boolean().optional(), 84 + }); 85 + 82 86 export type GitSourceConfig = v.Infer<typeof gitSourceConfigSchema>; 83 87 export type AtprotoNsidsSourceConfig = v.Infer<typeof atprotoNsidsSourceConfigSchema>; 84 88 export type AtprotoAuthoritySourceConfig = v.Infer<typeof atprotoAuthoritySourceConfigSchema>; ··· 87 91 export type PullConfig = v.Infer<typeof pullConfigSchema>; 88 92 export type ExportConfig = v.Infer<typeof exportConfigSchema>; 89 93 export type FormatterConfig = v.Infer<typeof formatterConfigSchema>; 94 + export type GenerateConfig = v.Infer<typeof generateConfigSchema>; 90 95 91 96 const isValidLexiconPattern = (pattern: string): boolean => { 92 97 if (pattern.endsWith('.*')) { ··· 144 149 .partial() 145 150 .optional(), 146 151 formatter: formatterConfigSchema.optional((): FormatterConfig => ({ type: 'prettier' })), 152 + generate: generateConfigSchema.optional(), 147 153 pull: pullConfigSchema.optional(), 148 154 export: exportConfigSchema.optional(), 149 155 });