Skip to content

Commit b420ad4

Browse files
committed
feat(package): move to ES6 with rollup build
Also the utility function getUsersUrl(db) has been made available as part of the plugin API as db.getUsersDatabaseUrl() as it is used in tests.
1 parent 3e6ce19 commit b420ad4

16 files changed

+181
-4031
lines changed

.eslintrc.json

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
3+
"extends": "eslint:recommended",
4+
5+
"parserOptions": {
6+
"ecmaVersion": 6,
7+
"sourceType": "module"
8+
},
9+
10+
"env": {
11+
"browser": true,
12+
"node": true,
13+
"mocha": true
14+
},
15+
16+
"globals": {
17+
"Map": true,
18+
"Set": true,
19+
"chrome": true,
20+
"Promise": true,
21+
"Uint8Array": true,
22+
"ArrayBuffer": true,
23+
"FileReaderSync": true,
24+
"sqlitePlugin": true,
25+
"emit": true,
26+
"PouchDB": true,
27+
"should": true,
28+
"assert": true,
29+
"testUtils": true,
30+
"importScripts": true,
31+
"testCases": true
32+
},
33+
34+
"rules": {
35+
"no-empty": 0,
36+
"no-console": 0,
37+
"semi": ["error", "always"],
38+
"curly": ["error", "all"],
39+
"space-unary-ops": ["error", {"words": true}],
40+
"space-before-function-paren": ["error", {"anonymous": "always", "named": "never"}],
41+
"max-len": ["error", 100, {"ignoreComments": true, "ignoreStrings": true, "ignoreRegExpLiterals": true}],
42+
"keyword-spacing": ["error"],
43+
"space-before-blocks": ["error"]
44+
}
45+
}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ coverage
55
npm-debug.log
66
test/test-bundle.js
77
dist
8+
lib
89
.idea

.jshintrc

-29
This file was deleted.

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ sudo: false
1111
before_script:
1212
- "npm install add-cors-to-couchdb"
1313
- "./node_modules/.bin/add-cors-to-couchdb"
14-
- "npm run jshint"
14+
- "npm run lint"
1515

1616
script: npm test
1717

config/rollup.config.browser.cjs.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import config from './rollup.config';
2+
3+
export default config({
4+
format: 'cjs',
5+
dest: 'lib/index.browser.js',
6+
browser: true
7+
});

config/rollup.config.browser.es.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import config from './rollup.config';
2+
3+
export default config({
4+
format: 'es',
5+
dest: 'lib/index.browser.es.js',
6+
browser: true
7+
});

config/rollup.config.cjs.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import config from './rollup.config';
2+
3+
export default config({
4+
format: 'cjs',
5+
dest: 'lib/index.js',
6+
browser: false
7+
});

config/rollup.config.es.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import config from './rollup.config';
2+
3+
export default config({
4+
format: 'es',
5+
dest: 'lib/index.es.js',
6+
browser: false
7+
});

config/rollup.config.iife.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import config from './rollup.config';
2+
3+
export default config({
4+
format: 'iife',
5+
dest: 'dist/pouchdb.authentication.js',
6+
browser: true
7+
});

config/rollup.config.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import buble from 'rollup-plugin-buble';
2+
import replace from 'rollup-plugin-replace';
3+
4+
export default config => {
5+
return {
6+
entry: 'src/index.js',
7+
format: config.format,
8+
moduleName: 'pouchdb_authentication',
9+
dest: config.dest,
10+
plugins: [
11+
buble(),
12+
replace({'process.browser': JSON.stringify(!!config.browser)})
13+
]
14+
};
15+
};

0 commit comments

Comments
 (0)