@crossdelta/platform-sdk 0.19.11 โ†’ 0.19.13

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 (29) hide show
  1. package/bin/cli.mjs +144 -126
  2. package/bin/templates/workspace/infra/package.json.hbs +2 -2
  3. package/bin/templates/workspace/packages/contracts/package.json.hbs +2 -2
  4. package/bin/templates/workspace/turbo.json +1 -2
  5. package/package.json +4 -4
  6. package/bin/chunk-634PL24Z.mjs +0 -20
  7. package/bin/config-CKQHYOF4.mjs +0 -2
  8. package/bin/templates/workspace/.github/README.md +0 -70
  9. package/bin/templates/workspace/.github/actions/check-image-tag-exists/action.yml +0 -27
  10. package/bin/templates/workspace/.github/actions/check-image-tag-exists/index.js +0 -179
  11. package/bin/templates/workspace/.github/actions/check-path-changes/action.yml +0 -21
  12. package/bin/templates/workspace/.github/actions/check-path-changes/index.js +0 -192
  13. package/bin/templates/workspace/.github/actions/detect-skipped-services/action.yml +0 -38
  14. package/bin/templates/workspace/.github/actions/generate-scope-matrix/action.yml +0 -21
  15. package/bin/templates/workspace/.github/actions/generate-scope-matrix/index.js +0 -370
  16. package/bin/templates/workspace/.github/actions/prepare-build-context/action.yml +0 -108
  17. package/bin/templates/workspace/.github/actions/resolve-scope-tags/action.yml +0 -31
  18. package/bin/templates/workspace/.github/actions/resolve-scope-tags/index.js +0 -398
  19. package/bin/templates/workspace/.github/actions/setup-bun-install/action.yml.hbs +0 -57
  20. package/bin/templates/workspace/.github/copilot-chat-configuration.json +0 -49
  21. package/bin/templates/workspace/.github/dependabot.yml +0 -18
  22. package/bin/templates/workspace/.github/workflows/build-and-deploy.yml.hbs +0 -243
  23. package/bin/templates/workspace/.github/workflows/lint-and-tests.yml.hbs +0 -32
  24. package/bin/templates/workspace/.github/workflows/publish-packages.yml +0 -202
  25. package/bin/templates/workspace/apps/.gitkeep +0 -0
  26. package/bin/templates/workspace/docs/.gitkeep +0 -0
  27. package/bin/templates/workspace/infra/services/.gitkeep +0 -0
  28. package/bin/templates/workspace/packages/.gitkeep +0 -0
  29. package/bin/templates/workspace/services/.gitkeep +0 -0
