@kosdev-code/kos-codegen-core 0.1.0-next.796 → 0.1.0-next.798

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.
@@ -2,6 +2,15 @@ import { CodegenFileSystem } from '../codegen-filesystem';
2
2
  export interface PolyglotWorkspaceOptions {
3
3
  /** Workspace/repo name (also determines the UI app name `<name>-ui`). */
4
4
  name: string;
5
+ /**
6
+ * The repo-root layer is IDENTICAL for every type — same scripts,
7
+ * workflows, and manifests, all runtime-tolerant of a missing half — so a
8
+ * repo can grow the other half later without restructuring. The type only
9
+ * seeds the manifests: "polyglot"/"ui" (default) pre-register the UI app
10
+ * artifact; "java" starts with empty artifact lists (ci:sync/java:add
11
+ * fill them in).
12
+ */
13
+ type?: "polyglot" | "ui" | "java";
5
14
  /**
6
15
  * `default_keyset` for the kos_build_handler manifests. Org-specific;
7
16
  * changeable in .github/build-*.json afterward. Default: "prod.kos".
@@ -1 +1 @@
1
- {"version":3,"file":"generate-polyglot-workspace.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-codegen-core/src/lib/generators/generate-polyglot-workspace.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI/D,MAAM,WAAW,wBAAwB;IACvC,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAUD,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,iBAAiB,EAC5B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,wBAAwB,GAChC,uBAAuB,CAuCzB"}
1
+ {"version":3,"file":"generate-polyglot-workspace.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-codegen-core/src/lib/generators/generate-polyglot-workspace.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI/D,MAAM,WAAW,wBAAwB;IACvC,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,GAAG,MAAM,CAAC;IAClC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAUD,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,iBAAiB,EAC5B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,wBAAwB,GAChC,uBAAuB,CAyCzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kosdev-code/kos-codegen-core",
3
- "version": "0.1.0-next.796",
3
+ "version": "0.1.0-next.798",
4
4
  "type": "commonjs",
5
5
  "main": "./index.js",
6
6
  "module": "./index.mjs",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "kos": {
27
27
  "build": {
28
- "gitHash": "1ddf27b7d03081c5b75d1f624934cea8fff5bd6b"
28
+ "gitHash": "a6322d3066945ba2545675cdb286b572d85a5452"
29
29
  }
30
30
  }
31
31
  }
@@ -4,6 +4,13 @@ set -e -o pipefail
4
4
  THIS_SCRIPT=$(realpath "$0")
5
5
  TOP_DIR=$(dirname "$THIS_SCRIPT")/..
6
6
 
7
+ # Skips cleanly while the repo has no ui half so the same scripts work for
8
+ # every workspace shape. Grow a ui half with: kosui ui:add
9
+ if [ ! -f "${TOP_DIR}/ui/package.json" ]; then
10
+ echo "No ui workspace yet (ui/package.json not found); skipping UI build."
11
+ exit 0
12
+ fi
13
+
7
14
  # Provision a repo-local Node if none is installed (the mvnw pattern).
8
15
  . "$(dirname "$THIS_SCRIPT")/nodew.sh"
9
16
 
@@ -33,13 +33,19 @@ esac
33
33
  IMAGE="ghcr.io/kosdev-code/kos-buildpublish/kos_builder:dockerimage"
34
34
  WORKSPACE_NAME="$(basename "$(cd "$TOP_DIR" && pwd)")"
35
35
 
36
+ # npm cache + node_modules volumes only make sense once a ui half exists
37
+ # (and mounting /work/ui/node_modules would otherwise create a stray ui/).
38
+ UI_VOLUMES=""
39
+ if [ -f "${TOP_DIR}/ui/package.json" ]; then
40
+ UI_VOLUMES="-v kos-npm-cache-${WORKSPACE_NAME}:/root/.npm -v kos-node-modules-${WORKSPACE_NAME}:/work/ui/node_modules"
41
+ fi
42
+
36
43
  # Named volumes keep Maven/npm caches warm between runs and keep the
37
44
  # container's linux node_modules out of the host's ui/node_modules.
38
45
  "$RUNTIME" run --rm \
39
46
  -v "$(cd "$TOP_DIR" && pwd):/work" \
40
47
  -v "kos-m2-${WORKSPACE_NAME}:/root/.m2" \
41
- -v "kos-npm-cache-${WORKSPACE_NAME}:/root/.npm" \
42
- -v "kos-node-modules-${WORKSPACE_NAME}:/work/ui/node_modules" \
48
+ ${UI_VOLUMES} \
43
49
  -w /work \
44
50
  -e KOS_KABTOOL_JAR=/usr/local/lib/kabtool.jar \
45
51
  -e JAVA_CMD=java \
@@ -11,12 +11,15 @@ if [ -z "${KOSBUILD_VERSION}" ]; then
11
11
  exit 1
12
12
  fi
13
13
 
14
- # Provision a repo-local Node if none is installed (the mvnw pattern).
15
- . "$(dirname "$THIS_SCRIPT")/nodew.sh"
16
-
17
- cd "${TOP_DIR}/ui"
18
- npm ci
19
- npx nx run-many --target=version --args=--ver="${KOSBUILD_VERSION}"
14
+ if [ -f "${TOP_DIR}/ui/package.json" ]; then
15
+ # Provision a repo-local Node if none is installed (the mvnw pattern).
16
+ . "$(dirname "$THIS_SCRIPT")/nodew.sh"
17
+ cd "${TOP_DIR}/ui"
18
+ npm ci
19
+ npx nx run-many --target=version --args=--ver="${KOSBUILD_VERSION}"
20
+ else
21
+ echo "No ui workspace yet; skipping ui version stamp."
22
+ fi
20
23
 
21
24
  if [ -f "${TOP_DIR}/java/pom.xml" ]; then
22
25
  # Provision a repo-local JDK + Maven if none are installed.
@@ -3,12 +3,12 @@
3
3
  "prebuild_cmd": "build/release_version_prebuild.sh",
4
4
  "build_cmd": "build/build-release.sh",
5
5
 
6
- "artifacts": [
6
+ "artifacts": [<% if (hasUi) { %>
7
7
  {
8
8
  "id": "<%= appUiName %>",
9
9
  "filename": "ui/dist/archives/packages/<%= appUiName %>/<%= appUiName %>.kab",
10
10
  "artifactstore": "kos-cdn",
11
11
  "marketplace": 1
12
- }
12
+ }<% } %>
13
13
  ]
14
14
  }
@@ -2,12 +2,12 @@
2
2
  "default_keyset": "<%= keyset %>",
3
3
  "build_cmd": "./build/build-ui.sh",
4
4
 
5
- "artifacts": [
5
+ "artifacts": [<% if (hasUi) { %>
6
6
  {
7
7
  "id": "<%= appUiName %>",
8
8
  "filename": "ui/dist/archives/packages/<%= appUiName %>/<%= appUiName %>.kab",
9
9
  "artifactstore": "kos-cdn",
10
10
  "marketplace": 1
11
- }
11
+ }<% } %>
12
12
  ]
13
13
  }
@@ -1,14 +1,16 @@
1
1
  # <%= nameDashCase %>
2
2
 
3
- Polyglot KOS application repository: a Java backend and a KOS UI workspace that
4
- build side-by-side KOS artifacts (KABs) published to the KOS marketplace.
3
+ KOS application repository. The layout is the same whether the repo holds a
4
+ UI workspace, a Java backend, or both each half can be added at any time
5
+ without restructuring, and every build/CI script skips cleanly over a half
6
+ that doesn't exist yet.
5
7
 
6
8
  ## Layout
7
9
 
8
10
  | Path | Purpose |
9
11
  | --- | --- |
10
- | `ui/` | KOS UI workspace (Nx root lives here — run `npm`/`nx` commands inside `ui/`) |
11
- | `java/` | KOS Java backend (Maven; scaffold modules with the KOS Maven archetypes — see `java/README.md`) |
12
+ | `ui/` | KOS UI workspace, if present (Nx root lives here — run `npm`/`nx` commands inside `ui/`; grow with `kosui ui:add`) |
13
+ | `java/` | KOS Java backend, if present (Maven; scaffold modules with the KOS Maven archetypes — `kosui java:add` or see `java/README.md`) |
12
14
  | `build/` | Repo-level build orchestration scripts used locally and by CI |
13
15
  | `.github/` | CI workflows and `kos_build_handler` manifests (`build-*.json`) |
14
16
 
@@ -18,9 +20,9 @@ artifacts, published together by the release pipeline.
18
20
  ## Local builds
19
21
 
20
22
  ```sh
21
- ./build/build-ui.sh # npm ci + build all UI KABs
22
- ./build/build-java.sh # mvn build (skips cleanly while java/ is empty)
23
- ./build/build-release.sh # UI then Java (what the release pipeline runs)
23
+ ./build/build-ui.sh # npm ci + build all UI KABs (skips if no ui/)
24
+ ./build/build-java.sh # mvn build (skips if no java modules)
25
+ ./build/build-release.sh # both, in order what the release pipeline runs
24
26
  ```
25
27
 
26
28
  **No toolchain? No problem.** The build scripts provision what's missing
@@ -28,7 +30,7 @@ automatically (the `mvnw` pattern): `build/nodew.sh` fetches a pinned Node
28
30
  runtime and `build/jdkw.sh` a pinned Temurin JDK + Maven, each into the
29
31
  repo-local, gitignored `.kos/` on first use. Developers with their own
30
32
  toolchains/IDEs are never touched — the wrappers always defer to an existing
31
- install, so working on just `java/` in your own IDE needs nothing from here.
33
+ install, so working on just one half in your own IDE needs nothing from here.
32
34
 
33
35
  Optional: `./build/docker-build.sh ui|java|release` runs a build inside the
34
36
  same container image CI uses (docker or podman; `docker login ghcr.io` for the
@@ -46,7 +48,7 @@ git tag 1.0.0 && git push origin 1.0.0
46
48
 
47
49
  The release workflow derives `KOSBUILD_VERSION` from the tag, then
48
50
  `build/release_version_prebuild.sh` stamps it into every UI project's
49
- `.kos.json` (via `nx run-many --target=version`) and into the Maven POMs
51
+ `.kos.json` (via `nx run-many --target=version`) and the Maven POMs
50
52
  (`mvn versions:set`) before building and publishing all artifacts.
51
53
 
52
54
  ## CI configuration
@@ -64,6 +66,6 @@ keyset.
64
66
  ## Adding artifacts
65
67
 
66
68
  Every KAB the repo produces must be listed in the `artifacts` arrays of
67
- `.github/build-ui.json` / `build-java.json` and the union kept in
68
- `build-release.json`. Update these when adding UI projects or Java modules
69
- (`kosui ci:sync` automates this where available).
69
+ `.github/build-ui.json` / `build-java.json`, with the union kept in
70
+ `build-release.json`. `kosui ci:sync` keeps these in sync with the projects
71
+ and modules that actually exist (`kosui java:add` updates them automatically).