-
-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Open sourcing the private part of moonmail (user management and billi…
…ng related stuff) (#333) * Open sourcing the private part of moonmail (user management and billing) * Unignoring token manipulation modules
- Loading branch information
1 parent
7808f99
commit 9bc5471
Showing
476 changed files
with
86,306 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,79 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
dist | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git | ||
node_modules | ||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
#IDE Stuff | ||
**/.idea | ||
# Optional eslint cache | ||
.eslintcache | ||
|
||
#OS STUFF | ||
.DS_Store | ||
.tmp | ||
# Optional REPL history | ||
.node_repl_history | ||
|
||
#SERVERLESS STUFF | ||
admin.env | ||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
_meta/_tmp/ | ||
*.sublime-* | ||
# next.js build output | ||
.next | ||
|
||
# macos stuff | ||
.DS_store | ||
|
||
# Serverless directories | ||
.serverless | ||
|
||
.jshintrc | ||
_meta/ | ||
!./_meta/variables/s-variables-common.json | ||
playground/ | ||
users/ | ||
|
||
events/users | ||
events/user | ||
.gitmodules | ||
|
||
certs/ | ||
api/lib/auth.js | ||
api/lib/auth-token-decryptor.js.bak | ||
|
||
/.vscode/settings.json | ||
private/ | ||
api/lib/get_* | ||
api/lib/models/ | ||
|
||
.serverless | ||
|
||
**/config.*.json | ||
lists-microservice/public | ||
|
||
*.pem |
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,9 @@ | ||
{ | ||
"comments": false, | ||
"presets": [ | ||
[ "env", { "node": "8.10" } ] | ||
], | ||
"plugins": [ | ||
"source-map-support" | ||
] | ||
} |
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,7 @@ | ||
{ | ||
"env": { | ||
"mocha": true | ||
}, | ||
"rules": {}, | ||
"extends": ["airbnb", "prettier"] | ||
} |
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,67 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
# next.js build output | ||
.next | ||
|
||
# macos stuff | ||
.DS_store | ||
|
||
# Serverless directories | ||
.serverless |
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,25 @@ | ||
# serverless-webpack-template-jest | ||
|
||
This is a Serverless service template for the Serverless framework, it provides the latest JavaScript features(ES6 via Webpack + Babel, testing with mocha+chai+sinon, linting with ESLint, and formatting with Prettier) along with other interesting plugins such as **serverless-offline** and **serverless-plugin-aws-alerts** which are required on the most of serverless projects out there. | ||
|
||
Once installed, you can create and deploy functions with the latest ES6 features in minutes, with linting and formatting baked in. | ||
|
||
Note: Currently, this starter kit specifically targets AWS. | ||
|
||
## Install | ||
|
||
```bash | ||
# If you don't already have the serverless cli installed, do that | ||
yarn global add serverless | ||
|
||
# Use the serverless cli to install this repo | ||
serverless install --url https://github.com/ccverak/serverless-webpack-template-jest | ||
``` | ||
|
||
## Configuration | ||
|
||
Rename the directory at will, then change serverless.yml according to your needs, easy cake. | ||
|
||
## License | ||
|
||
MIT |
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,60 @@ | ||
{ | ||
"name": "sls-service-template", | ||
"version": "0.0.1", | ||
"description": "", | ||
"main": "src/handler.js", | ||
"scripts": { | ||
"watch": "yarn test:unit --watch", | ||
"test": "yarn test:unit", | ||
"test:unit": "NODE_ENV=test jest", | ||
"lint": "eslint ./src", | ||
"precommit": "lint-staged", | ||
"serve": "serverless offline start" | ||
}, | ||
"devEngines": { | ||
"node": "8.x || 9.x" | ||
}, | ||
"author": "Carlos Castellanos Vera", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"babel-core": "^6.26.0", | ||
"babel-jest": "^22.4.3", | ||
"babel-loader": "^7.1.3", | ||
"babel-plugin-source-map-support": "^2.0.1", | ||
"babel-preset-env": "^1.6.0", | ||
"chai": "^4.1.2", | ||
"choma": "^1.1.0", | ||
"eslint": "^4.19.1", | ||
"eslint-config-airbnb": "^16.1.0", | ||
"eslint-config-prettier": "^2.9.0", | ||
"eslint-plugin-import": "^2.11.0", | ||
"eslint-plugin-jsx-a11y": "^6.0.3", | ||
"eslint-plugin-react": "^7.7.0", | ||
"husky": "^0.14.3", | ||
"jest": "^22.4.3", | ||
"lint-staged": "^7.1.0", | ||
"serverless": "1.27.2", | ||
"serverless-offline": "^3.20.3", | ||
"serverless-plugin-aws-alerts": "^1.2.4", | ||
"serverless-webpack": "^5.1.5", | ||
"webpack": "^4.8.1", | ||
"webpack-node-externals": "^1.7.2" | ||
}, | ||
"dependencies": { | ||
"bluebird": "^3.5.1", | ||
"global": "^4.3.2", | ||
"joi": "^13.3.0", | ||
"middy": "^0.13.1", | ||
"moment": "^2.22.1", | ||
"omit-empty": "^0.4.1", | ||
"prettier": "^1.12.1", | ||
"source-map-support": "^0.5.5" | ||
}, | ||
"lint-staged": { | ||
"src/**/*.js": [ | ||
"yarn lint --fix", | ||
"prettier --write", | ||
"git add" | ||
] | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
.templates/serverless-webpack-template-jest/serverless.yml
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,54 @@ | ||
service: my-service-name | ||
|
||
plugins: | ||
- serverless-webpack | ||
- serverless-offline | ||
- serverless-plugin-aws-alerts | ||
|
||
custom: | ||
defaultStage: dev | ||
currentStage: ${opt:stage, self:custom.defaultStage} | ||
resourcesPrefix: ${self:service}-${self:custom.currentStage} | ||
config: ${file(./config.${self:custom.currentStage}.json)} | ||
webpack: | ||
webpackConfig: 'webpack.config.js' # Name of webpack configuration file | ||
includeModules: true # Node modules configuration for packaging | ||
packager: 'yarn' # Packager that will be used to package your external modules | ||
serverless-offline: | ||
babelOptions: | ||
presets: ["es2015"] | ||
alerts: | ||
stages: | ||
- prod | ||
topics: | ||
alarm: | ||
topic: ${self:service}-${opt:stage}-alerts-alarm | ||
notifications: | ||
- protocol: email | ||
endpoint: name@domain.com # Change this to your email address | ||
|
||
provider: | ||
name: aws | ||
runtime: nodejs8.10 | ||
profile: ${opt:profile, self:custom.config.PROFILE} | ||
region: ${opt:region, self:custom.config.REGION} | ||
timeout: 300 | ||
environment: | ||
REGION: ${self:custom.config.REGION} | ||
iamRoleStatements: | ||
- Effect: "Allow" | ||
Action: | ||
- "dynamodb:*" | ||
Resource: "*" | ||
|
||
package: | ||
individually: true | ||
|
||
functions: | ||
hello: | ||
handler: src/handler.default | ||
events: | ||
- http: | ||
path: version | ||
method: get | ||
|
13 changes: 13 additions & 0 deletions
13
.templates/serverless-webpack-template-jest/src/handler.js
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,13 @@ | ||
import Promise from "bluebird"; | ||
import ApiGatewayUtils from "./utils/ApiGatewayUtils"; | ||
|
||
export default function version(event, context, callback) { | ||
return Promise.resolve("0.0.1") | ||
.then(v => | ||
callback( | ||
null, | ||
ApiGatewayUtils.buildResponse({ statusCode: 200, body: { version: v } }) | ||
) | ||
) | ||
.catch(err => callback(err)); | ||
} |
9 changes: 9 additions & 0 deletions
9
.templates/serverless-webpack-template-jest/src/handler.test.js
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,9 @@ | ||
import version from './handler'; | ||
|
||
describe('version', () => { | ||
it('executes as expected', () => { | ||
version({}, {}, (error) => { | ||
expect(error).toBeNull(); | ||
}); | ||
}); | ||
}); |
33 changes: 33 additions & 0 deletions
33
.templates/serverless-webpack-template-jest/src/utils/ApiGatewayUtils.js
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,33 @@ | ||
import omitEmpty from "omit-empty"; | ||
|
||
function buildResponse({ statusCode = 200, body = {}, headers = {} }) { | ||
return { | ||
statusCode, | ||
headers: omitEmpty( | ||
Object.assign( | ||
{}, | ||
{ | ||
"Access-Control-Allow-Origin": "*", | ||
"Access-Control-Allow-Credentials": true | ||
}, | ||
headers | ||
) | ||
), | ||
body: JSON.stringify(body) | ||
}; | ||
} | ||
|
||
function buildRedirectResponse({ url }) { | ||
const headers = { Location: url }; | ||
return buildResponse({ statusCode: 302, headers }); | ||
} | ||
|
||
function redirectTo({ url, callback }) { | ||
return callback(null, buildRedirectResponse({ url })); | ||
} | ||
|
||
export default { | ||
buildResponse, | ||
buildRedirectResponse, | ||
redirectTo | ||
}; |
Oops, something went wrong.