Skip to content

Commit b24a5b2

Browse files
authored
Bump the sass_api version (#289)
This also adds a test to ensure that this doesn't get out-of-date relative to the version we test against, and updates the CI configuration to use the sass_api package that matches the sass package. See #287
1 parent 48eee20 commit b24a5b2

File tree

3 files changed

+47
-6
lines changed

3 files changed

+47
-6
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
with: {sdk: "${{ matrix.dart_channel }}"}
3434
- uses: sass/clone-linked-repo@v1
3535
with: {repo: sass/dart-sass, path: dart-sass}
36-
- run: "dart pub add \"override:sass:{path: dart-sass}\""
36+
- run: "dart pub add \"override:sass:{path: dart-sass}\" \"override:sass_api:{path: dart-sass/pkg/sass_api}\""
3737
- run: dart pub get
3838
- run: dart pub run grinder pkg-standalone-dev
3939
- name: Run tests
@@ -74,7 +74,7 @@ jobs:
7474
with: {sdk: "${{ matrix.dart_channel }}"}
7575
- uses: sass/clone-linked-repo@v1
7676
with: {repo: sass/dart-sass, path: dart-sass}
77-
- run: "dart pub add \"override:sass:{path: dart-sass}\""
77+
- run: "dart pub add \"override:sass:{path: dart-sass}\" \"override:sass_api:{path: dart-sass/pkg/sass_api}\""
7878
- run: dart pub get
7979
- uses: actions/setup-node@v2
8080
with: {node-version: "${{ matrix.node_version }}"}
@@ -92,7 +92,7 @@ jobs:
9292
- uses: dart-lang/setup-dart@v1
9393
- uses: sass/clone-linked-repo@v1
9494
with: {repo: sass/dart-sass, path: dart-sass}
95-
- run: "dart pub add \"override:sass:{path: dart-sass}\""
95+
- run: "dart pub add \"override:sass:{path: dart-sass}\" \"override:sass_api:{path: dart-sass/pkg/sass_api}\""
9696
- run: dart pub get
9797
- name: Analyze dart
9898
run: dart analyze --fatal-warnings --fatal-infos lib tool test

pubspec.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: sass_migrator
2-
version: 2.5.0
2+
version: 2.5.1
33
description: A tool for running migrations on Sass files
44
homepage: https://github.com/sass/migrator
55

66
environment:
7-
sdk: '>=3.0.0 <4.0.0'
7+
sdk: '>=3.2.0 <4.0.0'
88

99
dependencies:
1010
args: ^2.1.0
@@ -17,7 +17,7 @@ dependencies:
1717
node_interop: ^2.0.2
1818
node_io: ^2.3.0
1919
path: ^1.8.0
20-
sass_api: ^15.4.0
20+
sass_api: ^17.0.0
2121
source_span: ^1.8.1
2222
stack_trace: ^1.10.0
2323
string_scanner: ^1.1.0
@@ -31,6 +31,7 @@ dev_dependencies:
3131
http: ^1.1.2
3232
node_preamble: ^2.0.0
3333
pub_semver: ^2.0.0
34+
pubspec_parse: ^1.5.0
3435
test: ^1.17.1
3536
test_descriptor: ^2.0.0
3637
test_process: ^2.0.0

test/dependency_test.dart

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright 2025 Google LLC
2+
//
3+
// Use of this source code is governed by an MIT-style
4+
// license that can be found in the LICENSE file or at
5+
// https://opensource.org/licenses/MIT.
6+
7+
import 'dart:io';
8+
import 'dart:isolate';
9+
10+
import 'package:test/test.dart';
11+
import 'package:pubspec_parse/pubspec_parse.dart';
12+
import 'package:path/path.dart' as p;
13+
14+
void main() {
15+
test("declares a compatible dependency for sass_api", () {
16+
var migratorPubspec = Pubspec.parse(File("pubspec.yaml").readAsStringSync(),
17+
sourceUrl: p.toUri("pubspec.yaml"));
18+
var sassApiPubspecPath = p.normalize(p.join(
19+
p.fromUri(
20+
Isolate.resolvePackageUriSync(Uri.parse("package:sass_api/."))),
21+
"../pubspec.yaml"));
22+
var sassApiPubspec = Pubspec.parse(
23+
File(sassApiPubspecPath).readAsStringSync(),
24+
sourceUrl: p.toUri(sassApiPubspecPath));
25+
26+
switch (migratorPubspec.dependencies["sass_api"]) {
27+
case HostedDependency dep:
28+
if (!dep.version.allows(sassApiPubspec.version!)) {
29+
fail("sass_api dependency $dep doesn't include actual sass_api "
30+
"version ${sassApiPubspec.version!}");
31+
}
32+
33+
case var dep?:
34+
fail("Expected a hosted dependency on sass_api, was $dep");
35+
36+
case null:
37+
fail("This package doesn't seem to have a dependency on sass_api");
38+
}
39+
});
40+
}

0 commit comments

Comments
 (0)