Skip to content

Commit

Permalink
Fix relative import paths
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Jul 21, 2021
1 parent c31548c commit f28ec24
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion bin/release-it.js
Expand Up @@ -5,7 +5,7 @@ import parseArgs from 'yargs-parser';
import release from '../lib/index.js';
import { readJSON } from '../lib/util.js';

const pkg = readJSON('../package.json');
const pkg = readJSON(new URL('../package.json', import.meta.url));

const aliases = {
c: 'config',
Expand Down
2 changes: 1 addition & 1 deletion lib/cli.js
@@ -1,7 +1,7 @@
import { readJSON } from '../lib/util.js';
import Log from './log.js';

const pkg = readJSON('../package.json');
const pkg = readJSON(new URL('../package.json', import.meta.url));

const log = new Log();

Expand Down
2 changes: 1 addition & 1 deletion lib/config.js
Expand Up @@ -8,7 +8,7 @@ import _debug from 'debug';
import { readJSON, getSystemInfo } from './util.js';

const debug = _debug('release-it:config');
const defaultConfig = readJSON('../config/release-it.json');
const defaultConfig = readJSON(new URL('../config/release-it.json', import.meta.url));

const searchPlaces = [
'package.json',
Expand Down
2 changes: 1 addition & 1 deletion lib/deprecated.js
Expand Up @@ -2,7 +2,7 @@ import Deprecated from 'deprecated-obj';
import { readJSON } from './util.js';
import Log from './log.js';

const deprecated = readJSON('../config/deprecated.json');
const deprecated = readJSON(new URL('../config/deprecated.json', import.meta.url));

export default (config, log = new Log()) => {
const deprecations = new Deprecated(deprecated, config);
Expand Down
2 changes: 1 addition & 1 deletion lib/metrics.js
Expand Up @@ -7,7 +7,7 @@ import _debug from 'debug';
import { readJSON } from './util.js';

const debug = _debug('release-it:metrics');
const pkg = readJSON('../package.json');
const pkg = readJSON(new URL('../package.json', import.meta.url));

const noop = Promise.resolve();

Expand Down
2 changes: 1 addition & 1 deletion lib/plugin/GitRelease.js
Expand Up @@ -2,7 +2,7 @@ import _ from 'lodash';
import { readJSON } from '../util.js';
import GitBase from './GitBase.js';

const defaultConfig = readJSON('../../config.release-it.json');
const defaultConfig = readJSON(new URL('../../config/release-it.json', import.meta.url));

class GitRelease extends GitBase {
static isEnabled(options) {
Expand Down
2 changes: 1 addition & 1 deletion lib/plugin/github/GitHub.js
Expand Up @@ -9,7 +9,7 @@ import { format, parseVersion, readJSON, e } from '../../util.js';
import Release from '../GitRelease.js';
import prompts from './prompts.js';

const pkg = readJSON('../../../package.json');
const pkg = readJSON(new URL('../../../package.json', import.meta.url));

const docs = 'https://git.io/release-it-github';

Expand Down
2 changes: 1 addition & 1 deletion lib/plugin/npm/npm.js
Expand Up @@ -27,7 +27,7 @@ class npm extends Plugin {
}

async init() {
const { name, version: latestVersion, private: isPrivate, publishConfig } = require(path.resolve(MANIFEST_PATH));
const { name, version: latestVersion, private: isPrivate, publishConfig } = readJSON(path.resolve(MANIFEST_PATH));
this.setContext({ name, latestVersion, private: isPrivate, publishConfig });

const { publish, skipChecks } = this.options;
Expand Down
4 changes: 2 additions & 2 deletions lib/util.js
Expand Up @@ -6,9 +6,9 @@ import semver from 'semver';
import osName from 'os-name';
import Log from './log.js';

const readJSON = async file => JSON.parse(fs.readFileSync(file, 'utf8'));
const readJSON = file => JSON.parse(fs.readFileSync(file, 'utf8'));

const pkg = readJSON('../package.json');
const pkg = readJSON(new URL('../package.json', import.meta.url));

const log = new Log();

Expand Down
2 changes: 1 addition & 1 deletion test/cli.js
Expand Up @@ -3,7 +3,7 @@ import mockStdIo from 'mock-stdio';
import { version, help } from '../lib/cli.js';
import { readJSON } from '../lib/util.js';

const pkg = readJSON('../package.json');
const pkg = readJSON(new URL('../package.json', import.meta.url));

test('should print version', t => {
mockStdIo.start();
Expand Down
2 changes: 1 addition & 1 deletion test/config.js
Expand Up @@ -3,7 +3,7 @@ import mock from 'mock-fs';
import Config from '../lib/config.js';
import { readJSON } from '../lib/util.js';

const defaultConfig = readJSON('../config/release-it.json');
const defaultConfig = readJSON(new URL('../config/release-it.json', import.meta.url));

const localConfig = { github: { release: true } };

Expand Down
2 changes: 1 addition & 1 deletion test/git.init.js
Expand Up @@ -5,7 +5,7 @@ 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');
const { git } = readJSON(new URL('../config/release-it.json', import.meta.url));

test.serial.beforeEach(t => {
const bare = mkTmpDir();
Expand Down

0 comments on commit f28ec24

Please sign in to comment.