Skip to content

Commit eeeabd9

Browse files
committed
1 parent 618b29e commit eeeabd9

5 files changed

Lines changed: 16 additions & 8 deletions

File tree

src/cli.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
#! /usr/bin/env node
2+
import { readFile } from 'node:fs/promises';
3+
24
import * as core from '@actions/core';
35
import chalk from 'chalk';
46
import updateNotifier from 'update-notifier-cjs';
57

6-
import pkg from '../package.json' assert { type: 'json' };
7-
88
import { isGHA } from './lib/isCI.js';
99

1010
import rdme from './index.js';
1111

12+
const pkg = JSON.parse(await readFile(new URL('../../package.json', import.meta.url), { encoding: 'utf-8' }));
13+
1214
updateNotifier({ pkg }).notify();
1315

1416
rdme(process.argv.slice(2))

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint-disable import/first, import/order, no-underscore-dangle */
2+
import { readFile } from 'node:fs/promises';
23
import path from 'node:path';
34

45
import chalk from 'chalk';
@@ -20,7 +21,7 @@ import config from 'config';
2021

2122
process.env.NODE_CONFIG_DIR = configDir;
2223

23-
import pkg from '../package.json' assert { type: 'json' };
24+
const pkg = JSON.parse(await readFile(new URL('../../package.json', import.meta.url), { encoding: 'utf-8' }));
2425

2526
const { version } = pkg;
2627

src/lib/configstore.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import { readFile } from 'node:fs/promises';
2+
13
import Configstore from 'configstore';
24

3-
import pkg from '../../package.json' assert { type: 'json' };
5+
const pkg = JSON.parse(await readFile(new URL('../../package.json', import.meta.url), { encoding: 'utf-8' }));
46

57
const configstore = new Configstore(
68
/**

src/lib/getPkgVersion.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
import { readFile } from 'node:fs/promises';
2+
13
// eslint-disable-next-line no-restricted-imports
24
import fetch from 'node-fetch';
35
import semver from 'semver';
46

5-
import pkg from '../../package.json' assert { type: 'json' };
6-
77
import { error } from './logger.js';
88

9+
const pkg = JSON.parse(await readFile(new URL('../../package.json', import.meta.url), { encoding: 'utf-8' }));
10+
911
const registryUrl = 'https://registry.npmjs.com/rdme';
1012

1113
/**

src/lib/readmeAPIFetch.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
import type { SpecFileType } from './prepareOas.js';
22
import type { RequestInit, Response } from 'node-fetch';
33

4+
import { readFile } from 'node:fs/promises';
45
import path from 'node:path';
56

67
import config from 'config';
78
import mime from 'mime-types';
89
import nodeFetch, { Headers } from 'node-fetch'; // eslint-disable-line no-restricted-imports
910

10-
import pkg from '../../package.json' assert { type: 'json' };
11-
1211
import APIError from './apiError.js';
1312
import { git } from './createGHA/index.js';
1413
import isCI, { ciName, isGHA } from './isCI.js';
1514
import { debug, warn } from './logger.js';
1615

16+
const pkg = JSON.parse(await readFile(new URL('../../package.json', import.meta.url), { encoding: 'utf-8' }));
17+
1718
const SUCCESS_NO_CONTENT = 204;
1819

1920
/**

0 commit comments

Comments
 (0)