-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…151) * Create sample core package * Initial round of feedback * eliminate index-based zip * Add BoltTool * Add PnpmTool * Add Yarn and None tools, update findroot unit tests * Implement sync methods for all Tools, fixing findRootSync tests * wip: 90% of get-packages converted to use Tools * revert back to original snaps * Small tool fixes * add latest content * Rename NoneTool to SinglePackageTool, it is never the root of a monorepo * Swap references to SinglePackageTool * Remove errant comment * Implement core type changes for Packages and Package * Suggested feedback * Mass prettier update after pull from main * additional PR feedback * errant console.log * Type fixes * Rename manypkg/core -> manypkg/tools * fix unit tests, snapshots * snapshot updates * Fixed the `PackagesWithConfig` type * Adjust checks implementations after changes * Support both dir and relativeDir * pr feedback * unused importrs * Fix prettier config, add changeset * Introduce `getRootWs` test helper * Exports only tools from `/tools` and handle default order in `/find-root` * Fix suggested path.join * Make root tool last * Split up changesets * Cleanup `/find-root` * Update .changeset/frozen-yogurt.md Co-authored-by: Mateusz Burzyński <[email protected]> * Fix some test and type issues, feedback * Refactor all try-catch blocks to assert positive instead of negative * Revert change to jest default test timeout * Update packages/tools/package.json Co-authored-by: Mateusz Burzyński <[email protected]> * Update packages/get-packages/package.json Co-authored-by: Mateusz Burzyński <[email protected]> Co-authored-by: Mateusz Burzyński <[email protected]>
- Loading branch information
1 parent
45b396d
commit a01efc9
Showing
33 changed files
with
1,253 additions
and
473 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@manypkg/find-root": major | ||
--- | ||
|
||
The `find-root` package now returns a new `MonorepoRoot` interface, instead of a string. This interface provides a `rootDir` for the discovered monorepo, and a `tool` object, which is an object using the new `Tool` interface provided by `@manypkg/tools`. |
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,5 @@ | ||
--- | ||
"@manypkg/tools": minor | ||
--- | ||
|
||
Introduces a new `Tool` API that provides key functions related to a specific implementation of a monorepo, like `isMonorepoRoot` and `getPackages`. Existing tool implementations in manypkg have been converted to use this new interface. |
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,5 @@ | ||
--- | ||
"@manypkg/get-packages": major | ||
--- | ||
|
||
The `get-packages` package now returns a slightly different structure. The old `tool` string has been replaced with a `tool` object, using the new `Tool` interface provided by `@manypkg/tools`. Each `Package` now contains both the absolute directory and relative directory path. Last, the `root` package has been renamed `rootPackage` and is optional, to support monorepos that do not contain a root package. |
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 |
---|---|---|
@@ -1,19 +1,17 @@ | ||
import path from "path"; | ||
import check from "../INCORRECT_REPOSITORY_FIELD"; | ||
import { getWS, getFakeWS, getFakeString } from "../../test-helpers"; | ||
import { getWS, getFakeWS, getFakeString, getRootWS } from "../../test-helpers"; | ||
|
||
describe("incorrect repository field", () => { | ||
describe("github", () => { | ||
it("should work", () => { | ||
let ws = getWS(); | ||
let rootWorkspace = getFakeWS("root"); | ||
let rootWorkspace = getRootWS(); | ||
let defaultBranch = `b${getFakeString(5)}`; | ||
|
||
(rootWorkspace.packageJson as any).repository = | ||
"https://github.com/Thinkmill/manypkg"; | ||
rootWorkspace.dir = __dirname; | ||
let workspace = getFakeWS("no-repository-field"); | ||
workspace.dir = path.join(__dirname, "packages/no-repository-field"); | ||
ws.set("depends-on-one", workspace); | ||
ws.set("root", rootWorkspace); | ||
let errors = check.validate(workspace, ws, rootWorkspace, { | ||
|
@@ -38,15 +36,13 @@ describe("incorrect repository field", () => { | |
}); | ||
it("should fix root in a different format", () => { | ||
let ws = getWS(); | ||
let rootWorkspace = getFakeWS("root"); | ||
let rootWorkspace = getRootWS(); | ||
let defaultBranch = `b${getFakeString(5)}`; | ||
|
||
(rootWorkspace.packageJson as any).repository = | ||
"https://github.com/Thinkmill/manypkg.git"; | ||
|
||
rootWorkspace.dir = __dirname; | ||
let workspace = getFakeWS("no-repository-field"); | ||
workspace.dir = path.join(__dirname, "packages/no-repository-field"); | ||
ws.set("depends-on-one", workspace); | ||
ws.set("root", rootWorkspace); | ||
let errors = check.validate(rootWorkspace, ws, rootWorkspace, { | ||
|
@@ -71,15 +67,13 @@ describe("incorrect repository field", () => { | |
}); | ||
it("should do nothing if already in good format", () => { | ||
let ws = getWS(); | ||
let rootWorkspace = getFakeWS("root"); | ||
let rootWorkspace = getRootWS(); | ||
let defaultBranch = `b${getFakeString(5)}`; | ||
|
||
(rootWorkspace.packageJson as any).repository = | ||
"https://github.com/Thinkmill/manypkg"; | ||
|
||
rootWorkspace.dir = __dirname; | ||
let workspace = getFakeWS("no-repository-field"); | ||
workspace.dir = path.join(__dirname, "packages/no-repository-field"); | ||
ws.set("depends-on-one", workspace); | ||
ws.set("root", rootWorkspace); | ||
let errors = check.validate(rootWorkspace, ws, rootWorkspace, { | ||
|
@@ -98,14 +92,12 @@ describe("incorrect repository field", () => { | |
describe("azure devops", () => { | ||
it("should work", () => { | ||
let ws = getWS(); | ||
let rootWorkspace = getFakeWS("root"); | ||
let rootWorkspace = getRootWS(); | ||
let defaultBranch = `b${getFakeString(5)}`; | ||
|
||
(rootWorkspace.packageJson as any).repository = | ||
"https://dev.azure.com/Thinkmill/monorepos/_git/manypkg"; | ||
rootWorkspace.dir = __dirname; | ||
let workspace = getFakeWS("no-repository-field"); | ||
workspace.dir = path.join(__dirname, "packages/no-repository-field"); | ||
ws.set("depends-on-one", workspace); | ||
ws.set("root", rootWorkspace); | ||
let errors = check.validate(workspace, ws, rootWorkspace, { | ||
|
@@ -130,15 +122,13 @@ describe("incorrect repository field", () => { | |
}); | ||
it("should fix root in a different format", () => { | ||
let ws = getWS(); | ||
let rootWorkspace = getFakeWS("root"); | ||
let rootWorkspace = getRootWS(); | ||
let defaultBranch = `b${getFakeString(5)}`; | ||
|
||
(rootWorkspace.packageJson as any).repository = | ||
"https://[email protected]/Thinkmill/monorepos/_git/manypkg"; | ||
|
||
rootWorkspace.dir = __dirname; | ||
let workspace = getFakeWS("no-repository-field"); | ||
workspace.dir = path.join(__dirname, "packages/no-repository-field"); | ||
ws.set("depends-on-one", workspace); | ||
ws.set("root", rootWorkspace); | ||
let errors = check.validate(rootWorkspace, ws, rootWorkspace, { | ||
|
@@ -163,15 +153,13 @@ describe("incorrect repository field", () => { | |
}); | ||
it("should do nothing if already in good format", () => { | ||
let ws = getWS(); | ||
let rootWorkspace = getFakeWS("root"); | ||
let rootWorkspace = getRootWS(); | ||
let defaultBranch = `b${getFakeString(5)}`; | ||
|
||
(rootWorkspace.packageJson as any).repository = | ||
"https://dev.azure.com/Thinkmill/monorepos/_git/manypkg"; | ||
|
||
rootWorkspace.dir = __dirname; | ||
let workspace = getFakeWS("no-repository-field"); | ||
workspace.dir = path.join(__dirname, "packages/no-repository-field"); | ||
ws.set("depends-on-one", workspace); | ||
ws.set("root", rootWorkspace); | ||
let errors = check.validate(rootWorkspace, ws, rootWorkspace, { | ||
|
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
4 changes: 2 additions & 2 deletions
4
packages/cli/src/checks/__tests__/INVALID_DEV_AND_PEER_DEPENDENCY.ts
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
Oops, something went wrong.