chore: remove pify dependency, use util.promisify (#901)

This commit is contained in:
Nolan Lawson 2019-01-19 15:06:25 -08:00 committed by GitHub
parent 4a8f65b7fc
commit 6b3d53a795
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 18 additions and 24 deletions

View File

@ -1,6 +1,6 @@
import crypto from 'crypto'
import fs from 'fs'
import pify from 'pify'
import { promisify } from 'util'
import path from 'path'
import { rollup } from 'rollup'
import { terser } from 'rollup-plugin-terser'
@ -8,7 +8,7 @@ import replace from 'rollup-plugin-replace'
import fromPairs from 'lodash-es/fromPairs'
import { themes } from '../src/routes/_static/themes'
const writeFile = pify(fs.writeFile.bind(fs))
const writeFile = promisify(fs.writeFile)
const themeColors = fromPairs(themes.map(_ => ([_.name, _.color])))

View File

@ -1,11 +1,11 @@
import sass from 'node-sass'
import path from 'path'
import fs from 'fs'
import pify from 'pify'
import { promisify } from 'util'
const writeFile = pify(fs.writeFile.bind(fs))
const readdir = pify(fs.readdir.bind(fs))
const render = pify(sass.render.bind(sass))
const writeFile = promisify(fs.writeFile)
const readdir = promisify(fs.readdir)
const render = promisify(sass.render.bind(sass))
const globalScss = path.join(__dirname, '../src/scss/global.scss')
const defaultThemeScss = path.join(__dirname, '../src/scss/themes/_default.scss')

View File

@ -1,12 +1,12 @@
import svgs from './svgs'
import path from 'path'
import fs from 'fs'
import pify from 'pify'
import { promisify } from 'util'
import SVGO from 'svgo'
import $ from 'cheerio'
const svgo = new SVGO()
const readFile = pify(fs.readFile.bind(fs))
const readFile = promisify(fs.readFile)
export async function buildSvg () {
let result = (await Promise.all(svgs.map(async svg => {

View File

@ -1,14 +1,14 @@
import chokidar from 'chokidar'
import fs from 'fs'
import path from 'path'
import pify from 'pify'
import { promisify } from 'util'
import { buildSass } from './build-sass'
import { buildInlineScript } from './build-inline-script'
import { buildSvg } from './build-svg'
import now from 'performance-now'
import debounce from 'lodash-es/debounce'
const writeFile = pify(fs.writeFile.bind(fs))
const writeFile = promisify(fs.writeFile)
const DEBOUNCE = 500

View File

@ -1,11 +1,11 @@
import path from 'path'
import fs from 'fs'
import pify from 'pify'
import { promisify } from 'util'
import CleanCSS from 'clean-css'
const writeFile = pify(fs.writeFile.bind(fs))
const readFile = pify(fs.readFile.bind(fs))
const copyFile = pify(fs.copyFile.bind(fs))
const writeFile = promisify(fs.writeFile)
const readFile = promisify(fs.readFile)
const copyFile = promisify(fs.copyFile)
async function compileThirdPartyCss () {
let css = await readFile(path.resolve(__dirname, '../node_modules/emoji-mart/css/emoji-mart.css'), 'utf8')

View File

@ -1,5 +1,5 @@
import { restoreMastodonData } from './restore-mastodon-data'
import pify from 'pify'
import { promisify } from 'util'
import childProcessPromise from 'child-process-promise'
import path from 'path'
import fs from 'fs'
@ -8,9 +8,9 @@ import mkdirpCB from 'mkdirp'
const exec = childProcessPromise.exec
const spawn = childProcessPromise.spawn
const mkdirp = pify(mkdirpCB)
const stat = pify(fs.stat.bind(fs))
const writeFile = pify(fs.writeFile.bind(fs))
const mkdirp = promisify(mkdirpCB)
const stat = promisify(fs.stat)
const writeFile = promisify(fs.writeFile)
const dir = __dirname
const GIT_URL = 'https://github.com/tootsuite/mastodon.git'

5
package-lock.json generated
View File

@ -7338,11 +7338,6 @@
"resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.0.tgz",
"integrity": "sha512-9CT4NFlDcosssyg8KVFltgokyKZIFjoBxw8CTGy+5F38Y1eQWrt8tRayiUOXE+zVKQnYu5BR8JjCtvK3BcnBhg=="
},
"pify": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",
"integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g=="
},
"pinkie": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",

View File

@ -79,7 +79,6 @@
"p-any": "^1.1.0",
"page-lifecycle": "^0.1.1",
"performance-now": "^2.1.0",
"pify": "^4.0.1",
"prop-types": "^15.6.2",
"quick-lru": "^2.0.0",
"remount": "^0.9.3",