Skip to content

Commit

Permalink
feat: publish infra to npm (#68)
Browse files Browse the repository at this point in the history
This PR publishes infra code to npm, so that it can be used in w3infra
tests.

Note: renames `lambda` => `infra` since that's a better name.
  • Loading branch information
Alan Shaw authored Jun 11, 2024
1 parent e5187b8 commit a29ebcc
Show file tree
Hide file tree
Showing 19 changed files with 114 additions and 21 deletions.
3 changes: 2 additions & 1 deletion .github/release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"separate-pull-requests": true,
"packages": {
"packages/cli": {},
"packages/core": {}
"packages/core": {},
"packages/infra": {}
}
}
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ on:
type: boolean
description: release packages/core even if it normally wouldn't (e.g. due to release-please checks)
default: false
force_release_infra:
type: boolean
description: release packages/infra even if it normally wouldn't (e.g. due to release-please checks)
default: false

jobs:
release:
Expand Down Expand Up @@ -79,3 +83,27 @@ jobs:
- run: npm publish --access=public --workspace=packages/cli --provenance
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
npm-infra:
name: npm publish @web3-storage/content-claims-infra
needs: release
if: contains(fromJson(needs.release.outputs.paths_released), 'packages/infra') || inputs.force_release_infra
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- run: npm ci
- run: npm run build --workspace=packages/infra
- run: npm publish --access=public --workspace=packages/infra --provenance
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ For more CLI Usage instructions, see the [content-claims-cli README](./packages/
The repo contains the infra deployment code and the service implementation.

```
├── packages - content-claims core and lambda wrapper
├── packages - content-claims core, CLI and AWS infra
└── stacks - sst and AWS CDK code to deploy all the things
```
Expand Down
58 changes: 44 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 35 additions & 2 deletions packages/lambda/package.json → packages/infra/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,44 @@
{
"name": "@web3-storage/content-claims-lambda",
"name": "@web3-storage/content-claims-infra",
"version": "0.0.0",
"type": "module",
"private": true,
"scripts": {
"build": "tsc --build",
"lint": "standard && tsc",
"test": "ava --verbose --timeout=5m --no-worker-threads --serial"
},
"files": [
"src",
"tsconfig.json",
"types"
],
"exports": {
".": {
"import": "./types/content-claims.js",
"types": "./types/content-claims.d.ts"
},
"./lib/config": {
"import": "./types/lib/config.js",
"types": "./types/lib/config.d.ts"
},
"./lib/store": {
"import": "./types/lib/store/index.js",
"types": "./types/lib/store/index.d.ts"
}
},
"typesVersions": {
"*": {
"*": [
"types/*"
],
"lib/config": [
"types/lib/config.d.ts"
],
"lib/store": [
"types/lib/store/index.d.ts"
]
}
},
"dependencies": {
"@aws-sdk/client-dynamodb": "^3.563.0",
"@aws-sdk/client-s3": "^3.563.0",
Expand All @@ -16,6 +48,7 @@
"@ucanto/principal": "^9.0.1",
"@ucanto/server": "^10.0.0",
"@ucanto/transport": "^9.1.1",
"@web3-storage/content-claims": "^5.1.0",
"cardex": "^3.0.2",
"carstream": "^2.0.0",
"multiformats": "^13.1.0",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"include": ["src"],
"exclude": ["node_modules", "types"],
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"noEmit": true,
"outDir": "dist",
"emitDeclarationOnly": false,
"outDir": "types",
"allowJs": true,
"checkJs": true,
"strict": true,
Expand Down
2 changes: 1 addition & 1 deletion stacks/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function API ({ stack }) {
const { claimsBucket } = use(Bucket)

const fun = new Function(stack, 'fn', {
handler: 'packages/lambda/src/content-claims.handler',
handler: 'packages/infra/src/content-claims.handler',
url: {
cors: true,
authorizer: 'none'
Expand Down

0 comments on commit a29ebcc

Please sign in to comment.