Skip to content

Commit

Permalink
move to script
Browse files Browse the repository at this point in the history
  • Loading branch information
mangs committed Jul 19, 2024
1 parent f6d466c commit 188c46b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"./time": "./src/timeUtils.mts"
},
"scripts": {
"diff": "bun --print \"const response = await fetch('https://api.github.com/repos/mangs/bun-utils/pulls/88/files', { headers: { Accept: 'application/vnd.github+json', Authorization: 'Bearer '+Bun.env.GITHUB_TOKEN }} ); const responseJson = await response.json(); const patchContents = responseJson.find(({filename, status}) => filename === 'package.json' && status === 'modified').patch; const isValidPatchRange = patchContents.startsWith('@@ -1,'); const versionBefore = /^-\\s*\"version\":\\s*\"([^\"])\",$/; patchContents.match(versionBefore);\"",
"diff": "bun scripts/bun/diff.mts",
"audit:node-modules": "cd node_modules && du -sh -- * | sort -h",
"build:documentation": "typedoc --options ./config/typedoc/typedoc.json",
"check:environment": "bun --bun run --silent check:environment:symlinks && bun run --silent check:environment:versions",
Expand Down
16 changes: 16 additions & 0 deletions scripts/bun/diff.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const response = await fetch('https://api.github.com/repos/mangs/bun-utils/pulls/88/files', {
headers: {
Accept: 'application/vnd.github+json',
Authorization: `Bearer ${Bun.env.GITHUB_TOKEN}`,
},
});
const responseJson = await response.json();
if (!Array.isArray(responseJson)) {
throw new Error('booooo', { cause: { responseJson } });
}
const patchContents = responseJson.find(
({ filename, status }) => filename === 'package.json' && status === 'modified',
).patch;
const isValidPatchRange = patchContents.startsWith('@@ -1,');
const versionBefore = /^-\s*"version":\s*"([^"]+)",$/;
patchContents.match(versionBefore);

0 comments on commit 188c46b

Please sign in to comment.