Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating packages and fix comp. errors #126

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/schemats.ts
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ let argv: SchematsConfig = yargs
.describe('o', 'output file name')
.help('h')
.alias('h', 'help')
.argv;
.argv as unknown as SchematsConfig;

(async () => {

4,264 changes: 4,264 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

65 changes: 32 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
@@ -15,7 +15,6 @@
"build": "tsc",
"dependency-check": "dependency-check . --entry bin/schemats.js --missing --no-dev",
"test": "npm run lint && npm run build && npm run dependency-check && mocha",
"prepublish": "npm run build",
"clean": "del-cli node_modules **/*.js",
"coverage": "npm run lint && npm run build && npm run dependency-check && nyc mocha",
"coverage:ci": "npm run lint && npm run build && npm run dependency-check && nyc mocha && nyc report --reporter=text-lcov | coveralls"
@@ -38,41 +37,41 @@
],
"license": "MIT",
"devDependencies": {
"@types/bluebird": "^3.0.35",
"@types/diff": "^3.2.0",
"@types/lodash": "^4.14.37",
"@types/mocha": "^2.2.39",
"@types/mysql": "0.0.33",
"@types/mz": "^0.0.31",
"@types/node": "^6.0.77",
"@types/power-assert": "^1.4.29",
"@types/proxyquire": "^1.3.27",
"@types/sinon": "^2.1.2",
"@types/yargs": "^6.3.3",
"coveralls": "^2.11.15",
"del-cli": "^0.2.0",
"dependency-check": "^2.6.0",
"@types/bluebird": "^3.5.33",
"@types/diff": "^5.0.0",
"@types/lodash": "^4.14.168",
"@types/mocha": "^8.2.2",
"@types/mysql": "2.15.18",
"@types/mz": "^2.7.3",
"@types/node": "^15.0.1",
"@types/power-assert": "^1.5.3",
"@types/proxyquire": "^1.3.28",
"@types/sinon": "^10.0.0",
"@types/yargs": "^16.0.1",
"coveralls": "^3.1.0",
"del-cli": "^3.0.1",
"dependency-check": "^4.1.0",
"istanbul": "^0.4.5",
"mocha": "^3.2.0",
"nyc": "^11.0.2",
"power-assert": "^1.4.2",
"proxyquire": "^1.7.11",
"sinon": "^2.1.0",
"source-map-support": "^0.4.15",
"ts-node": "^3.0.4",
"tslint": "^5.4.2",
"tslint-config-standard": "^5.0.2"
"mocha": "^8.3.2",
"nyc": "^15.1.0",
"power-assert": "^1.6.1",
"proxyquire": "^2.1.3",
"sinon": "^10.0.0",
"source-map-support": "^0.5.19",
"ts-node": "^9.1.1",
"tslint": "^5.20.1",
"tslint-config-standard": "^9.0.0"
},
"dependencies": {
"bluebird": "^3.5.0",
"diff": "^3.2.0",
"lodash": "^4.17.4",
"mysql": "^2.13.0",
"mz": "^2.6.0",
"pg-promise": "^6.3.6",
"typescript": "^2.7.1",
"typescript-formatter": "^7.0.1",
"yargs": "^8.0.1"
"bluebird": "^3.7.2",
"diff": "^5.0.0",
"lodash": "^4.17.21",
"mysql": "^2.18.1",
"mz": "^2.7.0",
"pg-promise": "^10.10.1",
"typescript": "^4.2.4",
"typescript-formatter": "^7.2.2",
"yargs": "^16.2.0"
},
"nyc": {
"extension": [
4 changes: 2 additions & 2 deletions src/schemaMysql.ts
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ import { TableDefinition, Database } from './schemaInterfaces'
import Options from './options'

export class MysqlDatabase implements Database {
private db: mysql.IConnection
private db: mysql.Connection
private defaultSchema: string

constructor (public connectionString: string) {
@@ -163,7 +163,7 @@ export class MysqlDatabase implements Database {

public queryAsync (queryString: string, escapedValues?: Array<string>): Promise<Object[]> {
return new Promise((resolve, reject) => {
this.db.query(queryString, escapedValues, (error: Error, results: Array<Object>) => {
this.db.query(queryString, escapedValues, (error: mysql.MysqlError, results: Array<Object>) => {
if (error) {
return reject(error)
}
9 changes: 6 additions & 3 deletions test/integration/cli.test.ts
Original file line number Diff line number Diff line change
@@ -3,31 +3,34 @@ import * as assert from 'power-assert'

describe('schemats cli tool integration testing', () => {
describe('schemats generate postgres', () => {
let postgresUrl: string | undefined = undefined;
before(async function () {
if (!process.env.POSTGRES_URL) {
return this.skip()
}
postgresUrl = process.env.POSTGRES_URL;
})
it('should run without error', () => {
let {status, stdout, stderr} = spawnSync('node', [
'bin/schemats', 'generate',
'-c', process.env.POSTGRES_URL,
'-c', postgresUrl as string,
'-o', '/tmp/schemats_cli_postgres.ts'
], { encoding: 'utf-8' })
console.log('opopopopop', stdout, stderr)
assert.equal(0, status)
})
})
describe('schemats generate mysql', () => {
let mysqlUrl: string | undefined = undefined;
before(async function () {
if (!process.env.MYSQL_URL) {
return this.skip()
}
let mysqlUrl: string | undefined = undefined;
})
it('should run without error', () => {
let {status} = spawnSync('node', [
'bin/schemats', 'generate',
'-c', process.env.MYSQL_URL,
'-c', mysqlUrl as string,
'-s', 'test',
'-o', '/tmp/schemats_cli_postgres.ts'
])
2 changes: 1 addition & 1 deletion test/unit/index.test.ts
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ import Options, { OptionValues } from '../../src/options'
const options: OptionValues = {}

describe('index', () => {
const typedTableSandbox = sinon.sandbox.create()
const typedTableSandbox = sinon.createSandbox()
const db = {
getDefaultSchema: typedTableSandbox.stub(),
getTableTypes: typedTableSandbox.stub(),
4 changes: 2 additions & 2 deletions test/unit/schemaMysql.test.ts
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ const MysqlDBReflection = MysqlDatabase as any

describe('MysqlDatabase', () => {
let db: MysqlDatabase
const sandbox = sinon.sandbox.create()
const sandbox = sinon.createSandbox()
before(() => {
sandbox.stub(mysql, 'createConnection')
sandbox.stub(MysqlDBReflection.prototype, 'queryAsync')
@@ -141,7 +141,7 @@ describe('MysqlDatabase', () => {
})
})
describe('getTableTypes', () => {
const tableTypesSandbox = sinon.sandbox.create()
const tableTypesSandbox = sinon.createSandbox()
before(() => {
tableTypesSandbox.stub(MysqlDBReflection.prototype, 'getEnumTypes')
tableTypesSandbox.stub(MysqlDBReflection.prototype, 'getTableDefinition')
4 changes: 2 additions & 2 deletions test/unit/schemaPostgres.test.ts
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ const options = new Options({})
const pgp = PgPromise()

describe('PostgresDatabase', () => {
const sandbox = sinon.sandbox.create()
const sandbox = sinon.createSandbox()
const db = {
query: sandbox.stub(),
each: sandbox.stub(),
@@ -93,7 +93,7 @@ describe('PostgresDatabase', () => {
})
})
describe('getTableTypes', () => {
const tableTypesSandbox = sinon.sandbox.create()
const tableTypesSandbox = sinon.createSandbox()
before(() => {
tableTypesSandbox.stub(PostgresProxy, 'getEnumTypes')
tableTypesSandbox.stub(PostgresProxy, 'getTableDefinition')