@xpertss/projen-types 0.0.1 → 0.0.3

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.
Files changed (47) hide show
  1. package/.jsii +1083 -92
  2. package/API.md +7459 -4313
  3. package/README.md +127 -25
  4. package/lib/actions/action-build-workflow.d.ts +17 -0
  5. package/lib/actions/action-build-workflow.js +52 -0
  6. package/lib/actions/action-dogfood-workflow.d.ts +47 -0
  7. package/lib/actions/action-dogfood-workflow.js +84 -0
  8. package/lib/actions/action-sonar-workflow.d.ts +25 -0
  9. package/lib/actions/action-sonar-workflow.js +64 -0
  10. package/lib/actions/github-action-project.d.ts +60 -0
  11. package/lib/actions/github-action-project.js +157 -0
  12. package/lib/cdk/app-runtime-scaffold.js +1 -1
  13. package/lib/cdk/cdk-app-project.js +2 -4
  14. package/lib/cdk/cdk-infra-project.js +1 -1
  15. package/lib/cdk/cdk-typescript-base.js +16 -3
  16. package/lib/cdk/components/ecr-ecs-constructs.js +1 -1
  17. package/lib/cdk/components/edge-networking-constructs.js +1 -1
  18. package/lib/cdk/database-component.js +1 -1
  19. package/lib/cdk/options.d.ts +0 -2
  20. package/lib/cdk/options.js +1 -1
  21. package/lib/common/actions-allowlist-guard.d.ts +37 -0
  22. package/lib/common/actions-allowlist-guard.js +70 -0
  23. package/lib/common/internal-actions.d.ts +10 -0
  24. package/lib/common/internal-actions.js +33 -0
  25. package/lib/common/manual-deploy-workflow.d.ts +0 -2
  26. package/lib/common/manual-deploy-workflow.js +1 -12
  27. package/lib/common/projen-drift-check-workflow.d.ts +36 -0
  28. package/lib/common/projen-drift-check-workflow.js +77 -0
  29. package/lib/common/upgrade-workflow.js +6 -2
  30. package/lib/common/workflow-change-notice-workflow.d.ts +33 -0
  31. package/lib/common/workflow-change-notice-workflow.js +58 -0
  32. package/lib/index.d.ts +8 -0
  33. package/lib/index.js +9 -1
  34. package/lib/java/components/cdk-deploy-hook.js +1 -1
  35. package/lib/java/components/code-index-workflow.js +1 -1
  36. package/lib/java/components/docker-publish.js +1 -1
  37. package/lib/java/components/flyway-migration.js +1 -1
  38. package/lib/java/components/github-packages-publish.js +1 -1
  39. package/lib/java/components/maven-central-publish.js +1 -1
  40. package/lib/java/java-app-project.js +1 -1
  41. package/lib/java/java-library-project.js +1 -1
  42. package/lib/java/java-maven-base.js +21 -4
  43. package/lib/java/java-service-project.js +1 -1
  44. package/package.json +2 -2
  45. package/release-publishing.md +57 -66
  46. package/lib/common/drift-check.d.ts +0 -8
  47. package/lib/common/drift-check.js +0 -18
@@ -2,133 +2,124 @@
2
2
 
3
3
  ## Scope
4
4
 
5
- This document defines the commit and release discipline required for the `release` workflow (`.github/workflows/release.yml`, generated by projen from `.projenrc.ts`) to publish correctly to npm and GitHub Releases.
5
+ This document defines how to trigger a release of `@xpertss/projen-types` and the commit discipline required for a release to happen. It applies to the `release` workflow (`.github/workflows/release.yml`, generated by projen from `.projenrc.ts`).
6
6
 
7
- Keying requirement: **the first line of your commit message is the release control plane.** Everything else (triggering, versioning, publishing) is automatic once commits follow this spec.
7
+ **A release happens when a run of the `release` workflow finds at least one releasable commit since the last release tag** — a commit whose subject is typed `feat:` or `fix:` (see §2). Runs are started by any push to `main` (or manually, §1). A run whose window contains no `feat:`/`fix:` commits is a **green no-op** that publishes nothing — `docs:`, `ci:`, `chore:`, and other commits never release on their own.
8
8
 
