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

Update npm dependencies to latest #798

Merged
merged 4 commits into from
Oct 27, 2023
Merged

Update npm dependencies to latest #798

merged 4 commits into from
Oct 27, 2023

Conversation

minestarks
Copy link
Member

@minestarks minestarks commented Oct 17, 2023

Updated all direct npm dependencies to @latest.

Observed changes:

I was really hoping this would be a trivial process, but sadly it wasn't. For posterity, here's what the process ended up being:

const { execSync } = require("node:child_process");

function run(command) {
  console.log(`running command ${command}`);
  return execSync(command);
}

const deps = JSON.parse(run(`npm ls --package-lock-only --json`));

// Do these in this order first, otherwise @typescript-eslint/eslint-plugin
// gets really upset about the peer dependency missing
run("npm install @typescript-eslint/parser@latest");
run("npm install @typescript-eslint/eslint-plugin@latest");

// Update all direct deps to @latest
for (const depName of Object.keys(deps.dependencies)) {
  if (!depName.startsWith("qsharp")) {
    run(`npm install ${depName}@latest`);
  }
}

// Update indirect deps in package-lock.json
run("npm update");

// This fixes the workspace names in package-lock.json,
// which for some reason get erased above
run("npm install");

Ran ./build.py to confirm the repo still built, discovered formatting changes.

To reformat with new Prettier defaults:

npm run prettier:fix

Since we pulled a lot of JS tooling updates, I ran a quick script to save the built artifacts so I could diff the JS output:

#!/bin/bash

set -e

# clean repo
git clean -fdx
rm -rf baseline-compare/
mkdir baseline-compare

# build
./build.py --wasm --npm --vscode --no-check --no-test

# npm
mkdir -p baseline-compare/npm
pushd npm
npm pack --pack-destination .
popd
tar -xzf npm/qsharp-lang-0.0.0.tgz -C baseline-compare/npm

# vsix
npm install -g @vscode/vsce
pushd vscode
vsce package --pre-release
popd
unzip vscode/qsharp-lang-vscode-dev-0.0.0.vsix -d baseline-compare/vscode

# commit baseline
cp package-lock.json baseline-compare/
git add baseline-compare/
git commit -m "Baseline for $(git rev-parse HEAD)"

Ran this script first on main, then with the updated package.json & package-lock.json. Used git to diff the baseline-compare changes. Confirmed they looked harmless.

@minestarks minestarks force-pushed the minestarks/deps branch 2 times, most recently from b8354f1 to 63afefb Compare October 17, 2023 21:23
@minestarks minestarks changed the title cargo update && npm update Update npm dependencies to latest Oct 17, 2023
@minestarks minestarks marked this pull request as ready for review October 17, 2023 21:52
package.json Outdated Show resolved Hide resolved
@sezna
Copy link
Contributor

sezna commented Oct 23, 2023

Were there any code changes corresponding to updated APIs? I looked through the diff and it seems to be basically entirely formatting changes. If that's the case, we should probably get this in soon to minimize conflicts

@minestarks
Copy link
Member Author

@sezna yeah just formatting changes in the code. I called out everything I could spot in the PR description.

This is blocked on codeowner approval and has already accrued a bunch of merge conflicts :/

Will update and resolve

@minestarks
Copy link
Member Author

@billti would you mind taking a look? Merge conflicts freshly resolved.

@minestarks minestarks added this pull request to the merge queue Oct 27, 2023
Merged via the queue into main with commit b43f3f4 Oct 27, 2023
12 checks passed
@minestarks minestarks deleted the minestarks/deps branch October 27, 2023 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants