Skip to content

Commit d9c72a1

Browse files
committed
Document the way this package handles dependencies
1 parent 14eb391 commit d9c72a1

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

CONTRIBUTING.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,86 @@ such, manual commits should never:
3535

3636
* Update the `package.json`'s `"compiler-version"` field to a non-`-dev` number.
3737
Changing it from non-`-dev` to dev when using a new feature is fine.
38+
39+
# Keeping in Sync With Other Packages
40+
41+
The embedded host depends on several different components which come from
42+
different repositories:
43+
44+
* The [Dart Sass embedded compiler].
45+
* [Dart Sass] (transitively through the embedded compiler).
46+
* The [Sass embedded protocol].
47+
* The [Sass JS API definition].
48+
49+
[Dart Sass embedded compiler]: https://github.com/sass/dart-sass-embedded
50+
[Dart Sass]: https://github.com/sass/dart-sass
51+
[Sass embedded protocol]: https://github.com/sass/embedded-protocol
52+
[JS API definition]: https://github.com/sass/sass/tree/main/spec/js-api
53+
54+
These dependencies are made available in different ways depending on context.
55+
56+
## Local Development
57+
58+
When developing locally, you can download all of these dependencies by running
59+
`npm run init`. This provides the following options for `compiler` (for the
60+
embedded compiler), `protocol` (for the embedded protocol), and `api` (for the
61+
JS API):
62+
63+
* `--<type>-path`: The local filesystem path of the package to use. This is
64+
useful when doing local development on both the host and its dependencies at
65+
the same time.
66+
67+
* `--<type>-ref`: A Git reference for the GitHub repository of the package to
68+
clone.
69+
70+
* `--<type>-version`: The released version of the package to use. This isn't
71+
available for `api`, because the JS API definition doesn't have its own tagged
72+
versions.
73+
74+
By default:
75+
76+
* This uses the version of the embedded protocol and compiler specified by
77+
`protocol-version` and `compiler-version` in `package.json`, *unless* these
78+
versions end in `-dev` in which case it checks out the latest revision on
79+
GitHub.
80+
81+
* This uses the JS API definition from the latest revision on GitHub.
82+
83+
`npm run init` chooses the Dart Sass version as follows:
84+
85+
* If a released version of the embedded compiler was specified, it uses the
86+
version of Dart Sass compiled into that release.
87+
88+
* If `--compiler-path` was specified, it uses the version of Dart Sass linked to
89+
that compiler.
90+
91+
* If the embedded compiler was cloned from GitHub, it uses the version of Dart
92+
Sass specified in its pubspec *unless* that version ends in `-dev`, in which
93+
case it checks out the latest revision on GitHub.
94+
95+
## Continuous Integration
96+
97+
CI tests also use `npm run init`, so they use the same defaults as local
98+
development. However, if the pull request description includes a link to a pull
99+
request for the embedded compiler, Dart Sass, the embedded protocol, or the JS
100+
API, this will check out that version and run tests against it instead.
101+
102+
## Release
103+
104+
When this package is released to npm, it downloads the embedded protocol version
105+
that matches `protocol-version` in `package.json`. It downloads the latest JS
106+
API revision on GitHub.
107+
108+
The release version of the `sass-embedded` package does *not* include the
109+
embedded compiler or Dart Sass. Instead, we release optional packages of the
110+
form `sass-embedded-<os>-<arch>`. Each of these contains the published version
111+
of the embedded compiler that matches `compiler-version` in `package.json` for
112+
the given operating system/architecture combination.
113+
114+
If either `protocol-version` or `compiler-version` ends with `-dev`, the release
115+
will fail.
116+
117+
**Note:** As part of the holistic release process for Dart Sass, the embedded
118+
compiler's CI will automatically update this repository's `package.json` file
119+
with the latest `compiler-version` and optional dependency versions before
120+
tagging it for a release.

0 commit comments

Comments
 (0)