serverless-esbuild
Advanced tools
Comparing version 1.5.1 to 1.6.0
@@ -19,3 +19,3 @@ "use strict"; | ||
const helper_1 = require("./helper"); | ||
const packExternalModules_1 = require("./packExternalModules"); | ||
const pack_externals_1 = require("./pack-externals"); | ||
const SERVERLESS_FOLDER = '.serverless'; | ||
@@ -35,3 +35,3 @@ const BUILD_FOLDER = '.build'; | ||
this.options = options; | ||
this.packExternalModules = packExternalModules_1.packExternalModules.bind(this); | ||
this.packExternalModules = pack_externals_1.packExternalModules.bind(this); | ||
const withDefaultOptions = ramda_1.mergeRight(DEFAULT_BUILD_OPTIONS); | ||
@@ -119,2 +119,3 @@ this.buildOptions = withDefaultOptions((_b = (_a = this.serverless.service.custom) === null || _a === void 0 ? void 0 : _a.esbuild) !== null && _b !== void 0 ? _b : {}); | ||
delete config['packager']; | ||
delete config['packagePath']; | ||
return esbuild_1.build(config); | ||
@@ -121,0 +122,0 @@ })); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.spawnProcess = exports.SpawnError = void 0; | ||
exports.findProjectRoot = exports.findUp = exports.spawnProcess = exports.SpawnError = void 0; | ||
const childProcess = require("child_process"); | ||
const fs = require("fs-extra"); | ||
const path = require("path"); | ||
const ramda_1 = require("ramda"); | ||
@@ -54,1 +56,24 @@ class SpawnError extends Error { | ||
exports.spawnProcess = spawnProcess; | ||
/** | ||
* Find a file by walking up parent directories | ||
*/ | ||
function findUp(name, directory = process.cwd()) { | ||
const absoluteDirectory = path.resolve(directory); | ||
if (fs.existsSync(path.join(directory, name))) { | ||
return directory; | ||
} | ||
const { root } = path.parse(absoluteDirectory); | ||
if (absoluteDirectory === root) { | ||
return undefined; | ||
} | ||
return findUp(name, path.dirname(absoluteDirectory)); | ||
} | ||
exports.findUp = findUp; | ||
/** | ||
* Forwards `rootDir` or finds project root folder. | ||
*/ | ||
function findProjectRoot(rootDir) { | ||
var _a, _b; | ||
return (_b = (_a = rootDir !== null && rootDir !== void 0 ? rootDir : findUp('yarn.lock')) !== null && _a !== void 0 ? _a : findUp('package-lock.json')) !== null && _b !== void 0 ? _b : findUp('package.json'); | ||
} | ||
exports.findProjectRoot = findProjectRoot; |
{ | ||
"name": "serverless-esbuild", | ||
"version": "1.5.1", | ||
"version": "1.6.0", | ||
"license": "MIT", | ||
@@ -19,4 +19,3 @@ "author": "Victor Korzunin", | ||
"test": "jest --passWithNoTests", | ||
"lint": "eslint . --ext .ts --ignore-path .gitignore", | ||
"semantic-release": "semantic-release" | ||
"lint": "eslint ." | ||
}, | ||
@@ -47,15 +46,15 @@ "repository": { | ||
"@types/fs-extra": "^9.0.1", | ||
"@types/jest": "^25.2.2", | ||
"@types/jest": "^26.0.14", | ||
"@types/node": "^12.12.38", | ||
"@types/ramda": "^0.27.6", | ||
"@types/serverless": "^1.67.2", | ||
"@typescript-eslint/eslint-plugin": "^2.34.0", | ||
"@typescript-eslint/parser": "^2.34.0", | ||
"eslint": "^6.8.0", | ||
"@types/serverless": "^1.78.12", | ||
"@typescript-eslint/eslint-plugin": "^4.2.0", | ||
"@typescript-eslint/parser": "^4.2.0", | ||
"eslint": "^7.9.0", | ||
"husky": "^4.2.5", | ||
"jest": "^25.5.4", | ||
"jest": "^26.4.2", | ||
"mock-fs": "^4.12.0", | ||
"semantic-release": "^17.0.8", | ||
"ts-jest": "^25.5.1", | ||
"typescript": "^3.9.5" | ||
"ts-jest": "^26.4.0", | ||
"typescript": "^4.0.3" | ||
}, | ||
@@ -62,0 +61,0 @@ "dependencies": { |
42432
759
6