diff --git a/.eslintrc.js b/.eslintrc.js index bf6d274c79..1b939486f4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -160,7 +160,7 @@ module.exports = { 'import/no-default-export': 'error', 'import/no-duplicates': 'error', 'import/no-extraneous-dependencies': 'error', - 'import/no-unresolved': 'error', + 'import/no-unresolved': ['error', { commonjs: true }], 'import/no-useless-path-segments': 'error', 'import/order': 'error', @@ -200,9 +200,11 @@ module.exports = { }, { files: ['scripts/**/*.js', 'packages/*/scripts/**/*.js'], + excludedFiles: ['**/lib/**'], rules: { 'unicorn/filename-case': ['error', { case: 'kebabCase' }], 'local-rules/secure-command-execution': 'error', + 'local-rules/disallow-non-scripts': 'error', }, }, { diff --git a/eslint-local-rules/disallowNonScripts.js b/eslint-local-rules/disallowNonScripts.js new file mode 100644 index 0000000000..6875b32e3b --- /dev/null +++ b/eslint-local-rules/disallowNonScripts.js @@ -0,0 +1,29 @@ +module.exports = { + meta: { + docs: { + description: 'Disallow JS files that are not used as a "script"', + }, + schema: [], + }, + create: (context) => ({ + Program: (node) => { + if (!node.body.some(isMain)) { + context.report({ + node, + message: 'This file should be a script and contain a `runMain()` expression', + }) + } + }, + }), +} + +/** + * Check if the node is like `runMain(fn)` + */ +function isMain(node) { + return ( + node.type === 'ExpressionStatement' && + node.expression.type === 'CallExpression' && + node.expression.callee.name === 'runMain' + ) +} diff --git a/eslint-local-rules/index.js b/eslint-local-rules/index.js index 74fa1637e8..d61b2ad39d 100644 --- a/eslint-local-rules/index.js +++ b/eslint-local-rules/index.js @@ -15,5 +15,6 @@ module.exports = { 'disallow-zone-js-patched-values': require('./disallowZoneJsPatchedValues'), 'disallow-url-constructor-patched-values': require('./disallowUrlConstructorPatchValues.js'), 'disallow-generic-utils': require('./disallowGenericUtils'), + 'disallow-non-scripts': require('./disallowNonScripts'), 'secure-command-execution': require('./secureCommandExecution'), } diff --git a/scripts/build/replace-build-env.js b/scripts/build/replace-build-env.js index 3dc4cb9221..3fb7fc47e1 100644 --- a/scripts/build/replace-build-env.js +++ b/scripts/build/replace-build-env.js @@ -1,7 +1,7 @@ const glob = require('glob') -const { printLog, runMain } = require('../lib/execution-utils') -const { modifyFile } = require('../lib/files-utils') -const { buildEnvKeys, getBuildEnvValue } = require('../lib/build-env') +const { printLog, runMain } = require('../lib/executionUtils') +const { modifyFile } = require('../lib/filesUtils') +const { buildEnvKeys, getBuildEnvValue } = require('../lib/buildEnv') /** * Replace BuildEnv in build files diff --git a/scripts/check-licenses.js b/scripts/check-licenses.js index e16a3fec0e..c9e47d2729 100644 --- a/scripts/check-licenses.js +++ b/scripts/check-licenses.js @@ -3,8 +3,8 @@ const fs = require('fs') const path = require('path') const readline = require('readline') -const { printLog, printError, runMain } = require('./lib/execution-utils') -const { findBrowserSdkPackageJsonFiles } = require('./lib/files-utils') +const { printLog, printError, runMain } = require('./lib/executionUtils') +const { findBrowserSdkPackageJsonFiles } = require('./lib/filesUtils') const LICENSE_FILE = 'LICENSE-3rdparty.csv' diff --git a/scripts/check-packages.js b/scripts/check-packages.js index 4300a278c6..deb22ffaac 100644 --- a/scripts/check-packages.js +++ b/scripts/check-packages.js @@ -2,7 +2,7 @@ const fs = require('fs') const path = require('path') const glob = require('glob') const minimatch = require('minimatch') -const { printLog, printError, runMain } = require('./lib/execution-utils') +const { printLog, printError, runMain } = require('./lib/executionUtils') const { command } = require('./lib/command') runMain(() => { diff --git a/scripts/check-schemas.js b/scripts/check-schemas.js index fc96e7366b..ceb9369452 100644 --- a/scripts/check-schemas.js +++ b/scripts/check-schemas.js @@ -1,4 +1,4 @@ -const { printLog, printError, runMain } = require('./lib/execution-utils') +const { printLog, printError, runMain } = require('./lib/executionUtils') const { command } = require('./lib/command') runMain(() => { diff --git a/scripts/deploy/check-monitors.js b/scripts/deploy/check-monitors.js index 8ffe067991..4b01c4a30a 100644 --- a/scripts/deploy/check-monitors.js +++ b/scripts/deploy/check-monitors.js @@ -3,9 +3,9 @@ * Usage: * node check-monitors.js us1,eu1,... */ -const { printLog, runMain, fetchHandlingError } = require('../lib/execution-utils') +const { printLog, runMain, fetchHandlingError } = require('../lib/executionUtils') const { getTelemetryOrgApiKey, getTelemetryOrgApplicationKey } = require('../lib/secrets') -const { siteByDatacenter } = require('../lib/datadog-sites') +const { siteByDatacenter } = require('../lib/datadogSites') const monitorIdsByDatacenter = { us1: [72055549, 68975047, 110519972], diff --git a/scripts/deploy/deploy-prod-dc.js b/scripts/deploy/deploy-prod-dc.js index 5181df3017..a73fabb47c 100644 --- a/scripts/deploy/deploy-prod-dc.js +++ b/scripts/deploy/deploy-prod-dc.js @@ -1,4 +1,4 @@ -const { printLog, runMain, timeout } = require('../lib/execution-utils') +const { printLog, runMain, timeout } = require('../lib/executionUtils') const { command } = require('../lib/command') /** diff --git a/scripts/deploy/deploy.js b/scripts/deploy/deploy.js index b0fa7750d5..b8be36ed40 100644 --- a/scripts/deploy/deploy.js +++ b/scripts/deploy/deploy.js @@ -1,7 +1,7 @@ 'use strict' -const { printLog, runMain } = require('../lib/execution-utils') -const { fetchPR, LOCAL_BRANCH } = require('../lib/git-utils') +const { printLog, runMain } = require('../lib/executionUtils') +const { fetchPR, LOCAL_BRANCH } = require('../lib/gitUtils') const { command } = require('../lib/command') const { @@ -11,7 +11,7 @@ const { buildBundleFileName, buildPullRequestUploadPath, packages, -} = require('./lib/deployment-utils') +} = require('./lib/deploymentUtils') const ONE_MINUTE_IN_SECOND = 60 const ONE_HOUR_IN_SECOND = 60 * ONE_MINUTE_IN_SECOND diff --git a/scripts/deploy/lib/deployment-utils.js b/scripts/deploy/lib/deploymentUtils.js similarity index 100% rename from scripts/deploy/lib/deployment-utils.js rename to scripts/deploy/lib/deploymentUtils.js diff --git a/scripts/deploy/publish-developer-extension.js b/scripts/deploy/publish-developer-extension.js index 2dec118ab2..1d42f58698 100644 --- a/scripts/deploy/publish-developer-extension.js +++ b/scripts/deploy/publish-developer-extension.js @@ -2,7 +2,7 @@ const webstore = (...args) => import('chrome-webstore-upload').then(({ default: webstore }) => webstore(...args)) const fs = require('node:fs') -const { printLog, runMain } = require('../lib/execution-utils') +const { printLog, runMain } = require('../lib/executionUtils') const { command } = require('../lib/command') const { getChromeWebStoreClientId, diff --git a/scripts/deploy/publish-npm.js b/scripts/deploy/publish-npm.js index e04eb4a296..655a536a80 100644 --- a/scripts/deploy/publish-npm.js +++ b/scripts/deploy/publish-npm.js @@ -1,5 +1,5 @@ const fs = require('fs') -const { printLog, runMain } = require('../lib/execution-utils') +const { printLog, runMain } = require('../lib/executionUtils') const { command } = require('../lib/command') const { getNpmToken } = require('../lib/secrets') diff --git a/scripts/deploy/upload-source-maps.js b/scripts/deploy/upload-source-maps.js index 89478fbe18..63c763c36c 100644 --- a/scripts/deploy/upload-source-maps.js +++ b/scripts/deploy/upload-source-maps.js @@ -1,18 +1,18 @@ 'use strict' const path = require('path') -const { printLog, runMain } = require('../lib/execution-utils') +const { printLog, runMain } = require('../lib/executionUtils') const { command } = require('../lib/command') -const { getBuildEnvValue } = require('../lib/build-env') +const { getBuildEnvValue } = require('../lib/buildEnv') const { getTelemetryOrgApiKey } = require('../lib/secrets') -const { siteByDatacenter } = require('../lib/datadog-sites') +const { siteByDatacenter } = require('../lib/datadogSites') const { buildRootUploadPath, buildDatacenterUploadPath, buildBundleFolder, buildBundleFileName, packages, -} = require('./lib/deployment-utils') +} = require('./lib/deploymentUtils') /** * Upload source maps to datadog diff --git a/scripts/dev-server.js b/scripts/dev-server.js index ad2f372b2b..cc63501645 100644 --- a/scripts/dev-server.js +++ b/scripts/dev-server.js @@ -10,15 +10,17 @@ const rumSlimConfig = require('../packages/rum-slim/webpack.config') const rumConfig = require('../packages/rum/webpack.config') const workerConfig = require('../packages/worker/webpack.config') const webpackBase = require('../webpack.base') -const { printLog } = require('./lib/execution-utils') +const { printLog, runMain } = require('./lib/executionUtils') const sandboxPath = path.join(__dirname, '../sandbox') const port = 8080 -const app = express() -app.use(createStaticSandboxApp()) -app.use('/react-app', createReactApp()) -app.listen(port, () => printLog(`Server listening on port ${port}.`)) +runMain(() => { + const app = express() + app.use(createStaticSandboxApp()) + app.use('/react-app', createReactApp()) + app.listen(port, () => printLog(`Server listening on port ${port}.`)) +}) function createStaticSandboxApp() { const app = express() diff --git a/scripts/generate-schema-types.js b/scripts/generate-schema-types.js index a21e909bff..aaeeabbedf 100644 --- a/scripts/generate-schema-types.js +++ b/scripts/generate-schema-types.js @@ -1,8 +1,13 @@ const fs = require('fs') const path = require('path') + +// The json-schema-to-typescript is built on demand (see scripts/cli build_json2type) and is not +// always available in the node_modules. Skip the import check. +// eslint-disable-next-line import/no-unresolved const { compileFromFile } = require('json-schema-to-typescript') + const prettier = require('prettier') -const { printLog, runMain } = require('./lib/execution-utils') +const { printLog, runMain } = require('./lib/executionUtils') const schemasDirectoryPath = path.join(__dirname, '../rum-events-format/schemas') const prettierConfigPath = path.join(__dirname, '../.prettierrc.yml') diff --git a/scripts/lib/browser-sdk-version.js b/scripts/lib/browserSdkVersion.js similarity index 100% rename from scripts/lib/browser-sdk-version.js rename to scripts/lib/browserSdkVersion.js diff --git a/scripts/lib/bs-utils.js b/scripts/lib/bsUtils.js similarity index 83% rename from scripts/lib/bs-utils.js rename to scripts/lib/bsUtils.js index 79ef14c84a..5a2bcab0c9 100644 --- a/scripts/lib/bs-utils.js +++ b/scripts/lib/bsUtils.js @@ -1,4 +1,4 @@ -const { fetchHandlingError } = require('../lib/execution-utils') +const { fetchHandlingError } = require('../lib/executionUtils') async function browserStackRequest(url, options) { const response = await fetchHandlingError(url, { diff --git a/scripts/lib/build-env.js b/scripts/lib/buildEnv.js similarity index 97% rename from scripts/lib/build-env.js rename to scripts/lib/buildEnv.js index 309213310e..99899abc79 100644 --- a/scripts/lib/build-env.js +++ b/scripts/lib/buildEnv.js @@ -1,7 +1,7 @@ const { readFileSync } = require('fs') const path = require('path') const execSync = require('child_process').execSync -const { browserSdkVersion } = require('./browser-sdk-version') +const { browserSdkVersion } = require('./browserSdkVersion') const { command } = require('./command') /** diff --git a/scripts/lib/command.js b/scripts/lib/command.js index 821c1b8d78..a106a3904d 100644 --- a/scripts/lib/command.js +++ b/scripts/lib/command.js @@ -1,6 +1,6 @@ const childProcess = require('child_process') -const { printError } = require('./execution-utils') +const { printError } = require('./executionUtils') /** * Helper to run executables. This has been introduced to work around Shell injections[0] while diff --git a/scripts/lib/datadog-sites.js b/scripts/lib/datadogSites.js similarity index 100% rename from scripts/lib/datadog-sites.js rename to scripts/lib/datadogSites.js diff --git a/scripts/lib/execution-utils.js b/scripts/lib/executionUtils.js similarity index 100% rename from scripts/lib/execution-utils.js rename to scripts/lib/executionUtils.js diff --git a/scripts/lib/files-utils.js b/scripts/lib/filesUtils.js similarity index 100% rename from scripts/lib/files-utils.js rename to scripts/lib/filesUtils.js diff --git a/scripts/lib/git-utils.js b/scripts/lib/gitUtils.js similarity index 97% rename from scripts/lib/git-utils.js rename to scripts/lib/gitUtils.js index 6f53ad0390..c4a9cf72ef 100644 --- a/scripts/lib/git-utils.js +++ b/scripts/lib/gitUtils.js @@ -3,7 +3,7 @@ const fs = require('fs') const { command } = require('../lib/command') const { getGithubDeployKey, getGithubAccessToken } = require('./secrets') -const { fetchHandlingError } = require('./execution-utils') +const { fetchHandlingError } = require('./executionUtils') const GITHUB_TOKEN = getGithubAccessToken() diff --git a/scripts/lib/packages-directory-names.js b/scripts/lib/packagesDirectoryNames.js similarity index 100% rename from scripts/lib/packages-directory-names.js rename to scripts/lib/packagesDirectoryNames.js diff --git a/scripts/performance/index.js b/scripts/performance/index.js index 9ee584db2f..06b15b9cab 100644 --- a/scripts/performance/index.js +++ b/scripts/performance/index.js @@ -1,9 +1,9 @@ -const { runMain } = require('../lib/execution-utils') -const { reportAsPrComment } = require('./report-as-a-pr-comment') -const { reportToDatadog } = require('./report-to-datadog') -const { calculateBundleSizes } = require('./bundle-size/compute-bundle-size') -const { computeCpuPerformance } = require('./cpu-performance/compute-cpu-performance') -const { computeMemoryPerformance } = require('./memory-performance/compute-memory-performance') +const { runMain } = require('../lib/executionUtils') +const { reportAsPrComment } = require('./lib/reportAsAPrComment') +const { reportToDatadog } = require('./lib/reportToDatadog') +const { calculateBundleSizes } = require('./lib/computeBundleSize') +const { computeCpuPerformance } = require('./lib/computeCpuPerformance') +const { computeMemoryPerformance } = require('./lib/computeMemoryPerformance') runMain(async () => { const localBundleSizes = calculateBundleSizes() diff --git a/scripts/performance/bundle-size/compute-bundle-size.js b/scripts/performance/lib/computeBundleSize.js similarity index 100% rename from scripts/performance/bundle-size/compute-bundle-size.js rename to scripts/performance/lib/computeBundleSize.js diff --git a/scripts/performance/cpu-performance/compute-cpu-performance.js b/scripts/performance/lib/computeCpuPerformance.js similarity index 89% rename from scripts/performance/cpu-performance/compute-cpu-performance.js rename to scripts/performance/lib/computeCpuPerformance.js index c71766d0ae..ef85d69e45 100644 --- a/scripts/performance/cpu-performance/compute-cpu-performance.js +++ b/scripts/performance/lib/computeCpuPerformance.js @@ -1,8 +1,8 @@ -const { fetchHandlingError } = require('../../lib/execution-utils') +const { fetchHandlingError } = require('../../lib/executionUtils') const { getOrg2ApiKey, getOrg2AppKey } = require('../../lib/secrets') -const { timeout } = require('../../lib/execution-utils') -const { fetchPR, LOCAL_BRANCH } = require('../../lib/git-utils') -const { LOCAL_COMMIT_SHA } = require('../report-as-a-pr-comment') +const { timeout } = require('../../lib/executionUtils') +const { fetchPR, LOCAL_BRANCH } = require('../../lib/gitUtils') +const { LOCAL_COMMIT_SHA } = require('./reportAsAPrComment') const API_KEY = getOrg2ApiKey() const APP_KEY = getOrg2AppKey() const TIMEOUT_IN_MS = 15000 diff --git a/scripts/performance/memory-performance/compute-memory-performance.js b/scripts/performance/lib/computeMemoryPerformance.js similarity index 98% rename from scripts/performance/memory-performance/compute-memory-performance.js rename to scripts/performance/lib/computeMemoryPerformance.js index 6d3545c88f..f77f7e0317 100644 --- a/scripts/performance/memory-performance/compute-memory-performance.js +++ b/scripts/performance/lib/computeMemoryPerformance.js @@ -1,5 +1,5 @@ const puppeteer = require('puppeteer') -const { fetchPR, LOCAL_BRANCH } = require('../../lib/git-utils') +const { fetchPR, LOCAL_BRANCH } = require('../../lib/gitUtils') const NUMBER_OF_RUNS = 30 // Rule of thumb: this should be enough to get a good average const BATCH_SIZE = 2 const TESTS = [ diff --git a/scripts/performance/fetch-performance-metrics.js b/scripts/performance/lib/fetchPerformanceMetrics.js similarity index 90% rename from scripts/performance/fetch-performance-metrics.js rename to scripts/performance/lib/fetchPerformanceMetrics.js index 721640ee08..e44c250559 100644 --- a/scripts/performance/fetch-performance-metrics.js +++ b/scripts/performance/lib/fetchPerformanceMetrics.js @@ -1,5 +1,5 @@ -const { getOrg2ApiKey, getOrg2AppKey } = require('../lib/secrets') -const { fetchHandlingError } = require('../lib/execution-utils') +const { getOrg2ApiKey, getOrg2AppKey } = require('../../lib/secrets') +const { fetchHandlingError } = require('../../lib/executionUtils') const ONE_DAY_IN_SECOND = 24 * 60 * 60 function fetchPerformanceMetrics(type, names, commitId) { diff --git a/scripts/performance/report-as-a-pr-comment.js b/scripts/performance/lib/reportAsAPrComment.js similarity index 96% rename from scripts/performance/report-as-a-pr-comment.js rename to scripts/performance/lib/reportAsAPrComment.js index 7e6b5a236b..5717ab6fe3 100644 --- a/scripts/performance/report-as-a-pr-comment.js +++ b/scripts/performance/lib/reportAsAPrComment.js @@ -1,7 +1,7 @@ -const { command } = require('../lib/command') -const { fetchHandlingError } = require('../lib/execution-utils') -const { LOCAL_BRANCH, GITHUB_TOKEN, getLastCommonCommit, fetchPR } = require('../lib/git-utils') -const { fetchPerformanceMetrics } = require('./fetch-performance-metrics') +const { command } = require('../../lib/command') +const { fetchHandlingError } = require('../../lib/executionUtils') +const { LOCAL_BRANCH, GITHUB_TOKEN, getLastCommonCommit, fetchPR } = require('../../lib/gitUtils') +const { fetchPerformanceMetrics } = require('./fetchPerformanceMetrics') const PR_COMMENT_HEADER = 'Bundles Sizes Evolution' const PR_COMMENTER_AUTH_TOKEN = command`authanywhere --raw`.run() // The value is set to 5% as it's around 10 times the average value for small PRs. diff --git a/scripts/performance/report-to-datadog.js b/scripts/performance/lib/reportToDatadog.js similarity index 90% rename from scripts/performance/report-to-datadog.js rename to scripts/performance/lib/reportToDatadog.js index a9deac783d..3f8a311b35 100644 --- a/scripts/performance/report-to-datadog.js +++ b/scripts/performance/lib/reportToDatadog.js @@ -1,6 +1,6 @@ -const { fetchHandlingError } = require('../lib/execution-utils') -const { getOrg2ApiKey } = require('../lib/secrets') -const { browserSdkVersion } = require('../lib/browser-sdk-version') +const { fetchHandlingError } = require('../../lib/executionUtils') +const { getOrg2ApiKey } = require('../../lib/secrets') +const { browserSdkVersion } = require('../../lib/browserSdkVersion') const LOG_INTAKE_URL = 'https://http-intake.logs.datadoghq.com/api/v2/logs' const LOG_INTAKE_REQUEST_HEADERS = { 'DD-API-KEY': getOrg2ApiKey(), diff --git a/scripts/release/check-release.js b/scripts/release/check-release.js index 18b4e24053..639f4f16bc 100644 --- a/scripts/release/check-release.js +++ b/scripts/release/check-release.js @@ -1,9 +1,9 @@ 'use strict' const { version: releaseVersion } = require('../../lerna.json') -const { printLog, runMain } = require('../lib/execution-utils') +const { printLog, runMain } = require('../lib/executionUtils') const { command } = require('../lib/command') -const { findBrowserSdkPackageJsonFiles } = require('../lib/files-utils') +const { findBrowserSdkPackageJsonFiles } = require('../lib/filesUtils') runMain(() => { checkGitTag() diff --git a/scripts/release/generate-changelog.js b/scripts/release/generate-changelog.js index ab15d5fa2d..632b23c706 100644 --- a/scripts/release/generate-changelog.js +++ b/scripts/release/generate-changelog.js @@ -6,11 +6,11 @@ const readFile = util.promisify(require('fs').readFile) const emojiNameMap = require('emoji-name-map') -const { browserSdkVersion } = require('../lib/browser-sdk-version') -const { spawnCommand, printError, runMain } = require('../lib/execution-utils') +const { browserSdkVersion } = require('../lib/browserSdkVersion') +const { spawnCommand, printError, runMain } = require('../lib/executionUtils') const { command } = require('../lib/command') -const { modifyFile } = require('../lib/files-utils') -const { packagesDirectoryNames } = require('../lib/packages-directory-names') +const { modifyFile } = require('../lib/filesUtils') +const { packagesDirectoryNames } = require('../lib/packagesDirectoryNames') const CHANGELOG_FILE = 'CHANGELOG.md' const CONTRIBUTING_FILE = 'CONTRIBUTING.md' diff --git a/scripts/release/update-peer-dependency-versions.js b/scripts/release/update-peer-dependency-versions.js index c6d63dad6e..61a0f97677 100644 --- a/scripts/release/update-peer-dependency-versions.js +++ b/scripts/release/update-peer-dependency-versions.js @@ -1,8 +1,8 @@ -const { runMain } = require('../lib/execution-utils') -const { modifyFile } = require('../lib/files-utils') +const { runMain } = require('../lib/executionUtils') +const { modifyFile } = require('../lib/filesUtils') const { command } = require('../lib/command') -const { browserSdkVersion } = require('../lib/browser-sdk-version') -const { packagesDirectoryNames } = require('../lib/packages-directory-names') +const { browserSdkVersion } = require('../lib/browserSdkVersion') +const { packagesDirectoryNames } = require('../lib/packagesDirectoryNames') const JSON_FILES = packagesDirectoryNames.map((packageName) => `./packages/${packageName}/package.json`) diff --git a/scripts/staging-ci/check-squash-into-staging.js b/scripts/staging-ci/check-squash-into-staging.js index 191683457c..2858b530a8 100644 --- a/scripts/staging-ci/check-squash-into-staging.js +++ b/scripts/staging-ci/check-squash-into-staging.js @@ -1,8 +1,8 @@ 'use strict' -const { printLog, printError, runMain } = require('../lib/execution-utils') +const { printLog, printError, runMain } = require('../lib/executionUtils') const { command } = require('../lib/command') -const { initGitConfig } = require('../lib/git-utils') +const { initGitConfig } = require('../lib/gitUtils') const REPOSITORY = process.env.GIT_REPOSITORY const CI_COMMIT_SHA = process.env.CI_COMMIT_SHA diff --git a/scripts/staging-ci/check-staging-merge.js b/scripts/staging-ci/check-staging-merge.js index 6807555224..7955c6c1e3 100644 --- a/scripts/staging-ci/check-staging-merge.js +++ b/scripts/staging-ci/check-staging-merge.js @@ -1,8 +1,8 @@ 'use strict' -const { printLog, printError, runMain } = require('../lib/execution-utils') +const { printLog, printError, runMain } = require('../lib/executionUtils') const { command } = require('../lib/command') -const { initGitConfig } = require('../lib/git-utils') +const { initGitConfig } = require('../lib/gitUtils') const REPOSITORY = process.env.GIT_REPOSITORY const CI_COMMIT_SHA = process.env.CI_COMMIT_SHA diff --git a/scripts/staging-ci/staging-reset.js b/scripts/staging-ci/staging-reset.js index da1d8dce94..5941329272 100755 --- a/scripts/staging-ci/staging-reset.js +++ b/scripts/staging-ci/staging-reset.js @@ -1,10 +1,10 @@ 'use strict' const fs = require('fs') -const { printLog, runMain } = require('../lib/execution-utils') +const { printLog, runMain } = require('../lib/executionUtils') const { command } = require('../lib/command') -const { CI_FILE, replaceCiFileVariable, readCiFileVariable } = require('../lib/files-utils') -const { initGitConfig } = require('../lib/git-utils') +const { CI_FILE, replaceCiFileVariable, readCiFileVariable } = require('../lib/filesUtils') +const { initGitConfig } = require('../lib/gitUtils') const REPOSITORY = process.env.GIT_REPOSITORY const MAIN_BRANCH = process.env.MAIN_BRANCH diff --git a/scripts/test/bs-kill.js b/scripts/test/bs-kill.js index 1a9f7aa388..4df29a76a0 100644 --- a/scripts/test/bs-kill.js +++ b/scripts/test/bs-kill.js @@ -3,8 +3,8 @@ * This script stops all BrowserStack workers that are currently running. * Useful when troubleshooting BrowserStack issues locally. */ -const { printLog, runMain, timeout } = require('../lib/execution-utils') -const { browserStackRequest } = require('../lib/bs-utils') +const { printLog, runMain, timeout } = require('../lib/executionUtils') +const { browserStackRequest } = require('../lib/bsUtils') const MINIMUM_WORKER_LIFE = 30_000 diff --git a/scripts/test/bs-wrapper.js b/scripts/test/bs-wrapper.js index dee5e220db..4d8b58f8c0 100644 --- a/scripts/test/bs-wrapper.js +++ b/scripts/test/bs-wrapper.js @@ -14,9 +14,9 @@ // after killing it. There might be a better way of prematurely aborting the test command if we need // to in the future. -const { spawnCommand, printLog, runMain, timeout } = require('../lib/execution-utils') +const { spawnCommand, printLog, runMain, timeout } = require('../lib/executionUtils') const { command } = require('../lib/command') -const { browserStackRequest } = require('../lib/bs-utils') +const { browserStackRequest } = require('../lib/bsUtils') const AVAILABILITY_CHECK_DELAY = 30_000 const BS_BUILD_URL = 'https://api.browserstack.com/automate/builds.json?status=running' diff --git a/scripts/test/bump-chrome-version.js b/scripts/test/bump-chrome-version.js index 00b0d23d45..c00b80ae49 100644 --- a/scripts/test/bump-chrome-version.js +++ b/scripts/test/bump-chrome-version.js @@ -1,10 +1,10 @@ 'use strict' const fs = require('fs') -const { printLog, runMain, fetchHandlingError } = require('../lib/execution-utils') +const { printLog, runMain, fetchHandlingError } = require('../lib/executionUtils') const { command } = require('../lib/command') -const { CI_FILE, replaceCiFileVariable } = require('../lib/files-utils') -const { initGitConfig } = require('../lib/git-utils') +const { CI_FILE, replaceCiFileVariable } = require('../lib/filesUtils') +const { initGitConfig } = require('../lib/gitUtils') const { getGithubAccessToken } = require('../lib/secrets') const REPOSITORY = process.env.GIT_REPOSITORY diff --git a/scripts/test/export-test-result.js b/scripts/test/export-test-result.js index 010bd7ef8a..dfb6f2c6eb 100644 --- a/scripts/test/export-test-result.js +++ b/scripts/test/export-test-result.js @@ -1,6 +1,6 @@ 'use strict' -const { printLog, runMain } = require('../lib/execution-utils') +const { printLog, runMain } = require('../lib/executionUtils') const { command } = require('../lib/command') const { getOrg2ApiKey } = require('../lib/secrets') diff --git a/scripts/update-branch.js b/scripts/update-branch.js index 97a1cf4898..726d1b93ae 100644 --- a/scripts/update-branch.js +++ b/scripts/update-branch.js @@ -1,7 +1,7 @@ 'use strict' const { parseArgs } = require('node:util') -const { printLog, runMain, fetchHandlingError } = require('./lib/execution-utils') +const { printLog, runMain, fetchHandlingError } = require('./lib/executionUtils') const { command } = require('./lib/command') const REPOSITORY = process.env.APP diff --git a/webpack.base.js b/webpack.base.js index 047e88c849..a3b3396189 100644 --- a/webpack.base.js +++ b/webpack.base.js @@ -2,7 +2,7 @@ const path = require('path') const webpack = require('webpack') const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin') const TerserPlugin = require('terser-webpack-plugin') -const { buildEnvKeys, getBuildEnvValue } = require('./scripts/lib/build-env') +const { buildEnvKeys, getBuildEnvValue } = require('./scripts/lib/buildEnv') const tsconfigPath = path.join(__dirname, 'tsconfig.webpack.json')