This repository was archived by the owner on Jan 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
packages/libs/lambda-at-edge Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 7
7
"description" : " Provides handlers that can be used in CloudFront Lambda@Edge to deploy next.js applications to the edge" ,
8
8
"main" : " dist/index.js" ,
9
9
"types" : " dist/index.d.ts" ,
10
+ "bin" : {
11
+ "build-lambda-at-edge" : " src/command.js"
12
+ },
10
13
"scripts" : {
11
14
"prepare" : " yarn build" ,
12
15
"build" : " rollup --config && tsc -p tsconfig.build.json"
Original file line number Diff line number Diff line change
1
+ import { default as Builder } from "./build" ;
2
+ import { join } from "path" ;
3
+
4
+ async function main ( args : string [ ] ) {
5
+ if ( args . length > 1 ) {
6
+ console . error ( "Usage: build-lambda-at-edge [ NEXT_APP_DIR ]" ) ;
7
+ process . exit ( 1 ) ;
8
+ }
9
+
10
+ const nextConfigDir = args [ 0 ] || "." ;
11
+ const outputDir = join ( nextConfigDir , ".serverless_nextjs" ) ;
12
+
13
+ const builder = new Builder ( nextConfigDir , outputDir , {
14
+ cmd : "./node_modules/.bin/next" ,
15
+ cwd : process . cwd ( ) ,
16
+ env : { } ,
17
+ args : [ "build" ]
18
+ } ) ;
19
+
20
+ await builder . build ( ) ;
21
+ }
22
+
23
+ main ( process . argv . slice ( 2 ) ) . catch ( ( err ) => {
24
+ console . error ( err ) ;
25
+ process . exit ( 1 ) ;
26
+ } ) ;
You can’t perform that action at this time.
0 commit comments