Skip to content

Commit 3b6bcbd

Browse files
authored
Merge pull request #107 from Araxeus/update-dependencies
2 parents e297a22 + 96427c5 commit 3b6bcbd

File tree

14 files changed

+151
-127
lines changed

14 files changed

+151
-127
lines changed

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
Check:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v6
1515
- uses: oven-sh/setup-bun@v2
1616
- run: bun install
1717
- run: bun check

.github/workflows/dependabot_patch_bun.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: oven-sh/setup-bun@v2
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v6
1717
with:
1818
fetch-depth: 0
1919
ref: ${{ github.event.pull_request.head.ref }}

.github/workflows/dependency-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: "Checkout Repository"
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v6
1919
- name: 'Dependency Review'
2020
uses: actions/dependency-review-action@v4

.github/workflows/publish.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Publish Package
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch: null
8+
9+
permissions:
10+
id-token: write # Required for OIDC
11+
contents: read
12+
13+
jobs:
14+
publish:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v6
18+
- uses: actions/setup-node@v6
19+
with:
20+
# ensure we have the latest npm to get provenance support
21+
node-version: 'latest'
22+
- name: Verify npm version
23+
run: npm -v
24+
- uses: oven-sh/setup-bun@v2
25+
- run: bun install
26+
- run: bun check
27+
- run: bun b
28+
29+
- run: npm publish --provenance --access public
30+
# this only works because this package has no dependencies that need to be built
31+

