diff --git a/bin/release-it.js b/bin/release-it.js index 445b86a7..307021a2 100755 --- a/bin/release-it.js +++ b/bin/release-it.js @@ -3,7 +3,7 @@ import updater from 'update-notifier'; import parseArgs from 'yargs-parser'; import release from '../lib/index.js'; -import { readJSON } from '../lib/util'; +import { readJSON } from '../lib/util.js'; const pkg = readJSON('../package.json'); diff --git a/lib/cli.js b/lib/cli.js index 7e3f3b3c..1ddce05f 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -1,5 +1,5 @@ -import { readJSON } from '../lib/util'; -import Log from './log'; +import { readJSON } from '../lib/util.js'; +import Log from './log.js'; const pkg = readJSON('../package.json'); diff --git a/lib/config.js b/lib/config.js index 0c6057f4..29de6e51 100644 --- a/lib/config.js +++ b/lib/config.js @@ -1,11 +1,11 @@ import { cosmiconfigSync } from 'cosmiconfig'; import parseJson from 'parse-json'; -import parseToml from '@iarna/toml/parse-string'; +import parseToml from '@iarna/toml/parse-string.js'; import yaml from 'yaml'; import _ from 'lodash'; import isCI from 'is-ci'; import _debug from 'debug'; -import { readJSON, getSystemInfo } from './util'; +import { readJSON, getSystemInfo } from './util.js'; const debug = _debug('release-it:config'); const defaultConfig = readJSON('../config/release-it.json'); diff --git a/lib/deprecated.js b/lib/deprecated.js index 93b6e584..096d72bd 100644 --- a/lib/deprecated.js +++ b/lib/deprecated.js @@ -1,6 +1,6 @@ import Deprecated from 'deprecated-obj'; -import { readJSON } from './util'; -import Log from './log'; +import { readJSON } from './util.js'; +import Log from './log.js'; const deprecated = readJSON('../config/deprecated.json'); diff --git a/lib/index.js b/lib/index.js index 33a195ab..12a37ac2 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,6 +1,6 @@ -import { version, help } from './cli'; -import runTasks from './tasks'; -import Plugin from './plugin/Plugin'; +import { version, help } from './cli.js'; +import runTasks from './tasks.js'; +import Plugin from './plugin/Plugin.js'; export default async options => { if (options.version) { diff --git a/lib/metrics.js b/lib/metrics.js index 1b5f168a..f5866f32 100644 --- a/lib/metrics.js +++ b/lib/metrics.js @@ -4,7 +4,7 @@ import { v4 as uuidv4 } from 'uuid'; import osName from 'os-name'; import isCi from 'is-ci'; import _debug from 'debug'; -import { readJSON } from './util'; +import { readJSON } from './util.js'; const debug = _debug('release-it:metrics'); const pkg = readJSON('../package.json'); diff --git a/lib/plugin/GitBase.js b/lib/plugin/GitBase.js index 7260cf2e..88656079 100644 --- a/lib/plugin/GitBase.js +++ b/lib/plugin/GitBase.js @@ -1,6 +1,6 @@ import { EOL } from 'os'; -import { format, parseGitUrl } from '../util'; -import Plugin from './Plugin'; +import { format, parseGitUrl } from '../util.js'; +import Plugin from './Plugin.js'; const options = { write: false }; const changelogFallback = 'git log --pretty=format:"* %s (%h)"'; diff --git a/lib/plugin/GitRelease.js b/lib/plugin/GitRelease.js index bc548a18..8aaef1f6 100644 --- a/lib/plugin/GitRelease.js +++ b/lib/plugin/GitRelease.js @@ -1,6 +1,6 @@ import _ from 'lodash'; -import { readJSON } from '../util'; -import GitBase from './GitBase'; +import { readJSON } from '../util.js'; +import GitBase from './GitBase.js'; const defaultConfig = readJSON('../../config.release-it.json'); diff --git a/lib/plugin/factory.js b/lib/plugin/factory.js index 9261c632..c69c2d81 100644 --- a/lib/plugin/factory.js +++ b/lib/plugin/factory.js @@ -2,11 +2,11 @@ import path from 'path'; import _ from 'lodash'; import requireCwd from 'import-cwd'; import _debug from 'debug'; -import Version from './version/Version'; -import Git from './git/Git'; -import GitLab from './gitlab/GitLab'; -import GitHub from './github/GitHub'; -import npm from './npm/npm'; +import Version from './version/Version.js'; +import Git from './git/Git.js'; +import GitLab from './gitlab/GitLab.js'; +import GitHub from './github/GitHub.js'; +import npm from './npm/npm.js'; const debug = _debug('release-it:plugins'); diff --git a/lib/plugin/git/Git.js b/lib/plugin/git/Git.js index fee4739a..3f5b312f 100644 --- a/lib/plugin/git/Git.js +++ b/lib/plugin/git/Git.js @@ -1,9 +1,9 @@ import { EOL } from 'os'; import _ from 'lodash'; import findUp from 'find-up'; -import { format, e } from '../../util'; -import GitBase from '../GitBase'; -import prompts from './prompts'; +import { format, e } from '../../util.js'; +import GitBase from '../GitBase.js'; +import prompts from './prompts.js'; const noop = Promise.resolve(); const invalidPushRepoRe = /^\S+@/; diff --git a/lib/plugin/git/prompts.js b/lib/plugin/git/prompts.js index f92911f1..f0288389 100644 --- a/lib/plugin/git/prompts.js +++ b/lib/plugin/git/prompts.js @@ -1,4 +1,4 @@ -import { format, truncateLines } from '../../util'; +import { format, truncateLines } from '../../util.js'; export default { commit: { diff --git a/lib/plugin/github/GitHub.js b/lib/plugin/github/GitHub.js index 94550f09..a21213b3 100644 --- a/lib/plugin/github/GitHub.js +++ b/lib/plugin/github/GitHub.js @@ -5,9 +5,9 @@ import globby from 'globby'; import mime from 'mime-types'; import _ from 'lodash'; import retry from 'async-retry'; -import { format, parseVersion, readJSON, e } from '../../util'; -import Release from '../GitRelease'; -import prompts from './prompts'; +import { format, parseVersion, readJSON, e } from '../../util.js'; +import Release from '../GitRelease.js'; +import prompts from './prompts.js'; const pkg = readJSON('../../../package.json'); diff --git a/lib/plugin/github/prompts.js b/lib/plugin/github/prompts.js index c65cf0fa..5a53620d 100644 --- a/lib/plugin/github/prompts.js +++ b/lib/plugin/github/prompts.js @@ -1,4 +1,4 @@ -import { format } from '../../util'; +import { format } from '../../util.js'; const message = context => { const { isPreRelease, isUpdate, github } = context; diff --git a/lib/plugin/gitlab/GitLab.js b/lib/plugin/gitlab/GitLab.js index 9a5fe712..a7e2f140 100644 --- a/lib/plugin/gitlab/GitLab.js +++ b/lib/plugin/gitlab/GitLab.js @@ -4,9 +4,9 @@ import got from 'got'; import globby from 'globby'; import FormData from 'form-data'; import _ from 'lodash'; -import Release from '../GitRelease'; -import { format, e } from '../../util'; -import prompts from './prompts'; +import Release from '../GitRelease.js'; +import { format, e } from '../../util.js'; +import prompts from './prompts.js'; const docs = 'https://git.io/release-it-gitlab'; diff --git a/lib/plugin/gitlab/prompts.js b/lib/plugin/gitlab/prompts.js index c65b3d55..c7c10764 100644 --- a/lib/plugin/gitlab/prompts.js +++ b/lib/plugin/gitlab/prompts.js @@ -1,4 +1,4 @@ -import { format } from '../../util'; +import { format } from '../../util.js'; export default { release: { diff --git a/lib/plugin/npm/npm.js b/lib/plugin/npm/npm.js index e57a969a..1dd0f3b3 100644 --- a/lib/plugin/npm/npm.js +++ b/lib/plugin/npm/npm.js @@ -1,9 +1,9 @@ import path from 'path'; import semver from 'semver'; import urlJoin from 'url-join'; -import Plugin from '../Plugin'; -import { hasAccess, rejectAfter, parseVersion, e } from '../../util'; -import prompts from './prompts'; +import Plugin from '../Plugin.js'; +import { hasAccess, rejectAfter, parseVersion, readJSON, e } from '../../util.js'; +import prompts from './prompts.js'; const docs = 'https://git.io/release-it-npm'; diff --git a/lib/plugin/version/Version.js b/lib/plugin/version/Version.js index 3433450c..919cf973 100644 --- a/lib/plugin/version/Version.js +++ b/lib/plugin/version/Version.js @@ -1,6 +1,6 @@ import semver from 'semver'; import chalk from 'chalk'; -import Plugin from '../Plugin'; +import Plugin from '../Plugin.js'; const { green, red, redBright } = chalk; diff --git a/lib/shell.js b/lib/shell.js index 0412f8b9..e8fdf8e4 100644 --- a/lib/shell.js +++ b/lib/shell.js @@ -1,7 +1,7 @@ import sh from 'shelljs'; import execa from 'execa'; import _debug from 'debug'; -import { format } from './util'; +import { format } from './util.js'; const debug = _debug('release-it:shell'); diff --git a/lib/spinner.js b/lib/spinner.js index 1b028096..4f80c645 100644 --- a/lib/spinner.js +++ b/lib/spinner.js @@ -1,5 +1,5 @@ import ora from 'ora'; -import { format } from './util'; +import { format } from './util.js'; const noop = Promise.resolve(); diff --git a/lib/tasks.js b/lib/tasks.js index ab0f3dee..0ac9c688 100644 --- a/lib/tasks.js +++ b/lib/tasks.js @@ -1,13 +1,13 @@ import _ from 'lodash'; -import Factory from './plugin/factory'; -import Logger from './log'; -import Config from './config'; -import Shell from './shell'; -import Prompt from './prompt'; -import Spinner from './spinner'; -import Metrics from './metrics'; -import { reduceUntil, parseVersion } from './util'; -import handleDeprecated from './deprecated'; +import { getPlugins } from './plugin/factory.js'; +import Logger from './log.js'; +import Config from './config.js'; +import Shell from './shell.js'; +import Prompt from './prompt.js'; +import Spinner from './spinner.js'; +import Metrics from './metrics.js'; +import { reduceUntil, parseVersion } from './util.js'; +import handleDeprecated from './deprecated.js'; const runTasks = async (opts, di) => { let container = {}; @@ -54,7 +54,7 @@ const runTasks = async (opts, di) => { if (plugin === _.last(plugins)) await runHook('after', name); }; - const [internal, external] = await Factory.getPlugins(config, container); + const [internal, external] = await getPlugins(config, container); let plugins = [...external, ...internal]; for (const plugin of plugins) { diff --git a/lib/util.js b/lib/util.js index 962576fb..6cf81e7c 100644 --- a/lib/util.js +++ b/lib/util.js @@ -4,7 +4,7 @@ import _ from 'lodash'; import gitUrlParse from 'git-url-parse'; import semver from 'semver'; import osName from 'os-name'; -import Log from './log'; +import Log from './log.js'; const readJSON = async file => JSON.parse(fs.readFileSync(file, 'utf8')); diff --git a/test/cli.js b/test/cli.js index dfe1fa9a..a2a5def0 100644 --- a/test/cli.js +++ b/test/cli.js @@ -1,7 +1,7 @@ import test from 'ava'; import mockStdIo from 'mock-stdio'; -import { version, help } from '../lib/cli'; -import { readJSON } from './util'; +import { version, help } from '../lib/cli.js'; +import { readJSON } from '../lib/util.js'; const pkg = readJSON('../package.json'); diff --git a/test/config.js b/test/config.js index 9764ff8f..4e39d0aa 100644 --- a/test/config.js +++ b/test/config.js @@ -1,7 +1,7 @@ import test from 'ava'; import mock from 'mock-fs'; -import Config from '../lib/config'; -import { readJSON } from './util'; +import Config from '../lib/config.js'; +import { readJSON } from '../lib/util.js'; const defaultConfig = readJSON('../config/release-it.json'); diff --git a/test/deprecated.js b/test/deprecated.js index 6ff8b3a0..7cadbca8 100644 --- a/test/deprecated.js +++ b/test/deprecated.js @@ -1,7 +1,7 @@ import test from 'ava'; import sinon from 'sinon'; -import deprecated from '../lib/deprecated'; -import Log from '../lib/log'; +import deprecated from '../lib/deprecated.js'; +import Log from '../lib/log.js'; test('should show deprecation warnings and return compliant object', t => { const log = sinon.createStubInstance(Log); diff --git a/test/git.init.js b/test/git.init.js index 0edb3761..1fb68369 100644 --- a/test/git.init.js +++ b/test/git.init.js @@ -1,9 +1,9 @@ import test from 'ava'; import sh from 'shelljs'; -import Shell from '../lib/shell'; -import Git from '../lib/plugin/git/Git'; -import { factory, readJSON } from './util'; -import { mkTmpDir, gitAdd } from './util/helpers'; +import Shell from '../lib/shell.js'; +import Git from '../lib/plugin/git/Git.js'; +import { factory, readJSON } from '../lib/util.js'; +import { mkTmpDir, gitAdd } from './util/helpers.js'; const { git } = readJSON('../config/release-it.json'); diff --git a/test/git.js b/test/git.js index 856ed3b2..2325e1b6 100644 --- a/test/git.js +++ b/test/git.js @@ -2,9 +2,9 @@ import { EOL } from 'os'; import test from 'ava'; import sinon from 'sinon'; import sh from 'shelljs'; -import Git from '../lib/plugin/git/Git'; -import { mkTmpDir, readFile, gitAdd } from './util/helpers'; -import { factory } from './util'; +import Git from '../lib/plugin/git/Git.js'; +import { mkTmpDir, readFile, gitAdd } from './util/helpers.js'; +import { factory } from './util.js'; test.beforeEach(() => { const tmp = mkTmpDir(); diff --git a/test/github.js b/test/github.js index 977c6e09..21e3021c 100644 --- a/test/github.js +++ b/test/github.js @@ -1,8 +1,8 @@ import test from 'ava'; import sinon from 'sinon'; import { RequestError } from '@octokit/request-error'; -import GitHub from '../lib/plugin/github/GitHub'; -import { factory, runTasks } from './util'; +import GitHub from '../lib/plugin/github/GitHub.js'; +import { factory, runTasks } from './util.js'; import { interceptAuthentication, interceptCollaborator, diff --git a/test/gitlab.js b/test/gitlab.js index 78a0308f..4a899f73 100644 --- a/test/gitlab.js +++ b/test/gitlab.js @@ -1,7 +1,7 @@ import test from 'ava'; import sinon from 'sinon'; import nock from 'nock'; -import GitLab from '../lib/plugin/gitlab/GitLab'; +import GitLab from '../lib/plugin/gitlab/GitLab.js'; import { interceptUser, interceptCollaborator, @@ -9,7 +9,7 @@ import { interceptPublish, interceptAsset } from './stub/gitlab'; -import { factory, runTasks } from './util'; +import { factory, runTasks } from './util.js'; const tokenHeader = 'Private-Token'; const tokenRef = 'GITLAB_TOKEN'; diff --git a/test/log.js b/test/log.js index 1c6ec23a..b3571dda 100644 --- a/test/log.js +++ b/test/log.js @@ -2,7 +2,7 @@ import { EOL } from 'os'; import test from 'ava'; import mockStdIo from 'mock-stdio'; import stripAnsi from 'strip-ansi'; -import Log from '../lib/log'; +import Log from '../lib/log.js'; test('should write to stdout', t => { const log = new Log(); diff --git a/test/metrics.js b/test/metrics.js index 5a9537f4..17f43281 100644 --- a/test/metrics.js +++ b/test/metrics.js @@ -1,6 +1,6 @@ import test from 'ava'; import sinon from 'sinon'; -import Metrics from '../lib/metrics'; +import Metrics from '../lib/metrics.js'; test('should send metrics', async t => { const stub = sinon.stub().resolves(); diff --git a/test/npm.js b/test/npm.js index e61c2b75..3ba5d8e6 100644 --- a/test/npm.js +++ b/test/npm.js @@ -2,9 +2,9 @@ import path from 'path'; import test from 'ava'; import sinon from 'sinon'; import mock from 'mock-fs'; -import npm from '../lib/plugin/npm/npm'; -import { factory, runTasks } from './util'; -import { getArgs } from './util/helpers'; +import npm from '../lib/plugin/npm/npm.js'; +import { factory, runTasks } from './util.js'; +import { getArgs } from './util/helpers.js'; test('should return npm package url', t => { const options = { npm: { name: 'my-cool-package' } }; diff --git a/test/plugins.js b/test/plugins.js index ff4b52dd..ee82784b 100644 --- a/test/plugins.js +++ b/test/plugins.js @@ -3,12 +3,12 @@ import test from 'ava'; import sh from 'shelljs'; import proxyquire from 'proxyquire'; import sinon from 'sinon'; -import Log from '../lib/log'; -import Spinner from '../lib/spinner'; -import Config from '../lib/config'; -import Plugin from '../lib/plugin/Plugin'; -import { mkTmpDir, gitAdd } from './util/helpers'; -import ShellStub from './stub/shell'; +import Log from '../lib/log.js'; +import Spinner from '../lib/spinner.js'; +import Config from '../lib/config.js'; +import Plugin from '../lib/plugin/Plugin.js'; +import { mkTmpDir, gitAdd } from './util/helpers.js'; +import ShellStub from './stub/shell.js'; const noop = Promise.resolve(); diff --git a/test/prompt.js b/test/prompt.js index 189bd6a0..8c65ed0a 100644 --- a/test/prompt.js +++ b/test/prompt.js @@ -1,12 +1,12 @@ import test from 'ava'; import sinon from 'sinon'; -import Prompt from '../lib/prompt'; -import Config from '../lib/config'; -import git from '../lib/plugin/git/prompts'; -import github from '../lib/plugin/github/prompts'; -import gitlab from '../lib/plugin/gitlab/prompts'; -import npm from '../lib/plugin/npm/prompts'; -import { factory } from './util'; +import Prompt from '../lib/prompt.js'; +import Config from '../lib/config.js'; +import git from '../lib/plugin/git/prompts.js'; +import github from '../lib/plugin/github/prompts.js'; +import gitlab from '../lib/plugin/gitlab/prompts.js'; +import npm from '../lib/plugin/npm/prompts.js'; +import { factory } from './util.js'; const prompts = { git, github, gitlab, npm }; diff --git a/test/shell.js b/test/shell.js index 56dfb260..7b1d00e1 100644 --- a/test/shell.js +++ b/test/shell.js @@ -1,9 +1,9 @@ import test from 'ava'; import sh from 'shelljs'; import sinon from 'sinon'; -import Shell from '../lib/shell'; -import Log from '../lib/log'; -import { factory } from './util'; +import Shell from '../lib/shell.js'; +import Log from '../lib/log.js'; +import { factory } from './util.js'; const { stdout } = sh.exec('pwd'); const cwd = stdout.trim(); diff --git a/test/spinner.js b/test/spinner.js index 0f4c0090..0f460e15 100644 --- a/test/spinner.js +++ b/test/spinner.js @@ -1,7 +1,7 @@ import test from 'ava'; import sinon from 'sinon'; -import Spinner from '../lib/spinner'; -import Config from '../lib/config'; +import Spinner from '../lib/spinner.js'; +import Config from '../lib/config.js'; test.beforeEach(t => { t.context.ora = { diff --git a/test/stub/shell.js b/test/stub/shell.js index 0e4769c3..772165e5 100644 --- a/test/stub/shell.js +++ b/test/stub/shell.js @@ -1,5 +1,5 @@ import _debug from 'debug'; -import Shell from '../../lib/shell'; +import Shell from '../../lib/shell.js'; const debug = _debug('release-it:shell-stub'); diff --git a/test/tasks.interactive.js b/test/tasks.interactive.js index fa812ae3..3dce9e21 100644 --- a/test/tasks.interactive.js +++ b/test/tasks.interactive.js @@ -3,15 +3,15 @@ import test from 'ava'; import sh from 'shelljs'; import _ from 'lodash'; import sinon from 'sinon'; -import Log from '../lib/log'; -import Spinner from '../lib/spinner'; -import Prompt from '../lib/prompt'; -import Config from '../lib/config'; -import runTasks from '../lib/tasks'; -import { mkTmpDir, gitAdd } from './util/helpers'; -import ShellStub from './stub/shell'; -import { interceptPublish as interceptGitLabPublish } from './stub/gitlab'; -import { interceptCreate as interceptGitHubCreate } from './stub/github'; +import Log from '../lib/log.js'; +import Spinner from '../lib/spinner.js'; +import Prompt from '../lib/prompt.js'; +import Config from '../lib/config.js'; +import runTasks from '../lib/tasks.js'; +import { mkTmpDir, gitAdd } from './util/helpers.js'; +import ShellStub from './stub/shell.js'; +import { interceptPublish as interceptGitLabPublish } from './stub/gitlab.js'; +import { interceptCreate as interceptGitHubCreate } from './stub/github.js'; const noop = Promise.resolve(); diff --git a/test/tasks.js b/test/tasks.js index a17b4530..dc45c9cf 100644 --- a/test/tasks.js +++ b/test/tasks.js @@ -4,13 +4,13 @@ import sh from 'shelljs'; import proxyquire from 'proxyquire'; import _ from 'lodash'; import sinon from 'sinon'; -import Log from '../lib/log'; -import Spinner from '../lib/spinner'; -import Config from '../lib/config'; -import runTasks from '../lib/tasks'; -import Plugin from '../lib/plugin/Plugin'; -import { mkTmpDir, gitAdd, getArgs } from './util/helpers'; -import ShellStub from './stub/shell'; +import Log from '../lib/log.js'; +import Spinner from '../lib/spinner.js'; +import Config from '../lib/config.js'; +import runTasks from '../lib/tasks.js'; +import Plugin from '../lib/plugin/Plugin.js'; +import { mkTmpDir, gitAdd, getArgs } from './util/helpers.js'; +import ShellStub from './stub/shell.js'; import { interceptUser as interceptGitLabUser, interceptCollaborator as interceptGitLabCollaborator, diff --git a/test/util/index.js b/test/util/index.js index c9baf4c1..c05aa472 100644 --- a/test/util/index.js +++ b/test/util/index.js @@ -1,12 +1,12 @@ import _ from 'lodash'; import sinon from 'sinon'; import semver from 'semver'; -import { parseVersion } from '../../lib/util'; -import Log from '../../lib/log'; -import Config from '../../lib/config'; -import ShellStub from '../stub/shell'; -import Spinner from '../../lib/spinner'; -import Prompt from '../../lib/prompt'; +import { parseVersion } from '../../lib/util.js'; +import Log from '../../lib/log.js'; +import Config from '../../lib/config.js'; +import ShellStub from '../stub/shell.js'; +import Spinner from '../../lib/spinner.js'; +import Prompt from '../../lib/prompt.js'; export let factory = (Definition, { namespace, options = {}, container = {} } = {}) => { _.defaults(options, { ci: true, verbose: false, 'dry-run': false, debug: false }); diff --git a/test/utils.js b/test/utils.js index 6acb1815..5ce196d9 100644 --- a/test/utils.js +++ b/test/utils.js @@ -2,7 +2,7 @@ import { EOL } from 'os'; import test from 'ava'; import mockStdIo from 'mock-stdio'; import stripAnsi from 'strip-ansi'; -import { format, truncateLines, parseGitUrl, parseVersion } from '../lib/util'; +import { format, truncateLines, parseGitUrl, parseVersion } from '../lib/util.js'; test('format', t => { t.is(format('release v${version}', { version: '1.0.0' }), 'release v1.0.0'); diff --git a/test/version.js b/test/version.js index 10efe961..d0d15a55 100644 --- a/test/version.js +++ b/test/version.js @@ -1,7 +1,7 @@ import test from 'ava'; import sinon from 'sinon'; -import Version from '../lib/plugin/version/Version'; -import { factory, runTasks } from './util'; +import Version from '../lib/plugin/version/Version.js'; +import { factory, runTasks } from './util.js'; test('isValidVersion', t => { const v = factory(Version);