-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
74 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/yarn", | ||
"version": "*", | ||
"devDependencies": { | ||
"@yarnpkg/types": "latest" | ||
} | ||
} |
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,10 @@ | ||
// https://yarnpkg.com/features/constraints | ||
|
||
/** @type {import('@yarnpkg/types')} */ | ||
const { defineConfig } = require('@yarnpkg/types'); | ||
|
||
module.exports = defineConfig({ | ||
async constraints({Yarn}) { | ||
// `Yarn` is now well-typed ✨ | ||
}, | ||
}); |
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,6 @@ | ||
# This file is generated by running "yarn install" inside your project. | ||
# Manual changes might be lost - proceed with caution! | ||
|
||
__metadata: | ||
version: 8 | ||
cacheKey: 10 |
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,19 @@ | ||
import type { IsPluginEnabled, Plugin } from '../../types/config.js'; | ||
import { _firstGlob } from '../../util/glob.js'; | ||
|
||
// https://yarnpkg.com/features/constraints | ||
|
||
const title = 'Yarn'; | ||
|
||
const enablers = 'This plugin is enabled when a `yarn.lock` file is found in the root folder.'; | ||
|
||
const isEnabled: IsPluginEnabled = async ({ cwd }) => Boolean(await _firstGlob({ cwd, patterns: ['yarn.lock'] })); | ||
|
||
const entry: string[] = ['yarn.config.cjs']; | ||
|
||
export default { | ||
title, | ||
enablers, | ||
isEnabled, | ||
entry, | ||
} 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
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,23 @@ | ||
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/yarn'); | ||
|
||
test('Find dependencies with the yarn plugin', async () => { | ||
const { issues, counters } = await main({ | ||
...baseArguments, | ||
cwd, | ||
}); | ||
|
||
assert(issues.files.size === 0); | ||
|
||
assert.deepEqual(counters, { | ||
...baseCounters, | ||
processed: 1, | ||
total: 1, | ||
}); | ||
}); |