diff --git a/.changeset/slow-vans-repair.md b/.changeset/slow-vans-repair.md new file mode 100644 index 00000000..61622a62 --- /dev/null +++ b/.changeset/slow-vans-repair.md @@ -0,0 +1,8 @@ +--- +"@manypkg/get-packages": major +"@manypkg/find-root": major +"@manypkg/tools": major +"@manypkg/cli": minor +--- + +Drop support for Bolt diff --git a/README.md b/README.md index fb4ff793..325f1cd6 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ # Manypkg -Manypkg is a linter for `package.json` files in Yarn, Bolt or pnpm monorepos. +Manypkg is a linter for `package.json` files in Yarn, npm or pnpm monorepos. ## Install @@ -166,7 +166,7 @@ The most commonly used range of the dependency is set as the range at every non-
Incorrect example -> NOTE: This example uses Yarn Workspaces but this will work the same with Bolt and pnpm +> NOTE: This example uses Yarn Workspaces but this will work the same with npm and pnpm `package.json` @@ -220,7 +220,7 @@ This example will cause an error because the range `2.0.0` for `some-external-pa
Correct example -> NOTE: This example uses Yarn Workspaces but this will work the same with Bolt and pnpm +> NOTE: This example uses Yarn Workspaces but this will work the same with npm and pnpm `package.json` diff --git a/__fixtures__/bolt-workspace/package.json b/__fixtures__/bolt-workspace/package.json deleted file mode 100644 index 851a601f..00000000 --- a/__fixtures__/bolt-workspace/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "private": true, - "name": "bolt-workspaces", - "description": "bolt-workspaces", - "version": "1.0.0", - "bolt": { - "workspaces": [ - "packages/*" - ] - } -} diff --git a/__fixtures__/bolt-workspace/packages/pkg-a/package.json b/__fixtures__/bolt-workspace/packages/pkg-a/package.json deleted file mode 100644 index 6d1b4b4e..00000000 --- a/__fixtures__/bolt-workspace/packages/pkg-a/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "bolt-workspace-pkg-a", - "version": "1.0.0", - "dependencies": { - "pkg-b": "1.0.0" - } -} diff --git a/__fixtures__/bolt-workspace/packages/pkg-b/package.json b/__fixtures__/bolt-workspace/packages/pkg-b/package.json deleted file mode 100644 index f4635f02..00000000 --- a/__fixtures__/bolt-workspace/packages/pkg-b/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "bolt-workspace-pkg-b", - "version": "1.0.0" -} diff --git a/packages/cli/README.md b/packages/cli/README.md index 385aebbc..80d77281 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -1,6 +1,6 @@ # Manypkg -Manypkg is a linter for `package.json` files in Yarn, Bolt, Lerna, pnpm or Rush monorepos. +Manypkg is a linter for `package.json` files in Yarn, npm, Lerna, pnpm or Rush monorepos. ## Install diff --git a/packages/cli/src/utils.ts b/packages/cli/src/utils.ts index b6a5b9c8..ff8fd6d9 100644 --- a/packages/cli/src/utils.ts +++ b/packages/cli/src/utils.ts @@ -16,7 +16,6 @@ export async function writePackage(pkg: Package) { export async function install(toolType: string, cwd: string) { const cliRunners: Record = { - bolt: "bolt", lerna: "lerna", npm: "npm", pnpm: "pnpm", diff --git a/packages/find-root/README.md b/packages/find-root/README.md index e4e75282..c2e30e04 100644 --- a/packages/find-root/README.md +++ b/packages/find-root/README.md @@ -1,6 +1,6 @@ # @manypkg/find-root -> Find the root of a monorepo with Yarn workspaces, Bolt, Lerna, pnpm or Rush +> Find the root of a monorepo with Yarn workspaces, npm, Lerna, pnpm or Rush ## Install diff --git a/packages/find-root/src/index.ts b/packages/find-root/src/index.ts index 3f79d5ff..cf6c8a21 100644 --- a/packages/find-root/src/index.ts +++ b/packages/find-root/src/index.ts @@ -1,8 +1,4 @@ -import fs from "node:fs"; -import fsp from "node:fs/promises"; -import path from "node:path"; import { - BoltTool, LernaTool, NpmTool, PnpmTool, @@ -12,6 +8,9 @@ import { type MonorepoRoot, type Tool, } from "@manypkg/tools"; +import fs from "node:fs"; +import fsp from "node:fs/promises"; +import path from "node:path"; /** * A default ordering for monorepo tool checks. @@ -26,7 +25,6 @@ export const DEFAULT_TOOLS: Tool[] = [ NpmTool, LernaTool, RushTool, - BoltTool, RootTool, ]; diff --git a/packages/get-packages/README.md b/packages/get-packages/README.md index 522e0092..1bf92d82 100644 --- a/packages/get-packages/README.md +++ b/packages/get-packages/README.md @@ -1,8 +1,8 @@ # @manypkg/get-packages -> A simple utility to get the packages from a monorepo, whether they're using Yarn, Bolt, Lerna, pnpm or Rush +> A simple utility to get the packages from a monorepo, whether they're using Yarn, npm, Lerna, pnpm or Rush -This library exports `getPackages` and `getPackagesSync`. It is intended mostly for use of developers building tools that want to support different kinds of monorepos as an easy way to write tools without having to write tool-specific code. It supports Yarn, Bolt, Lerna, pnpm, Rush and single-package repos(where the only package is the the same as the root package). This library uses `@manypkg/find-root` to search up from the directory that's passed to `getPackages` or `getPackagesSync` to find the project root. +This library exports `getPackages` and `getPackagesSync`. It is intended mostly for use of developers building tools that want to support different kinds of monorepos as an easy way to write tools without having to write tool-specific code. It supports Yarn, npm, Lerna, pnpm, Rush and single-package repos(where the only package is the the same as the root package). This library uses `@manypkg/find-root` to search up from the directory that's passed to `getPackages` or `getPackagesSync` to find the project root. ```typescript import { getPackages, getPackagesSync } from "@manypkg/get-packages"; diff --git a/packages/get-packages/src/index.test.ts b/packages/get-packages/src/index.test.ts index e000ceb8..dd0628d8 100644 --- a/packages/get-packages/src/index.test.ts +++ b/packages/get-packages/src/index.test.ts @@ -65,27 +65,6 @@ let runTests = (getPackages: GetPackages) => { expect(allPackages.tool.type).toEqual("yarn"); }); - it("should resolve workspaces for bolt", async () => { - const dir = f.copy("bolt-workspace"); - - // Test for both root and subdirectories - for (const location of [".", "packages", "packages/pkg-b"]) { - const allPackages = await getPackages(path.join(dir, location)); - - if (allPackages.packages === null) { - return expect(allPackages.packages).not.toBeNull(); - } - - expect(allPackages.packages[0].packageJson.name).toEqual( - "bolt-workspace-pkg-a" - ); - expect(allPackages.packages[1].packageJson.name).toEqual( - "bolt-workspace-pkg-b" - ); - expect(allPackages.tool.type).toEqual("bolt"); - } - }); - it("should resolve workspaces for pnpm", async () => { const dir = f.copy("pnpm-workspace-base"); diff --git a/packages/tools/src/BoltTool.ts b/packages/tools/src/BoltTool.ts deleted file mode 100644 index 4a3036c9..00000000 --- a/packages/tools/src/BoltTool.ts +++ /dev/null @@ -1,126 +0,0 @@ -import path from "node:path"; - -import { - type Tool, - type PackageJSON, - type Packages, - InvalidMonorepoError, -} from "./Tool.ts"; -import { - expandPackageGlobs, - expandPackageGlobsSync, -} from "./expandPackageGlobs.ts"; -import { readJson, readJsonSync } from "./utils.ts"; - -export interface BoltPackageJSON extends PackageJSON { - bolt?: { - workspaces?: string[]; - }; -} - -export const BoltTool: Tool = { - type: "bolt", - - async isMonorepoRoot(directory: string): Promise { - try { - const pkgJson = (await readJson( - directory, - "package.json" - )) as BoltPackageJSON; - if (pkgJson.bolt && pkgJson.bolt.workspaces) { - return true; - } - } catch (err) { - if (err && (err as { code: string }).code === "ENOENT") { - return false; - } - throw err; - } - return false; - }, - - isMonorepoRootSync(directory: string): boolean { - try { - const pkgJson = readJsonSync( - directory, - "package.json" - ) as BoltPackageJSON; - if (pkgJson.bolt && pkgJson.bolt.workspaces) { - return true; - } - } catch (err) { - if (err && (err as { code: string }).code === "ENOENT") { - return false; - } - throw err; - } - return false; - }, - - async getPackages(directory: string): Promise { - const rootDir = path.resolve(directory); - - try { - const pkgJson = (await readJson( - rootDir, - "package.json" - )) as BoltPackageJSON; - if (!pkgJson.bolt || !pkgJson.bolt.workspaces) { - throw new InvalidMonorepoError( - `Directory ${rootDir} is not a valid ${BoltTool.type} monorepo root: missing bolt.workspaces entry` - ); - } - const packageGlobs: string[] = pkgJson.bolt.workspaces; - - return { - tool: BoltTool, - packages: await expandPackageGlobs(packageGlobs, rootDir), - rootPackage: { - dir: rootDir, - relativeDir: ".", - packageJson: pkgJson, - }, - rootDir, - }; - } catch (err) { - if (err && (err as { code: string }).code === "ENOENT") { - throw new InvalidMonorepoError( - `Directory ${rootDir} is not a valid ${BoltTool.type} monorepo root: missing package.json` - ); - } - throw err; - } - }, - - getPackagesSync(directory: string): Packages { - const rootDir = path.resolve(directory); - - try { - const pkgJson = readJsonSync(rootDir, "package.json") as BoltPackageJSON; - if (!pkgJson.bolt || !pkgJson.bolt.workspaces) { - throw new InvalidMonorepoError( - `Directory ${directory} is not a valid ${BoltTool.type} monorepo root: missing bolt.workspaces entry` - ); - } - const packageGlobs: string[] = pkgJson.bolt.workspaces; - - return { - tool: BoltTool, - packages: expandPackageGlobsSync(packageGlobs, rootDir), - rootPackage: { - dir: rootDir, - relativeDir: ".", - packageJson: pkgJson, - }, - rootDir, - }; - } catch (err) { - if (err && (err as { code: string }).code === "ENOENT") { - throw new InvalidMonorepoError( - `Directory ${rootDir} is not a valid ${BoltTool.type} monorepo root: missing package.json` - ); - } - throw err; - } - }, -}; diff --git a/packages/tools/src/index.ts b/packages/tools/src/index.ts index 34e9e6d1..b8570d1a 100644 --- a/packages/tools/src/index.ts +++ b/packages/tools/src/index.ts @@ -1,5 +1,4 @@ export * from "./Tool.ts"; -export { BoltTool } from "./BoltTool.ts"; export { LernaTool } from "./LernaTool.ts"; export { NpmTool } from "./NpmTool.ts"; export { PnpmTool } from "./PnpmTool.ts";