9
9
  Key words "MUST", "MUST NOT", "SHOULD" are to be interpreted as described in RFC 2119.
10
10
 
11
- ## 1. Release triggering
11
+ ## 1. Triggering a release
12
12
 
13
- - **Any push to `main`** starts the `release` workflow — direct push or merged PR, both are equivalent. There is no per-release approval step; every push to `main` is a release *attempt*.
14
- - The workflow can also be started manually: Actions → `release` → **Run workflow** (optional `dry_run` input; when true, everything runs except the actual `npm publish`).
15
- - A push that produces nothing releasable (see §3) is a **no-op run**: green, no tag, no npm publish, no GitHub release. This is expected behavior, not an error.
13
+ - **Any push to `main`** starts the `release` workflow — direct push or merged PR. The run publishes only if the window since the last release tag contains a releasable commit (below); otherwise it is a no-op.
14
+ - The workflow can also be started manually: GitHub → **Actions** → `release` → **Run workflow** (optional `dry_run = true` runs everything except the actual `npm publish`) — useful for re-running after a failed build or to confirm a no-op window.
15
+ - At start of the run, the toolchain lists the **releasable commits** between the last release tag (`vX.Y.Z`) and `HEAD`: all non-merge commits whose subject matches `feat:` or `fix:` (with an optional scope and an optional `!`, e.g. `feat(parser)!: ...`).
16
+ - **≥ 1 releasable commit** → the run bumps the version, builds, and publishes to npm and GitHub Releases.
17
+ - **0 releasable commits** (e.g. only `docs:`, `ci:`, `chore:`, or unprefixed commits in the window) → the run is a **no-op**: green, no tag, no npm publish, no GitHub release. This is expected behavior, not an error.
16
18
 
17
- ## 2. Commit message rules (MUST)
19
+ ## 2. Commit message rules
18
20
 
19
21
  ### 2.1 Format
20
22
 
