Skip to content

Commit

Permalink
Use a file: dependency for sass-parser -> sass (#2340)
Browse files Browse the repository at this point in the history
This makes it harder to accidentally test against the wrong version,
and ensures CI doesn't break when the repo's Sass version number is
unreleased.
  • Loading branch information
nex3 authored Sep 11, 2024
1 parent 05e1691 commit 4fa5a02
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ jobs:
version: 'lts/*'
check-latest: true
registry-url: 'https://registry.npmjs.org'

# The repo package has a file dependency, but the released version needs
# a real dependency on the released version of Sass.
- run: npm install sass@${{ steps.version.outputs.version }}

- run: npm publish
env:
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,8 @@ jobs:

- run: dart run grinder pkg-npm-dev
env: {UPDATE_SASS_SASS_REPO: false}
- run: npm link
working-directory: build/npm
- run: npm install
working-directory: pkg/sass-parser/
- run: npm link sass
working-directory: pkg/sass-parser/
- name: Run tests
run: npm test
working-directory: pkg/sass-parser/
Expand All @@ -362,6 +358,13 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: {node-version: 'lts/*'}
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}

- run: dart run grinder pkg-npm-dev
env: {UPDATE_SASS_SASS_REPO: false}
- run: npm install
working-directory: build/npm/
- run: npm install
working-directory: pkg/sass-parser/
- name: Run static analysis
Expand Down
2 changes: 1 addition & 1 deletion pkg/sass-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"dependencies": {
"postcss": ">=8.4.41 <8.5.0",
"sass": "1.78.0"
"sass": "file:../../build/npm"
},
"devDependencies": {
"@types/jest": "^29.5.12",
Expand Down
8 changes: 0 additions & 8 deletions test/double_check_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,6 @@ void main() {
() => expect(packageJson["version"].toString(),
matchesChangelogVersion(_changelogVersion("pkg/sass-parser"))));

test("depends on the current sass version", () {
if (_isDevVersion(sassPubspec.version!)) return;

var dependencies = packageJson["dependencies"] as Map<String, Object?>;
expect(
dependencies, containsPair("sass", sassPubspec.version.toString()));
});

test(
"increments along with the sass version",
() => _checkVersionIncrementsAlong('sass-parser', sassPubspec,
Expand Down

0 comments on commit 4fa5a02

Please sign in to comment.