mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-24 16:18:57 -06:00
refactor: remove unnecessary padEnd & padStart shims
Both features are already supported in Node.js v8+
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
const { chalk } = require('@vue/cli-shared-utils')
|
||||
const padEnd = require('string.prototype.padend')
|
||||
const getPadLength = require('../util/getPadLength')
|
||||
|
||||
module.exports = (api, options) => {
|
||||
@@ -23,7 +22,7 @@ module.exports = (api, options) => {
|
||||
if (name !== 'help') {
|
||||
const opts = commands[name].opts || {}
|
||||
console.log(` ${
|
||||
chalk.blue(padEnd(name, padLength))
|
||||
chalk.blue(name.padEnd(padLength))
|
||||
}${
|
||||
opts.description || ''
|
||||
}`)
|
||||
@@ -47,7 +46,7 @@ module.exports = (api, options) => {
|
||||
const padLength = getPadLength(opts.options)
|
||||
for (const [flags, description] of Object.entries(opts.options)) {
|
||||
console.log(` ${
|
||||
chalk.blue(padEnd(flags, padLength))
|
||||
chalk.blue(flags.padEnd(padLength))
|
||||
}${
|
||||
description
|
||||
}`)
|
||||
|
||||
@@ -66,7 +66,6 @@
|
||||
"read-pkg": "^5.1.1",
|
||||
"slash": "^3.0.0",
|
||||
"ssri": "^7.1.0",
|
||||
"string.prototype.padend": "^3.0.0",
|
||||
"terser-webpack-plugin": "^2.2.1",
|
||||
"thread-loader": "^2.1.3",
|
||||
"url-loader": "^2.2.0",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const chalk = require('chalk')
|
||||
const stripAnsi = require('strip-ansi')
|
||||
const readline = require('readline')
|
||||
const padStart = require('string.prototype.padstart')
|
||||
const EventEmitter = require('events')
|
||||
|
||||
exports.events = new EventEmitter()
|
||||
@@ -20,7 +19,7 @@ const format = (label, msg) => {
|
||||
return msg.split('\n').map((line, i) => {
|
||||
return i === 0
|
||||
? `${label} ${line}`
|
||||
: padStart(line, stripAnsi(label).length)
|
||||
: line.padStart(stripAnsi(label).length)
|
||||
}).join('\n')
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
"request": "^2.87.0",
|
||||
"request-promise-native": "^1.0.8",
|
||||
"semver": "^6.1.0",
|
||||
"string.prototype.padstart": "^3.0.0",
|
||||
"strip-ansi": "^6.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
||||
18
yarn.lock
18
yarn.lock
@@ -15891,24 +15891,6 @@ string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0:
|
||||
is-fullwidth-code-point "^3.0.0"
|
||||
strip-ansi "^6.0.0"
|
||||
|
||||
string.prototype.padend@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/string.prototype.padend/-/string.prototype.padend-3.0.0.tgz#f3aaef7c1719f170c5eab1c32bf780d96e21f2f0"
|
||||
integrity sha1-86rvfBcZ8XDF6rHDK/eA2W4h8vA=
|
||||
dependencies:
|
||||
define-properties "^1.1.2"
|
||||
es-abstract "^1.4.3"
|
||||
function-bind "^1.0.2"
|
||||
|
||||
string.prototype.padstart@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/string.prototype.padstart/-/string.prototype.padstart-3.0.0.tgz#5bcfad39f4649bb2d031292e19bcf0b510d4b242"
|
||||
integrity sha1-W8+tOfRkm7LQMSkuGbzwtRDUskI=
|
||||
dependencies:
|
||||
define-properties "^1.1.2"
|
||||
es-abstract "^1.4.3"
|
||||
function-bind "^1.0.2"
|
||||
|
||||
string.prototype.trimleft@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz#6cc47f0d7eb8d62b0f3701611715a3954591d634"
|
||||
|
||||
Reference in New Issue
Block a user