Skip to content

Commit fe87550

Browse files
authored
fix!: version 3 (#6)
Changes: + Update dependencies (support Sveltekit 2) + Remove yarn + Use moduleResolution nodenext in tsconfig + Fix tests + Update workflows
1 parent 7445ba7 commit fe87550

19 files changed

+141
-143
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ on:
77
jobs:
88
release:
99
name: Release (${{ github.event.workflow_run.head_commit.id }})
10-
if: ${{ github.event.workflow_run.head_branch == 'main' && github.event.workflow_run.conclusion == 'success' }}
10+
if: ${{ github.event.workflow_run.head_branch == 'main' && github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'Data-Only-Greater'}}
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@v4
1515
with:
1616
fetch-depth: 0
1717
- name: Setup Node.js
18-
uses: actions/setup-node@v3
18+
uses: actions/setup-node@v4
1919
with:
2020
node-version: 'lts/*'
2121
registry-url: 'https://registry.npmjs.org'

.github/workflows/unit_tests.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,30 @@ jobs:
77
fail-fast: false
88
matrix:
99
os: [windows-latest, ubuntu-latest]
10-
node-version: [16, 18]
10+
node-version: [18, 20]
1111
runs-on: ${{ matrix.os }}
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
- name: Install Node
15-
uses: actions/setup-node@v3
15+
uses: actions/setup-node@v4
1616
with:
1717
node-version: ${{ matrix.node-version }}
1818
- name: Install dependencies
19-
run: yarn install
19+
run: npm install
2020
- name: Test
21-
run: yarn run test run --reporter verbose
21+
run: npm run test -- run --reporter verbose
2222
coverage:
2323
needs: 'test'
2424
runs-on: ubuntu-latest
2525
steps:
26-
- uses: actions/checkout@v3
26+
- uses: actions/checkout@v4
2727
- name: Install Node
28-
uses: actions/setup-node@v3
28+
uses: actions/setup-node@v4
2929
with:
30-
node-version: 18
30+
node-version: 20
3131
- name: Install dependencies
32-
run: yarn install
32+
run: npm install
3333
- name: Generate coverage report
34-
run: yarn run coverage
34+
run: npm run coverage
3535
- name: Upload coverage reports to Codecov with GitHub Action
36-
uses: codecov/codecov-action@v3
36+
uses: codecov/codecov-action@v4

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
node_modules
44
dist
55
coverage
6-
yarn.lock
6+
package-lock.json
77
!release.config.js

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"editor.formatOnSave": true
3+
}

bin/destroy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { createRequire } from 'module'
88

99
import yargs from 'yargs/yargs'
1010

11-
import { AWSAdapterProps } from '../adapter'
11+
import { AWSAdapterProps } from '../adapter.js'
1212

1313
const __dirname = fileURLToPath(new URL('.', import.meta.url))
1414

@@ -52,7 +52,7 @@ export async function main(args: string[]): Promise<void> {
5252
describe: 'cancel ongoing stack updates',
5353
type: 'boolean',
5454
})
55-
}
55+
},
5656
)
5757
.alias('h', 'help')
5858
.help()
@@ -136,7 +136,7 @@ export async function main(args: string[]): Promise<void> {
136136
cwd: pulumiPath,
137137
stdio: [process.stdin, process.stdout, process.stderr],
138138
env: process.env,
139-
}
139+
},
140140
)
141141

