Skip to content

Commit

Permalink
Adjust package scope
Browse files Browse the repository at this point in the history
  • Loading branch information
fdebijl committed Jun 24, 2024
1 parent 8827077 commit 4c86479
Show file tree
Hide file tree
Showing 16 changed files with 29 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ npm-debug.log
coverage
/*.env
.kube/**/secret.yml
dist
dist/
.vscode/
.migrations
assets.json
Expand Down
6 changes: 6 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
test/
coverage/
src/
.nyc_output
.npmignore
.npmrc
.travis.yml
.nycrc
.eslintignore
.eslintrc.json
.github
.yarnrc.yml
.yarn
.editorconfig
tsconfig.json
6 changes: 2 additions & 4 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
{
"cache": true,
"all": true,
"exclude": [
"node_modules/**",
"test/**",
"testUtils/**",
"tap-snapshots/**",
"coverage/**",
"migrations/**",
"src/migrationTemplates/**"
"migrationTemplates/**",
"dist/**"
]
}
42 changes: 0 additions & 42 deletions dist/adapter.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/adapter.js.map

This file was deleted.

8 changes: 0 additions & 8 deletions dist/index.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/index.js.map

This file was deleted.

8 changes: 0 additions & 8 deletions dist/migrationTemplates/async.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/migrationTemplates/async.js.map

This file was deleted.

File renamed without changes.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"type": "git",
"url": "git://github.com/feedbackfruits/east-mongo.git"
},
"main": "lib/index.js",
"main": "dist/index.js",
"keywords": [
"database",
"db",
Expand All @@ -22,7 +22,7 @@
},
"scripts": {
"build": "tsc",
"lint": "eslint \"./src/**/*.ts\" --max-warnings 0 --ignore-pattern \"src/migrationTemplates/**/*.ts\"",
"lint": "eslint \"./src/**/*.ts\" --max-warnings 0",
"lint:tests": "eslint \"./test/**/*.ts\" --max-warnings 0",
"test": "NODE_ENV=test nyc tsx node_modules/jasmine/bin/jasmine \"test/**/*.spec.ts\""
},
Expand Down
11 changes: 1 addition & 10 deletions src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,8 @@ class MongoAdapter implements Adapter<MongoClient> {
}
}

async isConnected(): Promise<boolean> {
try {
const count = await this.collection.estimatedDocumentCount();
return !isNaN(count);
} catch (e) {
return false;
}
}

getTemplatePath(): string {
return path.join(__dirname, 'migrationTemplates', 'async.ts');
return path.join(__dirname, '../migrationTemplates', 'async.ts');
}

async connect(): Promise<MongoClient> {
Expand Down
14 changes: 14 additions & 0 deletions test/adapter/constructor.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

import MongoAdapter from '../../src/adapter';

describe('constructor', () => {
it('should construct with URL', async () => {
const adapter = new MongoAdapter({ url: 'mongodb://localhost:27017/test' });

expect(adapter).toBeDefined();
});

it ('should throw without URL', async () => {
expect(() => new MongoAdapter({ url: '' })).toThrow();
});
});
2 changes: 1 addition & 1 deletion test/adapter/getTemplatePath.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('getTemplatePath', () => {
adapter.getTemplatePath()
);

expect(templatePath).toBe('../../src/migrationTemplates/async.ts');
expect(templatePath).toBe('../../migrationTemplates/async.ts');
});
});
});
2 changes: 1 addition & 1 deletion test/migrationTemplates.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'path';
describe('migrationTemplates', () => {
const templatesPath = path.resolve(
__dirname,
'../src/migrationTemplates'
'../migrationTemplates'
);

it('can load async template', async () => {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"isolatedModules": false,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"declaration": false,
"declaration": true,
"sourceMap": true,
"exactOptionalPropertyTypes": false,
"strictNullChecks": false,
Expand Down

0 comments on commit 4c86479

Please sign in to comment.