diff --git a/platform/ios/platform/darwin/scripts/generate-style-code.js b/platform/ios/platform/darwin/scripts/generate-style-code.js index 0c05fc5d5..efbb3035d 100755 --- a/platform/ios/platform/darwin/scripts/generate-style-code.js +++ b/platform/ios/platform/darwin/scripts/generate-style-code.js @@ -7,7 +7,7 @@ const _ = require('lodash'); const colorParser = require('csscolorparser'); const assert = require('assert'); -require('../../../scripts/style-code'); +require('../../../../../scripts/style-code'); const cocoaConventions = require('./style-spec-cocoa-conventions-v8.json'); const prefix = 'MGL'; diff --git a/platform/ios/platform/darwin/scripts/update-examples.js b/platform/ios/platform/darwin/scripts/update-examples.js index 885b26248..63acf18bf 100755 --- a/platform/ios/platform/darwin/scripts/update-examples.js +++ b/platform/ios/platform/darwin/scripts/update-examples.js @@ -5,7 +5,7 @@ const fs = require('fs'); const execFileSync = require('child_process').execFileSync; const _ = require('lodash'); -require('../../../scripts/style-code'); +require('../../../../../scripts/style-code'); const examplesSrc = fs.readFileSync('platform/darwin/test/MGLDocumentationExampleTests.swift', 'utf8'); diff --git a/platform/ios/scripts/generate-file-lists.js b/platform/ios/scripts/generate-file-lists.js index 546ce3823..2e9d0ee4b 100755 --- a/platform/ios/scripts/generate-file-lists.js +++ b/platform/ios/scripts/generate-file-lists.js @@ -5,7 +5,7 @@ const fs = require('fs'); const path = require('path'); const xcode = require('xcode'); -require('./style-code'); +require('../../../scripts/style-code'); const classifier = /^(?:(?:(?:platform|vendor)\/(?:(?!include|src).)*\/|(?:test|benchmark)\/)?(?:(include|src)\/)?)?(.+\.h(?:pp|xx)?)$/; diff --git a/platform/ios/scripts/generate-shaders.js b/platform/ios/scripts/generate-shaders.js index 75105af42..da94070c4 100755 --- a/platform/ios/scripts/generate-shaders.js +++ b/platform/ios/scripts/generate-shaders.js @@ -9,7 +9,7 @@ const crypto = require('crypto'); var shaders = require('../maplibre-gl-js/src/shaders'); -require('./style-code'); +require('../../../scripts/style-code'); let concatenated = ''; let offsets = {}; diff --git a/platform/ios/scripts/generate-style-code.js b/platform/ios/scripts/generate-style-code.js index 40818500f..ff4ec02e6 100755 --- a/platform/ios/scripts/generate-style-code.js +++ b/platform/ios/scripts/generate-style-code.js @@ -6,7 +6,7 @@ const ejs = require('ejs'); const spec = require('./style-spec'); const colorParser = require('csscolorparser'); -require('./style-code'); +require('../../../scripts/style-code'); function parseCSSColor(str) { const color = colorParser.parseCSSColor(str); diff --git a/platform/ios/scripts/style-code.js b/platform/ios/scripts/style-code.js deleted file mode 100644 index 7a93b13a7..000000000 --- a/platform/ios/scripts/style-code.js +++ /dev/null @@ -1,51 +0,0 @@ -// Global functions // - -const fs = require('fs'); -const path = require('path'); - -global.iff = function (condition, val) { - return condition() ? val : ""; -}; - -global.camelize = function (str) { - return str.replace(/(?:^|-)(.)/g, function (_, x) { - return x.toUpperCase(); - }); -}; - -global.camelizeWithLeadingLowercase = function (str) { - return str.replace(/-(.)/g, function (_, x) { - return x.toUpperCase(); - }); -}; - -global.snakeCaseUpper = function snakeCaseUpper(str) { - return str.replace(/-/g, "_").toUpperCase(); -}; - -global.unhyphenate = function (str) { - return str.replace(/-/g, " "); -}; - -// Write out a list of files that this script is modifying so that we can check -var files = []; -process.on('exit', function() { - const list = path.join(path.dirname(process.argv[1]), path.basename(process.argv[1], '.js') + '.list'); - fs.writeFileSync(list, files.join('\n')); -}); - -global.writeIfModified = function(filename, newContent) { - files.push(filename); - try { - const oldContent = fs.readFileSync(filename, 'utf8'); - if (oldContent == newContent) { - console.warn(`* Skipping file '${filename}' because it is up-to-date`); - return; - } - } catch(err) { - } - if (['0', 'false'].indexOf(process.env.DRY_RUN || '0') !== -1) { - fs.writeFileSync(filename, newContent); - } - console.warn(`* Updating outdated file '${filename}'`); -};