142142
if (comRes.status === null) {

package.json

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"adapter-stack-destroy": "./bin/destroy.js"
3232
},
3333
"scripts": {
34-
"build": "yarn clean && tsc --project tsconfig.build.json && yarn copy-files",
34+
"build": "npm run clean && tsc --project tsconfig.build.json && npm run copy-files",
3535
"watch": "tsc -w --excludeFiles test",
3636
"format": "prettier --write .",
3737
"test": "vitest",
@@ -40,46 +40,41 @@
4040
"coverage": "vitest run --coverage"
4141
},
4242
"devDependencies": {
43-
"@types/folder-hash": "^4.0.2",
44-
"@types/lodash": "^4.14.191",
45-
"@types/mime": "^3.0.1",
46-
"@types/minimist": "^1.2.2",
47-
"@types/node": "18.16.3",
48-
"@types/yargs": "^17.0.24",
49-
"@vitest/coverage-c8": "^0.31.0",
43+
"@types/folder-hash": "^4.0.4",
44+
"@types/lodash": "^4.17.1",
45+
"@types/minimist": "^1.2.5",
46+
"@types/node": "20.12.12",
47+
"@types/yargs": "^17.0.32",
5048
"copyfiles": "^2.4.1",
51-
"prettier": "^2.8.8",
52-
"rimraf": "^5.0.0",
53-
"typescript": "^5.0.4",
54-
"vitest": "^0.31.0"
49+
"prettier": "^3.2.5",
50+
"rimraf": "^5.0.7",
51+
"typescript": "^5.4.5",
52+
"vitest": "^1.6.0"
5553
},
5654
"dependencies": {
57-
"@pulumi/aws": "^5.39.0",
58-
"@pulumi/command": "^0.7.1",
59-
"@pulumi/pulumi": "^3.66.0",
60-
"dotenv": "^16.0.3",
55+
"@pulumi/aws": "^6.36.0",
56+
"@pulumi/command": "^0.10.0",
57+
"@pulumi/pulumi": "^3.116.1",
58+
"@vitest/coverage-v8": "^1.6.0",
59+
"dotenv": "^16.4.5",
6160
"folder-hash": "^4.0.4",
6261
"lodash": "^4.17.21",
63-
"sveltekit-adapter-aws-base": "^2.2.2",
62+
"mime": "^4.0.3",
63+
"sveltekit-adapter-aws-base": "^3.0.1",
6464
"yargs": "^17.7.2"
6565
},
6666
"peerDependencies": {
67-
"@sveltejs/kit": "^1.15.2"
67+
"@sveltejs/kit": "^2.5.8"
6868
},
69-
"resolutions": {
70-
"vitest/**/vite": "~4.2.0"
69+
"engines": {
70+
"node": ">=18.13"
7171
},
7272
"release": {
7373
"branches": [
7474
"main"
7575
],
7676
"plugins": [
77-
[
78-
"@semantic-release/commit-analyzer",
79-
{
80-
"preset": "conventionalcommits"
81-
}
82-
],
77+
"@semantic-release/commit-analyzer",
8378
"@semantic-release/release-notes-generator",
8479
[
8580
"@semantic-release/changelog",
@@ -103,6 +98,7 @@
10398
"message": "chore(release): set `package.json` to ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
10499
}
105100
]
106-
]
101+
],
102+
"preset": "conventionalcommits"
107103
}
108104
}

stacks/main/resources.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import * as fs from 'fs'
2-
import * as mime from 'mime'
32
import * as path from 'path'
3+
import mime from 'mime'
44

55
import * as aws from '@pulumi/aws'
66
import * as pulumi from '@pulumi/pulumi'
77
import { local } from '@pulumi/command'
88

9-
import { NameRegister } from '../utils'
9+
import { NameRegister } from '../utils.js'
1010

1111
const nameRegister = NameRegister.getInstance()
1212
let registerName = (name: string): string => {
@@ -25,12 +25,12 @@ export function getLambdaRole(functionArns?: string[]): aws.iam.Role {
2525
{
2626
type: string
2727
identifiers: string[]
28-
}
28+
},
2929
]
3030
actions: string[]
3131
effect: string
3232
resources?: string[]
33-
}
33+
},
3434
]
3535
}
3636

@@ -59,7 +59,7 @@ export function getLambdaRole(functionArns?: string[]): aws.iam.Role {
5959
{
6060
role: iamForLambda.name,
6161
policyArn: aws.iam.ManagedPolicy.AWSLambdaBasicExecutionRole,
62-
}
62+
},
6363
)
6464

