mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-22 10:28:34 +00:00
refactor(@embark/library_manager): move library manager into own package
This commit is contained in:
parent
6308c82993
commit
94c7ab3e12
4
packages/embark-library-manager/.npmrc
Normal file
4
packages/embark-library-manager/.npmrc
Normal file
@ -0,0 +1,4 @@
|
||||
engine-strict = true
|
||||
package-lock = false
|
||||
save-exact = true
|
||||
scripts-prepend-node-path = true
|
6
packages/embark-library-manager/README.md
Normal file
6
packages/embark-library-manager/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
# `embark-library-manager`
|
||||
|
||||
Module for downloading and managing libraries
|
||||
|
||||
Visit [embark.status.im](https://embark.status.im/) to get started with
|
||||
[Embark](https://github.com/embark-framework/embark).
|
67
packages/embark-library-manager/package.json
Normal file
67
packages/embark-library-manager/package.json
Normal file
@ -0,0 +1,67 @@
|
||||
{
|
||||
"name": "embark-library-manager",
|
||||
"version": "4.1.0-beta.0",
|
||||
"author": "Iuri Matias <iuri.matias@gmail.com>",
|
||||
"contributors": [],
|
||||
"description": "Module for downloading and managing libraries",
|
||||
"homepage": "https://github.com/embark-framework/embark/tree/master/packages/embark-library-manager#readme",
|
||||
"bugs": "https://github.com/embark-framework/embark/issues",
|
||||
"keywords": [
|
||||
"blockchain",
|
||||
"dapps",
|
||||
"ethereum",
|
||||
"ipfs",
|
||||
"serverless",
|
||||
"solc",
|
||||
"solidity"
|
||||
],
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"directory": "packages/embark-library-manager",
|
||||
"type": "git",
|
||||
"url": "https://github.com/embark-framework/embark.git"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"scripts": {
|
||||
"build": "cross-env BABEL_ENV=node babel src --extensions \".js,.ts\" --out-dir dist --root-mode upward --source-maps",
|
||||
"ci": "npm run qa",
|
||||
"clean": "npm run reset",
|
||||
"lint": "npm-run-all lint:*",
|
||||
"lint:js": "eslint src/",
|
||||
"// lint:ts": "tslint -c tslint.json \"src/**/*.ts\"",
|
||||
"package": "npm pack",
|
||||
"// qa": "npm-run-all lint typecheck build package",
|
||||
"qa": "npm-run-all lint build package",
|
||||
"reset": "npx rimraf dist embark-*.tgz package",
|
||||
"start": "npm run watch",
|
||||
"// typecheck": "tsc",
|
||||
"watch": "run-p watch:*",
|
||||
"watch:build": "npm run build -- --verbose --watch",
|
||||
"// watch:typecheck": "npm run typecheck -- --preserveWatchOutput --watch"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "../../.eslintrc.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime-corejs2": "7.3.1",
|
||||
"live-plugin-manager-git-fix": "0.12.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "7.2.3",
|
||||
"@babel/core": "7.2.2",
|
||||
"cross-env": "5.2.0",
|
||||
"eslint": "5.7.0",
|
||||
"npm-run-all": "4.1.5",
|
||||
"rimraf": "2.6.3",
|
||||
"tslint": "5.11.0",
|
||||
"typescript": "3.3.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.12.0",
|
||||
"npm": ">=6.4.1",
|
||||
"yarn": ">=1.12.3"
|
||||
}
|
||||
}
|
@ -80,7 +80,7 @@ class LibraryManager {
|
||||
|
||||
downloadIfNeeded(packageName, cb) {
|
||||
const wantedVersion = this.versions[packageName];
|
||||
let installedVersion = require('../../../../package.json').dependencies[packageName];
|
||||
let installedVersion = this.embark.config.package.dependencies[packageName];
|
||||
if (!wantedVersion || wantedVersion === installedVersion) {
|
||||
const nodePath = this.embark.fs.embarkPath('node_modules');
|
||||
const packagePath = require.resolve(packageName, {paths: [nodePath]});
|
@ -1,7 +1,7 @@
|
||||
const fs = require('../../core/fs.js');
|
||||
const fs = require('fs');
|
||||
const PluginManager = require('live-plugin-manager-git-fix').PluginManager;
|
||||
require('colors');
|
||||
import LongRunningProcessTimer from '../../utils/longRunningProcessTimer.js';
|
||||
import LongRunningProcessTimer from 'embark-utils';
|
||||
|
||||
class Npm {
|
||||
|
||||
@ -38,7 +38,7 @@ class Npm {
|
||||
this._installing[packageName + version] = [callback];
|
||||
|
||||
const timer = new LongRunningProcessTimer(
|
||||
this._logger,
|
||||
this._logger,
|
||||
packageName,
|
||||
version,
|
||||
'Downloading and installing {{packageName}} {{version}}...',
|
4
packages/embark-library-manager/tsconfig.json
Normal file
4
packages/embark-library-manager/tsconfig.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["src/**/*"]
|
||||
}
|
3
packages/embark-library-manager/tslint.json
Normal file
3
packages/embark-library-manager/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../../tslint.json"
|
||||
}
|
@ -47,10 +47,13 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime-corejs2": "7.3.1",
|
||||
"clipboardy": "1.2.3",
|
||||
"colors": "1.3.2",
|
||||
"follow-redirects": "1.5.7",
|
||||
"merge": "1.2.1",
|
||||
"multihashes": "0.4.14",
|
||||
"web3": "1.0.0-beta.37",
|
||||
"ora": "2.1.0",
|
||||
"web3": "1.0.0-beta.37",
|
||||
"shelljs": "0.5.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -1,5 +1,9 @@
|
||||
const merge = require("merge");
|
||||
|
||||
export function last(array: any) {
|
||||
return array[array.length - 1];
|
||||
}
|
||||
|
||||
export function recursiveMerge(target: any, source: any) {
|
||||
return merge.recursive(target, source);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ const {findNextPort} = require('./network');
|
||||
const logUtils = require('./log-utils');
|
||||
const toposortGraph = require('./toposort');
|
||||
|
||||
import { last } from './collections';
|
||||
import { last, recursiveMerge } from './collections';
|
||||
|
||||
function checkIsAvailable(url, callback) {
|
||||
const protocol = url.split(':')[0];
|
||||
@ -44,11 +44,6 @@ function soliditySha3(arg) {
|
||||
return Web3.utils.soliditySha3(arg);
|
||||
}
|
||||
|
||||
function recursiveMerge(target, source) {
|
||||
const merge = require('merge');
|
||||
return merge.recursive(target, source);
|
||||
}
|
||||
|
||||
function sha512(arg) {
|
||||
if (typeof arg !== 'string') {
|
||||
throw new TypeError('argument must be a string');
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { red } from "colors";
|
||||
import { recursiveMerge } from "embark-utils";
|
||||
import { Logger } from "embark";
|
||||
import { performance, PerformanceObserver } from "perf_hooks";
|
||||
import prettyMs from "pretty-ms";
|
||||
|
||||
import { Logger } from "embark";
|
||||
import { last, recursiveMerge } from "./collections";
|
||||
|
||||
const ora = require("ora");
|
||||
|
||||
@ -62,7 +61,7 @@ export default class LongRunningProcessTimer {
|
||||
let strDuration;
|
||||
|
||||
// find any download ongoing measurements we"ve made
|
||||
entry = last(items.getEntries().filter((thisEntry) => thisEntry.name === this.downloadOngoing));
|
||||
entry = last(items.getEntries().filter((thisEntry: any) => thisEntry.name === this.downloadOngoing));
|
||||
if (entry) {
|
||||
// ongoing performance mark
|
||||
// TODO: add i18n
|
||||
@ -72,7 +71,7 @@ export default class LongRunningProcessTimer {
|
||||
}
|
||||
} else {
|
||||
// otherwise, find our download complete measurement
|
||||
entry = last(items.getEntries().filter((thisEntry) => thisEntry.name === this.downloadComplete));
|
||||
entry = last(items.getEntries().filter((thisEntry: any) => thisEntry.name === this.downloadComplete));
|
||||
if (entry) {
|
||||
// TODO: add i18n
|
||||
strDuration = this.processFinishedMsg.replace("{{packageName}}", this.packageName).replace("{{version}}", this.version).replace("{{duration}}", prettyMs(entry.duration));
|
@ -97,6 +97,7 @@
|
||||
"embark-contracts-manager": "^4.1.0-beta.0",
|
||||
"embark-core": "^4.1.0-beta.0",
|
||||
"embark-ens": "^4.1.0-beta.0",
|
||||
"embark-library-manager": "^4.1.0-beta.0",
|
||||
"embark-logger": "^4.1.0-beta.0",
|
||||
"embark-process-logs-api": "^4.1.0-beta.0",
|
||||
"embark-profiler": "^4.1.0-beta.0",
|
||||
|
@ -13,6 +13,7 @@ import * as utilsContractsConfig from "../utils/contractsConfig";
|
||||
import { File, Types } from "./file";
|
||||
|
||||
const DEFAULT_CONFIG_PATH = 'config/';
|
||||
const PACKAGE = require('../../../package.json');
|
||||
|
||||
var Config = function(options) {
|
||||
const self = this;
|
||||
@ -28,6 +29,7 @@ var Config = function(options) {
|
||||
this.chainsFile = options.chainsFile || './chains.json';
|
||||
this.plugins = options.plugins;
|
||||
this.logger = options.logger;
|
||||
this.package = PACKAGE;
|
||||
this.events = options.events;
|
||||
this.embarkConfig = {};
|
||||
this.context = options.context || [constants.contexts.any];
|
||||
@ -95,7 +97,16 @@ Config.prototype.loadConfigFiles = function(options) {
|
||||
this.embarkConfig = fs.readJSONSync(options.embarkConfig);
|
||||
this.embarkConfig.plugins = this.embarkConfig.plugins || {};
|
||||
|
||||
this.plugins = new Plugins({plugins: this.embarkConfig.plugins, logger: this.logger, interceptLogs: interceptLogs, events: this.events, config: this, context: this.context, env: this.env, version: this.version});
|
||||
this.plugins = new Plugins({
|
||||
plugins: this.embarkConfig.plugins,
|
||||
logger: this.logger,
|
||||
interceptLogs: interceptLogs,
|
||||
events: this.events,
|
||||
config: this,
|
||||
context: this.context,
|
||||
env: this.env,
|
||||
version: this.version
|
||||
});
|
||||
this.plugins.loadPlugins();
|
||||
|
||||
this.loadEmbarkConfigFile();
|
||||
|
@ -316,7 +316,7 @@ class Engine {
|
||||
}
|
||||
|
||||
libraryManagerService(_options) {
|
||||
this.registerModule('library_manager', {useDashboard: this.useDashboard});
|
||||
this.registerModulePackage('embark-library-manager', {useDashboard: this.useDashboard});
|
||||
}
|
||||
|
||||
codeCoverageService(_options) {
|
||||
|
@ -1,11 +1,10 @@
|
||||
const path = require('path');
|
||||
const async = require('async');
|
||||
const utils = require('../../utils/utils.js');
|
||||
import {joinPath} from 'embark-utils';
|
||||
import {joinPath, LongRunningProcessTimer} from 'embark-utils';
|
||||
const ProcessLauncher = require('../../core/processes/processLauncher');
|
||||
const constants = require('embark-core/constants');
|
||||
const WebpackConfigReader = require('../pipeline/webpackConfigReader');
|
||||
import LongRunningProcessTimer from '../../utils/longRunningProcessTimer';
|
||||
|
||||
class Pipeline {
|
||||
constructor(embark, options) {
|
||||
|
@ -2,7 +2,7 @@ const fs = require('fs-extra');
|
||||
const semver = require('semver');
|
||||
const ProcessWrapper = require('../../core/processes/processWrapper');
|
||||
const PluginManager = require('live-plugin-manager-git-fix').PluginManager;
|
||||
import LongRunningProcessTimer from '../../utils/longRunningProcessTimer';
|
||||
import LongRunningProcessTimer from 'embark-utils';
|
||||
|
||||
class SolcProcess extends ProcessWrapper {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user