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

Commit

Permalink
add storage-adapter
Browse files Browse the repository at this point in the history
fix linting
  • Loading branch information
shamb0t committed Aug 28, 2019
1 parent 5cbfe16 commit dd884f8
Show file tree
Hide file tree
Showing 15 changed files with 15,909 additions and 2,120 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 src conf 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
Tests:
jobs:
- setup
- test-node:
requires:
- setup
- test-browser:
requires:
- setup
- build:
requires:
- setup
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,2 +1,4 @@
*sublime*
node_modules/
test/browser/bundle.js
test/browser/bundle.js.map
7 changes: 7 additions & 0 deletions .npmignore
@@ -0,0 +1,7 @@
*sublime*
node_modules/
dist/*.min.js.map
test
conf
Makefile
.circleci
25 changes: 25 additions & 0 deletions Makefile
@@ -0,0 +1,25 @@
all: build

deps: clean
npm install

test: deps
npm run test

build: test
npm run build
@echo "Build success!"
# cp dist/orbit-db-store.min.js dist/orbit-db-keystore.min.js.map examples/browser
@echo "Built: 'dist/', 'examples/browser/'"

clean:
rm -rf ipfs/
rm -rf keystore/

clean-dependencies: clean
rm -f package-lock.json
rm -rf node_modules/

rebuild: | clean-dependencies build

.PHONY: test
34 changes: 34 additions & 0 deletions conf/webpack.config.js
@@ -0,0 +1,34 @@
'use strict'

const path = require('path')

module.exports = {
entry: './src/Store.js',
output: {
libraryTarget: 'var',
library: 'Store',
filename: 'orbit-db-store.min.js'
},
target: 'web',
mode: 'production',
devtool: 'sourcemap',
node: {
console: false,
Buffer: true
},
plugins: [
],
resolve: {
modules: [
'node_modules',
path.resolve(__dirname, '../node_modules')
]
},
resolveLoader: {
modules: [
'node_modules',
path.resolve(__dirname, '../node_modules')
],
moduleExtensions: ['-loader']
}
}
75 changes: 75 additions & 0 deletions conf/webpack.tests.config.js
@@ -0,0 +1,75 @@
'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',
node: {
child_process: 'empty'
},
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: '{}',
rimraf: '{ sync: () => {} }',
'graceful-fs': '{}',
'fs-extra': '{ copy: () => {} }',
'fs.realpath': '{}'
// 'child_process': {},
// dns: '{}',
// "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']
}
}
},
{
test: /signing|getPublic$/,
loader: 'json-loader'
}
]
}
}
31 changes: 31 additions & 0 deletions dist/orbit-db-store.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/orbit-db-store.min.js.map

Large diffs are not rendered by default.

0 comments on commit dd884f8

Please sign in to comment.