Skip to content

Commit

Permalink
fixed got-api deps
Browse files Browse the repository at this point in the history
  • Loading branch information
vinnichase committed Jun 9, 2024
1 parent fd5ce00 commit 6f914d4
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
Binary file modified bun.lockb
Binary file not shown.
5 changes: 3 additions & 2 deletions packages/got-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gothub/got-api",
"version": "0.0.5",
"version": "0.0.6",
"license": "MIT",
"type": "module",
"module": "client-js/index.ts",
Expand All @@ -15,15 +15,16 @@
"@types/bun": "latest",
"@types/ramda": "^0.29.12",
"@gothub/typescript-util": "workspace:*",
"@gothub/got-api-test": "workspace:*",
"openapi-types": "^12.1.3",
"quicktype-core": "^6.0.71",
"ramda": "^0.29.1"
},
"peerDependencies": {
"@gothub-team/got-srp": "^0.3.20",
"typescript": "^5.0.0"
},
"dependencies": {
"@gothub-team/got-srp": "^0.3.20",
"@gothub/got-core": "workspace:^",
"sst": "ion"
}
Expand Down
33 changes: 33 additions & 0 deletions packages/got-api/sst.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@

import * as gotiac from '@gothub/pulumi-gotiac-aws';
import * as path from 'path';
import * as fs from 'fs';
import { AWS_PROFILE, AWS_REGION, GOT_API_DOMAIN, USER_POOL_ID, parseEnv } from '@gothub/typescript-util';
import { TEST_ADMIN_EMAIL, TEST_USER_1_EMAIL, TEST_USER_2_EMAIL } from '@gothub/got-api-test/env';

const env = parseEnv({
AWS_PROFILE,
AWS_REGION,
USER_POOL_ID,
GOT_API_DOMAIN,
TEST_ADMIN_EMAIL,
TEST_USER_1_EMAIL,
TEST_USER_2_EMAIL,
});

export default $config({
Expand All @@ -34,6 +39,34 @@ export default $config({
runtime: 'nodejs20.x',
codePath: path.join(process.cwd(), 'dist/lambda/zips'),
});

testResources({ userPool });

return api;
},
});

const testResources = ({ userPool }: { userPool: gotiac.UserPool }) => {
const testAdmin = new gotiac.TestUser('TestAdmin', {
userPoolId: userPool.userPoolId,
email: env.TEST_ADMIN_EMAIL,
});
const testUser1 = new gotiac.TestUser('TestUser1', {
userPoolId: userPool.userPoolId,
email: env.TEST_USER_1_EMAIL,
});
const testUser2 = new gotiac.TestUser('TestUser2', {
userPoolId: userPool.userPoolId,
email: env.TEST_USER_2_EMAIL,
});
fs.writeFileSync('.test-users.env', '# Automatically generated test users. Do not edit this file.\n');
testAdmin.password.apply((password) => {
fs.appendFileSync('.test-users.env', `export TEST_ADMIN_PW='${password}'\n`);
});
testUser1.password.apply((password) => {
fs.appendFileSync('.test-users.env', `export TEST_USER_1_PW='${password}'\n`);
});
testUser2.password.apply((password) => {
fs.appendFileSync('.test-users.env', `export TEST_USER_2_PW='${password}'\n`);
});
};

0 comments on commit 6f914d4

Please sign in to comment.