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.

chore: unify pull lexicon script

Mary ed8a5ae1 b9457952

+91 -80
+1 -1
lexdocs/bluemoji/README.md
··· 1 - https://github.com/aendra-rininsland/bluemoji/tree/802a236415645e765a40fb02b6dc1e04344058f5/schema 1 + https://github.com/aendra-rininsland/bluemoji/tree/802a236415645e765a40fb02b6dc1e04344058f5/schema/
+1 -1
lexdocs/frontpage/README.md
··· 1 - https://github.com/likeandscribe/frontpage/tree/ad5d8e1a76ed8353afb3ccc0ef83a64ecd67c676/lexicons/fyi/unravel/frontpage 1 + https://github.com/likeandscribe/frontpage/tree/ad5d8e1a76ed8353afb3ccc0ef83a64ecd67c676/lexicons/fyi/unravel/frontpage/
+1 -1
lexdocs/lexcom/README.md
··· 1 - https://github.com/lexicon-community/lexicon/tree/1a8b319c00b2b57bf2cd5b011e7c0ce9bcafac0e/schema 1 + https://github.com/lexicon-community/lexicon/tree/1a8b319c00b2b57bf2cd5b011e7c0ce9bcafac0e/community/lexicon/
+1 -1
lexdocs/tangled/README.md
··· 1 - https://github.com/mary-ext/tangled.sh-mirror/tree/6e09ad4d8dac347d23b64ab8ec5ba8ee734ba077/lexicons 1 + https://github.com/mary-ext/tangled.sh-mirror/tree/6e09ad4d8dac347d23b64ab8ec5ba8ee734ba077/lexicons/
+1 -1
lexdocs/whtwnd/README.md
··· 1 - https://github.com/whtwnd/whitewind-blog/tree/dc4b802154250b982191a52af1d1c9913c3b62e7/lexicons 1 + https://github.com/whtwnd/whitewind-blog/tree/dc4b802154250b982191a52af1d1c9913c3b62e7/lexicons/com/whtwnd/
lexdocs/whtwnd/com/whtwnd/blog/defs.json lexdocs/whtwnd/blog/defs.json
lexdocs/whtwnd/com/whtwnd/blog/entry.json lexdocs/whtwnd/blog/entry.json
lexdocs/whtwnd/com/whtwnd/blog/getAuthorPosts.json lexdocs/whtwnd/blog/getAuthorPosts.json
lexdocs/whtwnd/com/whtwnd/blog/getEntryMetadataByName.json lexdocs/whtwnd/blog/getEntryMetadataByName.json
lexdocs/whtwnd/com/whtwnd/blog/getMentionsByEntry.json lexdocs/whtwnd/blog/getMentionsByEntry.json
lexdocs/whtwnd/com/whtwnd/blog/notifyOfNewEntry.json lexdocs/whtwnd/blog/notifyOfNewEntry.json
+14 -11
scripts/pull-bluemoji-lexicons.js
··· 4 4 import { untar } from '@mary/tar'; 5 5 import prettier from 'prettier'; 6 6 7 - const repo = `aendra-rininsland/bluemoji`; 7 + const config = { 8 + repo: `aendra-rininsland/bluemoji`, 9 + path: `schema/`, 10 + out: `lexdocs/bluemoji/`, 11 + }; 8 12 9 13 async function main() { 10 - const config = await prettier.resolveConfig(process.cwd() + '/foo', { editorconfig: true }); 14 + const prettierConfig = await prettier.resolveConfig(process.cwd() + '/foo', { editorconfig: true }); 11 15 12 16 let sha; 13 17 { 14 18 console.log(`retrieving latest commit`); 15 - const response = await fetch(`https://api.github.com/repos/${repo}/commits?path=schema/`); 19 + const response = await fetch(`https://api.github.com/repos/${config.repo}/commits?path=${config.path}/`); 16 20 17 21 if (!response.ok) { 18 22 console.log(` response error ${response.status}`); ··· 35 39 36 40 { 37 41 console.log(`retrieving zip file`); 38 - const response = await fetch(`https://github.com/${repo}/archive/${sha}.tar.gz`); 42 + const response = await fetch(`https://github.com/${config.repo}/archive/${sha}.tar.gz`); 39 43 40 44 if (!response.ok) { 41 45 console.log(` response error ${response.status}`); 42 46 return; 43 47 } 44 48 45 - const basename = `bluemoji-${sha}/schema/`; 49 + const reponame = config.repo.replace(/^.*?\//, ''); 50 + const basename = `${reponame}-${sha}/${config.path}`; 46 51 47 52 const ds = new DecompressionStream('gzip'); 48 53 const stream = response.body.pipeThrough(ds); ··· 58 63 const code = await entry.text(); 59 64 60 65 const promise = (async () => { 61 - const formatted = await prettier.format(code, { ...config, parser: 'json' }); 66 + const formatted = await prettier.format(code, { ...prettierConfig, parser: 'json' }); 62 67 63 68 await fs.mkdir(basedir, { recursive: true }); 64 69 await fs.writeFile(tmpdir + name, formatted); ··· 73 78 } 74 79 75 80 { 76 - const source = `https://github.com/${repo}/tree/${sha}/schema\n`; 81 + const source = `https://github.com/${config.repo}/tree/${sha}/${config.path}\n`; 77 82 78 83 console.log(`writing readme file`); 79 84 ··· 81 86 } 82 87 83 88 { 84 - const dest = `lexdocs/bluemoji/`; 85 - 86 89 console.log(`moving folder`); 87 90 88 - await fs.rm(dest, { recursive: true, force: true }); 89 - await fs.rename(tmpdir, dest); 91 + await fs.rm(config.out, { recursive: true, force: true }); 92 + await fs.rename(tmpdir, config.out); 90 93 } 91 94 } 92 95
+14 -13
scripts/pull-frontpage-lexicons.js
··· 4 4 import { untar } from '@mary/tar'; 5 5 import prettier from 'prettier'; 6 6 7 - const repo = `likeandscribe/frontpage`; 7 + const config = { 8 + repo: `likeandscribe/frontpage`, 9 + path: `lexicons/fyi/unravel/frontpage/`, 10 + out: `lexdocs/frontpage/` 11 + }; 8 12 9 13 async function main() { 10 - const config = await prettier.resolveConfig(process.cwd() + '/foo', { editorconfig: true }); 14 + const prettierConfig = await prettier.resolveConfig(process.cwd() + '/foo', { editorconfig: true }); 11 15 12 16 let sha; 13 17 { 14 18 console.log(`retrieving latest commit`); 15 - const response = await fetch( 16 - `https://api.github.com/repos/${repo}/commits?path=lexicons/fyi/unravel/frontpage/`, 17 - ); 19 + const response = await fetch(`https://api.github.com/repos/${config.repo}/commits?path=${config.path}/`); 18 20 19 21 if (!response.ok) { 20 22 console.log(` response error ${response.status}`); ··· 37 39 38 40 { 39 41 console.log(`retrieving zip file`); 40 - const response = await fetch(`https://github.com/${repo}/archive/${sha}.tar.gz`); 42 + const response = await fetch(`https://github.com/${config.repo}/archive/${sha}.tar.gz`); 41 43 42 44 if (!response.ok) { 43 45 console.log(` response error ${response.status}`); 44 46 return; 45 47 } 46 48 47 - const basename = `frontpage-${sha}/lexicons/fyi/unravel/frontpage/`; 49 + const reponame = config.repo.replace(/^.*?\//, ''); 50 + const basename = `${reponame}-${sha}/${config.path}`; 48 51 49 52 const ds = new DecompressionStream('gzip'); 50 53 const stream = response.body.pipeThrough(ds); ··· 60 63 const code = await entry.text(); 61 64 62 65 const promise = (async () => { 63 - const formatted = await prettier.format(code, { ...config, parser: 'json' }); 66 + const formatted = await prettier.format(code, { ...prettierConfig, parser: 'json' }); 64 67 65 68 await fs.mkdir(basedir, { recursive: true }); 66 69 await fs.writeFile(tmpdir + name, formatted); ··· 75 78 } 76 79 77 80 { 78 - const source = `https://github.com/${repo}/tree/${sha}/lexicons/fyi/unravel/frontpage\n`; 81 + const source = `https://github.com/${config.repo}/tree/${sha}/${config.path}\n`; 79 82 80 83 console.log(`writing readme file`); 81 84 ··· 83 86 } 84 87 85 88 { 86 - const dest = `lexdocs/frontpage/`; 87 - 88 89 console.log(`moving folder`); 89 90 90 - await fs.rm(dest, { recursive: true, force: true }); 91 - await fs.rename(tmpdir, dest); 91 + await fs.rm(config.out, { recursive: true, force: true }); 92 + await fs.rename(tmpdir, config.out); 92 93 } 93 94 } 94 95
+14 -11
scripts/pull-lexcom-lexicons.js
··· 4 4 import { untar } from '@mary/tar'; 5 5 import prettier from 'prettier'; 6 6 7 - const repo = `lexicon-community/lexicon`; 7 + const config = { 8 + repo: `lexicon-community/lexicon`, 9 + path: `community/lexicon/`, 10 + out: `lexdocs/lexcom/`, 11 + }; 8 12 9 13 async function main() { 10 - const config = await prettier.resolveConfig(process.cwd() + '/foo', { editorconfig: true }); 14 + const prettierConfig = await prettier.resolveConfig(process.cwd() + '/foo', { editorconfig: true }); 11 15 12 16 let sha; 13 17 { 14 18 console.log(`retrieving latest commit`); 15 - const response = await fetch(`https://api.github.com/repos/${repo}/commits?path=community/lexicon/`); 19 + const response = await fetch(`https://api.github.com/repos/${config.repo}/commits?path=${config.path}/`); 16 20 17 21 if (!response.ok) { 18 22 console.log(` response error ${response.status}`); ··· 35 39 36 40 { 37 41 console.log(`retrieving zip file`); 38 - const response = await fetch(`https://github.com/${repo}/archive/${sha}.tar.gz`); 42 + const response = await fetch(`https://github.com/${config.repo}/archive/${sha}.tar.gz`); 39 43 40 44 if (!response.ok) { 41 45 console.log(` response error ${response.status}`); 42 46 return; 43 47 } 44 48 45 - const basename = `lexicon-${sha}/community/lexicon/`; 49 + const reponame = config.repo.replace(/^.*?\//, ''); 50 + const basename = `${reponame}-${sha}/${config.path}`; 46 51 47 52 const ds = new DecompressionStream('gzip'); 48 53 const stream = response.body.pipeThrough(ds); ··· 58 63 const code = await entry.text(); 59 64 60 65 const promise = (async () => { 61 - const formatted = await prettier.format(code, { ...config, parser: 'json' }); 66 + const formatted = await prettier.format(code, { ...prettierConfig, parser: 'json' }); 62 67 63 68 await fs.mkdir(basedir, { recursive: true }); 64 69 await fs.writeFile(tmpdir + name, formatted); ··· 73 78 } 74 79 75 80 { 76 - const source = `https://github.com/${repo}/tree/${sha}/schema\n`; 81 + const source = `https://github.com/${config.repo}/tree/${sha}/${config.path}\n`; 77 82 78 83 console.log(`writing readme file`); 79 84 ··· 81 86 } 82 87 83 88 { 84 - const dest = `lexdocs/lexcom/`; 85 - 86 89 console.log(`moving folder`); 87 90 88 - await fs.rm(dest, { recursive: true, force: true }); 89 - await fs.rename(tmpdir, dest); 91 + await fs.rm(config.out, { recursive: true, force: true }); 92 + await fs.rename(tmpdir, config.out); 90 93 } 91 94 } 92 95
+15 -12
scripts/pull-lexicons.js
··· 4 4 import { untar } from '@mary/tar'; 5 5 import prettier from 'prettier'; 6 6 7 - const repo = `bluesky-social/atproto`; 7 + const config = { 8 + repo: `aendra-rininsland/bluemoji`, 9 + path: `schema/`, 10 + out: `lexdocs/bluemoji/`, 11 + }; 8 12 9 13 async function main() { 10 - const config = await prettier.resolveConfig(process.cwd() + '/foo', { editorconfig: true }); 14 + const prettierConfig = await prettier.resolveConfig(process.cwd() + '/foo', { editorconfig: true }); 11 15 12 16 let sha; 13 17 { 14 18 console.log(`retrieving latest commit`); 15 - const response = await fetch(`https://api.github.com/repos/${repo}/commits?path=lexicons/`); 19 + const response = await fetch(`https://api.github.com/repos/${config.repo}/commits?path=${config.path}/`); 16 20 17 21 if (!response.ok) { 18 22 console.log(` response error ${response.status}`); ··· 35 39 36 40 { 37 41 console.log(`retrieving zip file`); 38 - const response = await fetch(`https://github.com/${repo}/archive/${sha}.tar.gz`); 42 + const response = await fetch(`https://github.com/${config.repo}/archive/${sha}.tar.gz`); 39 43 40 44 if (!response.ok) { 41 45 console.log(` response error ${response.status}`); 42 46 return; 43 47 } 44 48 45 - const basename = `atproto-${sha}/lexicons/`; 49 + const reponame = config.repo.replace(/^.*?\//, ''); 50 + const basename = `${reponame}-${sha}/${config.path}`; 46 51 47 52 const ds = new DecompressionStream('gzip'); 48 53 const stream = response.body.pipeThrough(ds); ··· 51 56 52 57 console.log(` reading`); 53 58 for await (const entry of untar(stream)) { 54 - if (entry.type === 'file' && entry.name.startsWith(basename)) { 59 + if (entry.type === 'file' && entry.name.startsWith(basename) && entry.name.endsWith('.json')) { 55 60 const name = entry.name.slice(basename.length); 56 61 const basedir = tmpdir + path.dirname(name); 57 62 58 63 const code = await entry.text(); 59 64 60 65 const promise = (async () => { 61 - const formatted = await prettier.format(code, { ...config, parser: 'json' }); 66 + const formatted = await prettier.format(code, { ...prettierConfig, parser: 'json' }); 62 67 63 68 await fs.mkdir(basedir, { recursive: true }); 64 69 await fs.writeFile(tmpdir + name, formatted); ··· 73 78 } 74 79 75 80 { 76 - const source = `https://github.com/${repo}/tree/${sha}/lexicons\n`; 81 + const source = `https://github.com/${config.repo}/tree/${sha}/${config.path}\n`; 77 82 78 83 console.log(`writing readme file`); 79 84 ··· 81 86 } 82 87 83 88 { 84 - const dest = `lexdocs/bluesky/`; 85 - 86 89 console.log(`moving folder`); 87 90 88 - await fs.rm(dest, { recursive: true, force: true }); 89 - await fs.rename(tmpdir, dest); 91 + await fs.rm(config.out, { recursive: true, force: true }); 92 + await fs.rename(tmpdir, config.out); 90 93 } 91 94 } 92 95
+14 -11
scripts/pull-tangled-lexicons.js
··· 4 4 import { untar } from '@mary/tar'; 5 5 import prettier from 'prettier'; 6 6 7 - const repo = `mary-ext/tangled.sh-mirror`; 7 + const config = { 8 + repo: `mary-ext/tangled.sh-mirror`, 9 + path: `lexicons/`, 10 + out: `lexdocs/tangled/`, 11 + }; 8 12 9 13 async function main() { 10 - const config = await prettier.resolveConfig(process.cwd() + '/foo', { editorconfig: true }); 14 + const prettierConfig = await prettier.resolveConfig(process.cwd() + '/foo', { editorconfig: true }); 11 15 12 16 let sha; 13 17 { 14 18 console.log(`retrieving latest commit`); 15 - const response = await fetch(`https://api.github.com/repos/${repo}/commits?path=lexicons/`); 19 + const response = await fetch(`https://api.github.com/repos/${config.repo}/commits?path=${config.path}/`); 16 20 17 21 if (!response.ok) { 18 22 console.log(` response error ${response.status}`); ··· 35 39 36 40 { 37 41 console.log(`retrieving zip file`); 38 - const response = await fetch(`https://github.com/${repo}/archive/${sha}.tar.gz`); 42 + const response = await fetch(`https://github.com/${config.repo}/archive/${sha}.tar.gz`); 39 43 40 44 if (!response.ok) { 41 45 console.log(` response error ${response.status}`); 42 46 return; 43 47 } 44 48 45 - const basename = `tangled.sh-mirror-${sha}/lexicons/`; 49 + const reponame = config.repo.replace(/^.*?\//, ''); 50 + const basename = `${reponame}-${sha}/${config.path}`; 46 51 47 52 const ds = new DecompressionStream('gzip'); 48 53 const stream = response.body.pipeThrough(ds); ··· 58 63 const code = await entry.text(); 59 64 60 65 const promise = (async () => { 61 - const formatted = await prettier.format(code, { ...config, parser: 'json' }); 66 + const formatted = await prettier.format(code, { ...prettierConfig, parser: 'json' }); 62 67 63 68 await fs.mkdir(basedir, { recursive: true }); 64 69 await fs.writeFile(tmpdir + name, formatted); ··· 73 78 } 74 79 75 80 { 76 - const source = `https://github.com/${repo}/tree/${sha}/lexicons\n`; 81 + const source = `https://github.com/${config.repo}/tree/${sha}/${config.path}\n`; 77 82 78 83 console.log(`writing readme file`); 79 84 ··· 81 86 } 82 87 83 88 { 84 - const dest = `lexdocs/tangled/`; 85 - 86 89 console.log(`moving folder`); 87 90 88 - await fs.rm(dest, { recursive: true, force: true }); 89 - await fs.rename(tmpdir, dest); 91 + await fs.rm(config.out, { recursive: true, force: true }); 92 + await fs.rename(tmpdir, config.out); 90 93 } 91 94 } 92 95
+15 -17
scripts/pull-whtwnd-lexicons.js
··· 4 4 import { untar } from '@mary/tar'; 5 5 import prettier from 'prettier'; 6 6 7 - const repo = `whtwnd/whitewind-blog`; 7 + const config = { 8 + repo: `whtwnd/whitewind-blog`, 9 + path: `lexicons/com/whtwnd/`, 10 + out: `lexdocs/whtwnd/`, 11 + }; 8 12 9 13 async function main() { 10 - const config = await prettier.resolveConfig(process.cwd() + '/foo', { editorconfig: true }); 14 + const prettierConfig = await prettier.resolveConfig(process.cwd() + '/foo', { editorconfig: true }); 11 15 12 16 let sha; 13 17 { 14 18 console.log(`retrieving latest commit`); 15 - const response = await fetch(`https://api.github.com/repos/${repo}/commits?path=lexicons/`); 19 + const response = await fetch(`https://api.github.com/repos/${config.repo}/commits?path=${config.path}/`); 16 20 17 21 if (!response.ok) { 18 22 console.log(` response error ${response.status}`); ··· 35 39 36 40 { 37 41 console.log(`retrieving zip file`); 38 - const response = await fetch(`https://github.com/${repo}/archive/${sha}.tar.gz`); 42 + const response = await fetch(`https://github.com/${config.repo}/archive/${sha}.tar.gz`); 39 43 40 44 if (!response.ok) { 41 45 console.log(` response error ${response.status}`); 42 46 return; 43 47 } 44 48 45 - const basename = `whitewind-blog-${sha}/lexicons/`; 49 + const reponame = config.repo.replace(/^.*?\//, ''); 50 + const basename = `${reponame}-${sha}/${config.path}`; 46 51 47 52 const ds = new DecompressionStream('gzip'); 48 53 const stream = response.body.pipeThrough(ds); ··· 51 56 52 57 console.log(` reading`); 53 58 for await (const entry of untar(stream)) { 54 - if (entry.type === 'file' && entry.name.startsWith(basename)) { 59 + if (entry.type === 'file' && entry.name.startsWith(basename) && entry.name.endsWith('.json')) { 55 60 const name = entry.name.slice(basename.length); 56 61 const basedir = tmpdir + path.dirname(name); 57 62 58 - // We're not interested in anything else. 59 - if (!name.startsWith('com/whtwnd/')) { 60 - continue; 61 - } 62 - 63 63 const code = await entry.text(); 64 64 65 65 const promise = (async () => { 66 - const formatted = await prettier.format(code, { ...config, parser: 'json' }); 66 + const formatted = await prettier.format(code, { ...prettierConfig, parser: 'json' }); 67 67 68 68 await fs.mkdir(basedir, { recursive: true }); 69 69 await fs.writeFile(tmpdir + name, formatted); ··· 78 78 } 79 79 80 80 { 81 - const source = `https://github.com/${repo}/tree/${sha}/lexicons\n`; 81 + const source = `https://github.com/${config.repo}/tree/${sha}/${config.path}\n`; 82 82 83 83 console.log(`writing readme file`); 84 84 ··· 86 86 } 87 87 88 88 { 89 - const dest = `lexdocs/whtwnd/`; 90 - 91 89 console.log(`moving folder`); 92 90 93 - await fs.rm(dest, { recursive: true, force: true }); 94 - await fs.rename(tmpdir, dest); 91 + await fs.rm(config.out, { recursive: true, force: true }); 92 + await fs.rename(tmpdir, config.out); 95 93 } 96 94 } 97 95