-
-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add wrangler plugin * Clean up wrangler plugin * Add wrangler script * Add wrangler pkg + bin * Wrap up --------- Co-authored-by: Lars Kappert <[email protected]>
- Loading branch information
Showing
10 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
4 changes: 4 additions & 0 deletions
4
packages/knip/fixtures/plugins/wrangler/node_modules/wrangler/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
{ | ||
"name": "@fixtures/wrangler", | ||
"version": "*", | ||
"scripts": { | ||
"dev": "wrangler dev" | ||
}, | ||
"dependencies": { | ||
"wrangler": "^3.37.0" | ||
} | ||
} |
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,2 @@ | ||
name = 'test' | ||
main = 'worker-test-entry.ts' |
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,25 @@ | ||
import { hasDependency } from '#p/util/plugin.js'; | ||
import type { IsPluginEnabled, Plugin, ResolveEntryPaths } from '#p/types/plugins.js'; | ||
import type { WranglerConfig } from './types.js'; | ||
|
||
// https://developers.cloudflare.com/workers/wrangler/configuration/ | ||
|
||
const title = 'Wrangler'; | ||
|
||
const enablers = ['wrangler']; | ||
|
||
const isEnabled: IsPluginEnabled = ({ dependencies }) => hasDependency(dependencies, enablers); | ||
|
||
const config = ['wrangler.{json,toml}']; | ||
|
||
const resolveEntryPaths: ResolveEntryPaths<WranglerConfig> = async config => { | ||
return config.main ? [config.main] : []; | ||
}; | ||
|
||
export default { | ||
title, | ||
enablers, | ||
isEnabled, | ||
config, | ||
resolveEntryPaths, | ||
} 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,3 @@ | ||
export type WranglerConfig = { | ||
main?: string; | ||
}; |
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,21 @@ | ||
import assert from 'node:assert/strict'; | ||
import test from 'node:test'; | ||
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/wrangler'); | ||
|
||
test('Find dependencies with the wrangler plugin', async () => { | ||
const { counters } = await main({ | ||
...baseArguments, | ||
cwd, | ||
}); | ||
|
||
assert.deepEqual(counters, { | ||
...baseCounters, | ||
processed: 0, | ||
total: 0, | ||
}); | ||
}); |