Skip to content

Commit

Permalink
refactor: re-implement library in ts strict mode
Browse files Browse the repository at this point in the history
BREAKING CHANGE: migrateModel/migrateCollection now accept migration options as 4th parameter instead of versionCollectionName
* Minimal noder version is now 12.8.1
* Typescript compiler was upgraded to version 3.8.3
  • Loading branch information
hellivan committed Apr 7, 2020
1 parent ebc5f81 commit 84135fd
Show file tree
Hide file tree
Showing 27 changed files with 9,115 additions and 891 deletions.
112 changes: 112 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
version: 2.1
orbs:
codecov: codecov/codecov@1.0.5

aliases:
- &job-defaults
docker:
- image: circleci/node:12.13.0
working_directory: ~/repo
- &attach_workspace
attach_workspace:
at: ~/

jobs:
setup:
<<: *job-defaults
steps:
- checkout
- run:
command: yarn install --frozen-lockfile --non-interactive
- persist_to_workspace:
root: ~/
paths:
- ./repo

build:
<<: *job-defaults
steps:
- *attach_workspace
- run:
command: yarn build
- persist_to_workspace:
root: ~/
paths:
- ./repo/dist

lint:
<<: *job-defaults
steps:
- *attach_workspace
- run:
command: yarn lint:ci
- store_test_results:
path: reports/junit

test:
<<: *job-defaults
steps:
- *attach_workspace
- run:
command: yarn test:cov
- run:
command: yarn test:e2e
- store_test_results:
path: reports/junit
- codecov/upload:
file: reports/coverage/cobertura-coverage.xml
flags: unittests


check-dependencies:
<<: *job-defaults
steps:
- *attach_workspace
- run:
command: yarn check-dependencies

check-formatting:
<<: *job-defaults
steps:
- *attach_workspace
- run:
command: yarn check-formatting

release:
<<: *job-defaults
steps:
- *attach_workspace
- run:
command: yarn semantic-release