@@ -1,243 +0,0 @@
1
- name: ๐Ÿš€ Build and Deploy
2
-
3
- on:
4
- push:
5
- branches: [main]
6
- paths:
7
- - 'apps/*/**'
8
- - 'services/*/**'
9
- - 'infra/**'
10
- - 'bun.lock'
11
- - '.github/workflows/**'
12
- workflow_dispatch:
13
-
14
- permissions:
15
- contents: read
16
- packages: write
17
-
18
- concurrency:
19
- group: deploy-$\{{ github.ref }}
20
- cancel-in-progress: false
21
-
22
- env:
23
- SCOPE_ROOTS: apps,services
24
- REGISTRY: ghcr.io/$\{{ github.repository_owner }}/$\{{ github.event.repository.name }}
25
- PULUMI_STACK: $\{{ vars.PULUMI_STACK_BASE }}/$\{{ github.ref_name == 'main' && 'production' || github.ref_name }}
26
- WORKFLOW_HEAD_SHA: $\{{ github.sha }}
27
- WORKFLOW_BASE_SHA_INPUT: $\{{ github.event.before }}
28
-
29
- jobs:
30
- prepare-scopes:
31
- name: ๐Ÿงช Prepare Scopes
32
- runs-on: ubuntu-latest
33
- outputs:
34
- scopes: $\{{ steps.scope-generator.outputs.scopes }}
35
- scope_count: $\{{ steps.scope-generator.outputs.scopes_count }}
36
- infrastructure_changed: $\{{ steps.infra-eval.outputs.changed }}
37
- steps:
38
- - uses: actions/checkout@v4
39
- with:
40
- fetch-depth: 0
41
- ref: $\{{ env.WORKFLOW_HEAD_SHA }}
42
-
43
- - name: Set commit range
44
- run: |
45
- set -euo pipefail
46
- HEAD_SHA="${WORKFLOW_HEAD_SHA}"
47
- BASE_SHA="${WORKFLOW_BASE_SHA_INPUT}"
48
- NULL_SHA="0000000000000000000000000000000000000000"
49
- if [ -z "$BASE_SHA" ] || [ "$BASE_SHA" = "$NULL_SHA" ]; then
50
- if git rev-parse "${HEAD_SHA}^" >/dev/null 2>&1; then
51
- BASE_SHA=$(git rev-parse "${HEAD_SHA}^")
52
- else
53
- BASE_SHA="$HEAD_SHA"
54
- fi
55
- fi
56
- echo "GITHUB_SHA=$HEAD_SHA" >> "$GITHUB_ENV"
57
- echo "GITHUB_EVENT_BEFORE=$BASE_SHA" >> "$GITHUB_ENV"
58
-
59
- - name: Check for infrastructure changes
60
- id: infra-check
61
- uses: dorny/paths-filter@v3
62
- with:
63
- filters: |
64
- changed:
65
- - 'infra/**'
66
-
67
- - name: Evaluate infrastructure change
68
- id: infra-eval
69
- run: |
70
- if [ "$\{{ github.event_name }}" = "workflow_run" ] || [ "$\{{ github.event_name }}" = "workflow_dispatch" ] || [ "$\{{ steps.infra-check.outputs.changed }}" = "true" ]; then
71
- echo "changed=true" >> "$GITHUB_OUTPUT"
72
- else
73
- echo "changed=false" >> "$GITHUB_OUTPUT"
74
- fi
75
-
76
- - name: Generate scope matrix
77
- id: scope-generator
78
- uses: ./.github/actions/generate-scope-matrix
79
- with:
80
- scope-roots: $\{{ env.SCOPE_ROOTS }}
81
- force-all: $\{{ github.event_name == 'workflow_dispatch' }}
82
-
83
- build:
84
- if: needs.prepare-scopes.outputs.scope_count && needs.prepare-scopes.outputs.scope_count != '0'
85
- needs: prepare-scopes
86
- runs-on: ubuntu-latest
87
- strategy:
88
- matrix:
89
- scope: $\{{ fromJson(needs.prepare-scopes.outputs.scopes) }}
90
- name: ๐Ÿณ Build $\{{ matrix.scope.shortName }}
91
- env:
92
- DOCKER_BUILDKIT: 1
93
- IMAGE_TAG: $\{{ github.sha }}
94
-
95
- steps:
96
- - uses: actions/checkout@v4
97
- with:
98
- fetch-depth: 2
99
- ref: $\{{ env.WORKFLOW_HEAD_SHA }}
100
-
101
- - name: Set scope metadata
102
- run: |
103
- echo "SCOPE_DIR=$\{{ matrix.scope.dir }}" >> $GITHUB_ENV
104
- echo "scope_name=$\{{ matrix.scope.shortName }}" >> $GITHUB_OUTPUT
105
-
106
- - name: Setup Bun and install dependencies
107
- uses: ./.github/actions/setup-bun-install
108
- with:
109
- enable-cache: 'true'
110
- cache-key: bun-$\{{ runner.os }}-$\{{ hashFiles('bun.lock') }}
111
- cache-restore-keys: bun-$\{{ runner.os }}-
112
- npm-token: $\{{ secrets.NPM_TOKEN }}
113
-
114
- - name: Build workspace packages
115
- run: bunx turbo run build --filter='./packages/*'
116
-
117
- - name: Prune
118
- run: |
119
- bunx turbo prune --scope=$\{{ matrix.scope.name }} --docker --out-dir out/$\{{ matrix.scope.shortName }}
120
-
121
- - name: Compute scope checksum
122
- id: scope-checksum
123
- run: |
124
- set -euo pipefail
125
- cd "out/$\{{ matrix.scope.shortName }}"
126
- HASH=$(find . -type f -print0 | sort -z | xargs -0 sha256sum | sha256sum)
127
- HASH=${HASH%% *}
128
- echo "scope_hash=$HASH" >> $GITHUB_OUTPUT
129
-
130
- - name: Use scope checksum as image tag
131
- run: echo "IMAGE_TAG=$\{{ steps.scope-checksum.outputs.scope_hash }}" >> $GITHUB_ENV
132
-
133
- - name: Check if image tag exists
134
- id: tag-check
135
- uses: ./.github/actions/check-image-tag-exists
136
- with:
137
- scope-short-name: $\{{ matrix.scope.shortName }}
138
- image-tag: $\{{ env.IMAGE_TAG }}
139
- github-token: $\{{ secrets.GITHUB_TOKEN }}
140
-
141
- - name: Set up Docker Buildx
142
- if: steps.tag-check.outputs.exists != 'true'
143
- uses: docker/setup-buildx-action@v3
144
-
145
- - name: Login to GitHub Packages (GHCR)
146
- if: steps.tag-check.outputs.exists != 'true'
147
- uses: docker/login-action@v3
148
- with:
149
- registry: ghcr.io
150
- username: $\{{ github.actor }}
151
- password: $\{{ secrets.GITHUB_TOKEN }}
152
-
153
- - name: Prepare build context
154
- if: steps.tag-check.outputs.exists != 'true'
155
- uses: ./.github/actions/prepare-build-context
156
- with:
157
- scope-short-name: $\{{ matrix.scope.shortName }}
158
- scope-dir: $\{{ matrix.scope.dir }}
159
-
160
- - name: Build and push image
161
- if: steps.tag-check.outputs.exists != 'true'
162
- uses: docker/build-push-action@v5
163
- env:
164
- NPM_TOKEN: $\{{ secrets.NPM_TOKEN }}
165
- with:
166
- context: out/$\{{ matrix.scope.shortName }}/full
167
- push: true
168
- tags: |
169
- $\{{ env.REGISTRY }}/$\{{ matrix.scope.shortName }}:$\{{ env.IMAGE_TAG }}
170
- $\{{ env.REGISTRY }}/$\{{ matrix.scope.shortName }}:latest
171
- cache-from: type=gha,scope=$\{{ matrix.scope.shortName }}
172
- cache-to: type=gha,scope=$\{{ matrix.scope.shortName }},mode=max
173
- secrets: |
174
- NPM_TOKEN=$\{{ env.NPM_TOKEN }}
175
-
176
- - name: Mark this scope as changed
177
- run: |
178
- mkdir -p .changed/$\{{ matrix.scope.shortName }}
179
- echo "$\{{ matrix.scope.shortName }}" > .changed/$\{{ matrix.scope.shortName }}/scope.txt
180
- printf '{"shortName":"%s","imageTag":"%s"}\n' "$\{{ matrix.scope.shortName }}" "$\{{ env.IMAGE_TAG }}" > .changed/$\{{ matrix.scope.shortName }}/metadata.json
181
-
182
- - name: Upload change marker
183
- uses: actions/upload-artifact@v4
184
- with:
185
- name: changed-$\{{ matrix.scope.shortName }}
186
- path: .changed/$\{{ matrix.scope.shortName }}
187
-
188
- deploy:
189
- runs-on: ubuntu-latest
190
- needs: [build, prepare-scopes]
191
- if: |
192
- always() &&
193
- needs.prepare-scopes.result == 'success' &&
194
- needs.build.result != 'failure' &&
195
- (needs.prepare-scopes.outputs.scope_count != '0' || needs.prepare-scopes.outputs.infrastructure_changed == 'true')
196
- name: ๐ŸŒ Deploy
197
- steps:
198
- - uses: actions/checkout@v4
199
- with:
200
- ref: $\{{ env.WORKFLOW_HEAD_SHA }}
201
- - name: Download all change markers
202
- uses: actions/download-artifact@v4
203
- with:
204
- path: .artifacts
205
-
206
- - name: Detect skipped services
207
- id: detect_skipped
208
- uses: ./.github/actions/detect-skipped-services
209
-
210
- - name: Resolve scope image tags
211
- id: resolve_scope_tags
212
- uses: ./.github/actions/resolve-scope-tags
213
- with:
214
- markers-dir: .artifacts
215
- scope-roots: $\{{ env.SCOPE_ROOTS }}
216
- repository-owner: $\{{ github.repository_owner }}
217
- allow-missing-scopes: $\{{ steps.detect_skipped.outputs.skipped-services }}
218
- github-token: $\{{ secrets.GITHUB_TOKEN }}
219
-
220
- - name: Setup Bun and install dependencies
221
- uses: ./.github/actions/setup-bun-install
222
- with:
223
- enable-cache: 'true'
224
- cache-key: bun-$\{{ runner.os }}-$\{{ hashFiles('bun.lock') }}
225
- cache-restore-keys: bun-$\{{ runner.os }}-
226
- npm-token: $\{{ secrets.NPM_TOKEN }}
227
-
228
- - name: Build infrastructure dependencies
229
- run: |
230
- bunx turbo run build --filter=@crossdelta/infrastructure --filter={{scope}}/contracts
231
-
232
- - name: Pulumi up
233
- uses: pulumi/actions@v6
234
- with:
235
- command: up
236
- suppress-progress: true
237
- comment-on-summary: true
238
- stack-name: $\{{ env.PULUMI_STACK }}
239
- work-dir: infra
240
- env:
241
- PULUMI_ACCESS_TOKEN: $\{{ secrets.PULUMI_ACCESS_TOKEN }}
242
- DIGITALOCEAN_TOKEN: $\{{ secrets.DIGITALOCEAN_TOKEN }}
243
- SCOPE_IMAGE_TAGS: $\{{ steps.resolve_scope_tags.outputs.scope_image_tags }}
@@ -1,32 +0,0 @@
1
- name: โœ… Pull Request Checks
2
-
3
- on:
4
- pull_request:
5
- branches:
6
- - main
7
-
8
- concurrency:
9
- group: $\{{ github.workflow }}-$\{{ github.ref }}
10
- cancel-in-progress: true
11
-
12
- jobs:
13
- lint-and-test:
14
- runs-on: ubuntu-latest
15
- env:
16
-
17
- steps:
18
- - name: Checkout code
19
- uses: actions/checkout@v4
20
-
21
- - name: Setup Bun and install dependencies
22
- uses: ./.github/actions/setup-bun-install
23
- with:
24
- enable-cache: 'true'
25
- cache-key: bun-$\{{ runner.os }}-$\{{ hashFiles('bun.lock') }}
26
- cache-restore-keys: bun-$\{{ runner.os }}-
27
-
28
- - name: Run Linter
29
- run: bun run --if-present lint
30
-
31
- - name: Run Tests
32
- run: bun run --if-present test
@@ -1,202 +0,0 @@
1
- name: ๐Ÿ“ฆ Publish Packages
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- paths:
8
- - 'packages/*/**'
9
- workflow_dispatch:
10
- inputs:
11
- package:
12
- description: 'Package to publish (slug from packages/ directory, or "all")'
13
- type: string
14
- default: all
15
- required: true
16
-
17
- permissions:
18
- contents: write
19
-
20
- jobs:
21
- determine-packages:
22
- if: github.actor != 'github-actions[bot]'
23
- runs-on: ubuntu-latest
24
- outputs:
25
- packages: ${{ steps.set-matrix.outputs.packages }}
26
- count: ${{ steps.set-matrix.outputs.count }}
27
- steps:
28
- - name: Checkout repository
29
- uses: actions/checkout@v4
30
- with:
31
- fetch-depth: 0
32
-
33
- - name: Detect changed packages
34
- id: changed
35
- uses: tj-actions/changed-files@v45
36
- with:
37
- json: true
38
- files: packages/*/**
39
-
40
- - name: Build package matrix
41
- id: set-matrix
42
- env:
43
- INPUT_PACKAGE: ${{ github.event.inputs.package || '' }}
44
- CHANGED_FILES: ${{ steps.changed.outputs.all_changed_files }}
45
- run: |
46
- declare -a packages=()
47
- declare -A changed_packages
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
53
- changed_packages["${BASH_REMATCH[1]}"]=1
54
- fi
55
- done
56
- fi
57
-
58
- # Iterate all packages
59
- for dir in packages/*/; do
60
- [ ! -f "$dir/package.json" ] && continue
61
-
62
- slug=$(basename "$dir")
63
- dir="${dir%/}" # Remove trailing slash
64
- name=$(jq -r '.name // empty' "$dir/package.json")
65
- is_private=$(jq -r '.private // false' "$dir/package.json")
66
-
67
- [ "$is_private" = "true" ] && continue
68
- [ -z "$name" ] && continue
69
-
70
- # Include package?
71
- should_include=false
72
- if [ -n "$INPUT_PACKAGE" ]; then
73
- [ "$INPUT_PACKAGE" = "all" ] || [ "$INPUT_PACKAGE" = "$slug" ] && should_include=true
74
- else
75
- [ -n "${changed_packages[$slug]}" ] && should_include=true
76
- fi
77
-
78
- [ "$should_include" = true ] && packages+=("{\"name\":\"$name\",\"dir\":\"$dir\"}")
79
- done
80
-
81
- # Output
82
- if [ ${#packages[@]} -eq 0 ]; then
83
- echo "packages=[]" >> "$GITHUB_OUTPUT"
84
- echo "count=0" >> "$GITHUB_OUTPUT"
85
- else
86
- echo "packages=[$(IFS=,; echo "${packages[*]}")]" >> "$GITHUB_OUTPUT"
87
- echo "count=${#packages[@]}" >> "$GITHUB_OUTPUT"
88
- echo "๐Ÿ“ฆ Packages to publish: ${#packages[@]}"
89
- fi
90
-
91
- # Build all packages in dependency order using Turborepo
92
- # This ensures infrastructure is built AFTER cloudevents (which it depends on)
93
- build-all:
94
- name: Build all packages
95
- needs: determine-packages
96
- if: needs.determine-packages.outputs.count != '0'
97
- runs-on: ubuntu-latest
98
- steps:
99
- - uses: actions/checkout@v4
100
-
101
- - name: Setup Bun and install dependencies
102
- uses: ./.github/actions/setup-bun-install
103
- with:
104
- enable-cache: 'true'
105
- cache-key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}
106
- cache-restore-keys: bun-${{ runner.os }}-
107
-
108
- - name: Build all packages
109
- run: bunx turbo run build --filter='./packages/*'
110
-
111
- - name: Upload build artifacts
112
- uses: actions/upload-artifact@v4
113
- with:
114
- name: dist-packages
115
- path: |
116
- packages/*/dist
117
- packages/*/bin
118
- packages/*/*.md
119
- packages/*/LICENSE
120
- packages/*/*.png
121
- packages/*/schemas
122
- packages/*/*.sh
123
- retention-days: 1
124
-
125
- # Publish packages sequentially (max-parallel: 1)
126
- # Build artifacts are already available from build-all job
127
- publish:
128
- name: Publish ${{ matrix.package.name }}
129
- needs: [determine-packages, build-all]
130
- if: needs.determine-packages.outputs.count != '0'
131
- runs-on: ubuntu-latest
132
- strategy:
133
- max-parallel: 1
134
- matrix:
135
- package: ${{ fromJson(needs.determine-packages.outputs.packages) }}
136
- steps:
137
- - uses: actions/checkout@v4
138
-
139
- - name: Setup Bun and install dependencies
140
- uses: ./.github/actions/setup-bun-install
141
- with:
142
- enable-cache: 'true'
143
- cache-key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}
144
- cache-restore-keys: bun-${{ runner.os }}-
145
-
146
- - name: Download build artifacts
147
- uses: actions/download-artifact@v4
148
- with:
149
- name: dist-packages
150
- path: packages
151
-
152
- - name: Verify build artifacts
153
- run: |
154
- echo "๐Ÿ“‚ Checking ${{ matrix.package.dir }}"
155
- ls -la "${{ matrix.package.dir }}" || true
156
- if [ ! -d "${{ matrix.package.dir }}/dist" ] && [ ! -d "${{ matrix.package.dir }}/bin" ]; then
157
- echo "โŒ Build artifacts missing for ${{ matrix.package.name }}"
158
- echo "๐Ÿ“‚ packages/ contents:"
159
- ls -la packages/
160
- exit 1
161
- fi
162
- echo "โœ… Build artifacts found for ${{ matrix.package.name }}"
163
-
164
- - name: Bump version
165
- id: bump
166
- working-directory: ${{ matrix.package.dir }}
167
- run: |
168
- CURRENT=$(jq -r '.version' package.json)
169
- PUBLISHED=$(npm view "${{ matrix.package.name }}" version 2>/dev/null || echo "0.0.0")
170
-
171
- if [ "$CURRENT" = "$PUBLISHED" ]; then
172
- # Auto-bump patch version
173
- NEW="${CURRENT%.*}.$((${CURRENT##*.} + 1))"
174
- jq --arg v "$NEW" '.version = $v' package.json > tmp && mv tmp package.json
175
- echo "version=$NEW" >> "$GITHUB_OUTPUT"
176
- echo "bumped=true" >> "$GITHUB_OUTPUT"
177
- echo "๐Ÿ“ฆ Bumped: $CURRENT โ†’ $NEW"
178
- else
179
- # Use manual version
180
- echo "version=$CURRENT" >> "$GITHUB_OUTPUT"
181
- echo "bumped=false" >> "$GITHUB_OUTPUT"
182
- echo "๐Ÿ“ฆ Manual version: $CURRENT (npm: $PUBLISHED)"
183
- fi
184
-
185
- - name: Publish to npm
186
- working-directory: ${{ matrix.package.dir }}
187
- env:
188
- NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
189
- run: |
190
- echo "๐Ÿ“ฆ Publishing ${{ matrix.package.name }}@${{ steps.bump.outputs.version }}"
191
- bun publish --access=public --provenance --tolerate-republish
192
-
193
- - name: Commit version bump
194
- if: steps.bump.outputs.bumped == 'true'
195
- env:
196
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
197
- run: |
198
- git config user.name "github-actions[bot]"
199
- git config user.email "github-actions[bot]@users.noreply.github.com"
200
- git add "${{ matrix.package.dir }}/package.json"
201
- git diff --cached --quiet || git commit -m "chore(release): ${{ matrix.package.name }}@${{ steps.bump.outputs.version }}"
202
- git pull --rebase origin ${{ github.ref_name }} && git push || true
File without changes
File without changes
File without changes
File without changes
File without changes