Skip to content

Commit c6b685e

Browse files
committed
🎨 rename shared-utils
1 parent 658694b commit c6b685e

File tree

8 files changed

+311
-47
lines changed

8 files changed

+311
-47
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ Micro APP 依赖工具库.
99
[![NPM Version][npm-img]][npm-url]
1010
[![NPM Download][download-img]][download-url]
1111

12-
[Coverage-img]: https://coveralls.io/repos/github/MicroAppJS/MicroApp-Shared-Utils/badge.svg?branch=master
13-
[Coverage-url]: https://coveralls.io/github/MicroAppJS/MicroApp-Shared-Utils?branch=master
14-
[CircleCI-img]: https://circleci.com/gh/MicroAppJS/MicroApp-Shared-Utils/tree/master.svg?style=svg
15-
[CircleCI-url]: https://circleci.com/gh/MicroAppJS/MicroApp-Shared-Utils/tree/master
12+
[Coverage-img]: https://coveralls.io/repos/github/MicroAppJS/shared-utils/badge.svg?branch=master
13+
[Coverage-url]: https://coveralls.io/github/MicroAppJS/shared-utils?branch=master
14+
[CircleCI-img]: https://circleci.com/gh/MicroAppJS/shared-utils/tree/master.svg?style=svg
15+
[CircleCI-url]: https://circleci.com/gh/MicroAppJS/shared-utils/tree/master
1616
[npm-img]: https://img.shields.io/npm/v/@micro-app/shared-utils.svg?style=flat-square
1717
[npm-url]: https://npmjs.org/package/@micro-app/shared-utils
1818
[download-img]: https://img.shields.io/npm/dm/@micro-app/shared-utils.svg?style=flat-square

index.d.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,26 @@ import parseGitUrl from 'git-url-parse';
1616
import multimatch from 'multimatch';
1717
import stringifyObject from 'stringify-object';
1818
import LRU from 'lru-cache';
19+
import inquirer from 'inquirer';
20+
import execa from 'execa';
21+
import yParser from 'yargs-parser';
22+
import yUnParser from 'yargs-unparser';
23+
import debug from 'debug';
1924

2025
export function tryRequire( id: string, req?: Object): any | null;
2126
export function assert(value: any, message?: string | Error): void;
2227

2328
import * as moduleAlias from './src/moduleAlias';
2429
import * as getPadLength from './src/getPadLength';
2530
import * as injectHtml from './src/injectHtml';
26-
import * as loadFile from './src/loadFile';
2731
import * as logger from './src/logger';
32+
import * as prompt from './src/prompt';
2833
import * as smartMerge from './src/smartMerge';
2934
import * as virtualFile from './src/virtualFile';
3035
import * as openBrowser from './src/openBrowser';
3136
import * as env from './src/env';
32-
import * as validateSchema from './src/validateSchema';
37+
import validateSchema from './src/validateSchema';
38+
import loadFile from './src/loadFile';
3339