21
- Commit messages MUST use the [Conventional Commits](https://www.conventionalcommits.org/) format. Only the **first line (subject)** is parsed, in the form:
23
+ Commit messages MUST use the [Conventional Commits](https://www.conventionalcommits.org/) format. Only the **first line (subject)** is parsed for the type, in the form:
22
24
 
23
25
  ```
24
26
  type(scope)!: description
25
27
  ```
26
28
 
27
- - `type` — required, lower-case, from the table in §2.2.
29
+ - `type` — lower-case; `feat` or `fix` makes the commit releasable (see §1).
28
30
  - `scope` — optional, free-form (e.g. `fix(parser): ...`).
29
31
  - `!` — optional breaking-change marker, see §2.3.
30
32
  - `description` — imperative mood preferred ("add", not "added"/"adds").
31
33
 
32
- ### 2.2 Types and their effect on the version
34
+ ### 2.2 Releasable types and the version bump
33
35
 
34
- | First line starts with | Bump level | Example `0.0.0` → |
36
+ Only `feat:` and `fix:` commits are releasable. When a release run does release, the bump level for the window is:
37
+
38
+ | Window since last tag | Bump level | Example `0.1.0` → |
35
39
  |---|---|---|
36
- | `feat:` | **minor** | `0.1.0` |
37
- | `fix:` | **patch** | `0.0.1` |
38
- | `perf:` | **patch** | `0.0.1` |
39
- | any type + breaking marker (§2.3) | **major** | `1.0.0` |
40
- | `chore:`, `docs:`, `style:`, `refactor:`, `test:`, `build:`, `ci:` | **none** | (no bump) |
41
- | anything else / no prefix | **none** | (no bump) |
40
+ | Breaking change present (§2.3) | **major** | `1.0.0` |
41
+ | Else any `feat:` commit | **minor** | `0.2.0` |
42
+ | Else (only `fix:` commits) | **patch** | `0.1.1` |
43
+
44
+ Within one window, the highest level wins.
45
+
46
+ **All commits since the last tag are included in the release**, not only the releasable ones — `docs:`, `ci:`, `chore:`, and other commits appear in the generated release notes (under an "Other" heading) and are part of the released content. They simply do not, on their own, cause a release to happen.
42
47
 
43
48
  ### 2.3 Breaking changes
44
49
 
45
50
  A change that is incompatible with existing consumers MUST be marked explicitly, one of:
46
51
 
47
52
  - `!` directly before the colon: `feat!: drop legacy option`
48
- - or a `BREAKING CHANGE:` paragraph in the commit **body** (for any type).
53
+ - or a `BREAKING CHANGE:` paragraph in the commit **body** (the body, not the subject).
49
54
 
50
- Unmarked breaking changes are the one real hazard in this scheme: they will silently ship as a minor/patch bump.
55
+ Because the releasable-commits check (§1) only inspects commit **subjects**, a breaking change MUST be carried by a `feat:`/`fix:` commit. A `BREAKING CHANGE:` note on any other commit type (e.g. `refactor:`) will never be released.
51
56
 
52
57
  ### 2.4 Examples
53
58
 
54
59
  | Message | Effect |
55
60
  |---|---|
56
- | `feat: add Java project scaffold` | minor bump |
57
- | `fix: correct dependency range in .projenrc.ts` | patch bump |
58
- | `feat!: remove deprecated option X` | major bump |
59
- | `Updated the README` | no bump — shipped in the next releasable window, listed under "Other" in release notes |
60
- | `one more fix` | no bump — contains the word "fix" but has no `fix:` prefix |
61
-
62
- ## 3. Versioning model (verified behavior)
63
-
64
- Verified against projen 0.103.23 (`lib/release/bump-version.js`) and `commit-and-tag-version@^12` (the bump engine in the `bump` task, `.projen/tasks.json`).
65
-
66
- 1. **Baseline** = the latest release tag on `main` (`vX.Y.Z`). The window being evaluated = all commits after that tag.
67
- 2. **First release (no tag exists) never bumps** — by design it tags and publishes the version currently in `package.json` (this project: `0.0.0`).
68
- 3. **Subsequent releases** bump according to the *highest* level present in the window: major > minor > patch. `feat:` + `fix:` in the same window → minor.
69
- 4. **No releasable commits in the window → `bump: "none"`** → the `check_tag_exists` gate (`release.yml`) skips both publish jobs → no-op run.
70
- 5. Version numbers are owned by the release toolchain. `package.json` `version` is written by the bump step and restored afterwards (`unbump`); the working copy must never show a drifted version.
71
- 6. The bump step is skipped entirely when the latest commit on `main` is `chore(release): ...` (the auto-generated release commit) — releases do not self-trigger.
72
-
73
- ### 3.1 What non-conventional commits do
74
-
75
- Commits without a recognized prefix:
76
-
77
- - do **not** trigger a release,
78
- - do **not** bump the version,
79
- - are **not** lost — they are shipped in the next release that the window produces (all commits since the last tag are published together),
80
- - appear under an **"Other"** heading in the generated release notes instead of "Features"/"Bug Fixes".
61
+ | `feat: add Java project scaffold` | releasable; minor bump |
62
+ | `fix: correct dependency range in .projenrc.ts` | releasable; patch bump |
63
+ | `feat!: remove deprecated option X` | releasable; major bump |
64
+ | `fix!: change default of option Y` | releasable; major bump |
65
+ | `docs: update publishing guide` | **not releasable** — no release unless the window also has a `feat:`/`fix:` |
66
+ | `ci: pin node version` | **not releasable** — no release unless the window also has a `feat:`/`fix:` |
67
+ | `Updated the README` (no prefix) | **not releasable** |
68
+ | `chore(release): 0.0.1` (auto-generated) | never counted — filtered out of the window |
81
69
 
82
- ## 4. Release lifecycle (what CI does per run)
70
+ ## 3. What a release run does
83
71
 
84
- Per push to `main`, in order:
72
+ Per run, in order:
85
73
 
86
- 1. `release` job runs `npx projen release` = `rm -fr dist` → **bump** (resolve latest tag → suggest bump from window → apply: new version in `package.json`, tag, changelog to `dist/changelog.md`) → **build** (jsii) → **unbump** → `git diff` must be clean. A build failure aborts the run before anything is published.
87
- 2. Gates: `tag_exists` (is `dist/releasetag.txt`'s tag already on origin?) and `latest_commit == github.sha` (did someone push a newer commit mid-run?).
74
+ 1. The `release` job runs `npx projen release` = `rm -fr dist` → **bump** (resolve latest tag → list releasable commits → if none, stop as no-op; if any, set the new version in `package.json`, write the changelog to `dist/changelog.md`) → **build** (jsii) → **unbump** → `git diff` must be clean. A build failure aborts the run before anything is published.
75
+ 2. Gates: `tag_exists` (is the computed release tag already on origin?) and `latest_commit == github.sha` (did someone push a newer commit mid-run?).
88
76
  3. If gated through, `Publish to npm` and `Publish to GitHub Releases` run in parallel:
89
77
  - **npm:** `publib-npm` with `NPM_TRUSTED_PUBLISHER=true` (OIDC, no token; see `spec/npm-publishing-setup.md`). A version that is already on the registry is reported as `SKIPPING: already published` — green, not an error.
90
78
  - **GitHub:** `gh release create vX.Y.Z --target <sha>` with the generated changelog as body; this also creates/pushes the `vX.Y.Z` tag.
91
79
  4. The `chore(release): vX.Y.Z` commit (author `github-actions[bot]`) lands on `main`.
92
80
 
93
- ## 5. Rules
81
+ ## 4. Rules
94
82
 
95
83
  ### MUST
96
84
 
97
- - Prefix every user-facing change with `feat:` (new capability) or `fix:` (bug fix); `perf:` for performance fixes.
98
- - Mark breaking changes with `!` or a `BREAKING CHANGE:` body paragraph.
99
- - Use the imperative mood in the subject.
85
+ - Type commits `feat:` or `fix:` when the change should be part of a release.
86
+ - Mark breaking changes with `!` or a `BREAKING CHANGE:` **body** paragraph, on a `feat:`/`fix:` commit (§2.3).
87
+ - Treat a push to `main` whose window contains `feat:`/`fix:` commits as an imminent release — review accordingly.
100
88
  - Verify after each release: `npm view @xpertss/projen-types version` and the GitHub **Releases** page.
101
89
 
102
90
  ### MUST NOT
103
91
 
92
+ - Push a `feat:`/`fix:` commit to `main` unless you are ready to publish — the run it triggers will release.
104
93
  - Edit `package.json` `version` by hand, or add a `version` field to `.projenrc.ts` — the release toolchain owns version numbers.
105
94
  - Move, rename, or rewrite release tags (`vX.Y.Z`) on `main` — the tag is the version baseline.
106
95
  - Force-push `main` — it desyncs the tag baseline from history.
107
96
  - Edit `.github/workflows/release.yml` directly — edit `.projenrc.ts` and run `npx projen`. In particular, renaming the workflow file or changing the `release_npm` job would orphan the npm **trusted publisher** configuration (see `spec/npm-publishing-setup.md`, step 3).
108
- - Rely on non-prefixed commits to trigger or bump a release.
109
97
 
110
98
  ### SHOULD
111
99
 
112
- - One logical change per commit; keep the subject ≤ 72 chars.
113
- - If merging via PR, use **squash merge** and make the *squash title* the conventional message — it replaces all underlying commit subjects, so a PR full of `feat:` commits merged as "stuff" releases nothing.
114
- - Batch work so each window ends with at least one prefixed commit, if the window contains releasable work.
100
+ - Use **squash merge** for PRs and make the *squash title* the conventional message — it replaces all underlying commit subjects and therefore decides whether the merged change is releasable.
101
+ - Use the imperative mood in the subject; one logical change per commit; subject ≤ 72 chars.
102
+ - Keep a releasable (`feat:`/`fix:`) commit in the window whenever you intend a release to include a given set of changes; otherwise bundle the changes into a `feat:`/`fix:` PR.
115
103
 
116
- ## 6. Edge cases and known behaviors
104
+ ## 5. Edge cases and known behaviors
117
105
 
118
106
  | Situation | Outcome |
119
107
  |---|---|
120
- | Push with only non-prefixed commits | no-op run (green, nothing published) |
121
- | `feat:` + `fix:` in one window | minor bump (highest wins) |
122
- | Re-running the workflow for the same version | `tag_exists` gate skips publishing |
123
- | Version already on npm (e.g. published manually beforehand) | `publib-npm` prints `SKIPPING: already published`, job is green |
124
- | Two pushes in rapid succession | concurrency group serializes; the second run's `latest_commit` gate handles drift |
125
- | Build fails | run aborts, no tag, no publish — push a fix and re-push |
126
- | `chore(release):` is the latest commit | bump step skips — no double release |
108
+ | Push to `main` with `feat:`/`fix:` commits in the window | release run — minor / patch / major per §2.2 |
109
+ | Push or manual run whose window has only non-releasable commits (`docs:`, `ci:`, …) | no-op run — green, nothing published |
110
+ | Window contains `feat:` (no breaking) | minor bump (highest level wins) |
111
+ | Breaking change marked per §2.3 on a `feat:`/`fix:` commit | major bump |
112
+ | Run with no commits since the last release tag (e.g. re-run of the same HEAD) | no-op run |
113
+ | Run for an already-published tag | `tag_exists` gate skips publishing |
114
+ | Version already on npm (e.g. published manually beforehand) | `publib-npm` prints `SKIPPING: already published`, run is green |
115
+ | Two runs in rapid succession | concurrency group serializes; the second run's `latest_commit` gate handles drift |
116
+ | Build fails | run aborts, no tag, no publish — fix and trigger again |
117
+ | `chore(release):` is the latest commit | excluded from the window — no double release |
127
118
 
128
119
  ## References
129
120
 
130
121
  - Workflow: `.github/workflows/release.yml` (projen-generated; source of truth is `.projenrc.ts`)
131
- - Bump engine: `commit-and-tag-version@^12` (task `bump`, `.projen/tasks.json`), projen builtins `release/resolve-latest-tag`, `release/suggest-version-bump`, `release/apply-version-bump`
132
- - Verified sources: projen 0.103.23 `lib/release/bump-version.js`, `lib/release/publisher.js`; publib 0.3.3 `bin/publib-npm`
122
+ - Releasable-commits gate: `bump:releasable-commits` task (`.projen/tasks.json`) — `git log --no-merges --oneline $LATEST_TAG..HEAD -E --grep '^(feat|fix){1}(\(...\))?(!)?:...'`
123
+ - Bump engine: `commit-and-tag-version@12` (task `bump`, `.projen/tasks.json`), projen builtins `release/resolve-latest-tag`, `release/suggest-version-bump`, `release/apply-version-bump`
133
124
  - Publishing credentials (OIDC trusted publisher, bootstrap, 2FA): `spec/npm-publishing-setup.md`
134
125
  - Conventional Commits: https://www.conventionalcommits.org/
@@ -1,8 +0,0 @@
1
- import { github } from 'projen';
2
- /**
3
- * Steps that re-run projen and fail the job if the generated output no
4
- * longer matches what's committed - i.e. someone hand-edited a projen
5
- * managed file (package.json/pom.xml/.github/workflows/*.yml/...) without
6
- * going through .projenrc.
7
- */
8
- export declare function driftCheckSteps(projenCommand?: string): github.workflows.JobStep[];
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.driftCheckSteps = driftCheckSteps;
4
- /**
5
- * Steps that re-run projen and fail the job if the generated output no
6
- * longer matches what's committed - i.e. someone hand-edited a projen
7
- * managed file (package.json/pom.xml/.github/workflows/*.yml/...) without
8
- * going through .projenrc.
9
- */
10
- function driftCheckSteps(projenCommand = 'npx projen') {
11
- return [
12
- {
13
- name: 'Check for projen drift',
14
- run: `${projenComm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