Skip to content

Commit e0d498c

Browse files
committed
feat: Modified the deploy script to deploy each resource directly to the db as well. Modified the build script to build the original json schema. Bump to version 1.1.0
1 parent f98fa38 commit e0d498c

6 files changed

Lines changed: 30 additions & 5 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"rollup": "rollup -c",
1616
"build": "tsx ./scripts/build.ts",
1717
"build:completions": "tsx ./scripts/generate-completions-index.ts",
18-
"deploy:completions": "npm run build:completions && cd completions-cron && wrangler deploy",
18+
"deploy:completions": "npm run build:completions && cd completions-cron && npx wrangler deploy",
1919
"deploy": "tsx ./scripts/deploy.ts",
2020
"deploy:beta": "BETA=true tsx ./scripts/deploy.ts",
2121
"testing": "codify-deploy"

rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default {
1616
json(),
1717
nodeResolve({ exportConditions: ['node'] }),
1818
typescript({
19-
exclude: ['**/*.test.ts', '**/*.d.ts', 'test']
19+
exclude: ['**/*.test.ts', '**/*.d.ts', 'test', '**/completions/*.ts']
2020
}),
2121
commonjs(),
2222
terser()

scripts/deploy.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ cp.spawnSync(`source ~/.zshrc; npx wrangler r2 object put plugins/${name}/${vers
2929

3030
if (!isBeta) {
3131
await uploadResources();
32+
33+
// Build and deploy completions as well.
34+
console.log('Deploying completions...')
35+
cp.spawnSync('source ~/.zshrc; npm run deploy:completions' , { shell: 'zsh', stdio: 'inherit' })
3236
}
3337

3438
async function uploadResources() {
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
export default async function loadAsdfPluginNames(): Promise<string[]> {
2-
const response = await fetch('https://api.github.com/repos/asdf-vm/asdf-plugins/contents/plugins')
2+
const response = await fetch('https://api.github.com/repos/asdf-vm/asdf-plugins/contents/plugins', {
3+
headers: { 'User-Agent': 'codify-completions-cron' },
4+
})
5+
6+
if (!response.ok) {
7+
throw new Error(`GitHub API error: ${response.status} ${await response.text()}`)
8+
}
9+
310
const data = await response.json() as Record<string, any>[]
411
return data.map((d: any) => d.name as string)
512
}
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
export default async function loadAsdfPlugins(): Promise<string[]> {
2-
const response = await fetch('https://api.github.com/repos/asdf-vm/asdf-plugins/contents/plugins')
2+
const response = await fetch('https://api.github.com/repos/asdf-vm/asdf-plugins/contents/plugins', {
3+
headers: { 'User-Agent': 'codify-completions-cron' },
4+
})
5+
6+
if (!response.ok) {
7+
throw new Error(`GitHub API error: ${response.status} ${await response.text()}`)
8+
}
9+
310
const data = await response.json() as Record<string, any>[]
411
return data.map((d: any) => d.name as string)
512
}

src/resources/ruby/rbenv/completions/rbenv.rubyVersions.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
export default async function loadRubyVersions(): Promise<string[]> {
2-
const response = await fetch('https://api.github.com/repos/rbenv/ruby-build/contents/share/ruby-build')
2+
const response = await fetch('https://api.github.com/repos/rbenv/ruby-build/contents/share/ruby-build', {
3+
headers: { 'User-Agent': 'codify-completions-cron' },
4+
})
5+
6+
if (!response.ok) {
7+
throw new Error(`GitHub API error: ${response.status} ${await response.text()}`)
8+
}
9+
310
const data = await response.json() as { name: string }[]
411

512
return data.map((entry) => entry.name)

0 commit comments

Comments
 (0)