mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-02 08:56:11 +00:00
feature(@embark/embarkjs-swarm): make embarkjs swarm plugin to its own module
This commit is contained in:
parent
776cb140d2
commit
f6c14d9f22
@ -97,6 +97,7 @@
|
||||
"embark-webserver": "^4.0.0",
|
||||
"embarkjs": "^4.0.0",
|
||||
"embarkjs-ipfs": "^4.0.0",
|
||||
"embarkjs-swarm": "^4.0.0",
|
||||
"eth-ens-namehash": "2.0.8",
|
||||
"ethereumjs-tx": "1.3.7",
|
||||
"ethereumjs-util": "6.0.0",
|
||||
|
@ -44,6 +44,7 @@ class VM {
|
||||
"embarkjs-whisper",
|
||||
"ipfs-api",
|
||||
"embarkjs-ipfs",
|
||||
"embarkjs-swarm",
|
||||
"rxjs",
|
||||
"rxjs/operators",
|
||||
],
|
||||
|
@ -1,6 +1,5 @@
|
||||
const UploadSwarm = require('./upload.js');
|
||||
const utils = require('../../utils/utils.js');
|
||||
import {joinPath} from 'embark-utils';
|
||||
const SwarmAPI = require('swarm-api');
|
||||
// TODO: not great, breaks module isolation
|
||||
const StorageProcessesLauncher = require('../storage/storageProcessesLauncher');
|
||||
@ -91,8 +90,8 @@ class Swarm {
|
||||
|
||||
addProviderToEmbarkJS() {
|
||||
let code = "";
|
||||
code += "\n" + this.fs.readFileSync(joinPath(__dirname, 'embarkjs.js')).toString();
|
||||
code += "\nEmbarkJS.Storage.registerProvider('swarm', __embarkSwarm);";
|
||||
code += "\nconst __embarkSwarm = require('embarkjs-swarm')";
|
||||
code += "\nEmbarkJS.Storage.registerProvider('swarm', __embarkSwarm.default || __embarkSwarm);";
|
||||
|
||||
this.embark.addCodeToEmbarkJS(code);
|
||||
}
|
||||
|
46
packages/embarkjs-swarm/.babelrc.js
Normal file
46
packages/embarkjs-swarm/.babelrc.js
Normal file
@ -0,0 +1,46 @@
|
||||
/* global module require */
|
||||
|
||||
const cloneDeep = require('lodash.clonedeep');
|
||||
|
||||
module.exports = (api) => {
|
||||
const env = api.env();
|
||||
|
||||
const base = {};
|
||||
|
||||
const browser = cloneDeep(base);
|
||||
Object.assign(browser, {
|
||||
ignore: [
|
||||
'src/embarkjs.js',
|
||||
'src/node/index.js'
|
||||
]
|
||||
});
|
||||
|
||||
const node = cloneDeep(base);
|
||||
Object.assign(node, {
|
||||
ignore: [
|
||||
'src/browser.js'
|
||||
]
|
||||
});
|
||||
|
||||
const nodeAsync = cloneDeep(base);
|
||||
Object.assign(nodeAsync, {
|
||||
ignore: [
|
||||
'src/node/index.js'
|
||||
]
|
||||
});
|
||||
|
||||
const nodeTest = cloneDeep(base);
|
||||
|
||||
switch (env) {
|
||||
case 'browser':
|
||||
return browser;
|
||||
case 'node':
|
||||
return node;
|
||||
case 'node:async':
|
||||
return nodeAsync;
|
||||
case 'node:test':
|
||||
return nodeTest;
|
||||
default:
|
||||
return base;
|
||||
}
|
||||
};
|
1
packages/embarkjs-swarm/.gitignore
vendored
Normal file
1
packages/embarkjs-swarm/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
build-test
|
4
packages/embarkjs-swarm/.npmrc
Normal file
4
packages/embarkjs-swarm/.npmrc
Normal file
@ -0,0 +1,4 @@
|
||||
engine-strict = true
|
||||
package-lock = false
|
||||
save-exact = true
|
||||
scripts-prepend-node-path = true
|
6
packages/embarkjs-swarm/README.md
Normal file
6
packages/embarkjs-swarm/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
# `embarkjs-ipfs`
|
||||
|
||||
embarkjs plugin to interact with ipfs
|
||||
|
||||
Visit [embark.status.im](https://embark.status.im/) to get started with
|
||||
[Embark](https://github.com/embark-framework/embark).
|
73
packages/embarkjs-swarm/package.json
Normal file
73
packages/embarkjs-swarm/package.json
Normal file
@ -0,0 +1,73 @@
|
||||
{
|
||||
"name": "embarkjs-swarm",
|
||||
"version": "4.0.0",
|
||||
"author": "Iuri Matias <iuri.matias@gmail.com>",
|
||||
"contributors": [],
|
||||
"description": "Swarm plugin for embarkjs",
|
||||
"homepage": "https://github.com/embark-framework/embark/tree/master/packages/embarkjs-swarm#readme",
|
||||
"bugs": "https://github.com/embark-framework/embark/issues",
|
||||
"keywords": [
|
||||
"blockchain",
|
||||
"dapps",
|
||||
"ethereum",
|
||||
"swarm",
|
||||
"serverless",
|
||||
"solc",
|
||||
"solidity"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"directory": "packages/embarkjs-swarm",
|
||||
"type": "git",
|
||||
"url": "https://github.com/embark-framework/embark.git"
|
||||
},
|
||||
"main": "dist/node/index.js",
|
||||
"browser": {
|
||||
"./dist/node/index.js": "./dist/browser/index.js"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 1 version",
|
||||
"not dead",
|
||||
"> 0.2%"
|
||||
],
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "npm-run-all build:**",
|
||||
"build:browser": "cross-env BABEL_ENV=browser babel src --out-dir dist/browser --root-mode upward",
|
||||
"build:node": "cross-env BABEL_ENV=node babel src --out-dir dist --root-mode upward --source-maps",
|
||||
"build:node:async": "cross-env BABEL_ENV=node:async babel src/node --out-dir dist --root-mode upward --source-maps",
|
||||
"// build:node:test": "cross-env BABEL_ENV=node:test babel test --out-dir build-test --root-mode upward --source-maps",
|
||||
"ci": "npm run qa",
|
||||
"clean": "npm run reset",
|
||||
"package": "npm pack",
|
||||
"// qa": "npm-run-all build test package",
|
||||
"qa": "npm-run-all build package",
|
||||
"reset": "npx rimraf build-test dist embarkjs-*.tgz package",
|
||||
"start": "npm run watch",
|
||||
"test": "mocha \"build-test/**/*.js\" --exit --no-timeouts --require source-map-support/register",
|
||||
"watch": "run-p \"build:** -- --verbose --watch\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime-corejs2": "7.3.1",
|
||||
"swarm-api": "0.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "7.2.3",
|
||||
"@babel/core": "7.2.2",
|
||||
"ajv": "6.5.2",
|
||||
"chai": "4.2.0",
|
||||
"cross-env": "5.2.0",
|
||||
"lodash.clonedeep": "4.5.0",
|
||||
"mocha": "5.2.0",
|
||||
"npm-run-all": "4.1.5",
|
||||
"rimraf": "2.6.3",
|
||||
"source-map-support": "0.5.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.12.0",
|
||||
"npm": ">=6.4.1",
|
||||
"yarn": ">=1.12.3"
|
||||
}
|
||||
}
|
1
packages/embarkjs-swarm/src/embarkjs.js
Normal file
1
packages/embarkjs-swarm/src/embarkjs.js
Normal file
@ -0,0 +1 @@
|
||||
export {default} from './index';
|
@ -117,3 +117,5 @@ __embarkSwarm.resolve = function (_name, callback) {
|
||||
__embarkSwarm.register = function (_addr, callback) {
|
||||
callback(NotAvailable);
|
||||
};
|
||||
|
||||
export default __embarkSwarm;
|
1
packages/embarkjs-swarm/src/node/index.js
Normal file
1
packages/embarkjs-swarm/src/node/index.js
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require('../embarkjs').default;
|
Loading…
x
Reference in New Issue
Block a user