-
-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plugins): add plugin for syncpack config (#629)
- Loading branch information
Showing
6 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "@fixtures/syncpack", | ||
"version": "*", | ||
"devDependencies": { | ||
"syncpack": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { EnablerPatterns } from '#p/types/config.js'; | ||
import type { IsPluginEnabled, Plugin } from '#p/types/plugins.js'; | ||
import { hasDependency } from '#p/util/plugin.js'; | ||
|
||
// link to syncpack docs https://jamiemason.github.io/syncpack/config/syncpackrc/ | ||
|
||
const title = 'Syncpack'; | ||
|
||
const enablers: EnablerPatterns = ['syncpack']; | ||
|
||
const isEnabled: IsPluginEnabled = ({ dependencies }) => hasDependency(dependencies, enablers); | ||
|
||
const config = ['.syncpackrc', '.syncpackrc.{json,yaml,yml,js,cjs}', '.syncpack.config.{js,cjs}']; | ||
|
||
export default { | ||
title, | ||
enablers, | ||
isEnabled, | ||
config, | ||
} satisfies Plugin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { test } from 'bun:test'; | ||
import assert from 'node:assert/strict'; | ||
import { main } from '../../src/index.js'; | ||
import { resolve } from '../../src/util/path.js'; | ||
import baseArguments from '../helpers/baseArguments.js'; | ||
import baseCounters from '../helpers/baseCounters.js'; | ||
|
||
const cwd = resolve('fixtures/plugins/syncpack'); | ||
|
||
test('Find dependencies with the Syncpack plugin', async () => { | ||
const { counters } = await main({ | ||
...baseArguments, | ||
cwd, | ||
}); | ||
|
||
assert.deepEqual(counters, { | ||
...baseCounters, | ||
devDependencies: 1, | ||
processed: 0, | ||
total: 0, | ||
}); | ||
}); |