Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
33 changes: 0 additions & 33 deletions .eslintrc

This file was deleted.

43 changes: 43 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint"
],
"env": {
"node": true
},
"globals": {
"Promise": true,
"Uint8Array": true,
"ArrayBuffer": true,
"Set": true,
"Map": true
},
"parserOptions": {
"ecmaVersion": 2017
},
"plugins": [
"prettier"
],
"rules": {
"prettier/prettier": "error",
"no-console": "off",
"eqeqeq": [
"error",
"always",
{
"null": "ignore"
}
],
"strict": [
"error",
"global"
],
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-var-requires": "off"
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ builderror.log

bson.sublime-project
bson.sublime-workspace

lib
12 changes: 12 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extension": [
"js"
],
"require": [
"ts-node/register",
"source-map-support/register"
],
"timeout": 10000,
"throw-deprecation": true,
"parallel": false
}
5 changes: 5 additions & 0 deletions .nycrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "@istanbuljs/nyc-config-typescript",
"include": ["src/**/*.ts"],
"reporter": ["lcovonly", "text-summary"]
}
7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"singleQuote": true,
"tabWidth": 2,
"printWidth": 100,
"arrowParens": "avoid",
"trailingComma": "none"
}
27 changes: 27 additions & 0 deletions Gulpfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { spawnSync } from 'child_process';
import * as gulp from 'gulp';
import * as ts from 'gulp-typescript';

import tsConfig = require('./tsconfig.json');
const run = (cmd: string) => {
const [program, ...args] = cmd.split(' ');
return spawnSync(program, args, { stdio: 'inherit' });
};

gulp.task('api-extractor', done => {
run('npx api-extractor run --local');
run('npx rimraf lib/*.d.ts lib/**/*.d.ts');
done();
});

gulp.task('compile', () => {
return gulp.src('./src/**/*.ts').pipe(ts(tsConfig.compilerOptions)).pipe(gulp.dest('./lib'));
});

gulp.task('bundle', done => {
run('rollup -c rollup.config.ts');
done();
});

gulp.task('definition', gulp.series('compile', 'api-extractor'));
gulp.task('default', gulp.series('compile', 'bundle', 'api-extractor'));
51 changes: 51 additions & 0 deletions api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "<projectFolder>/lib/bson.d.ts",
"apiReport": {
"enabled": false
},
"docModel": {
"enabled": false
},
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "<projectFolder>/types/<unscopedPackageName>.d.ts"
},
"tsdocMetadata": {
"enabled": false
},
"newlineKind": "lf",
"messages": {
"compilerMessageReporting": {
"default": {
"logLevel": "error"
}
},
"extractorMessageReporting": {
"default": {
"logLevel": "warning"
},
"ae-internal-missing-underscore": {
"logLevel": "none",
"addToApiReportFile": false
},
"ae-missing-release-tag": {
"logLevel": "none",
"addToApiReportFile": false
},
"ae-incompatible-release-tags": {
"logLevel": "none",
"addToApiReportFile": false
},
"ae-unresolved-link": {
"addToApiReportFile": false,
"logLevel": "none"
}
},
"tsdocMessageReporting": {
"default": {
"logLevel": "none"
}
}
}
}
11 changes: 2 additions & 9 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
{
"name": "bson",
"description": "A bson parser for node.js and the browser",
"keywords": [
"mongodb",
"bson",
"parser"
],
"keywords": ["mongodb", "bson", "parser"],
"author": "Christian Amor Kvalheim <[email protected]>",
"main": "./dist/bson.js",
"license": "Apache-2.0",
"moduleType": [
"globals",
"node"
],
"moduleType": ["globals", "node"],
"ignore": [
"**/.*",
"alternate_parsers",
Expand Down
21 changes: 10 additions & 11 deletions karma.conf.js → karma.conf.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
'use strict';

const scenariosPlugin = require('./tools/scenarios-plugin');
const jsonPlugin = require('rollup-plugin-json');
const nodeGlobals = require('rollup-plugin-node-globals');
const nodeBuiltins = require('rollup-plugin-node-builtins');
const commonjs = require('rollup-plugin-commonjs');
const nodeResolve = require('rollup-plugin-node-resolve');

import commonjs from '@rollup/plugin-commonjs';
import jsonPlugin from '@rollup/plugin-json';
import nodeResolve from '@rollup/plugin-node-resolve';
import nodeBuiltins from 'rollup-plugin-node-builtins';
import nodeGlobals from 'rollup-plugin-node-globals';

const rollupPlugins = [
scenariosPlugin(),
Expand All @@ -17,7 +16,7 @@ const rollupPlugins = [
namedExports: {
'node_modules/buffer/index.js': ['isBuffer']
}
}),
} as any),
nodeBuiltins(),
nodeGlobals(),
jsonPlugin()
Expand All @@ -37,9 +36,9 @@ const onwarn = warning => {
console.warn(warning.toString());
};

rollupConfig.onwarn = onwarn;
(rollupConfig as any).onwarn = onwarn;

module.exports = function(config) {
export default function (config) {
config.set({
basePath: '',
frameworks: ['mocha'],
Expand All @@ -63,4 +62,4 @@ module.exports = function(config) {
singleRun: true,
concurrency: Infinity
});
};
}
Loading