Skip to content

Commit

Permalink
fix: scripts (#9)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan Soukup <soukup@u.plus>
  • Loading branch information
sladg and sladg authored Aug 22, 2022
1 parent 63989c1 commit 0275dc0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
5 changes: 4 additions & 1 deletion lib/cli.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#!/usr/bin/env node
import { exec as child_exec } from "child_process"
import util from "util"
import path from "path"

const exec = util.promisify(child_exec)

// @TODO: Ensure path exists.
// @TODO: Ensure.next folder exists with standalone folder inside.

const scriptName = path.resolve(`${__dirname}/../../scripts/pack-nextjs.sh`)

const run = async () => {
console.log("Starting packaging of your NextJS project!")
await exec("chmod +x ./pack-nextjs.sh && ./pack-nextjs.sh").catch(console.error)
await exec(`chmod +x ${scriptName} && ${scriptName}`).catch(console.error)
console.log("Your NextJS project was succefully prepared for Lambda.")
}

Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

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

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"build:handler:server": "FILE=server-handler npm run build:file",
"build:handler:image": "FILE=image-handler npm run build:file && cd dist/image-handler && zip -r index.zip *",
"build:cli": "FILE=cli npm run build:file",
"build:sharp": "./build-sharp-layer.sh",
"build:sharp": "./scripts/build-sharp-layer.sh",
"build": "npm run build:handler:image && npm run build:handler:server && npm run build:sharp && npm run build:cli",
"release": "auto shipit"
},
Expand All @@ -28,11 +28,12 @@
},
"files": [
"lib",
"dist"
"dist",
"scripts"
],
"bin": "dist/cli/index.js",
"exports": {
"./sharp-layer": "./dist/sharp-layer.zip",
"./sharp-layer/zip": "./dist/sharp-layer.zip",
"./image-handler/zip": "./dist/image-handler/index.zip",
"./image-handler": {
"require": "./lib/image-handler.ts",
Expand Down Expand Up @@ -61,4 +62,4 @@
"next": "^12.2.3",
"serverless-http": "^3.0.2"
}
}
}
File renamed without changes.
File renamed without changes.

0 comments on commit 0275dc0

Please sign in to comment.