Skip to content

Commit

Permalink
fix: remove npmcli/fs dep
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Oct 13, 2022
1 parent 2fef1e8 commit 09bcd64
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/apply/apply-files.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fs = require('@npmcli/fs')
const fs = require('fs/promises')
const log = require('proc-log')
const { rmEach, parseEach } = require('../util/files.js')

Expand Down
5 changes: 3 additions & 2 deletions lib/check/check-changelog.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const fs = require('@npmcli/fs')
const fs = require('fs/promises')
const { existsSync } = require('fs')
const { join, relative } = require('path')

const run = async ({ root, path }) => {
Expand All @@ -7,7 +8,7 @@ const run = async ({ root, path }) => {
// make this glob for possible matches
const changelog = join(path, 'CHANGELOG.md')

if (await fs.exists(changelog)) {
if (existsSync(changelog)) {
const content = await fs.readFile(changelog, { encoding: 'utf8' })
const mustStart = /^#\s+Changelog\r?\n\r?\n#/
if (!mustStart.test(content)) {
Expand Down
5 changes: 3 additions & 2 deletions lib/check/check-gitignore.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const log = require('proc-log')
const { resolve, relative, basename } = require('path')
const fs = require('@npmcli/fs')
const fs = require('fs/promises')
const { existsSync } = require('fs')
const git = require('@npmcli/git')

const NAME = 'check-gitignore'
Expand All @@ -17,7 +18,7 @@ const run = async ({ root, path, config }) => {
// use the root to detect a git repo but the project directory (path) for the
// ignore check
const ignoreFile = resolve(path, '.gitignore')
if (!await git.is({ cwd: root }) || !await fs.exists(ignoreFile)) {
if (!await git.is({ cwd: root }) || !existsSync(ignoreFile)) {
log.verbose(NAME, 'no git or no gitignore')
return null
}
Expand Down
2 changes: 1 addition & 1 deletion lib/util/parser.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fs = require('@npmcli/fs')
const fs = require('fs/promises')
const { basename, extname, dirname } = require('path')
const yaml = require('yaml')
const NpmPackageJson = require('@npmcli/package-json')
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"@commitlint/cli": "^17.1.1",
"@commitlint/config-conventional": "^17.1.0",
"@isaacs/string-locale-compare": "^1.1.0",
"@npmcli/fs": "^2.0.1",
"@npmcli/git": "^3.0.0",
"@npmcli/map-workspaces": "^2.0.2",
"@npmcli/package-json": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion test/setup.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const t = require('tap')
const { join, resolve, posix } = require('path')
const { merge, defaults, escapeRegExp: esc } = require('lodash')
const fs = require('@npmcli/fs')
const fs = require('fs/promises')
const Git = require('@npmcli/git')
const localeCompare = require('@isaacs/string-locale-compare')('en')
const npa = require('npm-package-arg')
Expand Down
2 changes: 1 addition & 1 deletion test/util/has-package.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fs = require('@npmcli/fs')
const fs = require('fs/promises')
const t = require('tap')
const path = require('path')
const hasPackage = require('../../lib/util/has-package.js')
Expand Down

0 comments on commit 09bcd64

Please sign in to comment.