Meta tweaks
This commit is contained in:
parent
af4a078245
commit
655653bb0c
16 changed files with 19 additions and 24 deletions
2
index.d.ts
vendored
2
index.d.ts
vendored
|
|
@ -78,6 +78,8 @@ declare namespace chalk {
|
|||
|
||||
@example
|
||||
```
|
||||
import chalk = require('chalk');
|
||||
|
||||
log(chalk`
|
||||
CPU: {red ${cpu.totalPercent}%}
|
||||
RAM: {green ${ram.used / ram.total * 100}%}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
"description": "Terminal string styling done right",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/chalk",
|
||||
"main": "source",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
|
|
@ -12,8 +13,7 @@
|
|||
"bench": "matcha benchmark.js"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"templates.js",
|
||||
"source",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
|
|
@ -44,7 +44,6 @@
|
|||
"supports-color": "^6.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sindresorhus/tsconfig": "^0.3.0",
|
||||
"ava": "^1.4.1",
|
||||
"coveralls": "^3.0.3",
|
||||
"execa": "^1.0.0",
|
||||
|
|
|
|||
|
|
@ -220,8 +220,8 @@ const miles = 18;
|
|||
const calculateFeet = miles => miles * 5280;
|
||||
|
||||
console.log(chalk`
|
||||
There are {bold 5280 feet} in a mile.
|
||||
In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}.
|
||||
There are {bold 5280 feet} in a mile.
|
||||
In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}.
|
||||
`);
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
'use strict';
|
||||
const ansiStyles = require('ansi-styles');
|
||||
const {stdout: stdoutColor} = require('supports-color');
|
||||
const template = require('./templates.js');
|
||||
|
||||
const template = require('./templates');
|
||||
const {
|
||||
stringReplaceAll,
|
||||
stringEncaseCRLFWithFirstIndex
|
||||
} = require('./lib/util');
|
||||
} = require('./util');
|
||||
|
||||
// `supportsColor.level` → `ansiStyles.color[name]` mapping
|
||||
const levelMapping = [
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
const stringReplaceAll = (string, substring, replacer) => {
|
||||
let index = string.indexOf(substring);
|
||||
if (index === -1) {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
const chalk = require('..');
|
||||
const chalk = require('../source');
|
||||
|
||||
console.log(chalk.hex('#ff6159')('test'));
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import test from 'ava';
|
|||
// Spoof supports-color
|
||||
require('./_supports-color')(__dirname);
|
||||
|
||||
const chalk = require('..');
|
||||
const chalk = require('../source');
|
||||
|
||||
console.log('TERM:', process.env.TERM || '[none]');
|
||||
console.log('platform:', process.platform || '[unknown]');
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import test from 'ava';
|
||||
|
||||
const chalk = require('..');
|
||||
const chalk = require('../source');
|
||||
|
||||
test('Chalk.constructor should throw an expected error', t => {
|
||||
const expectedError = t.throws(() => {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import test from 'ava';
|
|||
// Spoof supports-color
|
||||
require('./_supports-color')(__dirname);
|
||||
|
||||
const chalk = require('..');
|
||||
const chalk = require('../source');
|
||||
|
||||
test('don\'t output colors when manually disabled', t => {
|
||||
chalk.enabled = false;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import test from 'ava';
|
|||
// Spoof supports-color
|
||||
require('./_supports-color')(__dirname);
|
||||
|
||||
const chalk = require('..');
|
||||
const chalk = require('../source');
|
||||
|
||||
test('create an isolated context where colors can be disabled (by level)', t => {
|
||||
const instance = new chalk.Instance({level: 0, enabled: true});
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import execa from 'execa';
|
|||
// Spoof supports-color
|
||||
require('./_supports-color')(__dirname);
|
||||
|
||||
const chalk = require('..');
|
||||
const chalk = require('../source');
|
||||
|
||||
test('don\'t output colors when manually disabled', t => {
|
||||
const oldLevel = chalk.level;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ require('./_supports-color')(__dirname, {
|
|||
has16m: false
|
||||
});
|
||||
|
||||
const chalk = require('..');
|
||||
const chalk = require('../source');
|
||||
|
||||
test.failing('colors can be forced by using chalk.enabled', t => {
|
||||
chalk.enabled = true;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import test from 'ava';
|
|||
// Spoof supports-color
|
||||
require('./_supports-color')(__dirname);
|
||||
|
||||
const chalk = require('..');
|
||||
const chalk = require('../source');
|
||||
|
||||
test('return an empty string for an empty literal', t => {
|
||||
const instance = new chalk.Instance();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import test from 'ava';
|
|||
// Spoof supports-color
|
||||
require('./_supports-color')(__dirname);
|
||||
|
||||
const chalk = require('..');
|
||||
const chalk = require('../source');
|
||||
|
||||
test('visible: normal output when enabled', t => {
|
||||
const instance = new chalk.Instance({level: 3, enabled: true});
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"extends": "@sindresorhus/tsconfig",
|
||||
"compilerOptions": {
|
||||
"noEmit": true,
|
||||
"allowJs": true
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue