mirror of https://github.com/embarklabs/embark.git
refactor(@embark/embark-typings) move typings to its own module
fix typings
WIP: refactor
WIP: just needed an annotation 🎉 thanks @emizzle!
WIP: don't pack a tarball since it's a private package
WIP: no need to list as a devDep
This commit is contained in:
parent
8091c4e6d0
commit
fbc8ab0fea
|
@ -0,0 +1,4 @@
|
|||
engine-strict = true
|
||||
package-lock = false
|
||||
save-exact = true
|
||||
scripts-prepend-node-path = true
|
|
@ -0,0 +1,10 @@
|
|||
import "./src/remix-debug-debugtest";
|
||||
import "./src/solidity-parser-antlr";
|
||||
|
||||
export * from "./src/callbacks";
|
||||
export * from "./src/contract";
|
||||
export * from "./src/embark";
|
||||
export * from "./src/embarkConfig";
|
||||
export * from "./src/logger";
|
||||
export * from "./src/maybe";
|
||||
export * from "./src/plugins";
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"name": "@types/embark",
|
||||
"private": true,
|
||||
"version": "4.0.0-beta.0",
|
||||
"author": "Iuri Matias <iuri.matias@gmail.com>",
|
||||
"contributors": [],
|
||||
"description": "TypeScript definitions for embark",
|
||||
"homepage": "https://embark.status.im/",
|
||||
"keywords": [
|
||||
"blockchain",
|
||||
"dapps",
|
||||
"ethereum",
|
||||
"ipfs",
|
||||
"serverless",
|
||||
"solc",
|
||||
"solidity"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "github:embark-framework/embark",
|
||||
"main": "",
|
||||
"types": "index",
|
||||
"scripts": {
|
||||
"ci": "npm run qa",
|
||||
"lint": "tslint -c tslint.json index.d.ts \"src/**/*.ts\"",
|
||||
"qa": "npm-run-all lint typecheck",
|
||||
"reset": "npx rimraf node_modules",
|
||||
"start": "npm run watch",
|
||||
"typecheck": "tsc",
|
||||
"watch": "npm run typecheck -- --preserveWatchOutput --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/web3": "1.0.12",
|
||||
"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"
|
||||
}
|
||||
}
|
|
@ -8,15 +8,6 @@ export interface Events {
|
|||
setCommandHandler(name: string, callback: (options: any, cb: () => void) => void): void;
|
||||
}
|
||||
|
||||
export interface Plugins {
|
||||
getPluginsProperty(pluginType: string, property: string, sub_property?: string): any[];
|
||||
plugins: Plugin[];
|
||||
}
|
||||
|
||||
export interface Plugin {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface Embark {
|
||||
events: Events;
|
||||
registerAPICall: any;
|
|
@ -5,7 +5,12 @@ export interface Plugin {
|
|||
export interface Plugins {
|
||||
getPluginsFor(name: string): [Plugin];
|
||||
loadInternalPlugin(name: string, options: any): void;
|
||||
getPluginsProperty(prop: string, name: string): any[];
|
||||
getPluginsProperty(pluginType: string, property: string, sub_property?: string): any[];
|
||||
plugins: Plugin[];
|
||||
}
|
||||
|
||||
export interface Plugin {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface CompilerPluginObject {
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"files": [
|
||||
"index.d.ts"
|
||||
],
|
||||
"include": ["src/**/*"]
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "../../tslint.json"
|
||||
}
|
|
@ -196,7 +196,7 @@
|
|||
"rimraf": "2.6.3",
|
||||
"sinon": "4.5.0",
|
||||
"tslint": "5.11.0",
|
||||
"typescript": "3.1.3"
|
||||
"typescript": "3.3.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.12.0",
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as i18n from "i18n";
|
|||
import * as osLocale from "os-locale";
|
||||
import * as path from "path";
|
||||
|
||||
import { Maybe } from "../../../typings/maybe";
|
||||
import { Maybe } from "embark";
|
||||
|
||||
enum LocalType {
|
||||
Specified = "specified",
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { each } from "async";
|
||||
import { Callback, Logger } from "embark";
|
||||
import { NodeVM, NodeVMOptions } from "vm2";
|
||||
import { Callback } from "../../../../typings/callbacks";
|
||||
import { Logger } from "../../../../typings/logger";
|
||||
|
||||
const fs = require("../../fs");
|
||||
const { recursiveMerge, isEs6Module } = require("../../../utils/utils");
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import {Embark} from "../../../typings/embark";
|
||||
import {Embark} from "embark";
|
||||
import {__} from "i18n";
|
||||
import {dockerHostSwap} from "../../utils/host.js";
|
||||
import {findNextPort} from "../../utils/network";
|
||||
import Server from "./server";
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
import bodyParser from "body-parser";
|
||||
import cors from "cors";
|
||||
import { Embark, Plugins } from "embark";
|
||||
import express, { NextFunction, Request, Response } from "express";
|
||||
import proxy from "express-http-proxy";
|
||||
import expressWs from "express-ws";
|
||||
import findUp from "find-up";
|
||||
import helmet from "helmet";
|
||||
import * as http from "http";
|
||||
import {__} from "i18n";
|
||||
import * as path from "path";
|
||||
import * as ws from "ws";
|
||||
import { Embark, Plugins } from "../../../typings/embark";
|
||||
// @ts-ignore
|
||||
import { embarkPath } from "../../core/fs";
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import {Callback} from "../../../typings/callbacks";
|
||||
import {Callback, CompilerPluginObject, Embark, Plugins} from "embark";
|
||||
import {__} from "i18n";
|
||||
|
||||
const async = require("../../utils/async_extend.js");
|
||||
import { Embark } from "../../../typings/embark";
|
||||
import { CompilerPluginObject, Plugins } from "../../../typings/plugins";
|
||||
|
||||
class Compiler {
|
||||
private logger: any;
|
||||
|
|
|
@ -5,8 +5,9 @@ const utils = require("../../utils/utils");
|
|||
const EmbarkJS = require("embarkjs");
|
||||
const IpfsApi = require("ipfs-api");
|
||||
const stringify = require("json-stringify-safe");
|
||||
import { Embark, Events } from "embark";
|
||||
import {__} from "i18n";
|
||||
import Web3 from "web3";
|
||||
import { Embark, Events } from "../../../typings/embark";
|
||||
import Suggestions from "./suggestions";
|
||||
|
||||
type MatchFunction = (cmd: string) => boolean;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const fuzzySearch = require("../../utils/utils").fuzzySearch;
|
||||
|
||||
import { Embark, Events } from "../../../typings/embark";
|
||||
import { Embark, Events } from "embark";
|
||||
|
||||
interface ContractsManager {
|
||||
[key: string]: any;
|
||||
|
|
|
@ -2,8 +2,7 @@ import * as globule from "globule";
|
|||
import * as path from "path";
|
||||
import Web3Contract from "web3/eth/contract";
|
||||
|
||||
import { Contract } from "../../../typings/contract";
|
||||
import { Embark } from "../../../typings/embark";
|
||||
import { Contract, Embark } from "embark";
|
||||
import { removePureView } from "../../utils/solidity/code";
|
||||
import { ContractEnhanced } from "./contractEnhanced";
|
||||
import { coverageContractsPath } from "./path";
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import {__} from "i18n";
|
||||
import DebuggerManager from "./debugger_manager";
|
||||
|
||||
const NO_DEBUG_SESSION = __("No debug session active. Activate one with `debug`");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Ajv from "ajv";
|
||||
|
||||
import { Logger } from "../../../typings/logger";
|
||||
import { Logger } from "embark";
|
||||
import {__} from "i18n";
|
||||
|
||||
export enum Framework {
|
||||
React = "react",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Embark } from "embark";
|
||||
import Handlebars from "handlebars";
|
||||
import {__} from "i18n";
|
||||
import * as path from "path";
|
||||
|
||||
import { Embark } from "../../../../../typings/embark";
|
||||
import { Builder } from "../../builder";
|
||||
import { CommandOptions } from "../../commandOptions";
|
||||
import { SmartContractsRecipe } from "../../smartContractsRecipe";
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import { Contract, Embark } from "embark";
|
||||
import Handlebars from "handlebars";
|
||||
import {__} from "i18n";
|
||||
import * as path from "path";
|
||||
import { ABIDefinition } from "web3/eth/abi";
|
||||
|
||||
import { Contract } from "../../../../../typings/contract";
|
||||
import { Embark } from "../../../../../typings/embark";
|
||||
import { Builder } from "../../builder";
|
||||
import { CommandOptions } from "../../commandOptions";
|
||||
import { SmartContractsRecipe } from "../../smartContractsRecipe";
|
||||
|
@ -31,7 +30,9 @@ export class ReactBuilder implements Builder {
|
|||
public async build() {
|
||||
await this.installDependencies();
|
||||
|
||||
return [].concat.apply([], Object.keys(this.description.data).map((contractName) => {
|
||||
const arr: string[] = [];
|
||||
return arr.concat(
|
||||
...Object.keys(this.description.data).map((contractName) => {
|
||||
const [indexCode, dappCode] = this.generateCodes(contractName);
|
||||
if (indexCode && dappCode) {
|
||||
const files = this.saveFiles(contractName, indexCode, dappCode);
|
||||
|
@ -40,7 +41,8 @@ export class ReactBuilder implements Builder {
|
|||
} else {
|
||||
return [];
|
||||
}
|
||||
}));
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
private updateEmbarkJson(contractName: string, files: string[]) {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { Contract } from "../../../typings/contract";
|
||||
import { Embark } from "../../../typings/embark";
|
||||
import { Contract, Embark } from "embark";
|
||||
import { CommandOptions, ContractLanguage, Framework } from "./commandOptions";
|
||||
import { SolidityBuilder } from "./contractLanguage/solidityBuilder";
|
||||
import { ReactBuilder } from "./framework/reactBuilder";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Ajv from "ajv";
|
||||
|
||||
import { Logger } from "../../../typings/logger";
|
||||
import { Logger } from "embark";
|
||||
import {__} from "i18n";
|
||||
import { schema } from "./schema";
|
||||
|
||||
const fs = require("../../core/fs");
|
||||
|
|
|
@ -2,7 +2,7 @@ import { red } from "colors";
|
|||
import { performance, PerformanceObserver } from "perf_hooks";
|
||||
import prettyMs from "pretty-ms";
|
||||
|
||||
import { Logger } from "../../../src/typings/logger";
|
||||
import { Logger } from "embark";
|
||||
|
||||
const utils = require("./utils.js");
|
||||
const ora = require("ora");
|
||||
|
@ -21,7 +21,7 @@ export default class LongRunningProcessTimer {
|
|||
private endMark: string;
|
||||
private downloadComplete: string;
|
||||
private spinner!: any;
|
||||
private intOngoingDownload!: number;
|
||||
private intOngoingDownload!: NodeJS.Timeout;
|
||||
|
||||
// backing variables
|
||||
private _observer!: PerformanceObserver;
|
||||
|
@ -116,7 +116,7 @@ export default class LongRunningProcessTimer {
|
|||
() => {
|
||||
performance.mark(this.ongoingMark);
|
||||
performance.measure(this.downloadOngoing, this.startMark, this.ongoingMark);
|
||||
}, this.options.interval);
|
||||
}, this.options.interval || 0);
|
||||
}
|
||||
|
||||
public end() {
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
declare function __(...values: string[]): string;
|
|
@ -1,20 +1,7 @@
|
|||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"lib": ["es2017", "dom"],
|
||||
"moduleResolution": "node",
|
||||
"noEmit": true,
|
||||
"strict": true,
|
||||
"isolatedModules": true,
|
||||
"esModuleInterop": true,
|
||||
"typeRoots": ["node_modules/@types"],
|
||||
"rootDir": ".",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"*": ["./typings/*"]
|
||||
},
|
||||
"noImplicitThis": false
|
||||
},
|
||||
"include": ["./src/**/*"]
|
||||
"include": ["src/**/*"]
|
||||
}
|
|
@ -1,17 +1,3 @@
|
|||
{
|
||||
"defaultSeverity": "error",
|
||||
"extends": [
|
||||
"tslint:recommended"
|
||||
],
|
||||
"jsRules": {},
|
||||
"rules": {
|
||||
"max-line-length": [true, 200],
|
||||
"interface-name": [true, "never-prefix"],
|
||||
"member-ordering": [false],
|
||||
"no-var-requires": false,
|
||||
"no-empty": false,
|
||||
"no-console": false,
|
||||
"variable-name": ["allow-leading-underscore"]
|
||||
},
|
||||
"rulesDirectory": []
|
||||
"extends": "../../tslint.json"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"esModuleInterop": true,
|
||||
"isolatedModules": true,
|
||||
"lib": ["ES2017"],
|
||||
"module": "CommonJS",
|
||||
"noEmit": true,
|
||||
"strict": true,
|
||||
"target": "ES2017"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"defaultSeverity": "error",
|
||||
"extends": [
|
||||
"tslint:recommended"
|
||||
],
|
||||
"jsRules": {},
|
||||
"rules": {
|
||||
"interface-name": [true, "never-prefix"],
|
||||
"max-line-length": [true, 200],
|
||||
"member-ordering": [false],
|
||||
"no-empty": false,
|
||||
"no-console": false,
|
||||
"no-var-requires": false,
|
||||
"variable-name": ["allow-leading-underscore"]
|
||||
},
|
||||
"rulesDirectory": []
|
||||
}
|
|
@ -20819,10 +20819,10 @@ typedarray@^0.0.6:
|
|||
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
||||
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
|
||||
|
||||
typescript@3.1.3:
|
||||
version "3.1.3"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.1.3.tgz#01b70247a6d3c2467f70c45795ef5ea18ce191d5"
|
||||
integrity sha512-+81MUSyX+BaSo+u2RbozuQk/UWx6hfG0a5gHu4ANEM4sU96XbuIyAB+rWBW1u70c6a5QuZfuYICn3s2UjuHUpA==
|
||||
typescript@3.3.1:
|
||||
version "3.3.1"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.1.tgz#6de14e1db4b8a006ac535e482c8ba018c55f750b"
|
||||
integrity sha512-cTmIDFW7O0IHbn1DPYjkiebHxwtCMU+eTy30ZtJNBPF9j2O1ITu5XH2YnBeVRKWHqF+3JQwWJv0Q0aUgX8W7IA==
|
||||
|
||||
typewise-core@^1.2, typewise-core@^1.2.0:
|
||||
version "1.2.0"
|
||||
|
|
Loading…
Reference in New Issue