Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 23 additions & 0 deletions .yarn/versions/11405fb3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
releases:
"@yarnpkg/cli": patch
"@yarnpkg/plugin-init": patch

declined:
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-nm"
- "@yarnpkg/plugin-npm-cli"
- "@yarnpkg/plugin-pack"
- "@yarnpkg/plugin-patch"
- "@yarnpkg/plugin-pnp"
- "@yarnpkg/plugin-pnpm"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-version"
- "@yarnpkg/plugin-workspace-tools"
- "@yarnpkg/builder"
- "@yarnpkg/core"
- "@yarnpkg/doctor"
21 changes: 21 additions & 0 deletions packages/plugin-init/sources/commands/init-initializer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {Option} from 'clipanion';

import InitCommand from './init';

// eslint-disable-next-line arca/no-default-export
export default class InitInitializerCommand extends InitCommand {
static paths = [
[`init`],
];

initializer = Option.String();
argv = Option.Proxy();

async initialize() {
this.context.stdout.write(`\n`);

await this.cli.run([`dlx`, this.initializer, ...this.argv], {
quiet: true,
});
}
}
15 changes: 4 additions & 11 deletions packages/plugin-init/sources/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ export default class InitCommand extends BaseCommand {
description: `Initialize a package with the given name`,
});

initializer = Option.String({
required: false,
});

// Options that only mattered on v1
usev2 = Option.Boolean(`-2`, false, {hidden: true});
yes = Option.Boolean(`-y,--yes`, {hidden: true});
Expand Down Expand Up @@ -117,6 +113,9 @@ export default class InitCommand extends BaseCommand {
});
}

async initialize() {
}

async executeRegular(configuration: Configuration) {
let existingProject: Project | null = null;
try {
Expand Down Expand Up @@ -254,13 +253,7 @@ export default class InitCommand extends BaseCommand {
quiet: true,
});

if (this.initializer) {
this.context.stdout.write(`\n`);

await this.cli.run([`dlx`, this.initializer], {
quiet: true,
});
}
await this.initialize();

if (!xfs.existsSync(ppath.join(this.context.cwd, `.git`))) {
await execUtils.execvp(`git`, [`init`], {
Expand Down
4 changes: 3 additions & 1 deletion packages/plugin-init/sources/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {Plugin, SettingsType} from '@yarnpkg/core';

import InitInitializerCommand from './commands/init-initializer';
import InitCommand from './commands/init';

export {InitCommand};
export {InitCommand, InitInitializerCommand};

declare module '@yarnpkg/core' {
interface ConfigurationValueMap {
Expand Down Expand Up @@ -38,6 +39,7 @@ const plugin: Plugin = {
},
commands: [
InitCommand,
InitInitializerCommand,
],
};

Expand Down
Loading