From d987931c65deb0ef86f03f807454b4c53109e890 Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Mon, 31 Jul 2023 10:34:43 +0200 Subject: [PATCH] format config scripts --- .prettierignore | 14 ------- config/bundlesize.ts | 30 +++++++------- config/entryPoints.js | 22 +++++----- config/helpers.ts | 40 +++++++++--------- config/jest.config.js | 42 +++++++++---------- config/postprocessDist.ts | 18 ++++---- config/precheck.js | 15 ++----- config/prepareChangesetsRelease.ts | 4 +- config/prepareDist.js | 46 ++++++++++++--------- config/processInvariants.ts | 7 +++- config/rewriteSourceMaps.ts | 66 ++++++++++++++++-------------- config/rollup.config.js | 55 ++++++++++--------------- config/tsconfig.json | 4 +- config/version.js | 50 +++++++++++----------- 14 files changed, 198 insertions(+), 215 deletions(-) diff --git a/.prettierignore b/.prettierignore index b8cf7aaec55..05e97068d58 100644 --- a/.prettierignore +++ b/.prettierignore @@ -342,17 +342,3 @@ node_modules/ /src/react/hoc/__tests__/ssr/server.test.tsx /src/react/hoc/__tests__/subscriptions/subscriptions.test.tsx /src/react/hooks/internal/__tests__/useDeepMemo.test.ts -/config/bundlesize.ts -/config/compare-build-output-to.sh -/config/entryPoints.js -/config/helpers.ts -/config/jest.config.js -/config/postprocessDist.ts -/config/precheck.js -/config/prepareChangesetsRelease.ts -/config/prepareDist.js -/config/processInvariants.ts -/config/rewriteSourceMaps.ts -/config/rollup.config.js -/config/tsconfig.json -/config/version.js diff --git a/config/bundlesize.ts b/config/bundlesize.ts index d0529f47439..176bf601ed0 100644 --- a/config/bundlesize.ts +++ b/config/bundlesize.ts @@ -1,23 +1,21 @@ -import { readFileSync } from "fs"; -import { join } from "path"; -import { gzipSync } from "zlib"; -import bytes from "bytes"; +import { readFileSync } from 'fs'; +import { join } from 'path'; +import { gzipSync } from 'zlib'; +import bytes from 'bytes'; -const gzipBundleByteLengthLimit = bytes("35.25KB"); -const minFile = join("dist", "apollo-client.min.cjs"); -const minPath = join(__dirname, "..", minFile); +const gzipBundleByteLengthLimit = bytes('35.25KB'); +const minFile = join('dist', 'apollo-client.min.cjs'); +const minPath = join(__dirname, '..', minFile); const gzipByteLen = gzipSync(readFileSync(minPath)).byteLength; const overLimit = gzipByteLen > gzipBundleByteLengthLimit; -const message = `Minified + GZIP-encoded bundle size for ${ - minFile -} = ${ - bytes(gzipByteLen, { unit: "KB" }) -}, ${ - overLimit ? "exceeding" : "under" -} limit ${ - bytes(gzipBundleByteLengthLimit, { unit: "KB" }) -}`; +const message = `Minified + GZIP-encoded bundle size for ${minFile} = ${bytes( + gzipByteLen, + { unit: 'KB' } +)}, ${overLimit ? 'exceeding' : 'under'} limit ${bytes( + gzipBundleByteLengthLimit, + { unit: 'KB' } +)}`; if (overLimit) { throw new Error(message); diff --git a/config/entryPoints.js b/config/entryPoints.js index 8afa1c9af0c..e70b4480d5b 100644 --- a/config/entryPoints.js +++ b/config/entryPoints.js @@ -1,5 +1,5 @@ const entryPoints = [ - { dirs: [], bundleName: "main" }, + { dirs: [], bundleName: 'main' }, { dirs: ['cache'] }, { dirs: ['core'] }, { dirs: ['dev'] }, @@ -24,23 +24,23 @@ const entryPoints = [ { dirs: ['react', 'hooks'] }, { dirs: ['react', 'parser'] }, { dirs: ['react', 'ssr'] }, - { dirs: ['testing'], extensions: [".js", ".jsx"] }, + { dirs: ['testing'], extensions: ['.js', '.jsx'] }, { dirs: ['testing', 'core'] }, { dirs: ['utilities'] }, { dirs: ['utilities', 'globals'], sideEffects: true }, ]; const lookupTrie = Object.create(null); -entryPoints.forEach(info => { +entryPoints.forEach((info) => { let node = lookupTrie; - info.dirs.forEach(dir => { + info.dirs.forEach((dir) => { const dirs = node.dirs || (node.dirs = Object.create(null)); node = dirs[dir] || (dirs[dir] = { isEntry: false }); }); node.isEntry = true; }); -exports.forEach = function(callback, context) { +exports.forEach = function (callback, context) { entryPoints.forEach(callback, context); }; @@ -48,7 +48,7 @@ exports.map = function map(callback, context) { return entryPoints.map(callback, context); }; -const path = require("path").posix; +const path = require('path').posix; exports.check = function (id, parentId) { const resolved = path.resolve(path.dirname(parentId), id); @@ -76,9 +76,11 @@ exports.check = function (id, parentId) { return false; } - console.warn(`Risky cross-entry-point nested import of ${id} in ${ - partsAfterDist(parentId).join("/") - }`); + console.warn( + `Risky cross-entry-point nested import of ${id} in ${partsAfterDist( + parentId + ).join('/')}` + ); } } @@ -87,7 +89,7 @@ exports.check = function (id, parentId) { function partsAfterDist(id) { const parts = id.split(path.sep); - const distIndex = parts.lastIndexOf("dist"); + const distIndex = parts.lastIndexOf('dist'); if (/^index.jsx?$/.test(parts[parts.length - 1])) { parts.pop(); } diff --git a/config/helpers.ts b/config/helpers.ts index e0e1b248ca1..6600e02bdc0 100644 --- a/config/helpers.ts +++ b/config/helpers.ts @@ -1,40 +1,42 @@ -import * as path from "path"; -import * as recast from "recast"; -import * as parser from "recast/parsers/babel"; -import glob = require("glob"); +import * as path from 'path'; +import * as recast from 'recast'; +import * as parser from 'recast/parsers/babel'; +import glob = require('glob'); -export const distDir = path.resolve(__dirname, "..", "dist"); +export const distDir = path.resolve(__dirname, '..', 'dist'); -export function eachFile(dir: string, callback: ( - absPath: string, - relPath: string, -) => any) { +export function eachFile( + dir: string, + callback: (absPath: string, relPath: string) => any +) { const promises: Promise[] = []; return new Promise((resolve, reject) => { glob(`${dir.replace(/\\/g, '/')}/**/*.js`, (error, files) => { if (error) return reject(error); - files.sort().forEach(file => { + files.sort().forEach((file) => { const relPath = path.relative(dir, file); // Outside the distDir, somehow. - if (relPath.startsWith("../")) return; + if (relPath.startsWith('../')) return; // Avoid re-transforming CommonJS bundle files. - if (relPath.endsWith(".cjs")) return; - if (relPath.endsWith(".cjs.js")) return; - if (relPath.endsWith(".cjs.native.js")) return; + if (relPath.endsWith('.cjs')) return; + if (relPath.endsWith('.cjs.js')) return; + if (relPath.endsWith('.cjs.native.js')) return; // Avoid re-transforming CommonJS bundle files. - if (relPath.endsWith(".min.js")) return; + if (relPath.endsWith('.min.js')) return; // This file is not meant to be imported or processed. - if (relPath.endsWith("invariantErrorCodes.js")) return; + if (relPath.endsWith('invariantErrorCodes.js')) return; - promises.push(new Promise(resolve => { - resolve(callback(file, relPath)); - })); + promises.push( + new Promise((resolve) => { + resolve(callback(file, relPath)); + }) + ); }); resolve(); diff --git a/config/jest.config.js b/config/jest.config.js index e8ae983c671..03454f45c2e 100644 --- a/config/jest.config.js +++ b/config/jest.config.js @@ -1,29 +1,29 @@ const defaults = { - rootDir: "src", - preset: "ts-jest", - testEnvironment: "jsdom", - setupFilesAfterEnv: ["/config/jest/setup.ts"], + rootDir: 'src', + preset: 'ts-jest', + testEnvironment: 'jsdom', + setupFilesAfterEnv: ['/config/jest/setup.ts'], globals: { __DEV__: true, }, testEnvironmentOptions: { - url: "http://localhost", + url: 'http://localhost', }, snapshotFormat: { escapeString: true, - printBasicPrototype: true + printBasicPrototype: true, }, transform: { '^.+\\.tsx?$': [ 'ts-jest', { diagnostics: { - warnOnly: process.env.TEST_ENV !== 'ci' + warnOnly: process.env.TEST_ENV !== 'ci', }, }, ], }, - resolver: "ts-jest-resolver", + resolver: 'ts-jest-resolver', }; const ignoreTSFiles = '.ts$'; @@ -34,40 +34,36 @@ const react17TestFileIgnoreList = [ // For now, we only support useSuspenseQuery with React 18, so no need to test // it with React 17 'src/react/hooks/__tests__/useSuspenseQuery.test.tsx', - 'src/react/hooks/__tests__/useBackgroundQuery.test.tsx' -] + 'src/react/hooks/__tests__/useBackgroundQuery.test.tsx', +]; const tsStandardConfig = { ...defaults, displayName: 'Core Tests', testPathIgnorePatterns: [ignoreTSXFiles], -} +}; // For both React (Jest) "projects", ignore core tests (.ts files) as they // do not import React, to avoid running them twice. const standardReact18Config = { ...defaults, - displayName: "ReactDOM 18", + displayName: 'ReactDOM 18', testPathIgnorePatterns: [ignoreTSFiles], }; const standardReact17Config = { ...defaults, - displayName: "ReactDOM 17", + displayName: 'ReactDOM 17', testPathIgnorePatterns: react17TestFileIgnoreList, moduleNameMapper: { - "^react$": "react-17", - "^react-dom$": "react-dom-17", - "^react-dom/server$": "react-dom-17/server", - "^react-dom/test-utils$": "react-dom-17/test-utils", - "^@testing-library/react$": "@testing-library/react-12", + '^react$': 'react-17', + '^react-dom$': 'react-dom-17', + '^react-dom/server$': 'react-dom-17/server', + '^react-dom/test-utils$': 'react-dom-17/test-utils', + '^@testing-library/react$': '@testing-library/react-12', }, }; module.exports = { - projects: [ - tsStandardConfig, - standardReact17Config, - standardReact18Config, - ], + projects: [tsStandardConfig, standardReact17Config, standardReact18Config], }; diff --git a/config/postprocessDist.ts b/config/postprocessDist.ts index 2d6d04d106e..624c82b9844 100644 --- a/config/postprocessDist.ts +++ b/config/postprocessDist.ts @@ -2,11 +2,13 @@ import { distDir } from './helpers.ts'; import fs from 'node:fs'; import path from 'node:path'; -const globalTypesFile = path.resolve(distDir, "utilities/globals/global.d.ts"); -fs.writeFileSync(globalTypesFile, - fs.readFileSync(globalTypesFile, "utf8") - .split("\n") - .filter(line => line.trim() !== 'const __DEV__: boolean;') - .join("\n"), - "utf8" -); \ No newline at end of file +const globalTypesFile = path.resolve(distDir, 'utilities/globals/global.d.ts'); +fs.writeFileSync( + globalTypesFile, + fs + .readFileSync(globalTypesFile, 'utf8') + .split('\n') + .filter((line) => line.trim() !== 'const __DEV__: boolean;') + .join('\n'), + 'utf8' +); diff --git a/config/precheck.js b/config/precheck.js index 85de72c59b4..51dc7876b30 100644 --- a/config/precheck.js +++ b/config/precheck.js @@ -1,21 +1,14 @@ -const { - lockfileVersion, -} = require("../package-lock.json"); +const { lockfileVersion } = require('../package-lock.json'); const expectedVersion = 2; -if (typeof lockfileVersion !== "number" || - lockfileVersion < expectedVersion) { +if (typeof lockfileVersion !== 'number' || lockfileVersion < expectedVersion) { throw new Error( - `Old lockfileVersion (${ - lockfileVersion - }) found in package-lock.json (expected ${ - expectedVersion - } or later)` + `Old lockfileVersion (${lockfileVersion}) found in package-lock.json (expected ${expectedVersion} or later)` ); } -console.log("ok", { +console.log('ok', { lockfileVersion, expectedVersion, }); diff --git a/config/prepareChangesetsRelease.ts b/config/prepareChangesetsRelease.ts index d24a28a4c06..a7c578f31ab 100644 --- a/config/prepareChangesetsRelease.ts +++ b/config/prepareChangesetsRelease.ts @@ -14,8 +14,8 @@ // - Add both .changeset and CHANGELOG.md to an .npmignore so they are not // included in the published package. -const fs = require("fs"); -const path = require("path"); +const fs = require('fs'); +const path = require('path'); const distRoot = `${__dirname}/../dist`; const srcDir = `${__dirname}/..`; diff --git a/config/prepareDist.js b/config/prepareDist.js index 0205b0eb8bc..00b6684b88d 100644 --- a/config/prepareDist.js +++ b/config/prepareDist.js @@ -17,7 +17,6 @@ const recast = require('recast'); const distRoot = `${__dirname}/../dist`; - /* @apollo/client */ const packageJson = require('../package.json'); @@ -43,14 +42,19 @@ delete packageJson.engines; // on-going package development (e.g. running tests, supporting npm link, etc.). // When publishing from "dist" however, we need to update the package.json // to point to the files within the same directory. -const distPackageJson = JSON.stringify(packageJson, (_key, value) => { - if (typeof value === 'string' && value.startsWith('./dist/')) { - const parts = value.split('/'); - parts.splice(1, 1); // remove dist - return parts.join('/'); - } - return value; -}, 2) + "\n"; +const distPackageJson = + JSON.stringify( + packageJson, + (_key, value) => { + if (typeof value === 'string' && value.startsWith('./dist/')) { + const parts = value.split('/'); + parts.splice(1, 1); // remove dist + return parts.join('/'); + } + return value; + }, + 2 + ) + '\n'; // Save the modified package.json to "dist" fs.writeFileSync(`${distRoot}/package.json`, distPackageJson); @@ -58,8 +62,8 @@ fs.writeFileSync(`${distRoot}/package.json`, distPackageJson); // Copy supporting files into "dist" const srcDir = `${__dirname}/..`; const destDir = `${srcDir}/dist`; -fs.copyFileSync(`${srcDir}/README.md`, `${destDir}/README.md`); -fs.copyFileSync(`${srcDir}/LICENSE`, `${destDir}/LICENSE`); +fs.copyFileSync(`${srcDir}/README.md`, `${destDir}/README.md`); +fs.copyFileSync(`${srcDir}/LICENSE`, `${destDir}/LICENSE`); // Create individual bundle package.json files, storing them in their // associated dist directory. This helps provide a way for the Apollo Client @@ -74,13 +78,17 @@ entryPoints.forEach(function buildPackageJson({ if (!dirs.length) return; fs.writeFileSync( path.join(distRoot, ...dirs, 'package.json'), - JSON.stringify({ - name: path.posix.join('@apollo', 'client', ...dirs), - type: "module", - main: `${bundleName}.cjs`, - module: 'index.js', - types: 'index.d.ts', - sideEffects, - }, null, 2) + "\n", + JSON.stringify( + { + name: path.posix.join('@apollo', 'client', ...dirs), + type: 'module', + main: `${bundleName}.cjs`, + module: 'index.js', + types: 'index.d.ts', + sideEffects, + }, + null, + 2 + ) + '\n' ); }); diff --git a/config/processInvariants.ts b/config/processInvariants.ts index 787772aa262..b85030f9f41 100644 --- a/config/processInvariants.ts +++ b/config/processInvariants.ts @@ -86,7 +86,6 @@ function getErrorCode( extractString(file, target, message.alternate, condition) ); } else if (isStringOnly(message)) { - const messageText = reprint(message); if (messageText.includes('Apollo DevTools')) { return message; @@ -196,7 +195,11 @@ function transform(code: string, relativeFilePath: string) { }, }); - if (!['utilities/globals/index.js', 'config/jest/setup.js'].includes(relativeFilePath)) + if ( + !['utilities/globals/index.js', 'config/jest/setup.js'].includes( + relativeFilePath + ) + ) recast.visit(ast, { visitIdentifier(path) { this.traverse(path); diff --git a/config/rewriteSourceMaps.ts b/config/rewriteSourceMaps.ts index cb3c284ef0d..6c733d75eee 100644 --- a/config/rewriteSourceMaps.ts +++ b/config/rewriteSourceMaps.ts @@ -1,7 +1,7 @@ -import * as fs from "fs"; -import * as path from "path"; +import * as fs from 'fs'; +import * as path from 'path'; import { distDir } from './helpers.ts'; -import glob = require("glob"); +import glob = require('glob'); glob(`${distDir.replace(/\\/g, '/')}/**/*.js.map`, (error, files) => { if (error) throw error; @@ -11,34 +11,38 @@ glob(`${distDir.replace(/\\/g, '/')}/**/*.js.map`, (error, files) => { const startTime = Date.now(); let rewriteCount = 0; - Promise.all(files.map(async file => { - const content = await fs.promises.readFile(file, "utf8"); - const map = JSON.parse(content); - if (map.sourcesContent) return; - if (map.sources) { - map.sourcesContent = await Promise.all( - map.sources.map((relSourcePath: string) => { - const sourcePath = path.normalize( - path.join(path.dirname(file), relSourcePath)); - const relPath = path.relative(rootDir, sourcePath); - // Disallow reading paths outside rootDir. - if (relPath.startsWith("../")) { - throw new Error(`Bad path: ${sourcePath}`); - } - return fs.promises.readFile(sourcePath, "utf8"); - }) + Promise.all( + files.map(async (file) => { + const content = await fs.promises.readFile(file, 'utf8'); + const map = JSON.parse(content); + if (map.sourcesContent) return; + if (map.sources) { + map.sourcesContent = await Promise.all( + map.sources.map((relSourcePath: string) => { + const sourcePath = path.normalize( + path.join(path.dirname(file), relSourcePath) + ); + const relPath = path.relative(rootDir, sourcePath); + // Disallow reading paths outside rootDir. + if (relPath.startsWith('../')) { + throw new Error(`Bad path: ${sourcePath}`); + } + return fs.promises.readFile(sourcePath, 'utf8'); + }) + ); + ++rewriteCount; + return fs.promises.writeFile(file, JSON.stringify(map)); + } + }) + ).then( + () => { + console.log( + `Rewrote ${rewriteCount} source maps in ${Date.now() - startTime}ms` ); - ++rewriteCount; - return fs.promises.writeFile(file, JSON.stringify(map)); + }, + (error) => { + console.error(error); + process.exit(-1); } - })).then(() => { - console.log(`Rewrote ${ - rewriteCount - } source maps in ${ - Date.now() - startTime - }ms`); - }, error => { - console.error(error); - process.exit(-1); - }); + ); }); diff --git a/config/rollup.config.js b/config/rollup.config.js index 081c430d278..c1d90e2277f 100644 --- a/config/rollup.config.js +++ b/config/rollup.config.js @@ -1,5 +1,5 @@ import path, { resolve, dirname } from 'path'; -import { promises as fs } from "fs"; +import { promises as fs } from 'fs'; import nodeResolve from '@rollup/plugin-node-resolve'; import { terser as minify } from 'rollup-plugin-terser'; @@ -8,31 +8,25 @@ const entryPoints = require('./entryPoints'); const distDir = './dist'; function isExternal(id, parentId, entryPointsAreExternal = true) { - let posixId = toPosixPath(id) + let posixId = toPosixPath(id); const posixParentId = toPosixPath(parentId); // Rollup v2.26.8 started passing absolute id strings to this function, thanks // apparently to https://github.com/rollup/rollup/pull/3753, so we relativize // the id again in those cases. if (path.isAbsolute(id)) { - posixId = path.posix.relative( - path.posix.dirname(posixParentId), - posixId, - ); - if (!posixId.startsWith(".")) { - posixId = "./" + posixId; + posixId = path.posix.relative(path.posix.dirname(posixParentId), posixId); + if (!posixId.startsWith('.')) { + posixId = './' + posixId; } } - const isRelative = - posixId.startsWith("./") || - posixId.startsWith("../"); + const isRelative = posixId.startsWith('./') || posixId.startsWith('../'); if (!isRelative) { return true; } - if (entryPointsAreExternal && - entryPoints.check(posixId, posixParentId)) { + if (entryPointsAreExternal && entryPoints.check(posixId, posixParentId)) { return true; } @@ -69,9 +63,7 @@ function prepareCJS(input, output) { exports: 'named', externalLiveBindings: false, }, - plugins: [ - nodeResolve(), - ], + plugins: [nodeResolve()], }; } @@ -127,30 +119,30 @@ function prepareBundle({ } function removeIndex(filename) { if (filename.endsWith(`${path.sep}index.js`)) { - return filename.slice(0, -`${path.sep}index.js`.length) + return filename.slice(0, -`${path.sep}index.js`.length); } - return filename + return filename; } - const external = isExternal(id, parentId, true) + const external = isExternal(id, parentId, true); if (external) { - if (id.startsWith(".")) { - return { id: removeIndex(resolve(dirname(parentId), id)), external: true }; + if (id.startsWith('.')) { + return { + id: removeIndex(resolve(dirname(parentId), id)), + external: true, + }; } return { id: removeIndex(id), external: true }; } return null; - } + }, }, extensions ? nodeResolve({ extensions }) : nodeResolve(), { - name: "copy *.cjs to *.cjs.native.js", + name: 'copy *.cjs to *.cjs.native.js', async writeBundle({ file }) { const buffer = await fs.readFile(file); - await fs.writeFile( - file + ".native.js", - buffer, - ); + await fs.writeFile(file + '.native.js', buffer); }, }, ], @@ -160,11 +152,6 @@ function prepareBundle({ export default [ ...entryPoints.map(prepareBundle), // Convert the ESM entry point to a single CJS bundle. - prepareCJS( - './dist/index.js', - './dist/apollo-client.cjs', - ), - prepareCJSMinified( - './dist/apollo-client.cjs', - ), + prepareCJS('./dist/index.js', './dist/apollo-client.cjs'), + prepareCJSMinified('./dist/apollo-client.cjs'), ]; diff --git a/config/tsconfig.json b/config/tsconfig.json index d8975964558..39e1fe94587 100644 --- a/config/tsconfig.json +++ b/config/tsconfig.json @@ -20,6 +20,6 @@ // respect this option unless the source maps are inlined into the // source files, which we definitely do not want. Instead, we use the // config/rewriteSourceMaps.ts script to add sourcesContent. - "inlineSources": true, - }, + "inlineSources": true + } } diff --git a/config/version.js b/config/version.js index 0abf54fe5c9..e61a0abf441 100644 --- a/config/version.js +++ b/config/version.js @@ -1,25 +1,27 @@ -const assert = require("assert"); -const fs = require("fs"); -const path = require("path"); -const distRoot = path.join(__dirname, "..", "dist"); -const versionPath = path.join(distRoot, "version.js"); -const pkgJsonPath = path.join(__dirname, "..", "package.json"); +const assert = require('assert'); +const fs = require('fs'); +const path = require('path'); +const distRoot = path.join(__dirname, '..', 'dist'); +const versionPath = path.join(distRoot, 'version.js'); +const pkgJsonPath = path.join(__dirname, '..', 'package.json'); const { version } = JSON.parse(fs.readFileSync(pkgJsonPath)); assert.strictEqual( - typeof version, "string", - '"version" field missing from package.json', + typeof version, + 'string', + '"version" field missing from package.json' ); switch (process.argv[2]) { - case "update": { + case 'update': { const updated = fs - .readFileSync(versionPath, "utf8") + .readFileSync(versionPath, 'utf8') .replace(/\blocal\b/, version); assert.notEqual( - updated.indexOf(version), -1, - "Failed to update dist/version.js with @apollo/client version", + updated.indexOf(version), + -1, + 'Failed to update dist/version.js with @apollo/client version' ); fs.writeFileSync(versionPath, updated); @@ -27,16 +29,17 @@ switch (process.argv[2]) { break; } - case "verify": { - const { - ApolloClient, - InMemoryCache, - } = require(path.join(distRoot, "core", "core.cjs")); + case 'verify': { + const { ApolloClient, InMemoryCache } = require(path.join( + distRoot, + 'core', + 'core.cjs' + )); // Though this may seem like overkill, verifying that ApolloClient is // constructible in Node.js is actually pretty useful, too! const client = new ApolloClient({ - cache: new InMemoryCache, + cache: new InMemoryCache(), }); // Probably not necessary, but it seems wise to clean up any resources @@ -50,17 +53,16 @@ switch (process.argv[2]) { // convenient because dist/version.js uses ECMAScript module syntax, and is // thus not importable in all versions of Node.js. assert.strictEqual( - client.version, version, - "Failed to update dist/version.js and dist/core/core.cjs", + client.version, + version, + 'Failed to update dist/version.js and dist/core/core.cjs' ); break; } default: - throw new Error( - "Pass either 'update' or 'verify' to config/version.js" - ); + throw new Error("Pass either 'update' or 'verify' to config/version.js"); } -console.log("ok"); +console.log('ok');