Skip to content

Commit

Permalink
CI: ensure resolutions version matches local version (#936)
Browse files Browse the repository at this point in the history
* CI: ensure resolutions version matches local version

* fix checkResolutions script
  • Loading branch information
josepot committed Apr 6, 2022
1 parent 8666a38 commit 03e6529
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .ensure-resolution.mjs
@@ -0,0 +1,22 @@
import { readFile as cbReadFile } from "fs"
import { promisify } from "util"

const readFile = promisify(cbReadFile)

const [rootPkg, connectPkg] = await Promise.all([
readFile("./package.json"),
readFile("./packages/connect/package.json"),
]).then((pkgs) => pkgs.map((rawPkg) => JSON.parse(rawPkg)))

const rootVersion = rootPkg.resolutions?.["@substrate/connect"]
const connectVersion = connectPkg.version

const isMismatch = rootVersion !== connectVersion

if (isMismatch) {
console.error(
"The @substrate/connect resolution on the root package.json does not match the version of packages/connect/package.json",
)
}

process.exit(isMismatch ? 1 : 0)
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Expand Up @@ -40,6 +40,7 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn checkResolutions
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn lint
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -34,7 +34,8 @@
"dev:landing-page": "yarn workspace @substrate/landing-page run dev",
"dev:extension": "yarn workspace @substrate/extension run dev",
"deploy": "./deploy.sh",
"format": "prettier --write ."
"format": "prettier --write .",
"checkResolutions": "node ./.ensure-resolution.mjs"
},
"devDependencies": {
"@babel/core": "^7.17.5",
Expand Down

0 comments on commit 03e6529

Please sign in to comment.