Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(core): auto-update vendored lockdown.umd.js #1078

Closed
wants to merge 1 commit into from

Conversation

boneskull
Copy link
Contributor

This changes the lint-staged configuration so that when package-lock.json is updated, the vendored packages/core/lib/lockdown.umd.js is copied from the currently-installed ses and added to the commit.

I'm not sure if this is something we want to be doing or not, but needing to run the lib:ses script in lavamoat-core after a ses upgrade is non-obvious for maintainers (me).

This changes the `lint-staged` configuration so that when `package-lock.json` is updated, the vendored `packages/core/lib/lockdown.umd.js` is copied from the currently-installed `ses` and added to the commit.

I'm not sure if this is something we want to be doing or not, but needing to run the `lib:ses` script in `lavamoat-core` after a `ses` upgrade is non-obvious for maintainers (me).
@boneskull boneskull requested review from legobeat and a team as code owners March 6, 2024 21:58
@github-actions github-actions bot added dependencies Pull requests that update a dependency file pkg:lavamoat-core Changes in package lavamoat-core labels Mar 6, 2024
@@ -29,7 +29,7 @@
"!*.tsbuildinfo"
],
"scripts": {
"lib:ses": "cp ../../node_modules/ses/dist/lockdown.umd.js ./lib/lockdown.umd.js",
"lib:ses": "cp ../../node_modules/ses/dist/lockdown.umd.js ./lib/lockdown.umd.js && git add -A ./lib/lockdown.umd.js",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"lib:ses": "cp ../../node_modules/ses/dist/lockdown.umd.js ./lib/lockdown.umd.js && git add -A ./lib/lockdown.umd.js",
"lib:ses": "cp ../../node_modules/ses/dist/lockdown.umd.js ./lib/lockdown.umd.js",

I think the package scripts like this shouldn't be modifying the local git environment, any drawback to moving it into the lint-script?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure (I had it this way originally but changed it for reasons that escape me)

// @ts-check

/** @type {import('lint-staged').Config} */
module.exports = {
'*.js': ['eslint --fix', 'prettier --write'],
'*.(ts|md|ya?ml|json)': ['prettier --write'],
'!((package-lock|policy)*).json': ['prettier --write'],
'package-lock.json': () => ['npm run -w lavamoat-core lib:ses'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'package-lock.json': () => ['npm run -w lavamoat-core lib:ses'],
'package-lock.json': () => ['npm run -w lavamoat-core lib:ses && git add -A ./packages/core/lib/lockdown.umd.js'],

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the package scripts like this shouldn't be modifying the local git environment, any drawback to moving it into the lint-script?

@legobeat
Copy link
Contributor

legobeat commented Mar 6, 2024

IMO a more proper solution would be to not have a copy checked into git at all - just vendor a copy from the package devDependency at build-time. And maybe add it to bundledDependencies?

Other than or until that, maybe giving a more helpful error message to the failing test here would also solve most of the need here, without additional magic in commit hooks?

@boneskull
Copy link
Contributor Author

Yeah, I mean, why do we vendor lockdown.umd.js, anyway?

@boneskull
Copy link
Contributor Author

Closing in lieu of a PR which removes it

@boneskull boneskull closed this Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file pkg:lavamoat-core Changes in package lavamoat-core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants