Skip to content

Commit

Permalink
fix: props not required
Browse files Browse the repository at this point in the history
  • Loading branch information
Slavo Vojacek committed Mar 14, 2022
1 parent e37b209 commit 3c806dd
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 17 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/semantic-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,20 @@ jobs:
node-version: '16.x'
registry-url: 'https://npm.pkg.github.com'

- name: Run semantic release
- name: Build the Lambda functions package
working-directory: ./lambda-functions
run: |
npm ci
npm run build
npx semantic-release
- name: Build the construct package
run: |
npm ci
npm run build
cp -r lambda-functions/dist dist/constructs/lambda/assets
- name: Run semantic release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:

- name: Check format, lint and build from source
run: |
npm ci --ignore-scripts
npm ci
npm run format:check
npm run lint:check
npx tsc
npm run build
# TODO: add test step

test-lambda-functions:
Expand All @@ -50,8 +50,8 @@ jobs:
- name: Check format, lint and build from source
working-directory: ./lambda-functions
run: |
npm ci --ignore-scripts
npm ci
npm run format:check
npm run lint:check
npx tsc
npm run build
# TODO: add test step
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,33 @@ cdk init app --language typescript
npx cdk bootstrap --profile dev
```

Make sure you're authenticated with the GitHub registry (GitHub PAT with `registry:read` access is enough):

```
npm config set @sniptt-official:registry https://npm.pkg.github.com
npm config set -- '//npm.pkg.github.com/:_authToken' $GITHUB_TOKEN
```

Install the `ots-aws` construct:

```
echo '@sniptt-official:registry=https://npm.pkg.github.com' >> .npmrc
npm i @sniptt-official/ots-aws
```

Add the `ots-aws` construct to your stack:

```
# ...
```ts
import { Ots } from '@sniptt-official/ots-aws';
import { Stack, StackProps } from 'aws-cdk-lib';
import { Construct } from 'constructs';

export class DevStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);

const ots = new Ots(this, 'Ots');
}
}
```

Deploy:
Expand Down
8 changes: 3 additions & 5 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ export class Ots extends Construct {
readonly createSecretFunction: CreateSecretFunction;
readonly getSecretFunction: GetSecretFunction;

constructor(
scope: Construct,
id: string,
{ tableProps, restApiProps, rateLimitedApiKeyProps, functionProps }: OtsProps
) {
constructor(scope: Construct, id: string, props: OtsProps = {}) {
super(scope, id);

const { tableProps, restApiProps, rateLimitedApiKeyProps, functionProps } = props;

// Create a table for persisting secrets
this.table = new Table(this, 'Table', { tableProps });

Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
"!dist/*.tsbuildinfo"
],
"scripts": {
"postinstall": "cd lambda-functions; npm ci",
"build": "tsc; cd lambda-functions; npm run build",
"postbuild": "cp -r lambda-functions/dist dist/constructs/lambda/assets",
"build": "tsc",
"test": "jest",
"format": "prettier --write '{.github,lib,test}/**' '*.json'",
"format:check": "prettier --check '{.github,lib,test}/**' '*.json'",
Expand Down

0 comments on commit 3c806dd

Please sign in to comment.