Skip to content
This repository has been archived by the owner on Sep 30, 2023. It is now read-only.

Commit

Permalink
Merge pull request #12 from orbitdb/fix/persistent-store
Browse files Browse the repository at this point in the history
Fix/persistent store
  • Loading branch information
aphelionz committed Aug 13, 2019
2 parents efee6d4 + 9703a61 commit 54d2638
Show file tree
Hide file tree
Showing 17 changed files with 16,230 additions and 1,420 deletions.
59 changes: 59 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,59 @@
# Use the latest 2.1 version of CircleCI pipeline processing engine, see https://circleci.com/docs/2.0/configuration-reference/
version: 2.1

executors:
node10-browsers:
docker:
- image: circleci/node:10-browsers

jobs:
setup:
executor: node10-browsers
steps:
- checkout
- run: mkdir -p /tmp/workspace
- run: make clean-dependencies
- run: make deps
- run: npm run lint
- run: cp -R conf src node_modules test package.json /tmp/workspace
- persist_to_workspace:
root: /tmp/workspace
paths:
- src
- node_modules
- test
- conf
- package.json
test-node:
executor: node10-browsers
steps:
- attach_workspace:
at: ./
- run: npm run test:node
test-browser:
executor: node10-browsers
steps:
- attach_workspace:
at: ./
- run: npm run test:browser
build:
executor: node10-browsers
steps:
- attach_workspace:
at: ./
- run: npm run build

workflows:
version: 2
Implementations:
jobs:
- setup
- test-node:
requires:
- setup
- test-browser:
requires:
- setup
- build:
requires:
- setup
5 changes: 4 additions & 1 deletion .gitignore
@@ -1 +1,4 @@
node_modules/
dump.rdb
orbitdb.json
node_modules
redis-stable*
163 changes: 0 additions & 163 deletions Cache.js

This file was deleted.

27 changes: 27 additions & 0 deletions Makefile
@@ -0,0 +1,27 @@
all: build

deps:
npm install

test: deps
npm run test
rm -f dump.rdb
rm -f orbitdb.json

build: test
npm run build
@echo "Build success!"
@echo "Output: 'dist/'"

clean:
rm -rf orbitdb/
rm -rf customDir/
rm -rf node_modules/
rm -rf redis-stable/

clean-dependencies: clean
rm -f package-lock.json;

rebuild: | clean-dependencies build

.PHONY: test build
12 changes: 0 additions & 12 deletions README.md
Expand Up @@ -20,18 +20,6 @@ npm install --save orbit-db-cache

#### Public methods

##### `open`

Open cache store and make it available to be used (indexedDB or leveldb)

##### `close`

Close cache store and the underlying indexedDB / leveldb instance

##### `destroy`

Completely remove an existing store and deletes the locally persisted cache

##### `get`

Get an item from the cache store
Expand Down
47 changes: 47 additions & 0 deletions conf/webpack.config.js
@@ -0,0 +1,47 @@
'use strict'

const path = require('path')
const webpack = require('webpack')

module.exports = {
entry: './src/Cache.js',
output: {
libraryTarget: 'var',
library: 'Cache',
filename: '../dist/orbit-db-cache.min.js'
},
target: 'web',
devtool: 'none',
externals: {
fs: '{}',
mkdirp: '{}'
},
node: {
console: false,
Buffer: true,
mkdirp: 'empty'
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify(process.env.NODE_ENV)
}
})
],
resolve: {
modules: [
'node_modules',
path.resolve(__dirname, '../node_modules')
],
alias: {
leveldown: 'level-js'
}
},
resolveLoader: {
modules: [
'node_modules',
path.resolve(__dirname, '../node_modules')
],
moduleExtensions: ['-loader']
}
}
65 changes: 65 additions & 0 deletions conf/webpack.tests.config.js
@@ -0,0 +1,65 @@
'use strict'

const glob = require('glob')
const webpack = require('webpack')
const path = require('path')

module.exports = {
// TODO: put all tests in a .js file that webpack can use as entry point
entry: glob.sync('./test/*.spec.js'),
output: {
filename: '../test/browser/bundle.js'
},
target: 'web',
mode: 'production',
devtool: 'source-map',
plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify(process.env.NODE_ENV)
}
}),
new webpack.IgnorePlugin(/mongo|redis/)
],
externals: {
fs: '{}',
fatfs: '{}',
runtimejs: '{}',
net: '{}',
tls: '{}',
'child_process': {},
dns: '{}'
// path: '{}',
// "node-gyp-build": '{}'
},
resolve: {
modules: [
'node_modules',
path.resolve(__dirname, '../node_modules')
]
},
resolveLoader: {
modules: [
'node_modules',
path.resolve(__dirname, '../node_modules')
],
moduleExtensions: ['-loader']
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', { modules: false }]
],
plugins: ['@babel/syntax-object-rest-spread', '@babel/transform-runtime', '@babel/plugin-transform-modules-commonjs']
}
}
}
]
}
}
1 change: 1 addition & 0 deletions dist/orbit-db-cache.min.js

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions index-browser.js

This file was deleted.

4 changes: 0 additions & 4 deletions index-nodejs.js

This file was deleted.

0 comments on commit 54d2638

Please sign in to comment.