Skip to content

Commit

Permalink
fix: move test-helpers, depdencies to packages so they are not "special"
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwremmel committed Jun 11, 2024
1 parent 4bd0854 commit 84a3087
Show file tree
Hide file tree
Showing 33 changed files with 248 additions and 34 deletions.
1 change: 1 addition & 0 deletions examples/aws-authorizer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"private": true,
"dependencies": {
"@clc/dependencies": "*",
"@code-like-a-carpenter/contract-tests": "*",
"@code-like-a-carpenter/env": "*",
"@code-like-a-carpenter/errors": "*",
Expand Down
4 changes: 2 additions & 2 deletions examples/aws-authorizer/src/authorizer.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {exceptionTracingService} from '@clc/dependencies';

import {
Forbidden,
NotFound,
Expand All @@ -9,8 +11,6 @@ import {
handleRestTokenAuthorizerEvent,
} from '@code-like-a-carpenter/lambda-handlers';

import {exceptionTracingService} from '../../dependencies.mts';

type AuthorizerContext =
| {
scheme: 'Bearer';
Expand Down
4 changes: 2 additions & 2 deletions examples/aws-authorizer/src/ping.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {handleRestEvent} from '@code-like-a-carpenter/lambda-handlers';
import {exceptionTracingService} from '@clc/dependencies';

import {exceptionTracingService} from '../../dependencies.mts';
import {handleRestEvent} from '@code-like-a-carpenter/lambda-handlers';

import type {operations} from './__generated__/api.ts';

Expand Down
1 change: 1 addition & 0 deletions examples/aws-otel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"private": true,
"dependencies": {
"@clc/dependencies": "*",
"@code-like-a-carpenter/contract-tests": "*",
"@code-like-a-carpenter/env": "*",
"@code-like-a-carpenter/lambda-handlers": "*",
Expand Down
4 changes: 2 additions & 2 deletions examples/aws-otel/src/ping.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {exceptionTracingService} from '@clc/dependencies';

import {handleRestEvent} from '@code-like-a-carpenter/lambda-handlers';
import {runWithNewSpan} from '@code-like-a-carpenter/telemetry';

import {exceptionTracingService} from '../../dependencies.mts';

import type {operations} from './__generated__/api.ts';

export const ping = handleRestEvent<operations['ping']>(async (event) => {
Expand Down
1 change: 1 addition & 0 deletions examples/basic-wiring/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"private": true,
"dependencies": {
"@clc/dependencies": "*",
"@code-like-a-carpenter/contract-tests": "*",
"@code-like-a-carpenter/env": "*",
"@code-like-a-carpenter/errors": "*",
Expand Down
4 changes: 2 additions & 2 deletions examples/basic-wiring/src/errors.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {exceptionTracingService} from '@clc/dependencies';

import {
BadRequest,
Forbidden,
Expand Down Expand Up @@ -42,8 +44,6 @@ import {
} from '@code-like-a-carpenter/errors';
import {handleRestEvent} from '@code-like-a-carpenter/lambda-handlers';

import {exceptionTracingService} from '../../dependencies.mts';

import type {operations} from './__generated__/api.ts';

export const errors = handleRestEvent<operations['errors']>(
Expand Down
4 changes: 2 additions & 2 deletions examples/basic-wiring/src/ping.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {handleRestEvent} from '@code-like-a-carpenter/lambda-handlers';
import {exceptionTracingService} from '@clc/dependencies';

import {exceptionTracingService} from '../../dependencies.mts';
import {handleRestEvent} from '@code-like-a-carpenter/lambda-handlers';

import type {operations} from './__generated__/api.ts';

Expand Down
4 changes: 2 additions & 2 deletions examples/basic-wiring/src/root.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {handleRestEvent} from '@code-like-a-carpenter/lambda-handlers';
import {exceptionTracingService} from '@clc/dependencies';

import {exceptionTracingService} from '../../dependencies.mts';
import {handleRestEvent} from '@code-like-a-carpenter/lambda-handlers';

import type {operations} from './__generated__/api.ts';

Expand Down
2 changes: 1 addition & 1 deletion examples/subscription-webhooks/.foundationrc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type {import('@code-like-a-carpenter/tool-foundation').InputConfig} */
const config = {
dependenciesModuleId: '../dependencies.mts',
dependenciesModuleId: '@clc/dependencies',
// Note that there's shared state between the CloudFormation and TypeScript
// plugins, so config that's read be the parser needs to be the same.
dispatcherDefaults: {
Expand Down

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

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

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

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

2 changes: 1 addition & 1 deletion examples/subscription-webhooks/__generated__/graphql.ts

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

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

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

1 change: 1 addition & 0 deletions examples/subscription-webhooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"@aws-sdk/lib-dynamodb": "3.188.0",
"@aws-sdk/smithy-client": "3.188.0",
"@aws-sdk/util-dynamodb": "3.188.0",
"@clc/dependencies": "*",
"@code-like-a-carpenter/assert": "*",
"@code-like-a-carpenter/foundation-runtime": "*",
"@code-like-a-carpenter/tool-foundation": "*",
Expand Down
3 changes: 1 addition & 2 deletions examples/subscription-webhooks/subscription-webhooks.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import assert from 'assert';

import {DeleteCommand} from '@aws-sdk/lib-dynamodb';
import {ddbDocClient} from '@clc/dependencies';
import {faker} from '@faker-js/faker';

import {NotFoundError} from '@code-like-a-carpenter/foundation-runtime';
import {waitFor} from '@code-like-a-carpenter/wait-for';

import {ddbDocClient} from '../dependencies.mts';

import type {SubscriptionEventPrimaryKey} from './__generated__/graphql.ts';
import {
createSubscriptionEvent,
Expand Down
2 changes: 1 addition & 1 deletion examples/user-session/.foundationrc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type {import('@code-like-a-carpenter/tool-foundation').InputConfig} */
const config = {
dependenciesModuleId: '../dependencies.mts',
dependenciesModuleId: '@clc/dependencies',
// Note that there's shared state between the CloudFormation and TypeScript
// plugins, so config that's read be the parser needs to be the same.
dispatcherDefaults: {
Expand Down
3 changes: 1 addition & 2 deletions examples/user-session/__generated__/graphql.ts

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

2 changes: 2 additions & 0 deletions examples/user-session/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"@aws-sdk/lib-dynamodb": "3.188.0",
"@aws-sdk/smithy-client": "3.188.0",
"@aws-sdk/util-dynamodb": "3.188.0",
"@clc/dependencies": "*",
"@clc/test-helpers": "*",
"@code-like-a-carpenter/assert": "*",
"@code-like-a-carpenter/foundation-runtime": "*",
"@code-like-a-carpenter/tool-foundation": "*",
Expand Down
3 changes: 1 addition & 2 deletions examples/user-session/user-session.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import assert from 'assert';

import {load} from '@clc/test-helpers';
import {faker} from '@faker-js/faker';
import Base64Import from 'base64url';

Expand All @@ -8,8 +9,6 @@ import {
OptimisticLockingError,
} from '@code-like-a-carpenter/foundation-runtime';

import {load} from '../test-helpers.mts';

import {
blindWriteUserSession,
createUserSession,
Expand Down
40 changes: 38 additions & 2 deletions package-lock.json

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

34 changes: 34 additions & 0 deletions packages/@clc/dependencies/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# @clc/dependencies

[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)

> foundation dependencies for examples
## Table of Contents

- [Install](#install)
- [Usage](#usage)
- [Maintainer](#maintainer)
- [Contributing](#contributing)
- [License](#license)

## Install

```bash
npm i @clc/dependencies
```

## Usage

## Maintainer

[Ian Remmel](https://www.ianwremmel.com)

## Contributing

Please see contributing guidelines at the
[project homepage](https://www.github.com/code-like-a-carpenter/workbench/).

## License

MIT © [Ian Remmel](https://www.ianwremmel.com) 2023 until at least now
Loading

0 comments on commit 84a3087

Please sign in to comment.