Skip to content

Commit

Permalink
Rename src directory to lib (#3338)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardograca authored and kibertoad committed Jul 10, 2019
1 parent edf1e36 commit 9aa7085
Show file tree
Hide file tree
Showing 135 changed files with 52 additions and 53 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -11,7 +11,6 @@ node_modules
test.sqlite3
npm-debug.log
tmp
lib

# Testing for the knex cli:
bin/migrations-folder
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
@@ -1,6 +1,6 @@
## How to contribute to Knex.js

- Make changes in the `/src` directory.
- Make changes in the `/lib` directory.

- Before sending a pull request for a feature or bug fix, be sure to have
[tests](https://github.com/tgriesser/knex/tree/master/test). Every pull request that changes the queries should have
Expand Down Expand Up @@ -33,7 +33,7 @@ So if you like to write your own dialect, you can just inherit own dialect from
require('sqlite3-offline');
const Knex = require('knex');

const Dialect = require(`knex/src/dialects/sqlite3/index.js`);
const Dialect = require(`knex/lib/dialects/sqlite3/index.js`);
Dialect.prototype._driver = () => require('sqlite3-offline');

const knex = Knex({
Expand Down
2 changes: 1 addition & 1 deletion bin/cli.js
Expand Up @@ -125,7 +125,7 @@ function invoke(env) {
pending = fs
.readFileAsync(
path.dirname(env.modulePath) +
'/src/migrate/stub/knexfile-' +
'/lib/migrate/stub/knexfile-' +
type +
'.stub'
)
Expand Down
2 changes: 1 addition & 1 deletion bin/utils/cli-config-utils.js
@@ -1,5 +1,5 @@
const { DEFAULT_EXT, DEFAULT_TABLE_NAME } = require('./constants');
const { resolveClientNameWithAliases } = require('../../src/helpers');
const { resolveClientNameWithAliases } = require('../../lib/helpers');
const fs = require('fs');
const path = require('path');
const tildify = require('tildify');
Expand Down
2 changes: 1 addition & 1 deletion knex.js
Expand Up @@ -5,4 +5,4 @@
// For details and documentation:
// http://knexjs.org

module.exports = require('./src/index');
module.exports = require('./lib/index');
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions package.json
Expand Up @@ -8,11 +8,11 @@
"node": ">=8"
},
"scripts": {
"format": "prettier --write \"{src,bin,scripts,test}/**/*.js\"",
"format": "prettier --write \"{lib,bin,scripts,test}/**/*.js\"",
"debug:test": "mocha --inspect-brk --exit -t 0 test/index.js",
"debug:tape": "node --inspect-brk test/tape/index.js",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"lint": "eslint \"src/**/*.js\" \"test/**/*.js\"",
"lint": "eslint \"lib/**/*.js\" \"test/**/*.js\"",
"lint:types": "dtslint types",
"pretest": "npm run lint && npm run lint:types",
"test": "mocha --exit -t 10000 test/index.js && npm run test:tape && npm run test:cli",
Expand Down Expand Up @@ -125,9 +125,9 @@
}
],
"browser": {
"./src/migrate/Migrator.js": "./src/util/noop.js",
"./src/bin/cli.js": "./src/util/noop.js",
"./src/seed/Seeder.js": "./src/util/noop.js",
"./lib/migrate/Migrator.js": "./lib/util/noop.js",
"./lib/bin/cli.js": "./lib/util/noop.js",
"./lib/seed/Seeder.js": "./lib/util/noop.js",
"mssql": false,
"mssql/lib/base": false,
"tedious": false,
Expand All @@ -140,14 +140,14 @@
"oracledb": false
},
"react-native": {
"./src/migrate": "./src/util/noop.js",
"./src/seed": "./src/util/noop.js"
"./lib/migrate": "./lib/util/noop.js",
"./lib/seed": "./lib/util/noop.js"
},
"files": [
"CONTRIBUTING.md",
"README.md",
"bin/*",
"src/*",
"lib/*",
"lib/*",
"knex.js",
"LICENSE",
Expand Down
2 changes: 1 addition & 1 deletion test/integration/builder/selects.js
Expand Up @@ -3,7 +3,7 @@

const _ = require('lodash');
const assert = require('assert');
const Runner = require('../../../src/runner');
const Runner = require('../../../lib/runner');

module.exports = function(knex) {
describe('Selects', function() {
Expand Down
4 changes: 2 additions & 2 deletions test/tape/knex.js
@@ -1,6 +1,6 @@
'use strict';

const knex = require('../../src/index');
const knex = require('../../lib/index');
const test = require('tape');

test('it should parse the connection string', function(t) {
Expand All @@ -20,7 +20,7 @@ test('it should parse the connection string', function(t) {

test('it should allow to use proprietary dialect', function(t) {
t.plan(2);
const Client = require('../../src/dialects/mysql');
const Client = require('../../lib/dialects/mysql');
const knexObj = knex({
client: Client,
connection: {
Expand Down
4 changes: 2 additions & 2 deletions test/tape/migrate.js
@@ -1,8 +1,8 @@
'use strict';

const tape = require('tape');
const { Migrator } = require('../../src/migrate/Migrator');
const mergeConfig = require('../../src/migrate/configuration-merger')
const { Migrator } = require('../../lib/migrate/Migrator');
const mergeConfig = require('../../lib/migrate/configuration-merger')
.getMergedConfig;

tape('migrate: constructor uses config.migrations', function(t) {
Expand Down
2 changes: 1 addition & 1 deletion test/tape/parse-connection.js
@@ -1,6 +1,6 @@
'use strict';

const parseConnection = require('../../src/util/parse-connection');
const parseConnection = require('../../lib/util/parse-connection');
const test = require('tape');

test('parses standard connections', function(t) {
Expand Down
2 changes: 1 addition & 1 deletion test/tape/pool.js
@@ -1,7 +1,7 @@
'use strict';

const test = require('tape');
const Client = require('../../src/dialects/sqlite3');
const Client = require('../../lib/dialects/sqlite3');
const tarn = require('tarn');
const Pool = tarn.Pool;
const knexfile = require('../knexfile');
Expand Down
4 changes: 2 additions & 2 deletions test/tape/query-builder.js
Expand Up @@ -2,8 +2,8 @@

const tape = require('tape');
const omit = require('lodash/omit');
const QueryBuilder = require('../../src/query/builder');
const Client = require('../../src/client');
const QueryBuilder = require('../../lib/query/builder');
const Client = require('../../lib/client');

tape('accumulates multiple update calls #647', function(t) {
t.plan(1);
Expand Down
4 changes: 2 additions & 2 deletions test/tape/raw.js
@@ -1,7 +1,7 @@
'use strict';

const Raw = require('../../src/raw');
const Client = require('../../src/client');
const Raw = require('../../lib/raw');
const Client = require('../../lib/client');
const test = require('tape');
const _ = require('lodash');

Expand Down
2 changes: 1 addition & 1 deletion test/tape/seed.js
@@ -1,7 +1,7 @@
'use strict';

const tape = require('tape');
const Seed = require('../../src/seed/Seeder');
const Seed = require('../../lib/seed/Seeder');

tape('checks config.seeds for seed config', function(t) {
t.plan(1);
Expand Down
2 changes: 1 addition & 1 deletion test/unit/dialects/postgres.js
@@ -1,7 +1,7 @@
const knex = require('../../../knex');
const expect = require('chai').expect;
const sinon = require('sinon');
const pgDialect = require('../../../src/dialects/postgres/index.js');
const pgDialect = require('../../../lib/dialects/postgres/index.js');
const pg = require('pg');
const _ = require('lodash');

Expand Down
2 changes: 1 addition & 1 deletion test/unit/dialects/sqlite3.js
Expand Up @@ -2,7 +2,7 @@

'use strict';
const sinon = require('sinon');
const DDL = require('../../../src/dialects/sqlite3/schema/ddl');
const DDL = require('../../../lib/dialects/sqlite3/schema/ddl');

it('[backwards compatible] can rename column with double quotes', function() {
const client = sinon.stub();
Expand Down
2 changes: 1 addition & 1 deletion test/unit/interface.js
@@ -1,5 +1,5 @@
'use strict';
const _interface = require('../../src/interface');
const _interface = require('../../lib/interface');
const chai = require('chai');

describe('interface', function() {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/knex.js
@@ -1,4 +1,4 @@
const Knex = require('../../src/index');
const Knex = require('../../lib/index');
const { expect } = require('chai');
const bluebird = require('bluebird');
const sqliteConfig = require('../knexfile').sqlite3;
Expand Down Expand Up @@ -433,7 +433,7 @@ describe('knex', () => {

it('throws if client module has not been installed', () => {
// create dummy dialect which always fails when trying to load driver
const SqliteClient = require(`../../src/dialects/sqlite3/index.js`);
const SqliteClient = require(`../../lib/dialects/sqlite3/index.js`);
function ClientFoobar(config) {
SqliteClient.call(this, config);
}
Expand Down
4 changes: 2 additions & 2 deletions test/unit/migrate/Migrator.js
@@ -1,7 +1,7 @@
const Knex = require('../../../src/index');
const Knex = require('../../../lib/index');
const { expect } = require('chai');
const sqliteConfig = require('../../knexfile').sqlite3;
const FsMigrations = require('../../../src/migrate/sources/fs-migrations')
const FsMigrations = require('../../../lib/migrate/sources/fs-migrations')
.default;

describe('Migrator', () => {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/migrate/migration-list-resolver.js
Expand Up @@ -5,8 +5,8 @@ const Promise = require('bluebird');
const { expect } = require('chai');
const sinon = require('sinon');
const mockFs = require('mock-fs');
const migrationListResolver = require('../../../src/migrate/migration-list-resolver');
const { FsMigrations } = require('../../../src/migrate/sources/fs-migrations');
const migrationListResolver = require('../../../lib/migrate/migration-list-resolver');
const { FsMigrations } = require('../../../lib/migrate/sources/fs-migrations');

describe('migration-list-resolver', () => {
describe('listAll', () => {
Expand Down
12 changes: 6 additions & 6 deletions test/unit/query/builder.js
Expand Up @@ -2,12 +2,12 @@
/*eslint no-var:0, indent:0, max-len:0 */
'use strict';

var MySQL_Client = require('../../../src/dialects/mysql');
var PG_Client = require('../../../src/dialects/postgres');
var Redshift_Client = require('../../../src/dialects/redshift');
var Oracledb_Client = require('../../../src/dialects/oracledb');
var SQLite3_Client = require('../../../src/dialects/sqlite3');
var MSSQL_Client = require('../../../src/dialects/mssql');
var MySQL_Client = require('../../../lib/dialects/mysql');
var PG_Client = require('../../../lib/dialects/postgres');
var Redshift_Client = require('../../../lib/dialects/redshift');
var Oracledb_Client = require('../../../lib/dialects/oracledb');
var SQLite3_Client = require('../../../lib/dialects/sqlite3');
var MSSQL_Client = require('../../../lib/dialects/mssql');

// use driverName as key
var clients = {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/schema/mssql.js
Expand Up @@ -3,7 +3,7 @@
'use strict';

const sinon = require('sinon');
const MSSQL_Client = require('../../../src/dialects/mssql');
const MSSQL_Client = require('../../../lib/dialects/mssql');
const client = new MSSQL_Client({ client: 'mssql' });

describe('MSSQL SchemaBuilder', function() {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/schema/mysql.js
@@ -1,8 +1,8 @@
/*global expect*/

const sinon = require('sinon');
const MySQL_Client = require('../../../src/dialects/mysql');
const MySQL2_Client = require('../../../src/dialects/mysql2');
const MySQL_Client = require('../../../lib/dialects/mysql');
const MySQL2_Client = require('../../../lib/dialects/mysql2');

module.exports = function(dialect) {
describe(dialect + ' SchemaBuilder', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/schema/oracle.js
Expand Up @@ -3,7 +3,7 @@
'use strict';

const sinon = require('sinon');
const Oracle_Client = require('../../../src/dialects/oracle');
const Oracle_Client = require('../../../lib/dialects/oracle');
const client = new Oracle_Client({ client: 'oracledb' });

describe('Oracle SchemaBuilder', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/schema/oracledb.js
Expand Up @@ -3,7 +3,7 @@
'use strict';

const sinon = require('sinon');
const Oracle_Client = require('../../../src/dialects/oracledb');
const Oracle_Client = require('../../../lib/dialects/oracledb');
const client = new Oracle_Client({ client: 'oracledb' });

describe('OracleDb SchemaBuilder', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/schema/postgres.js
Expand Up @@ -3,7 +3,7 @@
let tableSql;

const sinon = require('sinon');
const PG_Client = require('../../../src/dialects/postgres');
const PG_Client = require('../../../lib/dialects/postgres');
const client = new PG_Client({ client: 'pg' });
const knex = require('../../../knex');

Expand Down
2 changes: 1 addition & 1 deletion test/unit/schema/redshift.js
Expand Up @@ -5,7 +5,7 @@

let tableSql;

const Redshift_Client = require('../../../src/dialects/redshift');
const Redshift_Client = require('../../../lib/dialects/redshift');
const client = new Redshift_Client({ client: 'redshift' });

const equal = require('assert').equal;
Expand Down
4 changes: 2 additions & 2 deletions test/unit/schema/sqlite3.js
Expand Up @@ -5,9 +5,9 @@
let tableSql;

const sinon = require('sinon');
const SQLite3_Client = require('../../../src/dialects/sqlite3');
const SQLite3_Client = require('../../../lib/dialects/sqlite3');
const client = new SQLite3_Client({ client: 'sqlite3' });
const SQLite3_DDL = require('../../../src/dialects/sqlite3/schema/ddl');
const SQLite3_DDL = require('../../../lib/dialects/sqlite3/schema/ddl');

const _ = require('lodash');
const { equal, deepEqual } = require('assert');
Expand Down
2 changes: 1 addition & 1 deletion test/unit/util/save-async-stack.js
@@ -1,5 +1,5 @@
'use strict';
const saveAsyncStack = require('../../../src/util/save-async-stack');
const saveAsyncStack = require('../../../lib/util/save-async-stack');
const chai = require('chai');

describe('saveAsyncStack', function() {
Expand Down
4 changes: 2 additions & 2 deletions types/test.ts
Expand Up @@ -1173,7 +1173,7 @@ const main = async () => {
// $ExpectType string
await knex.seed.make('test', {
extension: 'ts',
directory: 'src/seeds'
directory: 'lib/seeds'
});

// $ExpectType string[]
Expand All @@ -1182,6 +1182,6 @@ const main = async () => {
// $ExpectType string[]
await knex.seed.run({
extension: 'ts',
directory: 'src/seeds'
directory: 'lib/seeds'
});
};

0 comments on commit 9aa7085

Please sign in to comment.