Skip to content

fix(inline-resources): remove module ids from component metadata. #984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 10, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions scripts/release/inline-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ for (let arg of process.argv.slice(2)) {
readFile(filePath, 'utf-8')
.then(content => inlineTemplate(filePath, content))
.then(content => inlineStyle(filePath, content))
.then(content => removeModuleIds(content))
.then(content => writeFile(filePath, content))
.catch(err => {
console.error('An error occured: ', err);
Expand Down Expand Up @@ -96,3 +97,13 @@ function inlineStyle(filePath, content) {
+ ']';
});
}

/**
* Removes the module ids of the component metadata.
* Since the templates and styles are now inlined, the module id has become unnecessary and
* can cause unexpected issues.
*/
function removeModuleIds(content) {
// Match the line feeds as well, because we want to get rid of that line.
return content.replace(/^\W+moduleId:\W+module\.id,?[\n|\r]+/gm, '');
}