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

refactor!: Clarify build-time–run-time distinction #104

Merged
merged 8 commits into from
Jul 31, 2024

Conversation

SimonAlling
Copy link
Owner

@SimonAlling SimonAlling commented Jul 17, 2024

This PR modifies the public API in an attempt to clarify the distinction between the build-time and the run-time parts of Userscripter. This should help users not accidentally import a build-time module in run-time code, which results in a completely incomprehensible wall of error messages since #96 (v3.0.0).

Consumers will have to adapt as follows:

  • -import … from "userscripter/build";
    +import … from "userscripter/build-time";
  • -import … from "userscripter/lib/foo";
    +import … from "userscripter/run-time/foo";

This command should make the required changes in a typical Git-tracked userscript:

for f in $(git ls-files "$(git rev-parse --show-toplevel)"); do
  sed -i 's#userscripter/build#userscripter/build-time#g' $f
  sed -i 's#userscripter/lib#userscripter/run-time#g' $f
done

💡 git show --color-words='build-time|\w+|.'

@SimonAlling SimonAlling changed the title chore!: Redesign and formalize public API refactor!: Clarify build-time–run-time distinction Jul 31, 2024
@SimonAlling SimonAlling marked this pull request as ready for review July 31, 2024 20:00
@SimonAlling SimonAlling merged commit 5409aae into master Jul 31, 2024
9 of 12 checks passed
@SimonAlling SimonAlling deleted the redesign-api branch July 31, 2024 20:06
@SimonAlling SimonAlling mentioned this pull request Jul 31, 2024
SimonAlling added a commit that referenced this pull request Jul 31, 2024
This release renames the `build` and `lib` export paths to `build-time` and `run-time`, respectively (#104).

## Migration guide

You need to adapt your imports like this:

  * ```diff
    -import … from "userscripter/build";
    +import … from "userscripter/build-time";
    ```

  * ```diff
    -import … from "userscripter/lib/foo";
    +import … from "userscripter/run-time/foo";
    ```

This command should accomplish that in a typical Git-tracked userscript:

```bash
for f in $(git ls-files "$(git rev-parse --show-toplevel)"); do
  sed -i 's#userscripter/build#userscripter/build-time#g' $f
  sed -i 's#userscripter/lib#userscripter/run-time#g' $f
done
```
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.

1 participant