Skip to content

Commit

Permalink
Chore: pull latest boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
pustovitDmytro committed Apr 18, 2021
2 parents 7d50adf + f9fd463 commit 67e583d
Show file tree
Hide file tree
Showing 17 changed files with 11,913 additions and 8,307 deletions.
19 changes: 19 additions & 0 deletions .commitlintrc.json
@@ -0,0 +1,19 @@
{
"rules": {
"subject-empty": [2, "never"],
"type-empty": [2, "never"],
"type-enum": [
2,
"always",
[
"Chore",
"Fix",
"New",
"Update",
"Breaking",
"Docs",
"Upgrade"
]
]
}
}
36 changes: 36 additions & 0 deletions .dangerfile.js
@@ -0,0 +1,36 @@
import { message, danger, warn, fail } from 'danger';
import lint from '@commitlint/lint';
import commitLintConfig from './.commitlintrc';

const src = danger.git.fileMatch('src/*');
const tests = danger.git.fileMatch('tests/*');
const system = danger.git.fileMatch('.*', '.*/**', 'LICENSE.md', 'package-lock.json', 'package.json');
const isOwner = danger.github.pr.user.login === danger.github.thisPR.owner;
const modifiedList = danger.git.modified_files.join('- ');

export default async function () {
message(`Changed Files in this PR: \n - ${modifiedList}`);

if (system.modified && !isOwner) {
const files = system.getKeyedPaths().modified;

fail(`Only owner can change system files [${files.join(', ')}], please provide issue instead`, files[0]);
}

if (!src.modified && !tests.modified) {
warn('Source files were changed without tests');
}

const promises = danger.github.commits.map(async commit => {
const msg = commit.commit.message;
const comitLintReport = await lint(msg, commitLintConfig.rules);

if (!comitLintReport.valid) {
const errors = comitLintReport.errors.map(e => e.message);

fail(`Commit [${commit.sha}]:\n${msg} not mathing convention:\n${errors.join('\n')}`);
}
});

await Promise.all(promises);
}
1 change: 1 addition & 0 deletions .eslintignore
@@ -0,0 +1 @@
!.dangerfile.js
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -5,4 +5,5 @@ lib/*
coverage/*
tmp/*
logs/*
*.log
*.log
*.tgz
1 change: 1 addition & 0 deletions .husky/.gitignore
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/commit-msg
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx commitlint --edit $1
9 changes: 9 additions & 0 deletions .jscpd.json
@@ -0,0 +1,9 @@
{
"threshold": 5,
"reporters": ["html", "console"],
"ignore": [],
"output": "./reports/jscpd",
"minLines": 3,
"minTokens": 30,
"ignoreCase": true
}
6 changes: 5 additions & 1 deletion .npmignore
Expand Up @@ -6,7 +6,11 @@ tests
.babelrc
tmp
examples
.husky
bin
*.tgz
.commitlintrc.json
.mocharc.json
.nycrc.json
.releaserc.json
.mocharc.json
coverage/*
30 changes: 21 additions & 9 deletions .releaserc.json
@@ -1,4 +1,5 @@
{
"branches": ["master"],
"branch": "master",
"ci": false,
"plugins": [
Expand All @@ -25,22 +26,33 @@
"changelogFile": "CHANGELOG.md"
}
],
"@semantic-release/npm",
[
"@semantic-release/npm",{
"tarballDir": "./"
}
],
[
"@semantic-release/git", {
"assets": ["README.md", "CHANGELOG.md", "package.json", "docs"],
"message": "Chore: (release) add version ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
"assets": ["README.md", "CHANGELOG.md", "package.json"],
"message": "Chore(release): add version ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
[
"@semantic-release/github", {
"assets": [
{ "path": "*.tgz", "label": "npm tarball" }
]
}
]
],
"preset": "eslint",
"releaseRules": [
{ "type": "Fix", "release": "patch" },
{ "type": "Update", "release": "minor" },
{ "type": "New", "release": "minor" },
{ "type": "Breaking", "release": "major" },
{ "type": "Docs", "release": "patch" },
{ "type": "Upgrade", "release": "patch" }
{ "tag": "Fix", "release": "patch" },
{ "tag": "Update", "release": "minor" },
{ "tag": "New", "release": "minor" },
{ "tag": "Breaking", "release": "minor" },
{ "tag": "Docs", "release": "patch" },
{ "tag": "Upgrade", "release": "patch" }
],
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
Expand Down
17 changes: 12 additions & 5 deletions .travis.yml
Expand Up @@ -4,24 +4,31 @@ before_script:
- "npm run build"
after_success:
- "npm run coveralls"
stages:
- analyze
- test
- name: deploy
if: branch = master
jobs:
include:
- stage: analyze
script: "npx danger ci -d .dangerfile.js"
- stage: test
script: "npm run test:lint"
- stage: test
script: "npm run test:security"
- stage: test
script: "npm run test:coverage"
- stage: test
script: "npm run test:package"
- stage: test
script: "npm run test:debt"
- stage: release
node_js: lts/*
deploy:
provider: script
skip_cleanup: true
script:
- npx semantic-release
allow_failures:
- stage: test
script: "npm run test:security"
script: npm run semantic-release
notifications:
email:
recipients: dipustovit@gmail.com
Expand Down
15 changes: 14 additions & 1 deletion README.md
Expand Up @@ -132,6 +132,7 @@ The Tag is one of the following:
The message summary should be a one-sentence description of the change. The issue number should be mentioned at the end.


<<<<<<< HEAD
[npm]: https://www.npmjs.com/package/rest-chronicle
[github]: https://github.com/pustovitDmytro/rest-chronicle
[travis]: https://travis-ci.org/pustovitDmytro/rest-chronicle
Expand All @@ -141,4 +142,16 @@ The message summary should be a one-sentence description of the change. The issu
[badge-vuln]: https://img.shields.io/snyk/vulnerabilities/npm/rest-chronicle.svg?style=popout
[badge-vers]: https://img.shields.io/npm/v/rest-chronicle.svg
[badge-lic]: https://img.shields.io/github/license/pustovitDmytro/rest-chronicle.svg
[badge-coverage]: https://coveralls.io/repos/github/pustovitDmytro/rest-chronicle/badge.svg?branch=master
[badge-coverage]: https://coveralls.io/repos/github/pustovitDmytro/rest-chronicle/badge.svg?branch=master
=======
[npm]: https://www.npmjs.com/package/npm-boilerplate
[github]: https://github.com/pustovitDmytro/npm-boilerplate
[travis]: https://travis-ci.org/pustovitDmytro/npm-boilerplate
[coveralls]: https://coveralls.io/github/pustovitDmytro/npm-boilerplate?branch=master
[badge-deps]: https://img.shields.io/david/pustovitDmytro/npm-boilerplate.svg
[badge-tests]: https://travis-ci.com/pustovitDmytro/npm-boilerplate.svg?branch=master
[badge-vuln]: https://img.shields.io/snyk/vulnerabilities/npm/npm-boilerplate.svg?style=popout
[badge-vers]: https://img.shields.io/npm/v/npm-boilerplate.svg
[badge-lic]: https://img.shields.io/github/license/pustovitDmytro/npm-boilerplate.svg
[badge-coverage]: https://coveralls.io/repos/github/pustovitDmytro/npm-boilerplate/badge.svg?branch=master
>>>>>>> f9fd4631aa300e16128a4d7107d45f9317f70c9b
6 changes: 6 additions & 0 deletions bin/pack.sh
@@ -0,0 +1,6 @@
#!/bin/bash
rm -rf tmp/package
PACKAGE="$(npm pack 2>&1 | tail -1)"
mkdir -p tmp
tar -xvzf $PACKAGE -C tmp
#mv $PACKAGE ${PACKAGE/-[0-9.]*.tgz/.tgz}
1 change: 1 addition & 0 deletions examples/chat/test.js
Expand Up @@ -50,4 +50,5 @@ test('Positive: get list of messages', async function () {
after(async () => {
await chronicle.save('./documentation/swagger.json', { reporter: 'swagger' });
await chronicle.save('./documentation/api-blueprint.md', { reporter: 'api-blueprint' });
chronicle.clear();
});

0 comments on commit 67e583d

Please sign in to comment.