Skip to content

Commit

Permalink
use @netacea/cloudfront@5.2.44
Browse files Browse the repository at this point in the history
  • Loading branch information
rswalkden committed May 22, 2024
1 parent 66ac722 commit 00c40b7
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ dist
.tern-port

# release zip
netacea-cloudfront.zip
netacea-cloudfront*.zip
24 changes: 12 additions & 12 deletions package-lock.json

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

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "Template for CloudFront Lambda@Edge including Netacea worker scripts",
"main": "./dist/index.js",
"scripts": {
"lint": "npx xo ./src/**/*.ts"
"lint": "npx xo ./src/**/*.ts",
"upgrade": "npm i @netacea/cloudfront@latest && bash ./scripts/create-zip.sh"
},
"repository": {
"type": "git",
Expand All @@ -29,7 +30,7 @@
"xo": "^0.55.0"
},
"dependencies": {
"@netacea/cloudfront": "^5.2.38"
"@netacea/cloudfront": "^5.2.44"
},
"xo": {
"space": true,
Expand Down
21 changes: 15 additions & 6 deletions scripts/create-zip.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
#!/bin/bash
set -e -o pipefail

rm -rf netacea-cloudfront.zip ./dist ./node_modules
# Clean-up old assets
rm -rf netacea-cloudfront*.zip ./dist ./node_modules

npm i
# Install all so we can compile typescript
npm ci
npx tsc
cp ./package.json ./dist/package.json
cp ./package.json ./package-lock.json ./dist/

# Get the version of @netacea/cloudfront now installed and derive the bundle name
version=$(npm list --json | jq -r '.dependencies["@netacea/cloudfront"].version')
bundle_name="netacea-cloudfront-$version.zip"
echo -e "\nCreating release assets for @netacea/cloudfront@$version with name $bundle_name"

# Install just production dependencies in ./dist
cd dist
npm i --production
rm *.js.map
npm ci --production
rm *.js.map package-lock.json

zip -r ../netacea-cloudfront ./*
# Create the zip file
zip -r ../$bundle_name ./*

0 comments on commit 00c40b7

Please sign in to comment.