From 83e33852c58f9f34d3f7ae32d0e216270f3bd498 Mon Sep 17 00:00:00 2001 From: Lloyd Brookes Date: Fri, 3 Sep 2021 22:31:23 +0100 Subject: [PATCH] Rename all filename extensions from .mjs to .js --- README.md | 4 ++-- bin/{cli.mjs => cli.js} | 2 +- .../{index-replace.mjs => index-replace.js} | 2 +- ...result-iterator.mjs => result-iterator.js} | 2 +- ...ind-replace.mjs => simple-find-replace.js} | 0 example/chain/{prefix.mjs => prefix.js} | 0 example/chain/{suffix.mjs => suffix.js} | 0 example/{make-sandbox.mjs => make-sandbox.js} | 2 +- .../view/{custom-view.mjs => custom-view.js} | 0 .../{minimal-view.mjs => minimal-view.js} | 0 index.mjs => index.js | 6 +++--- .../{find-replace.mjs => find-replace.js} | 0 .../{index-replace.mjs => index-replace.js} | 0 lib/{cli-app.mjs => cli-app.js} | 16 +++++++-------- lib/{cli-options.mjs => cli-options.js} | 4 ++-- lib/{rename-file.mjs => rename-file.js} | 2 +- lib/{replace-chain.mjs => replace-chain.js} | 6 +++--- lib/{util.mjs => util.js} | 7 +++---- lib/view/{default.mjs => default.js} | 0 lib/view/{diff.mjs => diff.js} | 2 +- lib/view/{long.mjs => long.js} | 2 +- lib/view/{one-line.mjs => one-line.js} | 2 +- package.json | 9 +++++---- test/{api-bad-input.mjs => api-bad-input.js} | 2 +- ...i-find-replace.mjs => api-find-replace.js} | 2 +- ...plugin-custom.mjs => api-plugin-custom.js} | 2 +- ...i-plugin-index.mjs => api-plugin-index.js} | 2 +- test/{cli-bad-input.mjs => cli-bad-input.js} | 8 ++++---- test/{cli.mjs => cli.js} | 20 +++++++++---------- .../{rename-file.mjs => rename-file.js} | 4 ++-- .../{replace-chain.mjs => replace-chain.js} | 6 +++--- .../{util-win32.mjs => util-win32.js} | 2 +- test/internals/{util.mjs => util.js} | 2 +- test/lib/{broken-view.mjs => broken-view.js} | 0 .../lib/{dummy-plugin.mjs => dummy-plugin.js} | 0 test/lib/{dummy-view.mjs => dummy-view.js} | 0 test/lib/{util.mjs => util.js} | 0 37 files changed, 59 insertions(+), 59 deletions(-) rename bin/{cli.mjs => cli.js} (66%) rename example/api/{index-replace.mjs => index-replace.js} (84%) rename example/api/{result-iterator.mjs => result-iterator.js} (85%) rename example/api/{simple-find-replace.mjs => simple-find-replace.js} (100%) rename example/chain/{prefix.mjs => prefix.js} (100%) rename example/chain/{suffix.mjs => suffix.js} (100%) rename example/{make-sandbox.mjs => make-sandbox.js} (97%) rename example/view/{custom-view.mjs => custom-view.js} (100%) rename example/view/{minimal-view.mjs => minimal-view.js} (100%) rename index.mjs => index.js (96%) rename lib/chain/{find-replace.mjs => find-replace.js} (100%) rename lib/chain/{index-replace.mjs => index-replace.js} (100%) rename lib/{cli-app.mjs => cli-app.js} (93%) rename lib/{cli-options.mjs => cli-options.js} (94%) rename lib/{rename-file.mjs => rename-file.js} (95%) rename lib/{replace-chain.mjs => replace-chain.js} (85%) rename lib/{util.mjs => util.js} (94%) rename lib/view/{default.mjs => default.js} (100%) rename lib/view/{diff.mjs => diff.js} (97%) rename lib/view/{long.mjs => long.js} (95%) rename lib/view/{one-line.mjs => one-line.js} (93%) rename test/{api-bad-input.mjs => api-bad-input.js} (98%) rename test/{api-find-replace.mjs => api-find-replace.js} (99%) rename test/{api-plugin-custom.mjs => api-plugin-custom.js} (98%) rename test/{api-plugin-index.mjs => api-plugin-index.js} (99%) rename test/{cli-bad-input.mjs => cli-bad-input.js} (90%) rename test/{cli.mjs => cli.js} (93%) rename test/internals/{rename-file.mjs => rename-file.js} (92%) rename test/internals/{replace-chain.mjs => replace-chain.js} (96%) rename test/internals/{util-win32.mjs => util-win32.js} (92%) rename test/internals/{util.mjs => util.js} (92%) rename test/lib/{broken-view.mjs => broken-view.js} (100%) rename test/lib/{dummy-plugin.mjs => dummy-plugin.js} (100%) rename test/lib/{dummy-view.mjs => dummy-view.js} (100%) rename test/lib/{util.mjs => util.js} (100%) diff --git a/README.md b/README.md index ded748d..d546d0b 100644 --- a/README.md +++ b/README.md @@ -87,10 +87,10 @@ class Suffix { export default Suffix ``` -Save the above as `suffix.mjs` then process all files in the current directory using the above plugin as the replace chain. +Save the above as `suffix.js` then process all files in the current directory using the above plugin as the replace chain. ``` -$ renamer --dry-run --chain suffix.mjs * +$ renamer --dry-run --chain suffix.js * Dry run diff --git a/bin/cli.mjs b/bin/cli.js similarity index 66% rename from bin/cli.mjs rename to bin/cli.js index 1c4d6c1..74509e1 100755 --- a/bin/cli.mjs +++ b/bin/cli.js @@ -1,5 +1,5 @@ #!/usr/bin/env node -import CliApp from '../lib/cli-app.mjs' +import CliApp from '../lib/cli-app.js' const cliApp = new CliApp() diff --git a/example/api/index-replace.mjs b/example/api/index-replace.js similarity index 84% rename from example/api/index-replace.mjs rename to example/api/index-replace.js index c4fbccc..9e2e0a6 100644 --- a/example/api/index-replace.mjs +++ b/example/api/index-replace.js @@ -1,4 +1,4 @@ -import Renamer from '../../index.mjs' +import Renamer from '../../index.js' const renamer = new Renamer() const results = await renamer.rename({ diff --git a/example/api/result-iterator.mjs b/example/api/result-iterator.js similarity index 85% rename from example/api/result-iterator.mjs rename to example/api/result-iterator.js index b26c96d..52401b7 100644 --- a/example/api/result-iterator.mjs +++ b/example/api/result-iterator.js @@ -1,4 +1,4 @@ -import Renamer from '../../index.mjs' +import Renamer from '../../index.js' const renamer = new Renamer() const options = { diff --git a/example/api/simple-find-replace.mjs b/example/api/simple-find-replace.js similarity index 100% rename from example/api/simple-find-replace.mjs rename to example/api/simple-find-replace.js diff --git a/example/chain/prefix.mjs b/example/chain/prefix.js similarity index 100% rename from example/chain/prefix.mjs rename to example/chain/prefix.js diff --git a/example/chain/suffix.mjs b/example/chain/suffix.js similarity index 100% rename from example/chain/suffix.mjs rename to example/chain/suffix.js diff --git a/example/make-sandbox.mjs b/example/make-sandbox.js similarity index 97% rename from example/make-sandbox.mjs rename to example/make-sandbox.js index 8942018..c3d2b0a 100755 --- a/example/make-sandbox.mjs +++ b/example/make-sandbox.js @@ -1,7 +1,7 @@ #!/usr/bin/env node import path from 'path' import rimraf from 'rimraf' -import { createFixture } from '../test/lib/util.mjs' +import { createFixture } from '../test/lib/util.js' rimraf.sync('sandbox') diff --git a/example/view/custom-view.mjs b/example/view/custom-view.js similarity index 100% rename from example/view/custom-view.mjs rename to example/view/custom-view.js diff --git a/example/view/minimal-view.mjs b/example/view/minimal-view.js similarity index 100% rename from example/view/minimal-view.mjs rename to example/view/minimal-view.js diff --git a/index.mjs b/index.js similarity index 96% rename from index.mjs rename to index.js index a51e728..c5be4c6 100644 --- a/index.mjs +++ b/index.js @@ -1,7 +1,7 @@ -import renameFile from './lib/rename-file.mjs' -import ReplaceChain from './lib/replace-chain.mjs' +import renameFile from './lib/rename-file.js' +import ReplaceChain from './lib/replace-chain.js' import FileSet from 'file-set' -import { depthFirstCompare } from './lib/util.mjs' +import { depthFirstCompare } from './lib/util.js' /** ∆ Renamer ≈ A tool to rename files and folders in bulk. diff --git a/lib/chain/find-replace.mjs b/lib/chain/find-replace.js similarity index 100% rename from lib/chain/find-replace.mjs rename to lib/chain/find-replace.js diff --git a/lib/chain/index-replace.mjs b/lib/chain/index-replace.js similarity index 100% rename from lib/chain/index-replace.mjs rename to lib/chain/index-replace.js diff --git a/lib/cli-app.mjs b/lib/cli-app.js similarity index 93% rename from lib/cli-app.mjs rename to lib/cli-app.js index dffcbd6..3196b91 100644 --- a/lib/cli-app.mjs +++ b/lib/cli-app.js @@ -1,15 +1,15 @@ -import { optionDefinitions, usageSections } from './cli-options.mjs' +import { optionDefinitions, usageSections } from './cli-options.js' import streamReadAll from 'stream-read-all' import Renamer from 'renamer' -import { regExpBuilder, loadPlugins } from './util.mjs' +import { regExpBuilder, loadPlugins } from './util.js' import commandLineUsage from 'command-line-usage' import commandLineArgs from 'command-line-args' -import FindReplace from './chain/find-replace.mjs' -import IndexReplace from './chain/index-replace.mjs' -import DefaultView from './view/default.mjs' -import LongView from './view/long.mjs' -import DiffView from './view/diff.mjs' -import OneLineView from './view/one-line.mjs' +import FindReplace from './chain/find-replace.js' +import IndexReplace from './chain/index-replace.js' +import DefaultView from './view/default.js' +import LongView from './view/long.js' +import DiffView from './view/diff.js' +import OneLineView from './view/one-line.js' import { isString } from 'typical' import { loadModule } from 'load-module' diff --git a/lib/cli-options.mjs b/lib/cli-options.js similarity index 94% rename from lib/cli-options.mjs rename to lib/cli-options.js index ba7f686..f66c100 100755 --- a/lib/cli-options.mjs +++ b/lib/cli-options.js @@ -28,8 +28,8 @@ const optionDefinitions = [ type: String, alias: 'c', /* - Must be lazyMultiple else this command would parse all mjs files as chain plugins. - renamer --chain index-replace.mjs --chain ./test/lib/dummy-plugin.mjs *.mjs -d + Must be lazyMultiple else this command would parse all js files as chain plugins. + renamer --chain index-replace.js --chain ./test/lib/dummy-plugin.js *.js -d */ lazyMultiple: true, description: 'One or more replace chain plugins to use, set the `--chain` option multiple times to build a chain. For each value, supply either: a) a path to a plugin file b) a path to an installed plugin package or c) the name of a built-in plugin, either `find-replace` or `index-replace`. The default plugin chain is `find-replace` then `index-replace`.', diff --git a/lib/rename-file.mjs b/lib/rename-file.js similarity index 95% rename from lib/rename-file.mjs rename to lib/rename-file.js index 4b99bbf..b36cd2e 100644 --- a/lib/rename-file.mjs +++ b/lib/rename-file.js @@ -1,5 +1,5 @@ import { promises as fs } from 'fs' -import { isFileAccessible } from './util.mjs' +import { isFileAccessible } from './util.js' const dryRunLog = {} diff --git a/lib/replace-chain.mjs b/lib/replace-chain.js similarity index 85% rename from lib/replace-chain.mjs rename to lib/replace-chain.js index f419f2e..fa2f275 100644 --- a/lib/replace-chain.mjs +++ b/lib/replace-chain.js @@ -1,8 +1,8 @@ -import { loadPlugins } from './util.mjs' +import { loadPlugins } from './util.js' import arrayify from 'array-back' import path from 'path' -import FindReplace from './chain/find-replace.mjs' -import IndexReplace from './chain/index-replace.mjs' +import FindReplace from './chain/find-replace.js' +import IndexReplace from './chain/index-replace.js' class ReplaceChain { async loadPlugins (pluginNames) { diff --git a/lib/util.mjs b/lib/util.js similarity index 94% rename from lib/util.mjs rename to lib/util.js index 6f02b3e..a798475 100644 --- a/lib/util.mjs +++ b/lib/util.js @@ -1,11 +1,10 @@ -import { promises as fs } from 'fs' -import { constants } from 'fs' +import { promises as fs, constants } from 'fs' import path from 'path' import arrayify from 'array-back' import { isClass } from 'typical' import { loadModuleResolvedFrom, loadModuleRelativeTo } from 'load-module' -import FindReplace from './chain/find-replace.mjs' -import IndexReplace from './chain/index-replace.mjs' +import FindReplace from './chain/find-replace.js' +import IndexReplace from './chain/index-replace.js' import getModulePaths from 'current-module-paths' import * as globalDirs from 'global-dirs' const __dirname = getModulePaths(import.meta.url).__dirname diff --git a/lib/view/default.mjs b/lib/view/default.js similarity index 100% rename from lib/view/default.mjs rename to lib/view/default.js diff --git a/lib/view/diff.mjs b/lib/view/diff.js similarity index 97% rename from lib/view/diff.mjs rename to lib/view/diff.js index 04a9de6..d8e8d54 100644 --- a/lib/view/diff.mjs +++ b/lib/view/diff.js @@ -1,5 +1,5 @@ import chalk from 'chalk' -import DefaultView from './default.mjs' +import DefaultView from './default.js' import fastDiff from 'fast-diff' class DiffView extends DefaultView { diff --git a/lib/view/long.mjs b/lib/view/long.js similarity index 95% rename from lib/view/long.mjs rename to lib/view/long.js index 69379e1..5e77638 100644 --- a/lib/view/long.mjs +++ b/lib/view/long.js @@ -1,5 +1,5 @@ import chalk from 'chalk' -import DefaultView from './default.mjs' +import DefaultView from './default.js' class LongView extends DefaultView { logResult (result, options = {}) { diff --git a/lib/view/one-line.mjs b/lib/view/one-line.js similarity index 93% rename from lib/view/one-line.mjs rename to lib/view/one-line.js index 04df870..e1d88a8 100644 --- a/lib/view/one-line.mjs +++ b/lib/view/one-line.js @@ -1,5 +1,5 @@ import chalk from 'chalk' -import DefaultView from './default.mjs' +import DefaultView from './default.js' class OneLineView extends DefaultView { logComplete (stats, options) { diff --git a/package.json b/package.json index 0d1111d..707875a 100644 --- a/package.json +++ b/package.json @@ -4,16 +4,17 @@ "version": "3.2.1", "author": "Lloyd Brookes <75pound@gmail.com>", "bin": { - "renamer": "bin/cli.mjs" + "renamer": "bin/cli.js" }, "license": "MIT", - "exports": "./index.mjs", + "type": "module", + "exports": "./index.js", "engines": { "node": ">=12.17" }, "repository": "https://github.com/75lb/renamer", "files": [ - "index.mjs", + "index.js", "bin", "lib" ], @@ -27,7 +28,7 @@ "batch" ], "scripts": { - "test": "test-runner test/*.mjs test/internals/*.mjs", + "test": "test-runner test/*.js test/internals/*.js", "cover": "c8 npm test && c8 report --reporter=text-lcov | coveralls" }, "dependencies": { diff --git a/test/api-bad-input.mjs b/test/api-bad-input.js similarity index 98% rename from test/api-bad-input.mjs rename to test/api-bad-input.js index 3c1161d..9980d6a 100644 --- a/test/api-bad-input.mjs +++ b/test/api-bad-input.js @@ -1,6 +1,6 @@ import Renamer from 'renamer' import assert from 'assert' -import { createFixture } from './lib/util.mjs' +import { createFixture } from './lib/util.js' import rimraf from 'rimraf' import fs from 'fs' import path from 'path' diff --git a/test/api-find-replace.mjs b/test/api-find-replace.js similarity index 99% rename from test/api-find-replace.mjs rename to test/api-find-replace.js index 259d32d..4d3bae7 100644 --- a/test/api-find-replace.mjs +++ b/test/api-find-replace.js @@ -1,6 +1,6 @@ import Renamer from 'renamer' import assert from 'assert' -import { createFixture } from './lib/util.mjs' +import { createFixture } from './lib/util.js' import rimraf from 'rimraf' import fs from 'fs' import path from 'path' diff --git a/test/api-plugin-custom.mjs b/test/api-plugin-custom.js similarity index 98% rename from test/api-plugin-custom.mjs rename to test/api-plugin-custom.js index ea24d76..9012989 100644 --- a/test/api-plugin-custom.mjs +++ b/test/api-plugin-custom.js @@ -1,6 +1,6 @@ import Renamer from 'renamer' import assert from 'assert' -import { createFixture } from './lib/util.mjs' +import { createFixture } from './lib/util.js' import rimraf from 'rimraf' import fs from 'fs' import path from 'path' diff --git a/test/api-plugin-index.mjs b/test/api-plugin-index.js similarity index 99% rename from test/api-plugin-index.mjs rename to test/api-plugin-index.js index 439ea7f..097f647 100644 --- a/test/api-plugin-index.mjs +++ b/test/api-plugin-index.js @@ -1,6 +1,6 @@ import Renamer from 'renamer' import assert from 'assert' -import { createFixture } from './lib/util.mjs' +import { createFixture } from './lib/util.js' import rimraf from 'rimraf' import fs from 'fs' import path from 'path' diff --git a/test/cli-bad-input.mjs b/test/cli-bad-input.js similarity index 90% rename from test/cli-bad-input.mjs rename to test/cli-bad-input.js index 67ad3bf..f6f20ac 100644 --- a/test/cli-bad-input.mjs +++ b/test/cli-bad-input.js @@ -1,11 +1,11 @@ -import CliApp from '../lib/cli-app.mjs' +import CliApp from '../lib/cli-app.js' import assert from 'assert' -import { createFixture } from './lib/util.mjs' +import { createFixture } from './lib/util.js' import rimraf from 'rimraf' import fs from 'fs' import path from 'path' import TestRunner from 'test-runner' -import DefaultView from '../lib/view/default.mjs' +import DefaultView from '../lib/view/default.js' const a = assert.strict const tom = new TestRunner.Tom() @@ -52,7 +52,7 @@ tom.test('--view: broken plugin', async function () { const view = new TestView() const cliApp = new CliApp({ view }) a.deepEqual(fs.existsSync(fixturePath), true) - await cliApp.start({ argv: ['-s', '--find', 'one', '--replace', 'yeah', fixturePath, '--view', './test/lib/broken-view.mjs'] }) + await cliApp.start({ argv: ['-s', '--find', 'one', '--replace', 'yeah', fixturePath, '--view', './test/lib/broken-view.js'] }) a.equal(cliApp.view.constructor.name, 'TestView') a.ok(/View must define a `write` method/.test(view.logs[0][0])) a.equal(process.exitCode, 1) diff --git a/test/cli.mjs b/test/cli.js similarity index 93% rename from test/cli.mjs rename to test/cli.js index fac2fe4..216eab7 100644 --- a/test/cli.mjs +++ b/test/cli.js @@ -1,13 +1,13 @@ -import CliApp from '../lib/cli-app.mjs' +import CliApp from '../lib/cli-app.js' import assert from 'assert' -import { createFixture } from './lib/util.mjs' +import { createFixture } from './lib/util.js' import rimraf from 'rimraf' import fs from 'fs' import path from 'path' import TestRunner from 'test-runner' import { spawn } from 'child_process' -import DefaultView from '../lib/view/default.mjs' -import DiffView from '../lib/view/diff.mjs' +import DefaultView from '../lib/view/default.js' +import DiffView from '../lib/view/diff.js' const a = assert.strict const tom = new TestRunner.Tom({ maxConcurrency: 1 }) @@ -50,9 +50,9 @@ tom.test('simple, dry run', async function () { tom.test('simple, using bin', async function () { const fixturePath = createFixture(`${testRoot}/${this.index}/one`) const origArgv = process.argv - process.argv = ['node', 'test.mjs', '-s', '--find', 'one', '--replace', 'yeah', fixturePath] + process.argv = ['node', 'test.js', '-s', '--find', 'one', '--replace', 'yeah', fixturePath] a.deepEqual(fs.existsSync(fixturePath), true) - const mod = await import('../bin/cli.mjs') // prints '✔︎ tmp/cli.js/3/one → tmp/cli.js/3/yeah' + const mod = await import('../bin/cli.js') // prints '✔︎ tmp/cli.js/3/one → tmp/cli.js/3/yeah' await mod.default process.argv = origArgv a.deepEqual(fs.existsSync(fixturePath), false) @@ -97,7 +97,7 @@ tom.test('simple regexp, insensitive', async function () { tom.test('input file list on stdin', async function () { const fixturePath = createFixture(`${testRoot}/${this.index}/one`) - const renamer = spawn('node', [path.join('bin', 'cli.mjs'), '-f', 'one', '-r', 'two', '-s']) + const renamer = spawn('node', [path.join('bin', 'cli.js'), '-f', 'one', '-r', 'two', '-s']) return new Promise((resolve, reject) => { renamer.on('close', () => { a.deepEqual(fs.existsSync(`${testRoot}/${this.index}/one`), false) @@ -211,7 +211,7 @@ tom.test('--view: load plugin', async function () { const fixturePath = createFixture(`${testRoot}/${this.index}/one`) const cliApp = new CliApp() a.deepEqual(fs.existsSync(fixturePath), true) - await cliApp.start({ argv: ['-s', '--find', 'one', '--replace', 'yeah', fixturePath, '--view', './test/lib/dummy-view.mjs'] }) + await cliApp.start({ argv: ['-s', '--find', 'one', '--replace', 'yeah', fixturePath, '--view', './test/lib/dummy-view.js'] }) a.equal(cliApp.view.constructor.name, 'DummyView') a.deepEqual(fs.existsSync(fixturePath), false) a.deepEqual(fs.existsSync(`${testRoot}/${this.index}/yeah`), true) @@ -230,7 +230,7 @@ tom.test('--chain built-in', async function () { const fixturePath = createFixture(`${testRoot}/${this.index}/one`) const cliApp = new CliApp() a.deepEqual(fs.existsSync(fixturePath), true) - await cliApp.start({ argv: ['-s', '--chain', 'find-replace.mjs', '--find', 'one', '--replace', 'yeah', fixturePath] }) + await cliApp.start({ argv: ['-s', '--chain', 'find-replace.js', '--find', 'one', '--replace', 'yeah', fixturePath] }) a.deepEqual(fs.existsSync(fixturePath), false) a.deepEqual(fs.existsSync(`${testRoot}/${this.index}/yeah`), true) }) @@ -238,7 +238,7 @@ tom.test('--chain built-in', async function () { tom.test('--chain built-in local --help', async function () { const cliApp = new CliApp({ view: new TestView() }) await cliApp.start({ - argv: ['--chain', 'find-replace.mjs', '--chain', './test/lib/dummy-plugin.mjs', '--help'] + argv: ['--chain', 'find-replace.js', '--chain', './test/lib/dummy-plugin.js', '--help'] }) a.ok(/FindReplace/.test(cliApp.view.logs[0][0])) a.ok(/DummyPlugin/.test(cliApp.view.logs[0][0])) diff --git a/test/internals/rename-file.mjs b/test/internals/rename-file.js similarity index 92% rename from test/internals/rename-file.mjs rename to test/internals/rename-file.js index 9ea67cb..63aa9d8 100644 --- a/test/internals/rename-file.mjs +++ b/test/internals/rename-file.js @@ -1,7 +1,7 @@ -import renameFile from '../../lib/rename-file.mjs' +import renameFile from '../../lib/rename-file.js' import assert from 'assert' import fs from 'fs' -import { createFixture } from '../lib/util.mjs' +import { createFixture } from '../lib/util.js' import rimraf from 'rimraf' import TestRunner from 'test-runner' const a = assert.strict diff --git a/test/internals/replace-chain.mjs b/test/internals/replace-chain.js similarity index 96% rename from test/internals/replace-chain.mjs rename to test/internals/replace-chain.js index 145fb02..06ea760 100644 --- a/test/internals/replace-chain.mjs +++ b/test/internals/replace-chain.js @@ -1,4 +1,4 @@ -import ReplaceChain from '../../lib/replace-chain.mjs' +import ReplaceChain from '../../lib/replace-chain.js' import assert from 'assert' import path from 'path' import TestRunner from 'test-runner' @@ -134,7 +134,7 @@ tom.test('custom plugins plus a built-in', async function () { } const file = 'a-one-two' const chain = new ReplaceChain() - await chain.loadPlugins(['find-replace.mjs', PluginOne, PluginTwo]) + await chain.loadPlugins(['find-replace.js', PluginOne, PluginTwo]) const result = chain.replace(file, { find: 'a', replace: 'b' }, 0, ['a-one-two']) a.deepEqual(result.from, file) a.deepEqual(result.to, 'b-{{one}}-2') @@ -148,7 +148,7 @@ tom.test('custom plugins plus a relative local path plugin', async function () { } } const chain = new ReplaceChain() - await chain.loadPlugins(['test/lib/dummy-plugin.mjs', PluginOne]) + await chain.loadPlugins(['test/lib/dummy-plugin.js', PluginOne]) const result = chain.replace('start', {}, 0, []) a.deepEqual(result.from, 'start') a.deepEqual(result.to, 'file: start, bindex: 0, file count: 0') diff --git a/test/internals/util-win32.mjs b/test/internals/util-win32.js similarity index 92% rename from test/internals/util-win32.mjs rename to test/internals/util-win32.js index 842a2b1..2882465 100644 --- a/test/internals/util-win32.mjs +++ b/test/internals/util-win32.js @@ -1,4 +1,4 @@ -import { depthFirstCompare } from '../../lib/util.mjs' +import { depthFirstCompare } from '../../lib/util.js' import assert from 'assert' import os from 'os' import TestRunner from 'test-runner' diff --git a/test/internals/util.mjs b/test/internals/util.js similarity index 92% rename from test/internals/util.mjs rename to test/internals/util.js index a7cedd2..b53c339 100644 --- a/test/internals/util.mjs +++ b/test/internals/util.js @@ -1,4 +1,4 @@ -import { depthFirstCompare } from '../../lib/util.mjs' +import { depthFirstCompare } from '../../lib/util.js' import assert from 'assert' import rimraf from 'rimraf' import TestRunner from 'test-runner' diff --git a/test/lib/broken-view.mjs b/test/lib/broken-view.js similarity index 100% rename from test/lib/broken-view.mjs rename to test/lib/broken-view.js diff --git a/test/lib/dummy-plugin.mjs b/test/lib/dummy-plugin.js similarity index 100% rename from test/lib/dummy-plugin.mjs rename to test/lib/dummy-plugin.js diff --git a/test/lib/dummy-view.mjs b/test/lib/dummy-view.js similarity index 100% rename from test/lib/dummy-view.mjs rename to test/lib/dummy-view.js diff --git a/test/lib/util.mjs b/test/lib/util.js similarity index 100% rename from test/lib/util.mjs rename to test/lib/util.js