How @bem/sdk.walk works?

node v8.17.0
version: master
endpointsharetweet
const mockfs = require('mock-fs'); const walk = require('@bem/sdk.walk'); const react = require('@bem/sdk.naming.presets/react'); const toArray = require('stream-to-array'); // { preset: 'legacy', fs: { scheme: 'flat' } } mockfs({ 'src/components': { 'btn': { 'btn.js': 'alert(1)', 'btn.css': '.btn { color: red }', 'btn.examples': { 'all.bemjson.js': '({ block: "btn" })' }, 'btn@desktop.js': 'alert(2)', 'btn@touch.js': 'alert(3)', 'text/btn-text.js': '// oh really\n', }, }, 'node_modules/react-components': { 'input': { 'input.ts': 'alert(4)', 'input.styl': '.btn { color: red }', 'input@desktop.ts': 'alert(5)', 'input@touch.ts': 'alert(6)', } } }); await toArray(walk( ['src/components', 'node_modules/react-components'], { defaults: { naming: react } } )).then(files => files.map(f => `${f.cell.id} at ${f.level}`))
Loading…

no comments

    sign in to comment