@crossdelta/platform-sdk 0.19.1 → 0.19.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.
- package/bin/templates/hono-microservice/Dockerfile.hbs +2 -1
- package/bin/templates/nest-microservice/Dockerfile.hbs +4 -2
- package/bin/templates/workspace/.github/actions/prepare-build-context/action.yml +48 -2
- package/bin/templates/workspace/.github/workflows/build-and-deploy.yml.hbs +25 -3
- package/bin/templates/workspace/.github/workflows/publish-packages.yml +6 -8
- package/bin/templates/workspace/infra/package.json.hbs +2 -2
- package/bin/templates/workspace/packages/contracts/package.json.hbs +2 -2
- package/package.json +3 -3
|
@@ -8,7 +8,8 @@ COPY bunfig.toml package.json ./
|
|
|
8
8
|
COPY packages ./packages
|
|
9
9
|
COPY src ./src
|
|
10
10
|
|
|
11
|
-
RUN --mount=type=
|
|
11
|
+
RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
12
|
+
--mount=type=secret,id=NPM_TOKEN \
|
|
12
13
|
export NPM_TOKEN="$(cat /run/secrets/NPM_TOKEN)" && \
|
|
13
14
|
bun install --production --omit=optional
|
|
14
15
|
|
|
@@ -9,7 +9,8 @@ COPY package.json tsconfig*.json nest-cli.json ./
|
|
|
9
9
|
COPY packages ./packages
|
|
10
10
|
COPY src ./src
|
|
11
11
|
|
|
12
|
-
RUN --mount=type=
|
|
12
|
+
RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
13
|
+
--mount=type=secret,id=NPM_TOKEN \
|
|
13
14
|
export NPM_TOKEN="$(cat /run/secrets/NPM_TOKEN)" && \
|
|
14
15
|
bun install
|
|
15
16
|
|
|
@@ -22,7 +23,8 @@ WORKDIR /app
|
|
|
22
23
|
COPY package.json ./
|
|
23
24
|
COPY packages ./packages
|
|
24
25
|
|
|
25
|
-
RUN --mount=type=
|
|
26
|
+
RUN --mount=type=cache,target=/root/.bun/install/cache \
|
|
27
|
+
--mount=type=secret,id=NPM_TOKEN \
|
|
26
28
|
export NPM_TOKEN="$(cat /run/secrets/NPM_TOKEN)" && \
|
|
27
29
|
bun install --production --omit=optional
|
|
28
30
|
|
|
@@ -39,17 +39,63 @@ runs:
|
|
|
39
39
|
fi
|
|
40
40
|
|
|
41
41
|
# Remove apps and services dirs (flattened above)
|
|
42
|
-
# Keep packages/ — workspace deps are resolved from here
|
|
43
42
|
rm -rf "$CONTEXT_DIR/apps" "$CONTEXT_DIR/services"
|
|
44
43
|
|
|
45
|
-
# Add workspace config so bun can resolve workspace:* deps from packages/
|
|
46
44
|
cd "$CONTEXT_DIR"
|
|
45
|
+
|
|
46
|
+
# Replace workspace:* with npm versions for published packages
|
|
47
|
+
# so bun install fetches pre-built packages from registry (with dist/)
|
|
48
|
+
# Private packages stay as workspace deps (Bun resolves their .ts source)
|
|
47
49
|
if [ -d "packages" ]; then
|
|
50
|
+
for pkg_dir in packages/*/; do
|
|
51
|
+
[ -f "$pkg_dir/package.json" ] || continue
|
|
52
|
+
|
|
53
|
+
pkg_name=$(jq -r '.name' "$pkg_dir/package.json")
|
|
54
|
+
is_private=$(jq -r '.private // false' "$pkg_dir/package.json")
|
|
55
|
+
pkg_version=$(jq -r '.version // empty' "$pkg_dir/package.json")
|
|
56
|
+
|
|
57
|
+
if [ "$is_private" = "true" ] || [ -z "$pkg_version" ]; then
|
|
58
|
+
echo " keeping workspace dep: $pkg_name (private)"
|
|
59
|
+
continue
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
echo " replacing workspace:* → ^$pkg_version for $pkg_name"
|
|
63
|
+
|
|
64
|
+
# Replace in dependencies and devDependencies
|
|
65
|
+
for field in dependencies devDependencies; do
|
|
66
|
+
if jq -e ".${field}[\"${pkg_name}\"]" package.json > /dev/null 2>&1; then
|
|
67
|
+
jq ".${field}[\"${pkg_name}\"] = \"^${pkg_version}\"" package.json > package.json.tmp
|
|
68
|
+
mv package.json.tmp package.json
|
|
69
|
+
fi
|
|
70
|
+
done
|
|
71
|
+
|
|
72
|
+
# Also update private packages that depend on this published package
|
|
73
|
+
for other_pkg in packages/*/; do
|
|
74
|
+
[ -f "$other_pkg/package.json" ] || continue
|
|
75
|
+
for field in dependencies devDependencies; do
|
|
76
|
+
if jq -e ".${field}[\"${pkg_name}\"]" "$other_pkg/package.json" > /dev/null 2>&1; then
|
|
77
|
+
jq ".${field}[\"${pkg_name}\"] = \"^${pkg_version}\"" "$other_pkg/package.json" > "$other_pkg/package.json.tmp"
|
|
78
|
+
mv "$other_pkg/package.json.tmp" "$other_pkg/package.json"
|
|
79
|
+
fi
|
|
80
|
+
done
|
|
81
|
+
done
|
|
82
|
+
|
|
83
|
+
# Remove published package dir (will be installed from npm)
|
|
84
|
+
rm -rf "$pkg_dir"
|
|
85
|
+
done
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
# Set workspace config for remaining private packages, or remove it
|
|
89
|
+
if [ -d "packages" ] && [ -n "$(ls -A packages/ 2>/dev/null)" ]; then
|
|
48
90
|
jq '.workspaces = ["packages/*"]' package.json > package.json.tmp
|
|
49
91
|
mv package.json.tmp package.json
|
|
50
92
|
else
|
|
93
|
+
rm -rf packages
|
|
51
94
|
jq 'del(.workspaces)' package.json > package.json.tmp
|
|
52
95
|
mv package.json.tmp package.json
|
|
53
96
|
fi
|
|
54
97
|
|
|
98
|
+
# Ensure packages/ dir exists (Dockerfiles COPY it even when empty)
|
|
99
|
+
mkdir -p packages
|
|
100
|
+
|
|
55
101
|
echo "context-dir=$CONTEXT_DIR" >> "$GITHUB_OUTPUT"
|
|
@@ -9,6 +9,7 @@ on:
|
|
|
9
9
|
- 'infra/**'
|
|
10
10
|
- 'bun.lock'
|
|
11
11
|
- '.github/workflows/**'
|
|
12
|
+
workflow_dispatch:
|
|
12
13
|
workflow_run:
|
|
13
14
|
workflows: ['📦 Publish Packages']
|
|
14
15
|
types:
|
|
@@ -37,7 +38,7 @@ jobs:
|
|
|
37
38
|
outputs:
|
|
38
39
|
scopes: $\{{ steps.scope-generator.outputs.scopes }}
|
|
39
40
|
scope_count: $\{{ steps.scope-generator.outputs.scopes_count }}
|
|
40
|
-
infrastructure_changed: $\{{ steps.infra-
|
|
41
|
+
infrastructure_changed: $\{{ steps.infra-eval.outputs.changed }}
|
|
41
42
|
steps:
|
|
42
43
|
- uses: actions/checkout@v4
|
|
43
44
|
with:
|
|
@@ -68,6 +69,15 @@ jobs:
|
|
|
68
69
|
changed:
|
|
69
70
|
- 'infra/**'
|
|
70
71
|
|
|
72
|
+
- name: Evaluate infrastructure change
|
|
73
|
+
id: infra-eval
|
|
74
|
+
run: |
|
|
75
|
+
if [ "$\{{ github.event_name }}" = "workflow_run" ] || [ "$\{{ github.event_name }}" = "workflow_dispatch" ] || [ "$\{{ steps.infra-check.outputs.changed }}" = "true" ]; then
|
|
76
|
+
echo "changed=true" >> "$GITHUB_OUTPUT"
|
|
77
|
+
else
|
|
78
|
+
echo "changed=false" >> "$GITHUB_OUTPUT"
|
|
79
|
+
fi
|
|
80
|
+
|
|
71
81
|
- name: Generate scope matrix
|
|
72
82
|
id: scope-generator
|
|
73
83
|
uses: ./.github/actions/generate-scope-matrix
|
|
@@ -214,9 +224,21 @@ jobs:
|
|
|
214
224
|
cache-restore-keys: bun-$\{{ runner.os }}-
|
|
215
225
|
npm-token: $\{{ secrets.NPM_TOKEN }}
|
|
216
226
|
|
|
217
|
-
- name: Build infrastructure
|
|
227
|
+
- name: Build infrastructure dependencies
|
|
228
|
+
run: |
|
|
229
|
+
bunx turbo run build --filter=@crossdelta/infrastructure --filter={{scope}}/contracts
|
|
230
|
+
|
|
231
|
+
- name: Refresh Pulumi state
|
|
232
|
+
env:
|
|
233
|
+
PULUMI_ACCESS_TOKEN: $\{{ secrets.PULUMI_ACCESS_TOKEN }}
|
|
234
|
+
DIGITALOCEAN_TOKEN: $\{{ secrets.DIGITALOCEAN_TOKEN }}
|
|
235
|
+
working-directory: infra
|
|
218
236
|
run: |
|
|
219
|
-
|
|
237
|
+
pulumi refresh \
|
|
238
|
+
--stack $\{{ env.PULUMI_STACK }} \
|
|
239
|
+
--run-program \
|
|
240
|
+
--yes \
|
|
241
|
+
--non-interactive
|
|
220
242
|
|
|
221
243
|
- name: Pulumi up
|
|
222
244
|
uses: pulumi/actions@v6
|
|
@@ -35,23 +35,21 @@ jobs:
|
|
|
35
35
|
uses: tj-actions/changed-files@v45
|
|
36
36
|
with:
|
|
37
37
|
json: true
|
|
38
|
-
dir_names: true
|
|
39
|
-
dir_names_max_depth: 2
|
|
40
38
|
files: packages/*/**
|
|
41
39
|
|
|
42
40
|
- name: Build package matrix
|
|
43
41
|
id: set-matrix
|
|
44
42
|
env:
|
|
45
43
|
INPUT_PACKAGE: ${{ github.event.inputs.package || '' }}
|
|
46
|
-
|
|
44
|
+
CHANGED_FILES: ${{ steps.changed.outputs.all_changed_files }}
|
|
47
45
|
run: |
|
|
48
46
|
declare -a packages=()
|
|
49
47
|
declare -A changed_packages
|
|
50
|
-
|
|
51
|
-
#
|
|
52
|
-
if [ "${{ github.event_name }}" == "push" ] && [ -n "$
|
|
53
|
-
for
|
|
54
|
-
if [[ $
|
|
48
|
+
|
|
49
|
+
# Extract package names from changed file paths (e.g. packages/platform-sdk/src/foo.ts → platform-sdk)
|
|
50
|
+
if [ "${{ github.event_name }}" == "push" ] && [ -n "$CHANGED_FILES" ]; then
|
|
51
|
+
for file in $(echo "$CHANGED_FILES" | jq -r '.[]'); do
|
|
52
|
+
if [[ $file =~ ^packages/([^/]+)/ ]]; then
|
|
55
53
|
changed_packages["${BASH_REMATCH[1]}"]=1
|
|
56
54
|
fi
|
|
57
55
|
done
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
"pulumi": "pulumi"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@crossdelta/cloudevents": "^0.6.
|
|
11
|
-
"@crossdelta/infrastructure": "^0.
|
|
10
|
+
"@crossdelta/cloudevents": "^0.6.4",
|
|
11
|
+
"@crossdelta/infrastructure": "^0.6.1",
|
|
12
12
|
"{{scope}}/contracts": "workspace:*",
|
|
13
13
|
"@pulumi/digitalocean": "^4.55.0",
|
|
14
14
|
"@pulumi/kubernetes": "^4.21.0",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"clean": "rm -rf dist"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@crossdelta/cloudevents": "^0.6.
|
|
23
|
-
"@crossdelta/infrastructure": "^0.
|
|
22
|
+
"@crossdelta/cloudevents": "^0.6.4",
|
|
23
|
+
"@crossdelta/infrastructure": "^0.6.1",
|
|
24
24
|
"zod": "^4.0.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crossdelta/platform-sdk",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.3",
|
|
4
4
|
"description": "Platform toolkit for event-driven microservices — keeping code and infrastructure in lockstep.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -142,8 +142,8 @@
|
|
|
142
142
|
"zod": "^4.0.0"
|
|
143
143
|
},
|
|
144
144
|
"peerDependencies": {
|
|
145
|
-
"@crossdelta/cloudevents": "0.6.
|
|
146
|
-
"@crossdelta/infrastructure": "0.5.
|
|
145
|
+
"@crossdelta/cloudevents": "0.6.4",
|
|
146
|
+
"@crossdelta/infrastructure": "0.5.5",
|
|
147
147
|
"@nestjs/schematics": "^11.0.5",
|
|
148
148
|
"turbo": "^2.0.0"
|
|
149
149
|
},
|