mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-11 22:34:24 +00:00
de0f02d00a
Previously, templates were in a subdirectory of `packages/embark`. Reorganize them so that they are member packages of the monorepo. This allows them to cleanly depend on other members of the monorepo, e.g. `embarkjs-connector-web3`. It is desirable for the templates, in the context of the monorepo, to specify embark as a dependency, to take advantage of `npx embark test` (and it's a "forward looking" setup re: how we plan to evolve embark). However, if embark were to specify the template packages as dependencies a circular relationship would be introduced, which is [unsupported by Lerna][circular]. Therefore, revise the template generator so that all templates are resolved / fetched at runtime, i.e. `boilerplate`, `demo`, and `simple` are no longer "built-ins" *per se*. This change won't be apparent to embark's users, but it does mean that the template generator won't work (in a production install of embark) if it can't connect to the npm registry, i.e. when the user runs `embark demo` or `embark new [--simple]`. When embark is inside the monorepo, templates are resolved and copied from the yarn workspace rather than being fetched from the registry, which is convenient for development. Also, any template dependencies that are members of the monorepo are linked into the copied template's `node_modules` rather than being installed from the registry, again for convenience. During template generation, remove scripts and dependencies that pertain only to membership in the monorepo; for now, that involves removing embark as a dependency since we're not quite ready for that arrangement to be the default, i.e. outside of the monorepo. Refactor the root scripts so that more of them can consistently be used with Lerna's filter options, e.g. `--scope` and `--ignore`. "Combo" scripts that don't support filtering generally have a `:full` postfix. Flip `clean` and `reset` scripts at the root and in the member packages for consistency re: Lerna's notion of `clean` and embark's notion of `reset`. Have each package run its `reset` script when its `clean` script is invoked (and that's all for now), relying on `lerna clean` to delete packages' `node_modules` in view of how Lerna's topological sorting works. Lift the implementation of `embark reset` into a private package in `packages/embark-reset` and make it a bundled dependency of embark. Packages in `dapps/*` depend on `embark-reset` directly and make use of it with `npx embark-reset` (but only in monorepo context). This removes a "wart" where reboots could show errors when embark's sources aren't already built in `packages/embark/dist`. Users will not notice any difference since `embark reset` works as before, transparently making use of the `embark-reset` package. The only downside to having it be a bundled dependency of embark is that bundled deps have all of their `node_modules` included in the tarball built with `npm pack` (that's why having the templates as bundled dependencies of embark isn't a viable approach). However, `embark-reset` only has one dependency, `rimraf`, which is a tiny module, so the cost seems acceptable. As part of the reorganization, move `test_dapps` into `dapps/tests` and `packages/embark/templates` into `dapps/templates`. Keep the directory names short but revise the package names to facilitate simple filtering with `embark-dapp-*`. Consolidate `.yarnrc` and `.gitignore` and clean up some redundant ignore listings. Scripts run with `--scope embark-dapp-*` use `--concurrency=1` to avoid conflicts that could arise over network ports. The `ci:full` and `qa:full` scripts use `--concurrency=1` in all scopes, for two reasons: resource limitations on Travis and AppVeyor result in slower runs with concurrency >1, and if something fails in those contexts it's easier to see what went wrong when Lerna's output isn't interleaved from a bunch of scripts in `packages/*`. Bump the Lerna version. [circular]: https://github.com/lerna/lerna/issues/1198#issuecomment-442278902
151 lines
6.5 KiB
JavaScript
151 lines
6.5 KiB
JavaScript
module.exports = {
|
|
// applies to all environments
|
|
default: {
|
|
enabled: true,
|
|
rpcHost: "localhost", // HTTP-RPC server listening interface (default: "localhost")
|
|
rpcPort: 8545, // HTTP-RPC server listening port (default: 8545)
|
|
rpcCorsDomain: { // Domains from which to accept cross origin requests (browser enforced). This can also be a comma separated list
|
|
auto: true, // When "auto" is true, Embark will automatically set the cors to the address of the webserver
|
|
additionalCors: [] // Additional CORS domains to add to the list. If "auto" is false, only those will be added
|
|
},
|
|
wsRPC: true, // Enable the WS-RPC server
|
|
wsOrigins: { // Same thing as "rpcCorsDomain", but for WS origins
|
|
auto: true,
|
|
additionalCors: []
|
|
},
|
|
wsHost: "localhost", // WS-RPC server listening interface (default: "localhost")
|
|
wsPort: 8546 // WS-RPC server listening port (default: 8546)
|
|
|
|
// Accounts to use as node accounts
|
|
// The order here corresponds to the order of `web3.eth.getAccounts`, so the first one is the `defaultAccount`
|
|
/*,accounts: [
|
|
{
|
|
nodeAccounts: true, // Accounts use for the node
|
|
numAddresses: "1", // Number of addresses/accounts (defaults to 1)
|
|
password: "config/development/devpassword" // Password file for the accounts
|
|
},
|
|
// Below are additional accounts that will count as `nodeAccounts` in the `deployment` section of your contract config
|
|
// Those will not be unlocked in the node itself
|
|
{
|
|
privateKey: "your_private_key"
|
|
},
|
|
{
|
|
privateKeyFile: "path/to/file", // Either a keystore or a list of keys, separated by , or ;
|
|
password: "passwordForTheKeystore" // Needed to decrypt the keystore file
|
|
},
|
|
{
|
|
mnemonic: "12 word mnemonic",
|
|
addressIndex: "0", // Optional. The index to start getting the address
|
|
numAddresses: "1", // Optional. The number of addresses to get
|
|
hdpath: "m/44'/60'/0'/0/" // Optional. HD derivation path
|
|
}
|
|
]*/
|
|
},
|
|
|
|
// default environment, merges with the settings in default
|
|
// assumed to be the intended environment by `embark run` and `embark blockchain`
|
|
development: {
|
|
ethereumClientName: "geth", // Can be geth or parity (default:geth)
|
|
//ethereumClientBin: "geth", // path to the client binary. Useful if it is not in the global PATH
|
|
networkType: "custom", // Can be: testnet, rinkeby, livenet or custom, in which case, it will use the specified networkId
|
|
networkId: 1337, // Network id used when networkType is custom
|
|
isDev: true, // Uses and ephemeral proof-of-authority network with a pre-funded developer account, mining enabled
|
|
datadir: ".embark/development/datadir", // Data directory for the databases and keystore (Geth 1.8.15 and Parity 2.0.4 can use the same base folder, till now they does not conflict with each other)
|
|
mineWhenNeeded: true, // Uses our custom script (if isDev is false) to mine only when needed
|
|
nodiscover: true, // Disables the peer discovery mechanism (manual peer addition)
|
|
maxpeers: 0, // Maximum number of network peers (network disabled if set to 0) (default: 25)
|
|
proxy: true, // Proxy is used to present meaningful information about transactions
|
|
targetGasLimit: 8000000, // Target gas limit sets the artificial target gas floor for the blocks to mine
|
|
simulatorBlocktime: 0 // Specify blockTime in seconds for automatic mining. Default is 0 and no auto-mining.
|
|
},
|
|
|
|
// merges with the settings in default
|
|
// used with "embark run privatenet" and/or "embark blockchain privatenet"
|
|
privatenet: {
|
|
networkType: "custom",
|
|
networkId: 1337,
|
|
isDev: false,
|
|
datadir: ".embark/privatenet/datadir",
|
|
// -- mineWhenNeeded --
|
|
// This options is only valid when isDev is false.
|
|
// Enabling this option uses our custom script to mine only when needed.
|
|
// Embark creates a development account for you (using `geth account new`) and funds the account. This account can be used for
|
|
// development (and even imported in to MetaMask). To enable correct usage, a password for this account must be specified
|
|
// in the `account > password` setting below.
|
|
// NOTE: once `mineWhenNeeded` is enabled, you must run an `embark reset` on your dApp before running
|
|
// `embark blockchain` or `embark run` for the first time.
|
|
mineWhenNeeded: true,
|
|
// -- genesisBlock --
|
|
// This option is only valid when mineWhenNeeded is true (which is only valid if isDev is false).
|
|
// When enabled, geth uses POW to mine transactions as it would normally, instead of using POA as it does in --dev mode.
|
|
// On the first `embark blockchain or embark run` after this option is enabled, geth will create a new chain with a
|
|
// genesis block, which can be configured using the `genesisBlock` configuration option below.
|
|
genesisBlock: "config/privatenet/genesis.json", // Genesis block to initiate on first creation of a development node
|
|
nodiscover: true,
|
|
maxpeers: 0,
|
|
proxy: true,
|
|
accounts: [
|
|
{
|
|
nodeAccounts: true,
|
|
password: "config/privatenet/password" // Password to unlock the account
|
|
}
|
|
],
|
|
targetGasLimit: 8000000,
|
|
simulatorBlocktime: 0
|
|
},
|
|
|
|
privateparitynet: {
|
|
ethereumClientName: "parity",
|
|
networkType: "custom",
|
|
networkId: 1337,
|
|
isDev: false,
|
|
genesisBlock: "config/privatenet/genesis-parity.json", // Genesis block to initiate on first creation of a development node
|
|
datadir: ".embark/privatenet/datadir",
|
|
mineWhenNeeded: false,
|
|
nodiscover: true,
|
|
maxpeers: 0,
|
|
proxy: true,
|
|
accounts: [
|
|
{
|
|
nodeAccounts: true,
|
|
password: "config/privatenet/password"
|
|
}
|
|
],
|
|
targetGasLimit: 8000000,
|
|
simulatorBlocktime: 0
|
|
},
|
|
|
|
// merges with the settings in default
|
|
// used with "embark run testnet" and/or "embark blockchain testnet"
|
|
testnet: {
|
|
networkType: "testnet",
|
|
syncMode: "light",
|
|
accounts: [
|
|
{
|
|
nodeAccounts: true,
|
|
password: "config/testnet/password"
|
|
}
|
|
]
|
|
},
|
|
|
|
// merges with the settings in default
|
|
// used with "embark run livenet" and/or "embark blockchain livenet"
|
|
livenet: {
|
|
networkType: "livenet",
|
|
syncMode: "light",
|
|
rpcCorsDomain: "http://localhost:8000",
|
|
wsOrigins: "http://localhost:8000",
|
|
accounts: [
|
|
{
|
|
nodeAccounts: true,
|
|
password: "config/livenet/password"
|
|
}
|
|
]
|
|
}
|
|
|
|
// you can name an environment with specific settings and then specify with
|
|
// "embark run custom_name" or "embark blockchain custom_name"
|
|
//custom_name: {
|
|
//}
|
|
};
|