Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v1.2.1 - 2018-04-21
- add source map support

## v1.1.27 - 2018-02-22
- fixed vars cloud compiling

Expand Down
7 changes: 4 additions & 3 deletions lib/plugins/run/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ class Run {
const functionName = this.options.function || functionArg;
const data = runCommon.findFunction(functionName);
const projectPath = this.sqz.vars.project.path;
const eventInputFile = path.join(data.func.path, 'event.input.json');
const eventInputFile = path.join(data.func.path, '.event.input.json');
const eventOutputFile = path.join(data.func.path, '.event.output.json');

fs.writeFileSync(`${projectPath}/.build/development/response.json`, JSON.stringify({}));
fs.writeFileSync(eventOutputFile, JSON.stringify({}));

let eventInput;

Expand Down Expand Up @@ -67,7 +68,7 @@ class Run {

return this.sqz.command.run(command.description, command.bin, command.args || []);
}).then(() => {
const responseData = JSON.parse(fs.readFileSync(`${projectPath}/.build/development/response.json`));
const responseData = JSON.parse(fs.readFileSync(eventOutputFile));
const response = JSON.stringify(responseData.body, null, 2) || 'null';
this.sqz.cli.log.console(`${colors.blue.bold('RESPONSE OUTPUT')}\n\n${response}\n`);
resolve();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import fs from 'fs';

const vars = JSON.parse(fs.readFileSync('.vars.json', 'utf8'));

exports.handler = (...args) => event(vars, (req, res) => {
export const handler = (...args) => event(vars, (req, res) => {
res.json(200, {
name : `Your name : ${req.query.name}`,
message: req.body.message || 'hello world !!!'
Expand Down
1 change: 1 addition & 0 deletions lib/plugins/templates/lib/shared/nodejs/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"strict": 0,
"import/no-extraneous-dependencies": "off",
"import/no-dynamic-require": "off",
"import/prefer-default-export" : "off",
"react/require-extension": "off",
"import/no-unresolved" : "off"
},
Expand Down
3 changes: 2 additions & 1 deletion lib/plugins/templates/lib/shared/nodejs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
.build

# events samples
event.input.json
.event.input.json
.event.output.json

# Logs
*.log
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
const nodeExternals = require('webpack-node-externals');
const WebpackSourceMapSupport = require('webpack-source-map-support');

module.exports = {
target: 'node',
externals: [nodeExternals()],
devtool: 'source-map',
module: {
loaders: [{
test: /\.js$/,
Expand All @@ -14,5 +16,7 @@ module.exports = {
output: {
libraryTarget: 'commonjs'
},
plugins : []
plugins: [
new WebpackSourceMapSupport()
]
};
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@

const nodeExternals = require('webpack-node-externals');
const WebpackSourceMapSupport = require('webpack-source-map-support');

module.exports = {
target: 'node',
externals: [nodeExternals()],
devtool: 'source-map',
node: {
__filename: true,
__dirname: true
},
module: {
loaders: [{
test: /\.js$/,
Expand All @@ -14,5 +20,8 @@ module.exports = {
},
output: {
libraryTarget: 'commonjs'
}
},
plugins: [
new WebpackSourceMapSupport()
]
};
3 changes: 2 additions & 1 deletion lib/plugins/templates/lib/shared/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"json-loader": "^0.5.4",
"jest": "^21.2.1",
"webpack": "^3.6.0",
"webpack-node-externals": "^1.6.0"
"webpack-node-externals": "^1.6.0",
"webpack-source-map-support": "^2.0.1"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "squeezer-cli",
"version": "1.1.28",
"version": "1.2.1",
"preferGlobal": true,
"description": "Event-driven APIs & Web apps on functions, serverless ! Squeezer is a framework designed to help developers to get a better architecture on serverless zero-administration compute platforms with code that runs into cloud functions like [AWS Lambda](https://aws.amazon.com/documentation/lambda/) , [Azure Functions](https://azure.microsoft.com/en-us/services/functions/) , [Google Cloud Functions](https://cloud.google.com/functions/docs/) and [IBM OpenWhisk](https://developer.ibm.com/openwhisk/) .",
"homepage": "https://squeezer.io/",
Expand Down