Browse Source

Set correct paths in bundle

master
Leo Lamprecht 7 years ago
parent
commit
d75c3f9348
  1. 98
      package-lock.json
  2. 4
      package.json
  3. 3
      src/serverless/builders/nodejs.js
  4. 10
      src/serverless/get-handler.js
  5. 5
      webpack.config.js

98
package-lock.json

@ -1362,6 +1362,17 @@
}
}
},
"child-process-promise": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/child-process-promise/-/child-process-promise-2.2.1.tgz",
"integrity": "sha1-RzChHvYQ+tRQuPIjx50x172tgHQ=",
"dev": true,
"requires": {
"cross-spawn": "4.0.2",
"node-version": "1.1.0",
"promise-polyfill": "6.0.2"
}
},
"chokidar": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz",
@ -1832,13 +1843,12 @@
}
},
"cross-spawn": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
"integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=",
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz",
"integrity": "sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=",
"dev": true,
"requires": {
"lru-cache": "4.1.1",
"shebang-command": "1.2.0",
"which": "1.3.0"
}
},
@ -2537,6 +2547,17 @@
"supports-color": "2.0.0"
}
},
"cross-spawn": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
"integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=",
"dev": true,
"requires": {
"lru-cache": "4.1.1",
"shebang-command": "1.2.0",
"which": "1.3.0"
}
},
"debug": {
"version": "2.6.8",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz",
@ -2661,6 +2682,19 @@
"p-finally": "1.0.0",
"signal-exit": "3.0.2",
"strip-eof": "1.0.0"
},
"dependencies": {
"cross-spawn": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
"integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=",
"dev": true,
"requires": {
"lru-cache": "4.1.1",
"shebang-command": "1.2.0",
"which": "1.3.0"
}
}
}
},
"exit-hook": {
@ -4722,6 +4756,17 @@
"staged-git-files": "0.0.4"
},
"dependencies": {
"cross-spawn": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
"integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=",
"dev": true,
"requires": {
"lru-cache": "4.1.1",
"shebang-command": "1.2.0",
"which": "1.3.0"
}
},
"execa": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/execa/-/execa-0.8.0.tgz",
@ -5418,6 +5463,12 @@
}
}
},
"node-version": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/node-version/-/node-version-1.1.0.tgz",
"integrity": "sha512-t1V2RFiaTavaW3jtQO0A2nok6k7/Gghuvx2rjvICuT0B0dYaObBQ4U0xHL+ZTPFZodt1LMYG2Vi2nypfz4/AJg==",
"dev": true
},
"normalize-package-data": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz",
@ -5634,6 +5685,17 @@
"mem": "1.1.0"
},
"dependencies": {
"cross-spawn": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
"integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=",
"dev": true,
"requires": {
"lru-cache": "4.1.1",
"shebang-command": "1.2.0",
"which": "1.3.0"
}
},
"execa": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz",
@ -6075,6 +6137,17 @@
"which": "1.2.14"
},
"dependencies": {
"cross-spawn": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
"integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=",
"dev": true,
"requires": {
"lru-cache": "4.1.1",
"shebang-command": "1.2.0",
"which": "1.2.14"
}
},
"which": {
"version": "1.2.14",
"resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz",
@ -6134,6 +6207,12 @@
"integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=",
"dev": true
},
"promise-polyfill": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-6.0.2.tgz",
"integrity": "sha1-2chtPcTcLfkBboiUbe/Wm0m0EWI=",
"dev": true
},
"proto-list": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz",
@ -7158,6 +7237,17 @@
"execa": "0.7.0"
},
"dependencies": {
"cross-spawn": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
"integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=",
"dev": true,
"requires": {
"lru-cache": "4.1.1",
"shebang-command": "1.2.0",
"which": "1.3.0"
}
},
"execa": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz",

4
package.json

@ -30,8 +30,7 @@
],
"pkg": {
"scripts": [
"bin/*",
"lib/**/*"
"dist/*"
],
"targets": [
"node7-alpine-x64",
@ -93,6 +92,7 @@
"babel-preset-es2015": "6.24.1",
"bytes": "2.5.0",
"chalk": "2.1.0",
"child-process-promise": "2.2.1",
"clipboardy": "1.1.4",
"convert-stream": "1.0.2",
"copy-webpack-plugin": "4.0.1",

3
src/serverless/builders/nodejs.js

@ -1,8 +1,7 @@
// Native
const { tmpdir } = require('os')
const { join } = require('path')
const { exec: exec_ } = require('child_process')
const exec = require('util').promisify(exec_)
const { exec } = require('child-process-promise')
// Packages
const { mkdir, stat, link, existsSync, readdir } = require('fs-extra')

10
src/serverless/get-handler.js

@ -1,9 +1,11 @@
// @flow
const { readFileSync } = require('fs')
// This needs to be relative because it otherwise
// doesn't work when `webpack`-ed
const handler = readFileSync('handler.js').toString()
// Native
const { readFileSync } = require('fs-extra')
const { join } = require('path')
// Utilities
const handler = readFileSync(join(__dirname, 'handler.js')).toString()
// symbols to replace in the meta-source
const CMD_SYMBOL = '/*NOW_CMD*/'

5
webpack.config.js

@ -7,8 +7,11 @@ module.exports = {
entry: './src/now.js',
target: 'node',
externals: [nodeExternals()],
node: {
__dirname: false
},
output: {
filename: 'dist/now.js',
filename: 'dist/now.js'
},
module: {
loaders: [

Loading…
Cancel
Save