@bem-react/pack
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -6,2 +6,8 @@ # Change Log | ||
# [1.3.0](https://github.com/bem/bem-react/compare/@bem-react/pack@1.2.0...@bem-react/pack@1.3.0) (2020-11-24) | ||
### Features | ||
- pack – multiple config output ([8956088](https://github.com/bem/bem-react/commit/8956088d59a7c71ce4dd54d2db65a2efc24962b4)) | ||
# [1.2.0](https://github.com/bem/bem-react/compare/@bem-react/pack@1.1.0...@bem-react/pack@1.2.0) (2020-11-11) | ||
@@ -8,0 +14,0 @@ |
@@ -14,3 +14,3 @@ "use strict"; | ||
}; | ||
const progress = Progress_1.createProgress({ steps }); | ||
const progress = Progress_1.createProgress({ steps, name: config.name }); | ||
// TODO: Catch errors from plugins and stop progress with message. | ||
@@ -17,0 +17,0 @@ progress.start(); |
@@ -10,4 +10,6 @@ "use strict"; | ||
const { flags } = this.parse(Build); | ||
const config = await loadConfig_1.loadConfig(path_1.resolve(flags.config)); | ||
build_1.tryBuild(config); | ||
const configs = await loadConfig_1.loadConfig(path_1.resolve(flags.config)); | ||
for (let config of configs) { | ||
await build_1.tryBuild(config); | ||
} | ||
} | ||
@@ -14,0 +16,0 @@ } |
@@ -16,2 +16,6 @@ export declare type Config = { | ||
plugins: Plugin[]; | ||
/** | ||
* Config name | ||
*/ | ||
name?: string; | ||
}; | ||
@@ -18,0 +22,0 @@ export declare type OnDone = () => void; |
import { Config } from './interfaces'; | ||
export declare function loadConfig(p: string): Config; | ||
export declare function loadConfig(p: string): Config[]; |
@@ -5,6 +5,9 @@ "use strict"; | ||
const log_1 = require("./log"); | ||
function normalizeConfig(config) { | ||
return Array.isArray(config) ? config : [config]; | ||
} | ||
function loadConfig(p) { | ||
try { | ||
const config = require(p); | ||
return config; | ||
const configs = normalizeConfig(require(p)); | ||
return configs; | ||
} | ||
@@ -11,0 +14,0 @@ catch (e) { |
declare type Options = { | ||
steps: string[]; | ||
name?: string; | ||
}; | ||
@@ -7,2 +8,3 @@ declare class Progress { | ||
private steps; | ||
private buildPrefix; | ||
private hrstart; | ||
@@ -9,0 +11,0 @@ private hrend; |
@@ -13,3 +13,4 @@ "use strict"; | ||
this.steps = options.steps; | ||
this.spinner = ora_1.default(`0/${this.steps.length} Building...`); | ||
this.buildPrefix = options.name ? options.name + ': ' : ''; | ||
this.spinner = ora_1.default(`0/${this.buildPrefix}${this.steps.length} Building...`); | ||
} | ||
@@ -22,6 +23,6 @@ start() { | ||
this.hrend = process.hrtime(this.hrstart); | ||
this.spinner.succeed(`Components build was successful! (${this.hrend[0]}s)`); | ||
this.spinner.succeed(`${this.buildPrefix}Components build was successful! (${this.hrend[0]}s)`); | ||
} | ||
update(step) { | ||
this.spinner.text = `${this.steps.indexOf(step) + 1}/${this.steps.length} Building...`; | ||
this.spinner.text = `${this.buildPrefix}${this.steps.indexOf(step) + 1}/${this.steps.length} Building...`; | ||
} | ||
@@ -28,0 +29,0 @@ } |
@@ -1,1 +0,1 @@ | ||
{"version":"1.2.0","commands":{"build":{"id":"build","description":"Runs components build with defined plugins.","pluginName":"@bem-react/pack","pluginType":"core","aliases":[],"flags":{"config":{"name":"config","type":"option","char":"c","description":"The path to a build config file.","default":"build.config.js"}},"args":[]}}} | ||
{"version":"1.3.0","commands":{"build":{"id":"build","description":"Runs components build with defined plugins.","pluginName":"@bem-react/pack","pluginType":"core","aliases":[],"flags":{"config":{"name":"config","type":"option","char":"c","description":"The path to a build config file.","default":"build.config.js"}},"args":[]}}} |
{ | ||
"name": "@bem-react/pack", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "A tool for building and prepare components for publishing", | ||
@@ -52,3 +52,3 @@ "homepage": "https://github.com/bem/bem-react/tree/master/packages/pack", | ||
}, | ||
"gitHead": "508a3beebc49b5568cce2860939712f714918020" | ||
"gitHead": "5e59d720c89a7e14bdeb85e3b435dd711334bcf7" | ||
} |
@@ -268,3 +268,3 @@ # @bem-react/pack · [![npm (scoped)](https://img.shields.io/npm/v/@bem-react/pack.svg)](https://www.npmjs.com/package/@bem-react/pack) | ||
export function useMyPlugin(): MyPlugin { | ||
return new CssPlugin() | ||
return new MyPlugin() | ||
} | ||
@@ -271,0 +271,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43795
533