-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: build workflow for sub-projects (#3317)
Creates a working `build` workflow specific to a sub-project when that project has `buildWorkflow` set to `true`. Based on #3208. So most of the same decisions were made. The `install` command is always run in the root directory same as the `release` workflow. But based on discussion in #3304, we may want to make that configurable. I could make that change in this PR for `build`. Or just address it in a followup PR for both `build` and `release`. I added a `buildWorkflowName` option to `NodeProject` to support customizing each build workflow name; but it still defaults to `build` or `build_{package-name}` for sub-projects. I've successfully tested this with my own monorepo and added a few tests. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
- Loading branch information
1 parent
4fb188e
commit bff36f7
Showing
24 changed files
with
310 additions
and
50 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,20 @@ | ||
import { Project } from "../project"; | ||
|
||
/** | ||
* Generate workflow name with suffix based on if project is subproject or not | ||
* @param base name prefix | ||
* @param project to which the workflow belongs | ||
*/ | ||
export function workflowNameForProject(base: string, project: Project): string { | ||
// Subprojects | ||
if (project.parent) { | ||
return `${base}_${fileSafeName(project.name)}`; | ||
} | ||
|
||
// root project doesn't get a suffix | ||
return base; | ||
} | ||
|
||
function fileSafeName(name: string): string { | ||
return name.replace("@", "").replace(/\//g, "-"); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.