@dbx-tools/projen 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +1 -1
- package/package.json +1 -1
- package/src/project-js.ts +30 -2
- package/src/release.ts +35 -6
package/index.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Hand edits are overwritten on the next watch; this file is read-only.
|
|
4
4
|
|
|
5
5
|
export const PACKAGE_IDENTIFIER = "@dbx-tools/projen";
|
|
6
|
-
export const PACKAGE_VERSION = "0.8.
|
|
6
|
+
export const PACKAGE_VERSION = "0.8.1";
|
|
7
7
|
export * as barrels from "./src/barrels.ts";
|
|
8
8
|
export * as bunApp from "./src/bun-app.ts";
|
|
9
9
|
export * as bunWorkflow from "./src/bun-workflow.ts";
|
package/package.json
CHANGED
package/src/project-js.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { type IConstruct } from "constructs";
|
|
|
15
15
|
import { Component, IgnoreFile, Project, type TaskOptions, javascript, typescript } from "projen";
|
|
16
16
|
import { BuildWorkflow } from "projen/lib/build";
|
|
17
17
|
import { AutoMerge } from "projen/lib/github";
|
|
18
|
-
import { JobPermission, type JobStep } from "projen/lib/github/workflows-model";
|
|
18
|
+
import { JobPermission, type JobStep, type Triggers } from "projen/lib/github/workflows-model";
|
|
19
19
|
import type { ReleaseProjectOptions } from "projen/lib/release";
|
|
20
20
|
import { mixin } from "..";
|
|
21
21
|
import { generateBarrels } from "./barrels.ts";
|
|
@@ -943,7 +943,35 @@ function configureBuildWorkflow(
|
|
|
943
943
|
});
|
|
944
944
|
validation.exec("bunx projen default");
|
|
945
945
|
validation.exec("bun run compile");
|
|
946
|
-
const configured =
|
|
946
|
+
const configured = {
|
|
947
|
+
...options.buildWorkflowOptions,
|
|
948
|
+
...(!options.buildWorkflowOptions?.workflowTriggers &&
|
|
949
|
+
project.releaseCatalog.mode === "independent"
|
|
950
|
+
? {
|
|
951
|
+
workflowTriggers: {
|
|
952
|
+
pullRequest: {
|
|
953
|
+
types: ["opened", "synchronize", "reopened", "closed"],
|
|
954
|
+
paths: [
|
|
955
|
+
"**",
|
|
956
|
+
"!.projen/release-units.json",
|
|
957
|
+
"!.release-please-manifest.json",
|
|
958
|
+
"!.release-units/**",
|
|
959
|
+
"!.release-notes/**",
|
|
960
|
+
"!docs/releases/**",
|
|
961
|
+
"!Cargo.lock",
|
|
962
|
+
"!**/Cargo.toml",
|
|
963
|
+
"!**/package.json",
|
|
964
|
+
"!**/pyproject.toml",
|
|
965
|
+
"!**/index.ts",
|
|
966
|
+
"!packages/js/node/rust-binary/src/_rust-release-binaries.ts",
|
|
967
|
+
"!packages/js/node/appkit-graphiti/src/_python-runtime.ts",
|
|
968
|
+
],
|
|
969
|
+
},
|
|
970
|
+
workflowDispatch: {},
|
|
971
|
+
} satisfies Triggers,
|
|
972
|
+
}
|
|
973
|
+
: {}),
|
|
974
|
+
};
|
|
947
975
|
const compatibility = nodeWorkflowCompatibility(project);
|
|
948
976
|
const configuredRunner = configured.runsOn !== undefined || configured.runsOnGroup !== undefined;
|
|
949
977
|
const workflow = new BuildWorkflow(project, {
|
package/src/release.ts
CHANGED
|
@@ -464,7 +464,7 @@ function configureReleaseRequestWorkflow(
|
|
|
464
464
|
if: `\${{ github.ref_name != '${baseBranch}' }}`,
|
|
465
465
|
runsOn: ["ubuntu-latest"],
|
|
466
466
|
permissions: {
|
|
467
|
-
contents: JobPermission.
|
|
467
|
+
contents: JobPermission.WRITE,
|
|
468
468
|
pullRequests: JobPermission.WRITE,
|
|
469
469
|
},
|
|
470
470
|
steps: [
|
|
@@ -489,7 +489,7 @@ function configureReleaseRequestWorkflow(
|
|
|
489
489
|
" exit 0",
|
|
490
490
|
"fi",
|
|
491
491
|
'echo "requested=true" >> "$GITHUB_OUTPUT"',
|
|
492
|
-
'echo "branch=$
|
|
492
|
+
'echo "branch=$GITHUB_REF_NAME" >> "$GITHUB_OUTPUT"',
|
|
493
493
|
'echo "approve=$(sed -n \'s/^Release-Approve: //p\' <<<"$MESSAGE" | tail -1)" >> "$GITHUB_OUTPUT"',
|
|
494
494
|
'echo "notes_path=$(sed -n \'s/^Release-Notes-Path: //p\' <<<"$MESSAGE" | tail -1)" >> "$GITHUB_OUTPUT"',
|
|
495
495
|
'echo "title=$(git log -1 --skip=1 --format=%s)" >> "$GITHUB_OUTPUT"',
|
|
@@ -515,7 +515,8 @@ function configureReleaseRequestWorkflow(
|
|
|
515
515
|
'if [ -n "$PR" ]; then',
|
|
516
516
|
' gh pr edit "$PR" --title "$TITLE" --body "$BODY"',
|
|
517
517
|
"else",
|
|
518
|
-
'
|
|
518
|
+
' gh pr create --head "$SOURCE_BRANCH" --base "$BASE_BRANCH" --title "$TITLE" --body "$BODY"',
|
|
519
|
+
' PR="$(gh pr list --head "$SOURCE_BRANCH" --base "$BASE_BRANCH" --state open --json number --jq \'.[0].number\')"',
|
|
519
520
|
"fi",
|
|
520
521
|
'if [ "$APPROVE" = "true" ]; then gh pr merge "$PR" --auto --merge; fi',
|
|
521
522
|
].join("\n"),
|
|
@@ -721,18 +722,27 @@ function addIndependentDocsJobs(
|
|
|
721
722
|
});
|
|
722
723
|
}
|
|
723
724
|
|
|
724
|
-
function addIndependentBranchSyncJob(
|
|
725
|
+
function addIndependentBranchSyncJob(
|
|
726
|
+
workflow: GithubWorkflow,
|
|
727
|
+
project: DBXToolsJavaScriptProject,
|
|
728
|
+
branch: string,
|
|
729
|
+
): void {
|
|
725
730
|
workflow.addJob("sync-release-branch", {
|
|
726
731
|
if: "${{ always() && github.event_name == 'push' && needs['publication-complete'].result == 'success' }}",
|
|
727
732
|
needs: ["publication-complete"],
|
|
728
733
|
runsOn: ["ubuntu-latest"],
|
|
729
734
|
permissions: { contents: JobPermission.WRITE },
|
|
735
|
+
env: { BUN_VERSION },
|
|
730
736
|
steps: [
|
|
731
737
|
{
|
|
732
738
|
name: "Checkout released main",
|
|
733
739
|
uses: "actions/checkout@v6",
|
|
734
740
|
with: { "fetch-depth": 0 },
|
|
735
741
|
},
|
|
742
|
+
...bunCacheRestoreSteps(project, {
|
|
743
|
+
ignorePaths: project.workflowCacheIgnorePaths,
|
|
744
|
+
}),
|
|
745
|
+
{ name: "Install dependencies", run: "bun install" },
|
|
736
746
|
{
|
|
737
747
|
name: `Safely sync ${branch}`,
|
|
738
748
|
shell: "bash",
|
|
@@ -754,8 +764,23 @@ function addIndependentBranchSyncJob(workflow: GithubWorkflow, branch: string):
|
|
|
754
764
|
' if git merge --no-ff --no-edit "$GITHUB_SHA"; then',
|
|
755
765
|
' git push origin "HEAD:refs/heads/$SOURCE_BRANCH"',
|
|
756
766
|
" else",
|
|
767
|
+
' SAFE_GENERATED="true"',
|
|
768
|
+
" while IFS= read -r FILE; do",
|
|
769
|
+
' case "$FILE" in',
|
|
770
|
+
" .projen/release-units.json|.release-please-manifest.json|.release-units/*/source.json|.release-units/*/version.txt|.release-units/*/CHANGELOG.md|Cargo.lock|*/Cargo.toml|*/package.json|*/pyproject.toml|*/index.ts) ;;",
|
|
771
|
+
' *) SAFE_GENERATED="false" ;;',
|
|
772
|
+
" esac",
|
|
773
|
+
" done < <(git diff --name-only --diff-filter=U)",
|
|
774
|
+
' if [ "$SAFE_GENERATED" = "true" ] && bunx projen; then',
|
|
775
|
+
" git add -A",
|
|
776
|
+
' if [ -z "$(git diff --name-only --diff-filter=U)" ]; then',
|
|
777
|
+
" git commit --no-edit",
|
|
778
|
+
' git push origin "HEAD:refs/heads/$SOURCE_BRANCH"',
|
|
779
|
+
" exit 0",
|
|
780
|
+
" fi",
|
|
781
|
+
" fi",
|
|
757
782
|
" git merge --abort",
|
|
758
|
-
' echo "::warning::source branch $SOURCE_BRANCH has
|
|
783
|
+
' echo "::warning::source branch $SOURCE_BRANCH has handwritten or unresolved conflicts with released main; leaving it untouched"',
|
|
759
784
|
" fi",
|
|
760
785
|
"fi",
|
|
761
786
|
].join("\n"),
|
|
@@ -794,7 +819,11 @@ class IndependentReleaseFinalizer extends Component {
|
|
|
794
819
|
addIndependentDocsJobs(this.workflow, this.project as DBXToolsJavaScriptProject, this.docs);
|
|
795
820
|
}
|
|
796
821
|
if (this.syncBranch) {
|
|
797
|
-
addIndependentBranchSyncJob(
|
|
822
|
+
addIndependentBranchSyncJob(
|
|
823
|
+
this.workflow,
|
|
824
|
+
this.project as DBXToolsJavaScriptProject,
|
|
825
|
+
this.syncBranch,
|
|
826
|
+
);
|
|
798
827
|
}
|
|
799
828
|
}
|
|
800
829
|
}
|