Skip to content

Commit

Permalink
Configure CC, test coverage, scripts for npm packaging upgrade, use e…
Browse files Browse the repository at this point in the history
…slint (airbnb base)
  • Loading branch information
Vadorequest committed Aug 29, 2019
1 parent b8daa60 commit d5f3706
Show file tree
Hide file tree
Showing 18 changed files with 7,856 additions and 137 deletions.
80 changes: 80 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# XXX See https://docs.codeclimate.com/docs/advanced-configuration
version: "2"
checks:
argument-count:
enabled: true
config:
threshold: 4
complex-logic:
enabled: true
config:
threshold: 4
file-lines:
enabled: true
config:
threshold: 400 # 250 by default
method-complexity:
enabled: true
config:
threshold: 5
method-count:
enabled: true
config:
threshold: 20
method-lines:
enabled: true
config:
threshold: 100 # 25 by default
nested-control-flow:
enabled: true
config:
threshold: 4
return-statements:
enabled: true
config:
threshold: 4

plugins:
# eslint: # https://docs.codeclimate.com/docs/eslint
# enabled: true
# channel: "eslint-4" # Depends on installed ESLint version - See https://docs.codeclimate.com/docs/eslint#section-eslint-versions
duplication: # https://docs.codeclimate.com/docs/duplication
enabled: true
config:
languages:
javascript:
mass_threshold: 80 # Instead of 50 - See https://docs.codeclimate.com/docs/duplication#section-understand-the-engine
fixme: # https://docs.codeclimate.com/docs/fixme
enabled: true
config:
strings: # Skip "XXX" as we don't use it for things to fix but rather for highlighting comments (DX)
- FIXME
- BUG
- TODO
- HACK
git-legal: # https://docs.codeclimate.com/docs/git-legal
enabled: true
# tslint: # https://docs.codeclimate.com/docs/tslint
# enabled: true
# config: tslint.json

# See https://docs.codeclimate.com/docs/excluding-files-and-folders
exclude_patterns:
- "**/*.test.*"
- "**/*.spec.*"
- "coverage/"
- "examples/"
- "lib/"

# Default CC excluded paths:
- "config/"
- "db/"
- "dist/"
- "features/"
- "**/node_modules/"
- "script/"
- "**/spec/"
- "**/test/"
- "**/tests/"
- "**/vendor/"
- "**/*.d.ts"
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.spec.js
*.test.js
19 changes: 19 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"env": {
"es6": true,
"node": true
},
"extends": [
"airbnb-base"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
}
}
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Jimdo GmbH
Copyright (c) 2019 Unly

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
69 changes: 67 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@

# ⚡️ Serverless-env-copy-plugin

> This plugin [was forked](https://github.com/Jimdo/serverless-dotenv) because the original repo isn't maintained.
> Also, the name of the plugin was changed, because the original name didn't make sense to us.
<!-- toc -->

- [About the plugin](#about-the-plugin)
- [Usage](#usage)
- [Example](#example)
- [Contributing](#contributing)
* [Test](#test)
* [Versions](#versions)
+ [SemVer](#semver)
+ [Release a new version](#release-a-new-version)
* [Releasing and publishing](#releasing-and-publishing)
- [License](#license)

<!-- tocstop -->

## About the plugin

This serverless plugin generates a `.env` file based on the environment variables in the `serverless.yml`. The idea is to use this environment variables for further tasks like integration tests etc. It works great with `serverless offline`, so you can start serverless offline, the plugin will hook into the process and create the `.env` file. You will find the `.env` file in the `.serverless` folder of your project.
Expand Down Expand Up @@ -35,6 +53,53 @@ That's it! You can now type `serverless dotenv` in your terminal to generate the

You can check https://github.com/UnlyEd/boilerplates-generator/tree/master/templates/node-v10.x-aws-serverless to get an example of this plugin

## Contribution

Feel free to contribute to this project! Our JavaScript is written based on [standardJS](https://standardjs.com). We recommend to use a `standardJS` [plugin](https://standardjs.com/index.html#are-there-text-editor-plugins) for your Editor, but you can also lint your code with `yarn run lint` - respectively `npm run lint`. Please don't forget to add unit and/or integration tests. Thanks <3
---

## Contributing

We gladly accept PRs, but please open an issue first so we can discuss it beforehand.

### Test

```
yarn test # Run all tests, interactive and watch mode
yarn test:once # Used for CI/CD
yarn test:coverage # Generate coverage report
```
### Versions
#### SemVer
We use Semantic Versioning for this project: https://semver.org/. (`vMAJOR.MINOR.PATCH`: `v1.0.1`)
- Major version: Must be changed when Breaking Changes are made (public API isn't backward compatible).
- A function has been renamed/removed from the public API
- Something has changed that will cause the app to behave differently with the same configuration
- Minor version: Must be changed when a new feature is added or updated (without breaking change nor behavioral change)
- Patch version: Must be changed when any change is made that isn't either Major nor Minor. (Misc, doc, etc.)
#### Release a new version
- `yarn run release`
This command will prompt you for the version to update to, create a git tag, build the files and commit/push everything automatically.
> Don't forget we are using SemVer, please follow our SemVer rules.
**Pro hint**: use `beta` tag if you're in a work-in-progress (or unsure) to avoid releasing WIP versions that looks legit
### Releasing and publishing
```
yarn releaseAndPublish # Shortcut - Will prompt for bump version, commit, create git tag, push commit/tag and publish to NPM

yarn release # Will prompt for bump version, commit, create git tag, push commit/tag
npm publish # Will publish to NPM
```
## License
MIT
2 changes: 2 additions & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ version: 0.2
env:
# Please refer to https://github.com/UnlyEd/slack-codebuild
variables:
SLACK_WEBHOOK_URL: "https://hooks.slack.com/services/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"
CODEBUILD_NOTIFY_ONLY_IF_FAIL: 1
CC_TEST_REPORTER_ID: f0d25bcb9b01e7c359d064a57c2e558ac7d07d78f2a93b573179d5e4cc1eb090

phases:
install:
Expand Down
Loading

0 comments on commit d5f3706

Please sign in to comment.