Skip to content

Commit

Permalink
ENG-1680 reverting widget codes
Browse files Browse the repository at this point in the history
  • Loading branch information
ffleandro committed Dec 23, 2020
1 parent eb10ae0 commit 617672c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/env-bundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,7 @@ const componentResponseProcessor = {
}));

const schema = {
code: [{
key: 'code',
transform: function(code) { return code.trim().toLowerCase().replace(new RegExp('[\\s\\-_]+', 'g'), '_') }
}],
'code': 'code',
'titles': 'titles',
'group': 'group',
'customUi': 'customUi',
Expand Down Expand Up @@ -746,6 +743,10 @@ function canonizeCode (code) {
return code.trim().toLowerCase().replace(new RegExp(' ', 'g'), '-').replace(new RegExp('-+', 'g'), '-');
}

function canonizeCodeUnderline (code) {
return code.trim().toLowerCase().replace(new RegExp('[\\s\\-_]+', 'g'), '_');
}

const urlEncoder = function (payload) {
return Object.keys(payload)
.map((k) => `${k}=${payload[k]}`)
Expand Down Expand Up @@ -961,8 +962,8 @@ async function generateBundle (options, components) {
}

async function filterWidgetFragments(components) {
const widgets = components['widget'];
components['fragment'] = components['fragment'].filter(f => !widgets.includes(f));
const widgets = components['widget'].map(w => canonizeCodeUnderline(w));
components['fragment'] = components['fragment'].filter(f => !widgets.includes(canonizeCodeUnderline(f)));
return components;
}

Expand Down

0 comments on commit 617672c

Please sign in to comment.