-
-
Notifications
You must be signed in to change notification settings - Fork 449
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(nextjs-component): serverless-patched binary should include @serv…
…erless/cli and find serverless binary in closest node_modules (#1661)
- Loading branch information
Showing
13 changed files
with
4,545 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
registry "https://registry.npmjs.org" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Patched serverless binary |
9 changes: 8 additions & 1 deletion
9
...extjs-component/bin/serverless-patched.ts → ...verless-patched/bin/serverless-patched.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
#!/usr/bin/env node | ||
|
||
import { execSync } from "child_process"; | ||
const findUpSync = require("find-up").sync; | ||
|
||
console.info("Note: running patched serverless binary."); | ||
|
||
const args = process.argv.slice(2).join(" "); | ||
// This executes package-local serverless which uses a patched @serverless/cli | ||
execSync(`${__dirname}/../../node_modules/.bin/serverless ${args}`, { | ||
// Try to find the closest serverless binary which should be patched | ||
const serverlessBin = findUpSync("node_modules/.bin/serverless", { | ||
cwd: __dirname | ||
}); | ||
|
||
execSync(`${serverlessBin} ${args}`, { | ||
stdio: "inherit" | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"name": "@sls-next/serverless-patched", | ||
"version": "3.4.0-alpha.2", | ||
"description": "Patched serverless package", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"main": "dist/serverless-patched.js", | ||
"directories": { | ||
"dist": "dist" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/serverless-nextjs/serverless-next.js.git", | ||
"directory": "packages/libs/serverless-patched" | ||
}, | ||
"scripts": { | ||
"prepare": "yarn clean && yarn build", | ||
"build": "tsc -p tsconfig.build.json", | ||
"clean": "yarn rimraf dist", | ||
"postinstall": "patch-package" | ||
}, | ||
"keywords": [ | ||
"AWS", | ||
"S3", | ||
"Next.js", | ||
"Serverless" | ||
], | ||
"author": "Daniel Phang <serverlessnextjs@gmail.com>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/serverless-nextjs/serverless-next.js/issues" | ||
}, | ||
"homepage": "https://github.com/serverless-nextjs/serverless-next.js#readme", | ||
"dependencies": { | ||
"@serverless/cli": "^1.5.2", | ||
"find-up": "^5.0.0", | ||
"patch-package": "^6.4.7", | ||
"postinstall-postinstall": "^2.1.0", | ||
"serverless": "^2.57.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^16.9.1", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^4.4.2" | ||
}, | ||
"bin": { | ||
"serverless-patched": "./dist/serverless-patched.js" | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"sourceMap": false, | ||
"removeComments": true | ||
}, | ||
"include": ["./bin/"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"compilerOptions": { | ||
"resolveJsonModule": true, | ||
"esModuleInterop": true, | ||
"declaration": true, | ||
"target": "ES2015", | ||
"module": "CommonJS", | ||
"moduleResolution": "node", | ||
"noImplicitAny": true, | ||
"outDir": "dist", | ||
"sourceMap": true, | ||
"strict": true, | ||
"allowJs": true | ||
}, | ||
"exclude": ["node_modules"], | ||
"include": ["**/*.ts"] | ||
} |
Oops, something went wrong.