mirror of
https://github.com/nasa/openmct.git
synced 2025-06-16 06:08:11 +00:00
[Templates] Add template paths
...with text! prefix
This commit is contained in:
@ -46,12 +46,25 @@ function findTemplateURLs(sourceCode) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function injectRequireArgument(sourceCode, templateUrls) {
|
||||||
|
var lines = sourceCode.split('\n'),
|
||||||
|
index;
|
||||||
|
|
||||||
|
templateUrls = _.uniq(templateUrls);
|
||||||
|
|
||||||
|
index = lines.map(_.trim).indexOf("'legacyRegistry'");
|
||||||
|
|
||||||
|
lines = lines.slice(0, index).concat(templateUrls.map(function (url) {
|
||||||
|
return " \"text!./res/" + url + "\",";
|
||||||
|
}).concat(lines.slice(index)));
|
||||||
|
|
||||||
|
return lines.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
function migrate(file) {
|
function migrate(file) {
|
||||||
var sourceCode = fs.readFileSync(file, 'utf8'),
|
var sourceCode = fs.readFileSync(file, 'utf8'),
|
||||||
templateUrls = findTemplateURLs(sourceCode);
|
templateUrls = findTemplateURLs(sourceCode);
|
||||||
templateUrls.forEach(function (templateUrl) {
|
console.log(injectRequireArgument(sourceCode, templateUrls));
|
||||||
console.log(templateUrl, toTemplateName(templateUrl));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glob('platform/**/bundle.js', {}, function (err, files) {
|
glob('platform/**/bundle.js', {}, function (err, files) {
|
||||||
|
Reference in New Issue
Block a user