3440
export {
3541
moduleAlias,
@@ -39,6 +45,7 @@ export {
3945
smartMerge,
4046
virtualFile,
4147
logger,
48+
prompt,
4249
openBrowser,
4350
env,
4451
};
@@ -61,4 +68,9 @@ export {
6168
multimatch,
6269
stringifyObject,
6370
LRU,
71+
inquirer,
72+
execa,
73+
yParser,
74+
yUnParser,
75+
debug
6476
}

index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const internal = [
1818
'injectHtml',
1919
'loadFile',
2020
'logger',
21+
'prompt',
2122
'smartMerge',
2223
'virtualFile',
2324
'openBrowser',
@@ -50,6 +51,11 @@ const thirdParty = {
5051
multimatch: 'multimatch',
5152
stringifyObject: 'stringify-object',
5253
LRU: 'lru-cache',
54+
inquirer: 'inquirer',
55+
execa: 'execa',
56+
yParser: 'yargs-parser',
57+
yUnParser: 'yargs-unparser',
58+
debug: 'debug',
5359
};
5460

5561
Object.keys(thirdParty).forEach(key => {

package.json

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
22
"name": "@micro-app/shared-utils",
3-
"version": "0.1.8",
3+
"version": "0.1.11",
44
"description": "[Shared] shared utilities for micro-app.",
55
"main": "index.js",
66
"scripts": {
77
"lint": "eslint .",
88
"lint:fix": "npm run lint -- --fix",
99
"test": "jest"
1010
},
11-
"homepage": "https://github.com/MicroAppJS/MicroApp-Shared-Utils",
11+
"homepage": "https://github.com/MicroAppJS/shared-utils",
1212
"repository": {
1313
"type": "git",
14-
"url": "git+https://github.com/MicroAppJS/MicroApp-Shared-Utils.git"
14+
"url": "git+https://github.com/MicroAppJS/shared-utils.git"
1515
},
1616
"bugs": {
17-
"url": "https://github.com/MicroAppJS/MicroApp-Shared-Utils/issues"
17+
"url": "https://github.com/MicroAppJS/shared-utils/issues"
1818
},
1919
"files": [
2020
"src",
@@ -40,14 +40,14 @@
4040
]
4141
},
4242
"devDependencies": {
43-
"@types/jest": "^24.0.23",
43+
"@types/jest": "^24.0.24",
4444
"babel-eslint": "^10.0.3",
45-
"coveralls": "^3.0.7",
45+
"coveralls": "^3.0.9",
4646
"eslint": "^5.16.0",
4747
"eslint-config-2o3t": "^1.1.17",
4848
"husky": "^3.1.0",
4949
"jest": "^24.9.0",
50-
"lint-staged": "^9.4.3",
50+
"lint-staged": "^9.5.0",
5151
"webpack-merge": "^4.2.2"
5252
},
5353
"dependencies": {
@@ -56,12 +56,15 @@
5656
"assert": "^2.0.0",
5757
"chalk": "^2.4.2",
5858
"cheerio": "^1.0.0-rc.3",
59+
"debug": "^4.1.1",
5960
"dedent": "^0.7.0",
61+
"execa": "^3.4.0",
6062
"fs-extra": "^8.1.0",
6163
"git-url-parse": "^11.1.2",
6264
"glob-parent": "^5.1.0",
6365
"globby": "^10.0.1",
6466
"import-fresh": "^3.2.1",
67+
"inquirer": "^7.0.1",
6568
"is-glob": "^4.0.1",
6669
"lodash": "^4.17.15",
6770
"lru-cache": "^5.1.1",
@@ -76,7 +79,9 @@
7679
"stream-to-string": "^1.2.0",
7780
"stringify-object": "^3.3.0",
7881
"try-require": "^1.2.1",
79-
"yaml": "^1.7.2"
82+
"yaml": "^1.7.2",
83+
"yargs-parser": "^16.1.0",
84+
"yargs-unparser": "^1.5.0"
8085
},
8186
"engines": {
8287
"node": ">=8"

src/logger/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class Logger {
177177
const defulatOpts = {
178178
text: message,
179179
color: 'yellow',
180-
prefixText: `${chalk.bgHex('#EE6B2C')(' PENDING ')} `,
180+
prefixText: chalk.bgHex('#EC6D29')(chalk.white(' WAIT ')),
181181
};
182182
return ora(typeof message === 'string' ? defulatOpts : Object.assign({}, defulatOpts, message));
183183
}

src/logger/logger.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('Logger', () => {
4141
const spinner = logger.spinner('abc');
4242
spinner.start();
4343
setTimeout(() => {
44-
spinner.success('cc');
44+
spinner.succeed('cc');
4545
}, 3000);
4646

4747
});

src/prompt/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const inquirer = require('inquirer');
55
const logger = require('../logger');
66
const npmlog = logger.npmlog;
77

8-
const SCOPE_NAME = require('../constants').SCOPE_NAME || '@micro-app';
9-
const prefix = `[${chalk.green('?')}] ${chalk.bgBlack(chalk.whiteBright(SCOPE_NAME))}`;
8+
const SCOPE_NAME = 'Q&A?';
9+
const prefix = chalk.bgMagentaBright(` ${chalk.whiteBright(SCOPE_NAME.substr(0, 2))}`) + chalk.bgCyanBright(`${chalk.whiteBright(SCOPE_NAME.substr(2, 2))} `);
1010

1111
function createDefaultOptions(options = {}) {
1212
return Object.assign({
@@ -86,3 +86,4 @@ function input(message, { filter, validate } = {}) {
8686
exports.confirm = confirm;
8787
exports.select = select;
8888
exports.input = input;
89+
exports.createDefaultOptions = createDefaultOptions;

0 commit comments

Comments
 (0)