-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add bolt check package * add repository field to package.jsons
- Loading branch information
Showing
100 changed files
with
442 additions
and
10 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 @@ | ||
{ "releases": [{ "name": "bolt-check", "type": "minor" }], "dependents": [] } |
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 @@ | ||
Initial Release |
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,9 @@ | ||
{ | ||
"releases": [ | ||
{ "name": "bolt-check", "type": "patch" }, | ||
{ "name": "@changesets/cli", "type": "patch" }, | ||
{ "name": "@changesets/get-github-info", "type": "patch" }, | ||
{ "name": "get-workspaces", "type": "patch" } | ||
], | ||
"dependents": [] | ||
} |
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 @@ | ||
Add repository information to package.json |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
12 changes: 12 additions & 0 deletions
12
__fixtures__/yarn-workspace-mismatched-external/package.json
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,12 @@ | ||
{ | ||
"private": true, | ||
"name": "yarn-workspace-base", | ||
"description": "Base yarn workspace work", | ||
"version": "1.0.0", | ||
"workspaces": [ | ||
"packages/*" | ||
], | ||
"dependencies": { | ||
"get-workspaces": "^0.2.0" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
__fixtures__/yarn-workspace-mismatched-external/packages/pkg-a/package.json
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,7 @@ | ||
{ | ||
"name": "yarn-workspace-base-pkg-a", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"get-workspaces": "^0.2.1" | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
__fixtures__/yarn-workspace-mismatched-external/packages/pkg-b/package.json
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,4 @@ | ||
{ | ||
"name": "yarn-workspace-base-pkg-b", | ||
"version": "1.0.0" | ||
} |
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,9 @@ | ||
{ | ||
"private": true, | ||
"name": "yarn-workspace-base", | ||
"description": "Base yarn workspace work", | ||
"version": "1.0.0", | ||
"workspaces": [ | ||
"packages/*" | ||
] | ||
} |
7 changes: 7 additions & 0 deletions
7
__fixtures__/yarn-workspace-mismatched-internal/packages/pkg-a/package.json
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,7 @@ | ||
{ | ||
"name": "yarn-workspace-base-pkg-a", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"yarn-workspace-base-pkg-b": "^0.1.0" | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
__fixtures__/yarn-workspace-mismatched-internal/packages/pkg-b/package.json
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,4 @@ | ||
{ | ||
"name": "yarn-workspace-base-pkg-b", | ||
"version": "1.0.0" | ||
} |
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,9 @@ | ||
{ | ||
"private": true, | ||
"name": "yarn-workspace-base", | ||
"description": "Base yarn workspace work", | ||
"version": "1.0.0", | ||
"workspaces": [ | ||
"packages/*" | ||
] | ||
} |
7 changes: 7 additions & 0 deletions
7
__fixtures__/yarn-workspace-missing-external/packages/pkg-a/package.json
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,7 @@ | ||
{ | ||
"name": "yarn-workspace-base-pkg-a", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"get-workspaces": "^0.2.1" | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
__fixtures__/yarn-workspace-missing-external/packages/pkg-b/package.json
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,4 @@ | ||
{ | ||
"name": "yarn-workspace-base-pkg-b", | ||
"version": "1.0.0" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Ben Conolly | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,29 @@ | ||
# bolt-check | ||
|
||
> A very simple command line utility to perform some of bolt's checks in yarn workspaces | ||
Recently have been looking at using yarn workspaces over bolt, but was missing | ||
bolt's checks. This very simple utility does the two checks I want the most. | ||
|
||
## Make sure internal dependencies are compatible | ||
|
||
We want to ensure we always use local versions of packages through yarn link, not | ||
versions installed from npm. This ensures as we release new suites of packages, | ||
they will all work together. | ||
|
||
## Make sure external dependencies are all on the same version | ||
|
||
When doing installs, we would like each package to use the same version of external | ||
packages. We do this by having the 'correct' version recorded in the root `package.json`, | ||
then ensuring that all workspaces a) rely on the same version as the root, and b) do | ||
not contain any dependencies that are not in the root. | ||
|
||
## So I don't need bolt anymore? | ||
|
||
Depends! This package is not a replacement for bolt, doesn't do nearly as much as bolt, | ||
and implements the two above checks in a fairly naive/simple way. Bolt is still a great | ||
tool, and a great way to manage projects. | ||
|
||
Most importantly, we aren't doing any work installing packages, so guarantees that bolt | ||
can make by owning that, this won't have. Also, since `bolt-check` must be separately | ||
installed, you won't gain benefits from short-circuiting installs. |
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,4 @@ | ||
#!/usr/bin/env node | ||
"use strict"; | ||
|
||
require("./"); |
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,30 @@ | ||
{ | ||
"name": "bolt-check", | ||
"version": "0.0.0", | ||
"description": "Run the two major checks that the bolt package does in yarn workspaces", | ||
"main": "dist/bolt-check.cjs.js", | ||
"module": "dist/bolt-check.esm.js", | ||
"author": "Ben Conolly", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/changesets/changesets.git", | ||
"directory": "packages/bolt-check" | ||
}, | ||
"bin": { | ||
"bolt-check": "bin.js" | ||
}, | ||
"files": [ | ||
"dist", | ||
"bin.js" | ||
], | ||
"dependencies": { | ||
"chalk": "^2.1.0", | ||
"semver": "^5.4.1", | ||
"fs-extra": "^7.0.1", | ||
"get-workspaces": "^0.2.1" | ||
}, | ||
"devDependencies": { | ||
"jest-fixtures": "^0.5.0" | ||
} | ||
} |
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,69 @@ | ||
import boltCheck from "./bolt-check"; | ||
import { getFixturePath } from "jest-fixtures"; | ||
|
||
describe("bolt-check", () => { | ||
it("should validate a project with no errors", async () => { | ||
const cwd = await getFixturePath(__dirname, "yarn-workspace-base"); | ||
|
||
const errors = await boltCheck({ cwd, silent: true }); | ||
expect(errors).toEqual([]); | ||
}); | ||
it("should error if a package contains an external dependency missing at root", async () => { | ||
const cwd = await getFixturePath( | ||
__dirname, | ||
"yarn-workspace-missing-external" | ||
); | ||
|
||
const errors = await boltCheck({ cwd, silent: true }); | ||
|
||
expect(errors).toEqual([ | ||
{ | ||
dependency: "get-workspaces", | ||
pkgName: "yarn-workspace-base-pkg-a", | ||
type: "missingDependency" | ||
} | ||
]); | ||
}); | ||
it("should error if a package contains an external dependency at a mistmatched version", async () => { | ||
const cwd = await getFixturePath( | ||
__dirname, | ||
"yarn-workspace-mismatched-external" | ||
); | ||
|
||
const errors = await boltCheck({ cwd, silent: true }); | ||
expect(errors).toEqual([ | ||
{ | ||
dependency: "get-workspaces", | ||
pkgName: "yarn-workspace-base-pkg-a", | ||
type: "externalMismatch", | ||
rootVersion: "^0.2.0", | ||
pkgVersion: "^0.2.1" | ||
} | ||
]); | ||
}); | ||
it("should error if a package contains an internal dependency at an incompatible version", async () => { | ||
const cwd = await getFixturePath( | ||
__dirname, | ||
"yarn-workspace-mismatched-internal" | ||
); | ||
|
||
const errors = await boltCheck({ cwd, silent: true }); | ||
expect(errors).toEqual([ | ||
{ | ||
dependency: "yarn-workspace-base-pkg-b", | ||
pkgName: "yarn-workspace-base-pkg-a", | ||
type: "internalMismatch", | ||
version: "1.0.0" | ||
} | ||
]); | ||
}); | ||
it.skip("should print errors for both external and internal dependencies at once", async () => { | ||
throw new Error("write this test"); | ||
}); | ||
it.skip("should print multiple errors for multiple internal mismatches", async () => { | ||
throw new Error("write this test"); | ||
}); | ||
it.skip("should print multiple errors for multiple external mismatches", async () => { | ||
throw new Error("write this test"); | ||
}); | ||
}); |
Oops, something went wrong.