-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: first iteration of monorepo support (#15)
- [x] Support for fixed versions - [x] Support for private/non-private root package - [x] Tests Some implementation is still missing, most notably support in `add-channel.ts`
- Loading branch information
Showing
9 changed files
with
700 additions
and
93 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
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import type { PackageJson } from "read-pkg"; | ||
import type { PluginConfig } from "./definitions/pluginConfig.js"; | ||
|
||
/** | ||
* Returns [true, null] if `npmPublish` is not `false` and `pkg.private` is not | ||
* `true` or `pkg.workspaces` is not `undefined`. | ||
* Returns [false, reason] otherwise. | ||
*/ | ||
function shouldPublishTuple( | ||
pluginConfig: PluginConfig, | ||
pkg: PackageJson | ||
): [boolean, string | null] { | ||
const reasonToNotPublish = | ||
pluginConfig.npmPublish === false | ||
? "npmPublish plugin option is false" | ||
: pkg.private === true && typeof pkg.workspaces === "undefined" | ||
? "package is private and has no workspaces" | ||
: null; | ||
|
||
const shouldPublish = !reasonToNotPublish; | ||
|
||
return [shouldPublish, reasonToNotPublish]; | ||
} | ||
|
||
export function shouldPublish(pluginConfig: PluginConfig, pkg: PackageJson) { | ||
return shouldPublishTuple(pluginConfig, pkg)[0]; | ||
} | ||
|
||
export function reasonToNotPublish( | ||
pluginConfig: PluginConfig, | ||
pkg: PackageJson | ||
) { | ||
return shouldPublishTuple(pluginConfig, pkg)[1]; | ||
} |
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.