6565
if (functionArns) {
@@ -90,7 +90,7 @@ export function getLambdaRole(functionArns?: string[]): aws.iam.Role {
9090

9191
export function buildRouter(
9292
iamForLambda: aws.iam.Role,
93-
routerPath: string
93+
routerPath: string,
9494
): aws.lambda.Function {
9595
const routerHandler = new aws.lambda.Function(
9696
registerName('LambdaRouterFunctionHandler'),
@@ -102,15 +102,15 @@ export function buildRouter(
102102
memorySize: 128,
103103
publish: true,
104104
},
105-
{ provider: eastRegion }
105+
{ provider: eastRegion },
106106
)
107107

108108
return routerHandler
109109
}
110110

111111
export function validateCertificate(
112112
FQDN: string,
113-
domainName: string
113+
domainName: string,
114114
): pulumi.Output<string> {
115115
if (!FQDN.includes(domainName)) {
116116
throw new Error('FQDN must contain domainName')
@@ -122,7 +122,7 @@ export function validateCertificate(
122122
domainName: FQDN,
123123
validationMethod: 'DNS',
124124
},
125-
{ provider: eastRegion }
125+
{ provider: eastRegion },
126126
)
127127

128128
const hostedZone = aws.route53.getZone({
@@ -138,7 +138,7 @@ export function validateCertificate(
138138
ttl: 60,
139139
type: certificate.domainValidationOptions[0].resourceRecordType,
140140
zoneId: hostedZone.then((x) => x.zoneId),
141-
}
141+
},
142142
)
143143

144144
const certificateValidation = new aws.acm.CertificateValidation(
@@ -147,15 +147,15 @@ export function validateCertificate(
147147
certificateArn: certificate.arn,
148148
validationRecordFqdns: [validationRecord.fqdn],
149149
},
150-
{ provider: eastRegion }
150+
{ provider: eastRegion },
151151
)
152152

153153
return certificateValidation.certificateArn
154154
}
155155

156156
export function buildStatic(
157157
staticPath: string,
158-
prerenderedPath: string
158+
prerenderedPath: string,
159159
): aws.s3.Bucket {
160160
const bucket = new aws.s3.Bucket(registerName('StaticContentBucket'), {
161161
acl: 'private',
@@ -200,7 +200,7 @@ export function uploadStatic(dirPath: string, bucket: aws.s3.Bucket) {
200200
},
201201
{
202202
parent: bucket,
203-
}
203+
},
204204
)
205205
})
206206
}
@@ -210,7 +210,7 @@ export function buildCDN(
210210
bucket: aws.s3.Bucket,
211211
serverHeaders: string[],
212212
FQDN?: string,
213-
certificateArn?: pulumi.Input<string>
213+
certificateArn?: pulumi.Input<string>,
214214
): aws.cloudfront.Distribution {
215215
const defaultRequestPolicy = new aws.cloudfront.OriginRequestPolicy(
216216
registerName('DefaultRequestPolicy'),
@@ -227,7 +227,7 @@ export function buildCDN(
227227
queryStringsConfig: {
228228
queryStringBehavior: 'all',
229229
},
230-
}
230+
},
231231
)
232232

233233
const oac = new aws.cloudfront.OriginAccessControl(
@@ -238,7 +238,7 @@ export function buildCDN(
238238
originAccessControlOriginType: 's3',
239239
signingBehavior: 'no-override',
240240
signingProtocol: 'sigv4',
241-
}
241+
},
242242
)
243243

244244
const optimizedCachePolicy = aws.cloudfront.getCachePolicyOutput({
@@ -300,7 +300,7 @@ export function buildCDN(
300300
restrictionType: 'none',
301301
},
302302
},
303-
}
303+
},
304304
)
305305

306306
const cloudFrontPolicyDocument = aws.iam.getPolicyDocumentOutput({
@@ -348,7 +348,7 @@ export function buildCDN(
348348
{
349349
bucket: bucket.id,
350350
policy: cloudFrontPolicyDocument.apply((policy) => policy.json),
351-
}
351+
},
352352
)
353353

354354
return distribution
@@ -358,7 +358,7 @@ export function buildCDN(
358358
// distribution.
359359
export function createAliasRecord(
360360
targetDomain: string,
361-
distribution: aws.cloudfront.Distribution
361+
distribution: aws.cloudfront.Distribution,
362362
): aws.route53.Record {
363363
const domainParts = exports.getDomainAndSubdomain(targetDomain)
364364
const hostedZoneId = aws.route53
@@ -404,7 +404,7 @@ export function getDomainAndSubdomain(domain: string): {
404404
export function buildInvalidator(
405405
distribution: aws.cloudfront.Distribution,
406406
staticPath: string,
407-
prerenderedPath: string
407+
prerenderedPath: string,
408408
) {
409409
interface PathHashResourceInputs {
410410
path: pulumi.Input<string>
@@ -427,7 +427,7 @@ export function buildInvalidator(
427427
async diff(
428428
id: string,
429429
previousOutput: PathHashOutputs,
430-
news: PathHashInputs
430+
news: PathHashInputs,
431431
): Promise<pulumi.dynamic.DiffResult> {
432432
const replaces: string[] = []
433433
let changes = true
@@ -458,7 +458,7 @@ export function buildInvalidator(
458458
constructor(
459459
name: string,
460460
args: PathHashResourceInputs,
461-
opts?: pulumi.CustomResourceOptions
461+
opts?: pulumi.CustomResourceOptions,
462462
) {
463463
super(pathHashProvider, name, { hash: undefined, ...args }, opts)
464464
}
@@ -480,6 +480,6 @@ export function buildInvalidator(
480480
},
481481
{
482482
dependsOn: [distribution],
483-
}
483+
},
484484
)
485485
}

0 commit comments

Comments
 (0)