Skip to content

Commit

Permalink
Pin sveltekit + shrinkwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
Explosion-Scratch committed Feb 3, 2024
1 parent ff62c8b commit 15a1e14
Show file tree
Hide file tree
Showing 4 changed files with 1,466 additions and 1,605 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v2
- name: Install and Build
run: |
npm install
npm ci
npm run build
- name: Deploy to GitHub Pages
Expand Down
40 changes: 40 additions & 0 deletions migrate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import {readFileSync, writeFileSync} from "fs";

const pkg = JSON.parse(readFileSync("package-lock.json"));

let out = {};
let deps = {};

[...Object.entries(pkg.dependencies), ...Object.entries(pkg.packages)].forEach(i => {
let name = i[0];
let versionobj = i[1];

if (name.startsWith('node_modules/')){
name = name.replace('node_modules/', '');
}
if (name.includes('/node_modules/')){
let parent = name.split('/node_modules/')[0];
let nm = name.split('/node_modules/')[1];
let existing = out[parent] || {}
if (typeof existing === 'string'){
deps[parent] = existing;
existing = {};
}
name = parent;
versionobj = {
...existing,
[nm]: i[1].version,
}
} else {
versionobj = i[1].version;
}
out[name] = versionobj;
})

let newPkg = JSON.parse(readFileSync('package.json'));

newPkg.overrides = out;
console.log(deps);
newPkg.dependencies = {...(newPkg.dependencies || {}), ...deps};

writeFileSync("package.json", JSON.stringify(newPkg, null, 2))
Loading

0 comments on commit 15a1e14

Please sign in to comment.