Skip to content

Commit

Permalink
Add .js extension to imports
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Jul 21, 2021
1 parent 216267b commit c31548c
Show file tree
Hide file tree
Showing 41 changed files with 115 additions and 115 deletions.
2 changes: 1 addition & 1 deletion bin/release-it.js
Expand Up @@ -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');

Expand Down
4 changes: 2 additions & 2 deletions 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');

Expand Down
4 changes: 2 additions & 2 deletions 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');
Expand Down
4 changes: 2 additions & 2 deletions 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');

Expand Down
6 changes: 3 additions & 3 deletions 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) {
Expand Down
2 changes: 1 addition & 1 deletion lib/metrics.js
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions 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)"';
Expand Down
4 changes: 2 additions & 2 deletions 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');

Expand Down
10 changes: 5 additions & 5 deletions lib/plugin/factory.js
Expand Up @@ -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');

Expand Down
6 changes: 3 additions & 3 deletions 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+@/;
Expand Down
2 changes: 1 addition & 1 deletion lib/plugin/git/prompts.js
@@ -1,4 +1,4 @@
import { format, truncateLines } from '../../util';
import { format, truncateLines } from '../../util.js';

export default {
commit: {
Expand Down
6 changes: 3 additions & 3 deletions lib/plugin/github/GitHub.js
Expand Up @@ -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');

Expand Down
2 changes: 1 addition & 1 deletion 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;
Expand Down
6 changes: 3 additions & 3 deletions lib/plugin/gitlab/GitLab.js
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion lib/plugin/gitlab/prompts.js
@@ -1,4 +1,4 @@
import { format } from '../../util';
import { format } from '../../util.js';

export default {
release: {
Expand Down
6 changes: 3 additions & 3 deletions 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';

Expand Down
2 changes: 1 addition & 1 deletion 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;

Expand Down
2 changes: 1 addition & 1 deletion 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');

Expand Down
2 changes: 1 addition & 1 deletion lib/spinner.js
@@ -1,5 +1,5 @@
import ora from 'ora';
import { format } from './util';
import { format } from './util.js';

const noop = Promise.resolve();

Expand Down
20 changes: 10 additions & 10 deletions 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 = {};
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion lib/util.js
Expand Up @@ -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'));

Expand Down
4 changes: 2 additions & 2 deletions 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');

Expand Down
4 changes: 2 additions & 2 deletions 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');

Expand Down
4 changes: 2 additions & 2 deletions 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);
Expand Down
8 changes: 4 additions & 4 deletions 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');

Expand Down
6 changes: 3 additions & 3 deletions test/git.js
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions 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,
Expand Down
4 changes: 2 additions & 2 deletions test/gitlab.js
@@ -1,15 +1,15 @@
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,
interceptCollaboratorFallback,
interceptPublish,
interceptAsset
} from './stub/gitlab';
import { factory, runTasks } from './util';
import { factory, runTasks } from './util.js';

const tokenHeader = 'Private-Token';
const tokenRef = 'GITLAB_TOKEN';
Expand Down
2 changes: 1 addition & 1 deletion test/log.js
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion 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();
Expand Down
6 changes: 3 additions & 3 deletions test/npm.js
Expand Up @@ -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' } };
Expand Down
12 changes: 6 additions & 6 deletions test/plugins.js
Expand Up @@ -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();

Expand Down
14 changes: 7 additions & 7 deletions 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 };

Expand Down
6 changes: 3 additions & 3 deletions 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();
Expand Down

0 comments on commit c31548c

Please sign in to comment.