.github/workflows/semgrep.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ jobs:
2020
container:
2121
image: returntocorp/semgrep
2222
steps:
23-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@v6
2424
- run: semgrep ci

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ Commands:
253253
help [command] display help for command
254254
255255
Options:
256-
-dir, --folder [folder] Folder containing the config file
256+
-d, --folder [folder] Folder containing the config file
257257
-v, --version output the current version
258258
-h, --help display help for command
259259
```
@@ -282,7 +282,7 @@ Usage: vendor update|upgrade [options] [names...]
282282
Update all/selected dependencies to their latest version (the tag of the latest release)
283283
284284
Options:
285-
-pr|--pr Output pull request text for gh action (default: false)
285+
-p|--pr Output pull request text for gh action (default: false)
286286
-h, --help display help for command
287287
288288
Examples:

biome.json

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,46 @@
11
{
2-
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3-
"organizeImports": {
4-
"enabled": true
5-
},
6-
"files": {
7-
"ignore": [
8-
"./node_modules/**",
9-
"./dist/*",
10-
"./vendor/*",
11-
"./lib/auth.js"
12-
]
13-
},
14-
"javascript": {
2+
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3+
"assist": { "actions": { "source": { "organizeImports": "on" } } },
4+
"files": {
5+
"includes": [
6+
"**",
7+
"!node_modules",
8+
"!dist",
9+
"!vendor",
10+
"!lib/auth.js"
11+
]
12+
},
13+
"javascript": {
14+
"formatter": {
15+
"quoteStyle": "single",
16+
"arrowParentheses": "asNeeded"
17+
}
18+
},
19+
"json": {
20+
"formatter": {
21+
"enabled": false
22+
}
23+
},
1524
"formatter": {
16-
"quoteStyle": "single"
25+
"enabled": true,
26+
"indentStyle": "space",
27+
"indentWidth": 4,
28+
"includes": ["**", "!**/*.json"]
29+
},
30+
"linter": {
31+
"enabled": true,
32+
"rules": {
33+
"recommended": true,
34+
"correctness": {
35+
"noUndeclaredVariables": "error",
36+
"noUnusedVariables": "error"
37+
},
38+
"style": {
39+
"noParameterAssign": "off"
40+
},
41+
"nursery": {
42+
"recommended": true
43+
}
44+
}
1745
}
18-
},
19-
"json": {
20-
"formatter": {
21-
"enabled": false
22-
}
23-
},
24-
"formatter": {
25-
"enabled": true,
26-
"indentStyle": "space",
27-
"indentWidth": 4,
28-
"ignore": [
29-
"*.json"
30-
]
31-
},
32-
"linter": {
33-
"enabled": true,
34-
"rules": {
35-
"recommended": true,
36-
"correctness": {
37-
"noUndeclaredVariables": "error",
38-
"noUnusedVariables": "error"
39-
},
40-
"style": {
41-
"noParameterAssign": "off"
42-
},
43-
"nursery": {
44-
"recommended": true
45-
}
46-
}
47-
}
4846
}

bun.lockb

-33.5 KB
Binary file not shown.

cli.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
#!/usr/bin/env node
22

3-
import type { FilesArray, VendorsOptions } from './lib/types.js';
4-
53
import { Command } from '@commander-js/extra-typings';
6-
74
import { install, sync, uninstall } from './lib/commands.js';
85
import { getConfig, setRunOptions } from './lib/config.js';
96
import { findRepoUrl, login } from './lib/github.js';
7+
import type { FilesArray, VendorsOptions } from './lib/types.js';
108
import {
119
assert,
1210
getPackageJson,
@@ -39,7 +37,7 @@ const updateCmd = new Command('update')
3937
.alias('up')
4038
.alias('u')
4139
.argument('[names...]')
42-
.option('-pr|--pr', 'Output pull request text for gh action', false)
40+
.option('-p|--pr', 'Output pull request text for gh action', false)
4341
.action((names, { pr }) => {
4442
if (names.length === 0) {
4543
upgradeAll(pr);
@@ -109,7 +107,7 @@ const installCmd = new Command('install')
109107
const deps =
110108
vendorOptions.dependencies[name] ||
111109
Object.values(vendorOptions.dependencies).find(
112-
(dep) => dep.repository === url,
110+
dep => dep.repository === url,
113111
) ||
114112
{};
115113

@@ -145,7 +143,7 @@ const uninstallCmd = new Command('uninstall')
145143
.alias('un')
146144
.alias('r')
147145
.argument('[names...]', 'Package names to uninstall')
148-
.action((names) => {
146+
.action(names => {
149147
assert(names.length > 0, 'No package names provided');
150148

151149
for (const name of names) {
@@ -166,7 +164,7 @@ Examples:
166164
const loginCmd = new Command('login')
167165
.alias('auth')
168166
.argument('[token]', 'GitHub token (leave empty to login via browser)')
169-
.action((token) => login(token))
167+
.action(token => login(token))
170168
.summary('Login to GitHub')
171169
.description('Login to GitHub to increase rate limit')
172170
.addHelpText(
@@ -195,7 +193,7 @@ program
195193
.addCommand(installCmd)
196194
.addCommand(uninstallCmd)
197195
.addCommand(loginCmd)
198-
.option('-dir, --folder [folder]', 'Folder containing the config file')
196+
.option('-d, --folder [folder]', 'Folder containing the config file')
199197
.version(
200198
(await getPackageJson()).version || 'unknown',
201199
'-v, --version',
@@ -232,7 +230,12 @@ function installOne({
232230
name,
233231
version,
234232
files,
235-
}: { url: string; files: FilesArray; version?: string; name?: string }) {
233+
}: {
234+
url: string;
235+
files: FilesArray;
236+
version?: string;
237+
name?: string;
238+
}) {
236239
install({
237240
dependency: (name && vendorOptions.dependencies[name]) || {
238241
repository: url,

lib/commands.ts

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
import { existsSync } from 'node:fs';
2+
import fs from 'node:fs/promises';
3+
import os from 'node:os';
4+
import path from 'node:path';
5+
import { unarchive } from 'unarchive';
6+
import { getRunOptions, writeConfig } from './config.js';
7+
import github from './github.js';
18
import type {
29
ConfigFile,
310
ConfigFileSettings,
@@ -6,16 +13,6 @@ import type {
613
VendorDependency,
714
VendorsOptions,
815
} from './types.js';
9-
10-
import { existsSync } from 'node:fs';
11-
import fs from 'node:fs/promises';
12-
import os from 'node:os';
13-
import path from 'node:path';
14-
15-
import { unarchive } from 'unarchive';
16-
17-
import { getRunOptions, writeConfig } from './config.js';
18-
import github from './github.js';
1916
import {
2017
assert,
2118
checkIfNeedsUpdate,
@@ -30,8 +27,8 @@ import {
3027
info,
3128
ownerAndNameFromRepoUrl,
3229
random,
33-
readLockfile,
3430
readableToFile,
31+
readLockfile,
3532
red,
3633
replaceVersion,
3734
success,
@@ -93,7 +90,7 @@ export async function sync(
9390
if (getRunOptions().prMode && updatedDeps.length > 0) {
9491
const updatedDepsString = updatedDeps
9592
.map(
96-
(dep) =>
93+
dep =>
9794
`* Bump [${dep.name}](${dep.url}) from ❌ ${dep.oldVersion} to ✅ ${dep.newVersion}`,
9895
)
9996
.join('\n');
@@ -256,7 +253,7 @@ export async function install({
256253
| string
257254
| [string, string]
258255
| [string, { [input: string]: string }]
259-
)[] = dependency.files.flatMap((file) =>
256+
)[] = dependency.files.flatMap(file =>
260257
// @ts-expect-error Type 'string' is not assignable to type '[string, string]'
261258
typeof file === 'object' ? Object.entries(file) : file,
262259
);
@@ -268,7 +265,7 @@ export async function install({
268265
const releaseFiles: { input: string; output: ReleaseFileOutput }[] = [];
269266

270267
await Promise.all(
271-
allFiles.map(async (file) => {
268+
allFiles.map(async file => {
272269
let input: string;
273270
// type of parameter two
274271
let output: ReleaseFileOutput;
@@ -301,7 +298,7 @@ export async function install({
301298
path: input,
302299
ref,
303300
})
304-
.catch((err) => {
301+
.catch(err => {
305302
if (err?.status === 404) {
306303
error(
307304
`File "${file}" was not found in ${dependency.repository}`,
@@ -325,7 +322,7 @@ export async function install({
325322

326323
await Promise.all(
327324
// file.output is either a string that or an object which would mean that we want to extract the files from the downloaded archive
328-
releaseFiles.map(async (file) => {
325+
releaseFiles.map(async file => {
329326
const input = replaceVersion(file.input, ref).replace(
330327
'{release}/',
331328
'',
@@ -367,7 +364,7 @@ export async function install({
367364
}
368365

369366
const inputOutput = Array.isArray(output)
370-
? output.map((o) => [o, o])
367+
? output.map(o => [o, o])
371368
: Object.entries(output);
372369

373370
// move files

0 commit comments

Comments
 (0)