diff --git a/README.md b/README.md index ff14dba..cd73031 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ new WebpackBemPlugin(options: object) ## Known issues -* Small tests +* [Small tests](https://github.com/bem/webpack-bem-plugin/issues/3) * Not picking changes in `bemrc` in watch-mode * Working only for [nested](https://en.bem.info/methodology/filestructure/#nested) fs-scheme ([flat](https://en.bem.info/methodology/filestructure/#flat) is not supported) * No **i18n** support diff --git a/src/BemPluginConfig.js b/src/BemPluginConfig.js index bcfe711..8e84a66 100644 --- a/src/BemPluginConfig.js +++ b/src/BemPluginConfig.js @@ -34,10 +34,12 @@ class BemPluginConfig { } /** - * Overwriting configs: + * Overriding configs: * a. main config for testing purpose - * b. libraries configs (like bem-react-components) for many reasons - * example: https://github.com/bem/bem-sdk/issues/261 + * b. libraries configs: + * - if wanted library has no its bemrc and adding it (via PR) is not simple + * - if wanted library or bem/sdk-config itself have unresolved issues but we can't wait + * example: https://github.com/bem/bem-sdk/issues/261 */ __prepareRc(bemConfig, libs, self) { if (!libs && !self) return; @@ -45,12 +47,16 @@ class BemPluginConfig { const configsMap = {}; const oldSync = rc.sync; + // overriding bem/sdk-config internal mechanism of reading config .bemrc file + // overriding only sync-method because BemPluginConfig uses sync-api only rc.sync = function(options) { return configsMap[options.cwd] || oldSync(options); }; + // overriding main config self && (configsMap[bemConfig._options.cwd] = [self]); + // overriding libraries configs libs && Object.keys(libs).forEach(libName => { configsMap[bemConfig.librarySync(libName)._options.cwd] = [libs[libName]]; }); diff --git a/src/BemRequest.js b/src/BemRequest.js index 7170c5b..d3b1b60 100644 --- a/src/BemRequest.js +++ b/src/BemRequest.js @@ -6,7 +6,7 @@ const namingConvention = require('./helpers/namingConvention'); const entityFromPath = require('./helpers/entityFromPath'); function completeRequest(request, ctx) { - // TODO: move to @bem/sdk.import-notation + // TODO: move to @bem/sdk.import-notation in https://github.com/bem/bem-sdk/issues/275 // TODO: make request string independent from import-notation parts order if (/^b:/.test(request)) { return request; @@ -26,11 +26,12 @@ function completeRequest(request, ctx) { */ class BemRequest { constructor(request, filePath, levels, setIndex) { + // TODO: replace it after https://github.com/bem/bem-sdk/issues/277 const requestNaming = namingConvention.getFromLevelsByPath(levels, filePath); + + // TODO: replace it after https://github.com/bem/bem-sdk/issues/276 const ctx = entityFromPath(filePath, requestNaming); - // TODO: remove duplicates from array in @bem/sdk.import-notation - // https://github.com/bem/bem-sdk/issues/263 this.entities = bemParse(request, ctx); this.ident = `bem-${completeRequest(request, ctx)}-${setIndex}`; diff --git a/src/helpers/importedFiles.js b/src/helpers/importedFiles.js index ab76231..16caee6 100644 --- a/src/helpers/importedFiles.js +++ b/src/helpers/importedFiles.js @@ -42,6 +42,5 @@ module.exports = (entities, levels, { techs, techMap }) => { }); }); - // FIXME: does it have right order ? return bemDeps; }; diff --git a/test/e2e/project/src/lib-with-rc/.bemrc.js b/test/e2e/project/src/lib-with-rc/.bemrc.js index 27e654d..48ed161 100644 --- a/test/e2e/project/src/lib-with-rc/.bemrc.js +++ b/test/e2e/project/src/lib-with-rc/.bemrc.js @@ -1,6 +1,5 @@ module.exports = { levels: [{ layer: 'desktop' }], - // TODO: remove sets after https://github.com/bem/bem-sdk/issues/262 sets: { desktop: 'desktop' } diff --git a/test/e2e/test.js b/test/e2e/test.js index c768838..7b7def7 100644 --- a/test/e2e/test.js +++ b/test/e2e/test.js @@ -220,7 +220,6 @@ describe('e2e', () => { const libs = { 'lib-without-rc': { levels: [{ layer: 'desktop' }], - // TODO: remove sets after https://github.com/bem/bem-sdk/issues/262 sets: { desktop: 'desktop' }