Skip to content

Commit

Permalink
feat: Add sematic release and circle ci
Browse files Browse the repository at this point in the history
  • Loading branch information
hirsch committed Oct 19, 2019
1 parent 696b602 commit 7d22a50
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 13 deletions.
32 changes: 32 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,32 @@
version: 2
jobs:
build:
working_directory: ~/typeorm-seeding
docker:
- image: circleci/node:10.16-jessie-browsers-legacy
steps:
- checkout
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Install Dependencies
command: yarn install --frozen-lockfile
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- run:
name: lint
command: yarn run lint
- run:
name: test
command: yarn run test
- run:
name: build
command: yarn run build
- run:
name: release
command: yarn run semantic-release || true
8 changes: 8 additions & 0 deletions .releaserc
@@ -0,0 +1,8 @@
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github"
]
}
3 changes: 3 additions & 0 deletions .sgcrc
@@ -0,0 +1,3 @@
{
"lowercaseTypes": true
}
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -10,12 +10,14 @@
"types": "dist/typeorm-seeding.d.ts",
"scripts": {
"format": "prettier --write \"src/**/*.ts\"",
"lint": "tslint -p tsconfig.json -c tslint.json",
"build": "npm run clean && rollup -c",
"watch": "rollup -cw",
"clean": "rimraf dist",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage"
"test:cov": "jest --coverage",
"semantic-release": "semantic-release"
},
"license": "MIT",
"author": "w3tec.ch <info@w3tec.ch>",
Expand Down
1 change: 1 addition & 0 deletions src/commands/config.command.ts
Expand Up @@ -17,6 +17,7 @@ export class ConfigCommand implements yargs.CommandModule {
}

async handler(args: yargs.Arguments) {
// tslint:disable-next-line
const log = console.log
log(chalk.bold(`typeorm-seeding v${(pkg as any).version}`))
try {
Expand Down
5 changes: 3 additions & 2 deletions src/utils/factory.test.ts
Expand Up @@ -19,7 +19,7 @@ describe('getNameOfClass', () => {
})
describe('isPromiseLike', () => {
test('Passing a promise should return true', () => {
const promise = new Promise(() => {})
const promise = new Promise(() => void 0)
expect(isPromiseLike(promise)).toBeTruthy()
})
test('Passing no promise should return false', () => {
Expand All @@ -31,7 +31,8 @@ describe('isPromiseLike', () => {
expect(isPromiseLike(false)).toBeFalsy()
expect(isPromiseLike([])).toBeFalsy()
expect(isPromiseLike({})).toBeFalsy()
expect(isPromiseLike(() => {})).toBeFalsy()
expect(isPromiseLike(() => void 0)).toBeFalsy()
// tslint:disable-next-line
class UserEntity {}
expect(isPromiseLike(new UserEntity())).toBeFalsy()
expect(isPromiseLike(new Date())).toBeFalsy()
Expand Down
2 changes: 2 additions & 0 deletions src/utils/log.util.ts
Expand Up @@ -4,8 +4,10 @@ import chalk from 'chalk'
* Prints the error to the console
*/
export const printError = (message: string, error?: any) => {
// tslint:disable-next-line
console.log('\n❌ ', chalk.red(message))
if (error) {
// tslint:disable-next-line
console.error(error)
}
}

0 comments on commit 7d22a50

Please sign in to comment.