Revert "refactor: move env module into own embark-env package"

This reverts commit 4f8734f19b.
This commit is contained in:
Pascal Precht 2019-04-25 17:35:40 +02:00
parent d5c3a9cf1d
commit 2464fb69af
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
10 changed files with 29 additions and 120 deletions

View File

@ -1,5 +0,0 @@
engine-strict = true
package-lock = false
save-exact = true
scripts-prepend-node-path = true

View File

@ -1,7 +0,0 @@
# `embark-env`
> Embark env utilities
Visit [embark.status.im](https://embark.status.im/) to get started with
[Embark](https://github.com/embark-framework/embark).

View File

@ -1,66 +0,0 @@
{
"name": "embark-env",
"version": "4.1.0-beta.0",
"author": "Iuri Matias <iuri.matias@gmail.com>",
"contributors": [],
"description": "Embark Env utilities",
"homepage": "https://github.com/embark-framework/embark/tree/master/packages/embark-env#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-env",
"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: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"
},
"dependencies": {
"@babel/runtime-corejs2": "7.3.1",
"embark-utils": "^4.1.0-beta.0",
"find-up": "2.1.0"
},
"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"
}
}

View File

@ -1,6 +0,0 @@
{
"extends": "../../tsconfig.json",
"include": ["src/**/*"]
}

View File

@ -1,4 +0,0 @@
{
"extends": "../../tslint.json"
}

View File

@ -87,7 +87,6 @@
"deep-equal": "1.0.1",
"ejs": "2.6.1",
"embark-compiler": "^4.0.0",
"embark-env": "^4.1.0-beta.0",
"embark-profiler": "^4.1.0-beta.0",
"embark-reset": "^4.1.0-beta.0",
"embark-specialconfigs": "^4.1.0-beta.0",

View File

@ -1,18 +1,18 @@
/* global __dirname module process require */
const {delimiter} = require("path");
const findUp = require("find-up");
import {joinPath} from "embark-utils";
const {delimiter} = require('path');
const findUp = require('find-up');
import {joinPath} from 'embark-utils';
function anchoredValue(anchor, value) {
if (!arguments.length) {
throw new TypeError("anchor name was not specified");
throw new TypeError('anchor name was not specified');
}
if (arguments.length > 2) {
throw new TypeError("accepts at most 2 arguments");
throw new TypeError('accepts at most 2 arguments');
}
if (typeof anchor !== "string") {
throw new TypeError("anchor name was not a string");
if (typeof anchor !== 'string') {
throw new TypeError('anchor name was not a string');
}
let _anchor = process.env[anchor];
if (arguments.length < 2 && !_anchor) {
@ -26,27 +26,27 @@ function anchoredValue(anchor, value) {
return _anchor;
}
const PWD = "PWD";
const PWD = 'PWD';
const DEFAULT_PWD = process.cwd();
anchoredValue(PWD, DEFAULT_PWD);
const DAPP_PATH = "DAPP_PATH";
const DAPP_PATH = 'DAPP_PATH';
const DEFAULT_DAPP_PATH = anchoredValue(PWD);
anchoredValue(DAPP_PATH, DEFAULT_DAPP_PATH);
const CMD_HISTORY_SIZE = "CMD_HISTORY_SIZE";
const CMD_HISTORY_SIZE = 'CMD_HISTORY_SIZE';
const DEFAULT_CMD_HISTORY_SIZE = 20;
anchoredValue(CMD_HISTORY_SIZE, DEFAULT_CMD_HISTORY_SIZE);
const DIAGRAM_PATH = "DIAGRAM_PATH";
const DEFAULT_DIAGRAM_PATH = joinPath(anchoredValue(DAPP_PATH), "diagram.svg");
const DIAGRAM_PATH = 'DIAGRAM_PATH';
const DEFAULT_DIAGRAM_PATH = joinPath(anchoredValue(DAPP_PATH), 'diagram.svg');
anchoredValue(DIAGRAM_PATH, DEFAULT_DIAGRAM_PATH);
const EMBARK_PATH = "EMBARK_PATH";
const DEFAULT_EMBARK_PATH = joinPath(__dirname, "../../..");
const EMBARK_PATH = 'EMBARK_PATH';
const DEFAULT_EMBARK_PATH = joinPath(__dirname, '../../..');
anchoredValue(EMBARK_PATH, DEFAULT_EMBARK_PATH);
const PKG_PATH = "PKG_PATH";
const PKG_PATH = 'PKG_PATH';
const DEFAULT_PKG_PATH = anchoredValue(PWD);
anchoredValue(PKG_PATH, DEFAULT_PKG_PATH);
@ -55,29 +55,27 @@ let len = 0;
let start = anchoredValue(EMBARK_PATH);
// eslint-disable-next-line no-constant-condition
while (true) {
const found = findUp.sync("node_modules", {cwd: start});
if (!found) {
break;
}
start = joinPath(start, "..");
const found = findUp.sync('node_modules', {cwd: start});
if (!found) break;
start = joinPath(start, '..');
if (EMBARK_NODE_MODULES_PATHS[len - 1] !== found) {
len = EMBARK_NODE_MODULES_PATHS.push(found);
}
}
const NODE_PATH = "NODE_PATH";
const NODE_PATH = 'NODE_PATH';
// NOTE: setting NODE_PATH at runtime won't effect lookup behavior in the
// current process, but will take effect in child processes
process.env[NODE_PATH] = EMBARK_NODE_MODULES_PATHS.join(delimiter) +
(process.env[NODE_PATH] ? delimiter : "") +
(process.env[NODE_PATH] || "");
(process.env[NODE_PATH] ? delimiter : '') +
(process.env[NODE_PATH] || '');
module.exports = {
CMD_HISTORY_SIZE,
anchoredValue,
PWD,
DAPP_PATH,
CMD_HISTORY_SIZE,
DIAGRAM_PATH,
EMBARK_PATH,
PKG_PATH,
PWD,
anchoredValue,
PKG_PATH
};

View File

@ -4,7 +4,7 @@ const {DAPP_PATH,
DIAGRAM_PATH,
EMBARK_PATH,
PKG_PATH,
anchoredValue} = require('embark-env');
anchoredValue} = require('./env');
const fs = require('fs-extra');
const os = require('os');
const parseJson = require('parse-json');

View File

@ -1,10 +1,10 @@
/* global module process require */
import {DAPP_PATH,
const {DAPP_PATH,
DIAGRAM_PATH,
EMBARK_PATH,
PKG_PATH,
anchoredValue} from 'embark-env';
anchoredValue} = require('../../core/env');
const fs = require('fs-extra');
const os = require('os');
const parseJson = require('parse-json');

View File

@ -1,5 +1,5 @@
/*globals __*/
const env = require("embark-env");
const env = require("../../core/env");
const utils = require("../../utils/utils");
const escapeHtml = require("../../utils/escapeHtml");
import { Callback } from "embark";