mirror of https://github.com/embarklabs/embark.git
feat(@embark/pipeline): Add `enabled` property to pipeline config
Add an `enabled` property to the pipeline config. This lets developers disable the pipeline using the config file. Updates to the enabled property will be reflected while embark is running. For example if embark is running with the pipeline, setting `enabled: false` in the pipeline config will build/deploy the contracts but not run the pipeline. Conversely, if embark is running with the pipeline disabled, enabling the pipeline in the config will build/deploy the contracts then build the dapp.
This commit is contained in:
parent
df0064f1a9
commit
5ea4807c90
|
@ -9,7 +9,7 @@
|
||||||
// embark new --template flow
|
// embark new --template flow
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
typescript: false
|
typescript: false,
|
||||||
// Setting `typescript: true` in this config will disable Flow support in
|
// Setting `typescript: true` in this config will disable Flow support in
|
||||||
// Embark's default webpack config and enable TypeScript support: .ts and
|
// Embark's default webpack config and enable TypeScript support: .ts and
|
||||||
// .tsx sources will automatically be transpiled into JavaScript without any
|
// .tsx sources will automatically be transpiled into JavaScript without any
|
||||||
|
@ -20,4 +20,8 @@ module.exports = {
|
||||||
// https://github.com/embark-framework/embark-typescript-template
|
// https://github.com/embark-framework/embark-typescript-template
|
||||||
// A new DApp can be created from that template with:
|
// A new DApp can be created from that template with:
|
||||||
// embark new --template typescript
|
// embark new --template typescript
|
||||||
|
enabled: true
|
||||||
|
// Setting `enabled: false` in this config will disable Embark's built-in Webpack
|
||||||
|
// pipeline. The developer will need to use a different frontend build tool, such as
|
||||||
|
// `create-react-app` or Angular CLI to build their dapp
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// embark new --template flow
|
// embark new --template flow
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
typescript: false
|
typescript: false,
|
||||||
// Setting `typescript: true` in this config will disable Flow support in
|
// Setting `typescript: true` in this config will disable Flow support in
|
||||||
// Embark's default webpack config and enable TypeScript support: .ts and
|
// Embark's default webpack config and enable TypeScript support: .ts and
|
||||||
// .tsx sources will automatically be transpiled into JavaScript without any
|
// .tsx sources will automatically be transpiled into JavaScript without any
|
||||||
|
@ -20,4 +20,8 @@ module.exports = {
|
||||||
// https://github.com/embark-framework/embark-typescript-template
|
// https://github.com/embark-framework/embark-typescript-template
|
||||||
// A new DApp can be created from that template with:
|
// A new DApp can be created from that template with:
|
||||||
// embark new --template typescript
|
// embark new --template typescript
|
||||||
|
enabled: true
|
||||||
|
// Setting `enabled: false` in this config will disable Embark's built-in Webpack
|
||||||
|
// pipeline. The developer will need to use a different frontend build tool, such as
|
||||||
|
// `create-react-app` or Angular CLI to build their dapp
|
||||||
};
|
};
|
||||||
|
|
|
@ -533,7 +533,8 @@ Config.prototype.loadEmbarkConfigFile = function() {
|
||||||
Config.prototype.loadPipelineConfigFile = function() {
|
Config.prototype.loadPipelineConfigFile = function() {
|
||||||
|
|
||||||
const defaultPipelineConfig = {
|
const defaultPipelineConfig = {
|
||||||
typescript: false
|
typescript: false,
|
||||||
|
enabled: true
|
||||||
};
|
};
|
||||||
|
|
||||||
let pipelineConfigPath = this._getFileOrObject(this.configDir, 'pipeline', 'pipeline');
|
let pipelineConfigPath = this._getFileOrObject(this.configDir, 'pipeline', 'pipeline');
|
||||||
|
@ -558,6 +559,7 @@ Config.prototype.loadPipelineConfigFile = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.pipelineConfig = pipelineConfig;
|
this.pipelineConfig = pipelineConfig;
|
||||||
|
this.events.emit('config:load:pipeline', this.pipelineConfig);
|
||||||
};
|
};
|
||||||
|
|
||||||
Config.prototype.loadAssetFiles = function () {
|
Config.prototype.loadAssetFiles = function () {
|
||||||
|
|
|
@ -144,6 +144,7 @@ function removeSync() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function anchoredPath(anchor, ...args) {
|
function anchoredPath(anchor, ...args) {
|
||||||
|
args = args.map(path => path.replace(dappPath(), ""));
|
||||||
return utils.joinPath(env.anchoredValue(anchor), ...args);
|
return utils.joinPath(env.anchoredValue(anchor), ...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,15 @@ class Pipeline {
|
||||||
this.isFirstBuild = true;
|
this.isFirstBuild = true;
|
||||||
this.useDashboard = options.useDashboard;
|
this.useDashboard = options.useDashboard;
|
||||||
|
|
||||||
this.events.setCommandHandler('pipeline:build', (options, callback) => this.build(options, callback));
|
// track changes to the pipeline config in the filesystem
|
||||||
|
this.events.on('config:load:pipeline', (pipelineConfig) => {
|
||||||
|
this.pipelineConfig = pipelineConfig;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.events.setCommandHandler('pipeline:build', (options, callback) => {
|
||||||
|
if(!this.pipelineConfig.enabled) return callback();
|
||||||
|
this.build(options, callback);
|
||||||
|
});
|
||||||
this.events.setCommandHandler('pipeline:build:contracts', callback => this.buildContracts([], callback));
|
this.events.setCommandHandler('pipeline:build:contracts', callback => this.buildContracts([], callback));
|
||||||
this.fs.removeSync(this.buildDir);
|
this.fs.removeSync(this.buildDir);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue