Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixes tests
  • Loading branch information
arcanis committed Mar 29, 2022
commit ec9034e422244b89e7d8ffcb3f7199af183ba9c6
1 change: 1 addition & 0 deletions .yarn/versions/bbd4868b.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ declined:
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-exec"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-nm"
- "@yarnpkg/plugin-npm-cli"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ describe(`Commands`, () => {
`it should stage the initial files`,
makeTemporaryEnv({}, async ({path, run, source}) => {
await execFile(`git`, [`init`], {cwd: path});
await writeFile(`${path}/.yarnrc.yml`, `plugins:\n - ${JSON.stringify(require.resolve(`@yarnpkg/monorepo/scripts/plugin-stage.js`))}\n`);

await expect(run(`stage`, `-n`, {cwd: path})).resolves.toMatchObject({
stdout: [
Expand All @@ -25,7 +24,6 @@ describe(`Commands`, () => {
`it should not stage non-yarn files`,
makeTemporaryEnv({}, async ({path, run, source}) => {
await execFile(`git`, [`init`], {cwd: path});
await writeFile(`${path}/.yarnrc.yml`, `plugins:\n - ${JSON.stringify(require.resolve(`@yarnpkg/monorepo/scripts/plugin-stage.js`))}\n`);

await writeFile(`${path}/index.js`, `module.exports = 42;\n`);

Expand All @@ -48,7 +46,6 @@ describe(`Commands`, () => {
await run(`install`);

await execFile(`git`, [`init`], {cwd: path});
await writeFile(`${path}/.yarnrc.yml`, `plugins:\n - ${JSON.stringify(require.resolve(`@yarnpkg/monorepo/scripts/plugin-stage.js`))}\n`);

await expect(run(`stage`, `-n`, {cwd: path})).resolves.toMatchObject({
stdout: [
Expand All @@ -74,7 +71,6 @@ describe(`Commands`, () => {
},
}, async ({path, run, source}) => {
await execFile(`git`, [`init`], {cwd: path});
await writeFile(`${path}/.yarnrc.yml`, `plugins:\n - ${JSON.stringify(require.resolve(`@yarnpkg/monorepo/scripts/plugin-stage.js`))}\n`);

// Otherwise we can't always commit
await execFile(`git`, [`config`, `user.name`, `John Doe`], {cwd: path});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
const {
fs: {writeFile, writeJson},
fs: {writeJson},
} = require(`pkg-tests-core`);


async function setupWorkspaces(path) {
await writeFile(`${path}/.yarnrc.yml`, `plugins:\n - ${JSON.stringify(require.resolve(`@yarnpkg/monorepo/scripts/plugin-workspace-tools.js`))}\n`);

await writeJson(`${path}/docs/package.json`, {
name: `docs`,
version: `1.0.0`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ async function setupWorkspaces(path) {
await writeFile(`${path}/mutexes/workspace-a`, ``);
await writeFile(`${path}/mutexes/workspace-b`, ``);

await writeFile(`${path}/.yarnrc.yml`, `plugins:\n - ${JSON.stringify(require.resolve(`@yarnpkg/monorepo/scripts/plugin-workspace-tools.js`))}\n`);

await writeFile(`${path}/packages/workspace-a/server.js`, getClientContent(`${path}/mutexes/workspace-a`, `PING`));
await writeJson(`${path}/packages/workspace-a/package.json`, {
name: `workspace-a`,
Expand Down Expand Up @@ -324,8 +322,6 @@ describe(`Commands`, () => {
workspaces: [`packages/*`],
},
async ({path, run}) => {
await writeFile(`${path}/.yarnrc.yml`, `plugins:\n - ${JSON.stringify(require.resolve(`@yarnpkg/monorepo/scripts/plugin-workspace-tools.js`))}\n`);

await writeJson(`${path}/packages/package-a/package.json`, {
name: `workspace-a`,
version: `1.0.0`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ describe(`Plugins`, () => {
[type]: {
[`@types/is-number`]: `1.0.0`,
},
}, {
tsEnableAutoTypes: true,
}), async ({path, run, source}) => {
await run(`remove`, `is-number`);

Expand All @@ -323,6 +325,8 @@ describe(`Plugins`, () => {
devDependencies: {
[`@types/iarna__toml`]: `1.0.0`,
},
}, {
tsEnableAutoTypes: true,
}, async ({path, run, source}) => {
await run(`remove`, `@iarna/toml`);

Expand Down
27 changes: 1 addition & 26 deletions packages/yarnpkg-cli/sources/pluginCommands.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,5 @@
// Don't modify this script directly! Instead, run:
// yarn build:plugin-commands

export const pluginCommands = new Map([
[`constraints`, [
[`constraints`, `query`],
[`constraints`, `source`],
[`constraints`],
]],
[`exec`, [
]],
[`interactive-tools`, [
[`search`],
[`upgrade-interactive`],
]],
[`stage`, [
[`stage`],
]],
[`typescript`, [
]],
[`version`, [
[`version`, `apply`],
[`version`, `check`],
[`version`],
]],
[`workspace-tools`, [
[`workspaces`, `focus`],
[`workspaces`, `foreach`],
]],
export const pluginCommands = new Map<string, Array<string>>([
]);
2 changes: 1 addition & 1 deletion scripts/gen-plugin-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let output = ``;
output += `// Don't modify this script directly! Instead, run:\n`;
output += `// yarn build:plugin-commands\n`;
output += `\n`;
output += `export const pluginCommands = new Map([\n`;
output += `export const pluginCommands = new Map<string, Array<string>>([\n`;

for (const name of folders) {
if (!name.startsWith(`plugin-`))
Expand Down