diff --git a/.releaserc.json b/.releaserc.json index 41b94402..286424c5 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -4,7 +4,18 @@ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", "@semantic-release/changelog", - "@semantic-release/npm", + [ + "@semantic-release/npm", + { + "npmPublish": false + } + ], + [ + "@semantic-release/exec", + { + "publishCmd": "yarn workspaces foreach npm publish" + } + ], "@semantic-release/github", [ "@semantic-release/git", diff --git a/TODO.md b/TODO.md index c7446d96..dbb9aa26 100644 --- a/TODO.md +++ b/TODO.md @@ -1,8 +1,7 @@ ### TODOs -| Filename | line # | TODO | -| :----------------------------------------------------------------------------- | :----: | :--------------------------- | -| [packages/core/src/yarnrc.ts](packages/core/src/yarnrc.ts#L23) | 23 | etc, fix later | -| [packages/cli/src/commands/create.ts](packages/cli/src/commands/create.ts#L16) | 16 | re-enable prompts | -| [packages/cli/src/commands/list.ts](packages/cli/src/commands/list.ts#L15) | 15 | list workspaces | -| [packages/plugins/src/jest/jest.ts](packages/plugins/src/jest/jest.ts#L35) | 35 | install jest without ts-jest | +| Filename | line # | TODO | +| :------------------------------------------------------------------------- | :----: | :------------------------------------------------------------ | +| [packages/core/src/yarnrc.ts](packages/core/src/yarnrc.ts#L23) | 23 | etc, fix later | +| [packages/cli/src/commands/list.ts](packages/cli/src/commands/list.ts#L15) | 15 | list workspaces using https://yarnpkg.com/cli/workspaces/list | +| [packages/plugins/src/jest/jest.ts](packages/plugins/src/jest/jest.ts#L35) | 35 | install jest without ts-jest | diff --git a/package.json b/package.json index 34e06262..b81039b4 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "@mokr/root", "description": "Moker root package (dummy)", - "repository": "https://github.com/hongaar/moker", "author": "joram@vandenboezem.nl", + "repository": "https://github.com/hongaar/moker", "license": "MIT", "type": "module", "workspaces": [ diff --git a/packages/cli/src/commands/create.ts b/packages/cli/src/commands/create.ts index 85a7eea8..54c5d4b8 100644 --- a/packages/cli/src/commands/create.ts +++ b/packages/cli/src/commands/create.ts @@ -1,7 +1,6 @@ import { applyTemplate, createMonorepo, - DEFAULT_INITIAL_VERSION, DEFAULT_LICENSE, DEFAULT_SCOPED, DEFAULT_WORKSPACES_DIRECTORY, @@ -13,13 +12,11 @@ import { import { command } from "bandersnatch"; import { resolve } from "node:path"; -// @todo: re-enable prompts - export const create = command("create") .description("Create a new monorepo") .argument("path", { description: "Monorepo path, basename will be used as the monorepo name.", - // prompt: "What is the name of your monorepo?", + prompt: "What is the name of your monorepo?", }) .option("template", { description: "Use monorepo template", @@ -33,23 +30,18 @@ export const create = command("create") .option("scoped", { description: "Use scoped packages", boolean: true, - // prompt: "Do you want to use scoped package names?", + prompt: "Do you want to use scoped package names?", default: DEFAULT_SCOPED, }) .option("license", { description: "License", choices: ["MIT", "GPLv3"], - // prompt: "What license do you want to publish your packages with?", + prompt: "What license do you want to publish your packages with?", default: DEFAULT_LICENSE, }) - .option("initialVersion", { - description: "Initial version", - // prompt: "What version do you want to start with?", - default: DEFAULT_INITIAL_VERSION, - }) .option("workspacesDirectory", { description: "Workspaces directory", - // prompt: "Which directory should we save workspaces to?", + prompt: "Which directory should we save workspaces to?", default: DEFAULT_WORKSPACES_DIRECTORY, }) .action(async ({ path, template, plugin, ...options }) => { diff --git a/packages/cli/src/commands/list.ts b/packages/cli/src/commands/list.ts index b113a9c4..dde3fb70 100644 --- a/packages/cli/src/commands/list.ts +++ b/packages/cli/src/commands/list.ts @@ -12,6 +12,6 @@ export const list = command("list") console.log(`Plugins: ${plugins.join(", ")}`); - // @todo: list workspaces + // @todo: list workspaces using https://yarnpkg.com/cli/workspaces/list console.log(`Workspaces: ...`); }); diff --git a/packages/core/src/monorepo.ts b/packages/core/src/monorepo.ts index 5e642288..adc83321 100644 --- a/packages/core/src/monorepo.ts +++ b/packages/core/src/monorepo.ts @@ -5,7 +5,6 @@ import { enqueueInstallDependency, initYarn } from "./yarn.js"; export const DEFAULT_SCOPED = true; export const DEFAULT_LICENSE = "MIT"; -export const DEFAULT_INITIAL_VERSION = "0.0.0"; export const DEFAULT_WORKSPACES_DIRECTORY = "packages"; export type MonorepoPackage = Package & { @@ -31,7 +30,6 @@ export async function createMonorepo({ directory, scoped = DEFAULT_SCOPED, license = DEFAULT_LICENSE, - initialVersion = DEFAULT_INITIAL_VERSION, workspacesDirectory = DEFAULT_WORKSPACES_DIRECTORY, }: CreateMonorepoOptions) { if (await isReadableAndWritableDirectory({ directory })) { @@ -43,9 +41,7 @@ export async function createMonorepo({ await writePackage({ directory, data: { - private: true, license, - version: initialVersion, workspaces: [`${workspacesDirectory}/*`], moker: { scoped, @@ -60,7 +56,7 @@ export async function createMonorepo({ enqueueInstallDependency({ directory, - identifier: "@mokr/cli", + identifier: "moker", dev: true, }); } diff --git a/packages/core/src/workspace.ts b/packages/core/src/workspace.ts index d4163089..82051f76 100644 --- a/packages/core/src/workspace.ts +++ b/packages/core/src/workspace.ts @@ -9,6 +9,8 @@ type DirOption = { directory: string; }; +const DEFAULT_INITIAL_VERSION = "0.0.0"; + export async function addWorkspace({ directory, name, @@ -33,9 +35,10 @@ export async function addWorkspace({ append: false, data: { name: packageName, - version: pkg.version, + version: DEFAULT_INITIAL_VERSION, license: pkg.license, author: pkg.author, + repository: pkg.repository, ...(isScoped ? { publishConfig: { diff --git a/packages/core/src/yarn.ts b/packages/core/src/yarn.ts index 0f703256..6bb2e4ba 100644 --- a/packages/core/src/yarn.ts +++ b/packages/core/src/yarn.ts @@ -35,8 +35,6 @@ export async function initYarn({ directory }: DirOption) { await addYarnPlugin({ directory, name: "interactive-tools" }); await addYarnPlugin({ directory, name: "workspace-tools" }); - - await addYarnPlugin({ directory, name: "version" }); } export async function addYarnPlugin({