Skip to content

Commit

Permalink
Change the signature of plugin make* functions
Browse files Browse the repository at this point in the history
A while ago `@ninjutsu-build/core` was updated so that
`NinjaBuilder.rule` could take any properties and these were taken as
the default value for any build edges created with this rule.

However, it was not possible to pass through arbitrary values for
`implicitDeps` or `orderOnlyDeps` in the plugins, or to set defaults
that we use ourselves (e.g. `configPath` for `@ninjutsu-build/biome`).

All plugin exports take an optional object as the second parameter
instead of an optional string for the rule name.  This optional object
can take the name, `implicitDeps`, `orderOnlyDeps`, and any
rule-specific defaults that make sense.  Right now this is just
`configPath` for `@ninjutsu-build/biome`, but later on we can add more.
  • Loading branch information
elliotgoodrich committed Jul 7, 2024
1 parent f68c534 commit d60313a
Show file tree
Hide file tree
Showing 13 changed files with 227 additions and 104 deletions.
2 changes: 1 addition & 1 deletion packages/biome/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ninjutsu-build/biome",
"version": "0.8.3",
"version": "0.9.0",
"description": "A biome plugin for ninjutsu-build",
"author": "Elliot Goodrich",
"scripts": {
Expand Down
7 changes: 5 additions & 2 deletions packages/biome/src/biome.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {

test("makeLintRule", () => {
const ninja = new NinjaBuilder();
const lint = makeLintRule(ninja);
const lint = makeLintRule(ninja, { name: "lint2" });
const out: {
file: "foo.js";
[validations]: "$builddir/.ninjutsu-build/biome/lint/foo.js";
Expand Down Expand Up @@ -70,7 +70,10 @@ test("makeFormatRule", () => {

test("makeFormatToRule", () => {
const ninja = new NinjaBuilder();
const format = makeFormatToRule(ninja);
const format = makeFormatToRule(ninja, {
configPath: "biome.jsonc",
[implicitDeps]: "dummy",
});
const out: "nice.js" = format({
in: "ugly.js",
out: "nice.js",
Expand Down
Loading

0 comments on commit d60313a

Please sign in to comment.