Rename before running transform

This commit is contained in:
Andreas Hocevar
2017-09-12 21:13:58 +02:00
parent e876003684
commit 5499028042
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -22,7 +22,7 @@
"changecase-src": "node tasks/filename-case-from-module.js", "changecase-src": "node tasks/filename-case-from-module.js",
"transform-examples": "jscodeshift --transform transforms/module.js examples", "transform-examples": "jscodeshift --transform transforms/module.js examples",
"transform-test": "jscodeshift --transform transforms/module.js test", "transform-test": "jscodeshift --transform transforms/module.js test",
"transform": "npm run transform-src && npm run changecase-src && npm run transform-examples && npm run transform-test && npm run lint -- --fix" "transform": "npm run changecase-src && npm run transform-src && npm run transform-examples && npm run transform-test && npm run lint -- --fix"
}, },
"main": "dist/ol.js", "main": "dist/ol.js",
"repository": { "repository": {
+1 -1
View File
@@ -11,7 +11,7 @@ glob('src/**/*.js', {}, function(err, files) {
const lines = contents.split('\n'); const lines = contents.split('\n');
for (let i = lines.length - 1; i >= 0; --i) { for (let i = lines.length - 1; i >= 0; --i) {
const line = lines[i]; const line = lines[i];
const match = line.match(/export default _.*_([^;]*)_;$/); const match = line.match(/goog\.provide\('.*\.([^']*)'\);$/);
if (match && match.length) { if (match && match.length) {
const newName = match[1] + '.js'; const newName = match[1] + '.js';
if (newName != newName.toLowerCase()) { if (newName != newName.toLowerCase()) {