-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
feat: support plugins with wildcards
- 4.2.2
- 4.2.1
- 4.2.0
- 4.1.1
- 4.1.0
- 4.0.37
- 4.0.36
- 4.0.35
- 4.0.34
- 4.0.33
- 4.0.32
- 4.0.31
- 4.0.30
- 4.0.29
- 4.0.28
- 4.0.27
- 4.0.26
- 4.0.25
- 4.0.24
- 4.0.23
- 4.0.22
- 4.0.21
- 4.0.20
- 4.0.19
- 4.0.18
- 4.0.17
- 4.0.16
- 4.0.15
- 4.0.14
- 4.0.13
- 4.0.12
- 4.0.11
- 4.0.10
- 4.0.9
- 4.0.8
- 4.0.7
- 4.0.6
- 4.0.5
- 4.0.4
- 4.0.3
- 4.0.2
- 4.0.1
- 4.0.0
- 4.0.0-v4.1
- 4.0.0-v4.0
- 4.0.0-beta.17
- 4.0.0-beta.16
- 4.0.0-beta.15
- 4.0.0-beta.14
- 4.0.0-beta.13
- 4.0.0-beta.12
- 4.0.0-beta.11
- 4.0.0-beta.10
- 4.0.0-beta.9
- 4.0.0-beta.8
- 4.0.0-beta.7
- 4.0.0-beta.6
- 4.0.0-beta.5
- 4.0.0-beta.4
- 4.0.0-beta.3
- 4.0.0-beta.2
- 4.0.0-beta.1
- 3.27.0
- 3.26.9
- 3.26.8
- 3.26.7
- 3.26.6
- 3.26.5
- 3.26.4
- 3.26.3
- 3.26.2
- 3.26.1
- 3.26.0
- 3.25.3
- 3.25.2
- 3.25.1
- 3.25.0
- 3.24.0
- 3.23.1
- 3.23.0
- 3.22.0
1 parent
8cee1ce
commit 966db94
Showing
8 changed files
with
152 additions
and
4 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
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,19 @@ | ||
{ | ||
"name": "wildcard-plugins-fixture", | ||
"version": "0.0.0", | ||
"description": "fixture for testing wildcard plugins", | ||
"private": true, | ||
"files": [], | ||
"dependencies": { | ||
"@oclif/core": "^3", | ||
"@oclif/plugin-help": "^6", | ||
"@oclif/plugin-plugins": "^4" | ||
}, | ||
"oclif": { | ||
"commands": "./lib/commands", | ||
"topicSeparator": " ", | ||
"plugins": [ | ||
"@oclif/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,8 @@ | ||
import {Command} from '../../../../../../src/index' | ||
|
||
export default class Foo extends Command { | ||
public static description = 'foo description' | ||
public async run(): Promise<void> { | ||
this.log('hello world!') | ||
} | ||
} |
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 @@ | ||
{ | ||
"compilerOptions": { | ||
"outDir": "./lib", | ||
"rootDirs": ["./src"] | ||
}, | ||
"include": ["./src/**/*"] | ||
} |
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,56 @@ | ||
import {expect} from 'chai' | ||
import {resolve} from 'node:path' | ||
import {SinonSandbox, createSandbox} from 'sinon' | ||
|
||
import {run, ux} from '../../src/index' | ||
|
||
describe('plugins defined as patterns in package.json', () => { | ||
let sandbox: SinonSandbox | ||
|
||
beforeEach(() => { | ||
sandbox = createSandbox() | ||
sandbox.stub(ux.write, 'stdout') | ||
}) | ||
|
||
afterEach(() => { | ||
sandbox.restore() | ||
}) | ||
|
||
it('should load all core plugins in dependencies that match pattern', async () => { | ||
const result = (await run(['plugins', '--core'], { | ||
root: resolve(__dirname, 'fixtures/wildcard/package.json'), | ||
pluginAdditions: { | ||
core: ['@oclif/plugin-*'], | ||
path: resolve(__dirname, '..', '..'), | ||
}, | ||
})) as Array<{name: string; type: string}> | ||
|
||
expect(result.length).to.equal(3) | ||
const rootPlugin = result.find((r) => r.name === 'wildcard-plugins-fixture') | ||
const pluginHelp = result.find((r) => r.name === '@oclif/plugin-help') | ||
const pluginPlugins = result.find((r) => r.name === '@oclif/plugin-plugins') | ||
|
||
expect(rootPlugin).to.exist | ||
expect(pluginHelp).to.exist | ||
expect(pluginPlugins).to.exist | ||
}) | ||
|
||
it('should load all dev plugins in dependencies and devDependencies that match pattern', async () => { | ||
const result = (await run(['plugins', '--core'], { | ||
root: resolve(__dirname, 'fixtures/wildcard/package.json'), | ||
pluginAdditions: { | ||
dev: ['@oclif/plugin-*'], | ||
path: resolve(__dirname, '..', '..'), | ||
}, | ||
})) as Array<{name: string; type: string}> | ||
|
||
expect(result.length).to.equal(3) | ||
const rootPlugin = result.find((r) => r.name === 'wildcard-plugins-fixture') | ||
const pluginHelp = result.find((r) => r.name === '@oclif/plugin-help') | ||
const pluginPlugins = result.find((r) => r.name === '@oclif/plugin-plugins') | ||
|
||
expect(rootPlugin).to.exist | ||
expect(pluginHelp).to.exist | ||
expect(pluginPlugins).to.exist | ||
}) | ||
}) |