Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Commit

Permalink
chore: update deps and fix linting/formatting (#72)
Browse files Browse the repository at this point in the history
BREAKING - no longer explicitly support node 6
  • Loading branch information
bradzacher authored May 17, 2019
1 parent e1bca89 commit 70c9258
Show file tree
Hide file tree
Showing 48 changed files with 2,501 additions and 1,793 deletions.
13 changes: 0 additions & 13 deletions .eslintrc.js

This file was deleted.

23 changes: 23 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": ["brad"],
"parserOptions": {
"project": "./tsconfig.json"
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {}
}
},
"overrides": [
{
"files": ["test/**/*"],
"rules": {
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "off"
}
}
]
}
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.rpt2_cache
dist
node_modules
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"arrowParens": "avoid",
"bracketSpacing": true,
"jsxBracketSameLine": true,
"proseWrap": "preserve",
"semi": true,
"singleQuote": true,
"tabWidth": 4,
"trailingComma": "all",
"useTabs": false
}
22 changes: 13 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@ dist: trusty
sudo: required
language: node_js
node_js:
- '10'
- '8'
- '6'
- '10'
- '8'
services:
- mysql
- mysql
before_install:
- mysql -e 'CREATE DATABASE IF NOT EXISTS mysqldump_test;'
- mysql -e 'CREATE DATABASE IF NOT EXISTS mysqldump_test;'
install: yarn
script:
- yarn build
- yarn setup-travis
- yarn test
- yarn test-prod
# setup travis first so test config exists
- yarn setup-travis
- yarn format-check
- yarn typecheck
# need to build before linting so the dist folder exists
- yarn build
- yarn lint
- yarn test
- yarn test-prod
16 changes: 5 additions & 11 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"name": "Launch Program",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/ts-node",
"args": [
"-P", "${workspaceRoot}/tsconfig.json",
"-P",
"${workspaceRoot}/tsconfig.json",
// launch main
"${workspaceRoot}/test/scripts/launch.ts"
],
Expand All @@ -22,16 +23,9 @@
"request": "launch",
"name": "Debug Test current test",
"program": "${workspaceRoot}/node_modules/.bin/jest",
"args": [
"--config", "jest.json",
"e2e"
],
"runtimeArgs": [
"--nolazy"
],
"outFiles": [
"${workspaceRoot}/dist/tsbuild/**/*"
],
"args": ["--config", "jest.json", "e2e"],
"runtimeArgs": ["--nolazy"],
"outFiles": ["${workspaceRoot}/dist/tsbuild/**/*"],
"sourceMaps": true,
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
Expand Down
11 changes: 9 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
"typescript.tsdk": "node_modules/typescript/lib",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"prettier.requireConfig": true,
"prettier.singleQuote": true,
"prettier.tabWidth": 4,
"prettier.trailingComma": "all",
"prettier.jsxBracketSameLine": true
}
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@ Create a backup of a MySQL database.

## Installation

```bash
$ npm install mysqldump
```
yarn add mysqldump
// or
npm install mysqldump

If you're using this package in typescript, you should also

```bash
$ npm install @types/node
```

## Usage

```typescript
import mysqldump from 'mysqldump'
import mysqldump from 'mysqldump';
// or const mysqldump = require('mysqldump')

// dump the result straight to a file
Expand All @@ -26,7 +31,7 @@ mysqldump({
database: 'my_database',
},
dumpToFile: './dump.sql',
})
});

// return the dump from the function and not to a file
const result = await mysqldump({
Expand All @@ -36,10 +41,13 @@ const result = await mysqldump({
password: '123456',
database: 'my_database',
},
})
});
```

## Result

The returned result contains the dump property, which is split into schema and data.

```TS
export default interface DumpReturn {
/**
Expand Down Expand Up @@ -68,7 +76,9 @@ export default interface DumpReturn {
```

## Options

All the below options are documented in the [typescript declaration file](./dist/mysqldump.d.ts):

```TS
export interface ConnectionOptions {
/**
Expand Down Expand Up @@ -342,7 +352,7 @@ export default function main(inputOptions: Options): Promise<DumpReturn>;
export as namespace mysqldump;
```

---------------------------------
---

The MIT [License](./LICENSE.md)

Expand All @@ -351,6 +361,7 @@ The MIT [License](./LICENSE.md)
### Installation

Make sure to first install all the required development dependencies:

```
yarn
// or
Expand Down
8 changes: 8 additions & 0 deletions dist/mysqldump.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,14 @@ export interface DataDumpOptions {
format?: boolean;
/**
* Include file headers in output
* Defaults to true.
*/
verbose?: boolean;
/**
* Use a read lock during the data dump (see: https://dev.mysql.com/doc/refman/5.7/en/replication-solutions-backups-read-only.html)
* Defaults to false.
*/
lockTables?: boolean;
/**
* Dump data from views.
* Defaults to false.
Expand Down Expand Up @@ -310,3 +316,5 @@ export interface DumpReturn {
export default function main(inputOptions: Options): Promise<DumpReturn>;

export as namespace mysqldump;

export {};
20 changes: 4 additions & 16 deletions jest.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
{
"moduleFileExtensions": [
"ts",
"tsx",
"js"
],
"moduleFileExtensions": ["ts", "tsx", "js"],
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.ts$",
"moduleDirectories": [
"src",
"node_modules"
],
"moduleDirectories": ["src", "node_modules"],
"globals": {
"ts-jest": {
"babelConfig": true,
Expand All @@ -20,13 +13,8 @@
},
"rootDir": ".",

"collectCoverageFrom": [
"src/**/*"
],
"coverageReporters": [
"html",
"text-summary"
],
"collectCoverageFrom": ["src/**/*"],
"coverageReporters": ["html", "text-summary"],
"coverageDirectory": "<rootDir>/coverage",
"coveragePathIgnorePatterns": [
"/node_modules/",
Expand Down
Loading

0 comments on commit 70c9258

Please sign in to comment.