workflows:
version: 2
install-test-build-and-publish:
jobs:
- setup
- build:
requires:
- setup
- lint:
requires:
- setup
- test:
requires:
- setup
- check-dependencies:
requires:
- build
- check-formatting:
requires:
- setup
- release:
filters:
branches:
only:
- master
requires:
- build
- lint
- test
- check-dependencies
- check-formatting
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[*]
charset=utf-8
end_of_line=lf
insert_final_newline=true
indent_style=space
indent_size=4
trim_trailing_whitespace=true
12 changes: 12 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
'plugin:prettier/recommended' // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
parserOptions: {
ecmaVersion: 2019, // Allows for the parsing of modern ECMAScript features
sourceType: 'module' // Allows for the use of imports
}
};
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_modules
lib
.idea
*~
/dist
/reports
9 changes: 5 additions & 4 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
src/
.idea/
*~
*
!/dist/**
!package.json
!yarn.lock
!README.md
9 changes: 9 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package.json
yarn.lock
.git/
dist/
node_modules/
documentation/
reports/
LICENSE
.*
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"singleQuote": true,
"trailingComma": "none",
"printWidth": 120,
"quoteProps": "consistent"
}
13 changes: 13 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"branch": "master",
"verifyConditions": "condition-circle",
"plugins": [
"@semantic-release/commit-analyzer",
["@semantic-release/changelog", {
"changelogFile": "CHANGELOG.md"
}],
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github"
]
}
76 changes: 26 additions & 50 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,118 +1,94 @@
<a name="0.1.7"></a>
## [0.1.7](https://github.com/hellivan/mongoose-model-migration/compare/v0.1.6...v0.1.7) (2018-09-11)

## [0.1.7](https://github.com/hellivan/mongoose-model-migration/compare/v0.1.6...v0.1.7) (2018-09-11)

### Bug Fixes

* increase mongoose peer dep range to >=4.0.0 <6.0.0 ([f1db469](https://github.com/hellivan/mongoose-model-migration/commit/f1db469))


- increase mongoose peer dep range to >=4.0.0 <6.0.0 ([f1db469](https://github.com/hellivan/mongoose-model-migration/commit/f1db469))

<a name="0.1.6"></a>
## [0.1.6](https://github.com/hellivan/mongoose-model-migration/compare/v0.1.5...v0.1.6) (2018-09-11)

## [0.1.6](https://github.com/hellivan/mongoose-model-migration/compare/v0.1.5...v0.1.6) (2018-09-11)

### Bug Fixes

* increase mongoose peer dep range to >=4.7.3 <6.0.0 ([1ba6d91](https://github.com/hellivan/mongoose-model-migration/commit/1ba6d91))


- increase mongoose peer dep range to >=4.7.3 <6.0.0 ([1ba6d91](https://github.com/hellivan/mongoose-model-migration/commit/1ba6d91))

<a name="0.1.5"></a>
## [0.1.5](https://github.com/hellivan/mongoose-model-migration/compare/v0.1.4...v0.1.5) (2018-09-07)

## [0.1.5](https://github.com/hellivan/mongoose-model-migration/compare/v0.1.4...v0.1.5) (2018-09-07)

### Bug Fixes

* version update error ([8513876](https://github.com/hellivan/mongoose-model-migration/commit/8513876))


- version update error ([8513876](https://github.com/hellivan/mongoose-model-migration/commit/8513876))

<a name="0.1.4"></a>
## [0.1.4](https://github.com/hellivan/mongoose-model-migration/compare/v0.1.3...v0.1.4) (2018-05-03)

## [0.1.4](https://github.com/hellivan/mongoose-model-migration/compare/v0.1.3...v0.1.4) (2018-05-03)

### Bug Fixes

* migrate function does not return promise in all cases ([8704119](https://github.com/hellivan/mongoose-model-migration/commit/8704119))


- migrate function does not return promise in all cases ([8704119](https://github.com/hellivan/mongoose-model-migration/commit/8704119))

<a name="0.1.3"></a>
## [0.1.3](https://github.com/hellivan/mongoose-model-migration/compare/v0.1.2...v0.1.3) (2018-05-02)


## [0.1.3](https://github.com/hellivan/mongoose-model-migration/compare/v0.1.2...v0.1.3) (2018-05-02)

<a name="0.1.2"></a>
## [0.1.2](https://github.com/hellivan/mongoose-model-migration/compare/v0.1.1...v0.1.2) (2017-12-06)

## [0.1.2](https://github.com/hellivan/mongoose-model-migration/compare/v0.1.1...v0.1.2) (2017-12-06)

### Features

* allow specifying version-collection name as thrid parameter for all migrators ([342394a](https://github.com/hellivan/mongoose-model-migration/commit/342394a))


- allow specifying version-collection name as thrid parameter for all migrators ([342394a](https://github.com/hellivan/mongoose-model-migration/commit/342394a))

<a name="0.1.1"></a>
## [0.1.1](https://github.com/hellivan/mongoose-model-migration/compare/v0.1.0...v0.1.1) (2017-10-30)

## [0.1.1](https://github.com/hellivan/mongoose-model-migration/compare/v0.1.0...v0.1.1) (2017-10-30)

### Bug Fixes

* typings in source-code ([0b50f2e](https://github.com/hellivan/mongoose-model-migration/commit/0b50f2e))


- typings in source-code ([0b50f2e](https://github.com/hellivan/mongoose-model-migration/commit/0b50f2e))

<a name="0.1.0"></a>
# [0.1.0](https://github.com/hellivan/mongoose-model-migration/compare/v0.0.5...v0.1.0) (2017-10-30)

# [0.1.0](https://github.com/hellivan/mongoose-model-migration/compare/v0.0.5...v0.1.0) (2017-10-30)

### Features

* add method for simply upgrading a collection (by name) ([ee2cbf8](https://github.com/hellivan/mongoose-model-migration/commit/ee2cbf8))

- add method for simply upgrading a collection (by name) ([ee2cbf8](https://github.com/hellivan/mongoose-model-migration/commit/ee2cbf8))

### BREAKING CHANGES

* migrateDb was renamed to migrateModel
* writeVersion/readVersion now only accept collection names
* interface Migration was renamed to ModelMigrationHandler
* signature for up/down function of ModelMigrationHandler has changed (last two parameters are now fromVersion, toVersion)


- migrateDb was renamed to migrateModel
- writeVersion/readVersion now only accept collection names
- interface Migration was renamed to ModelMigrationHandler
- signature for up/down function of ModelMigrationHandler has changed (last two parameters are now fromVersion, toVersion)

<a name="0.0.5"></a>
## [0.0.5](https://github.com/hellivan/mongoose-model-migration/compare/v0.0.4...v0.0.5) (2017-05-31)


## [0.0.5](https://github.com/hellivan/mongoose-model-migration/compare/v0.0.4...v0.0.5) (2017-05-31)

<a name="0.0.4"></a>
## [0.0.4](https://github.com/hellivan/mongoose-model-migration/compare/v0.0.3...v0.0.4) (2017-05-30)

## [0.0.4](https://github.com/hellivan/mongoose-model-migration/compare/v0.0.3...v0.0.4) (2017-05-30)

### Bug Fixes

* **Output:** remove console output ([d19a4e2](https://github.com/hellivan/mongoose-model-migration/commit/d19a4e2))


- **Output:** remove console output ([d19a4e2](https://github.com/hellivan/mongoose-model-migration/commit/d19a4e2))

<a name="0.0.3"></a>
## [0.0.3](https://github.com/hellivan/mongoose-model-migration/compare/v0.0.2...v0.0.3) (2017-05-04)


## [0.0.3](https://github.com/hellivan/mongoose-model-migration/compare/v0.0.2...v0.0.3) (2017-05-04)

<a name="0.0.2"></a>
## [0.0.2](https://github.com/hellivan/mongoose-model-migration/compare/v0.0.1...v0.0.2) (2016-12-20)


## [0.0.2](https://github.com/hellivan/mongoose-model-migration/compare/v0.0.1...v0.0.2) (2016-12-20)

<a name="0.0.1"></a>
## 0.0.1 (2016-12-19)

## 0.0.1 (2016-12-19)

### Features

* implement method that allows to register upgrade method for a mongoose model 98ec8ea



- implement method that allows to register upgrade method for a mongoose model 98ec8ea
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2019 Ivan Hell

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Loading

0 comments on commit 84135fd

Please sign in to comment.