-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:NervJS/taro
# Conflicts: # packages/taro-cli/src/rn/styleProcess.ts # packages/taro-cli/src/util/index.js
- Loading branch information
Showing
214 changed files
with
16,374 additions
and
5,482 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/usr/bin/env node | ||
|
||
const path = require('path') | ||
const program = require('commander') | ||
const _ = require('lodash/fp') | ||
const ora = require('ora') | ||
const chalk = require('chalk') | ||
const fs = require('fs-extra') | ||
const { PROJECT_CONFIG } = require('../dist/util/constants') | ||
const PROJECT_CONF_PATH = path.join(process.cwd(), PROJECT_CONFIG) | ||
|
||
if (!fs.existsSync(PROJECT_CONF_PATH)) { | ||
console.log(chalk.red(`找不到项目配置文件${PROJECT_CONFIG},请确定当前目录是Taro项目根目录!`)) | ||
process.exit(1) | ||
} | ||
|
||
const { validators } = require('../dist/doctor').default | ||
|
||
const NOTE_ALL_RIGHT = chalk.green('[✓] ') | ||
const NOTE_VALID = chalk.yellow('[!] ') | ||
const NOTE_INVALID = chalk.red('[✗] ') | ||
|
||
const titleChalk = chalk.hex('#aaa') | ||
const lineChalk = chalk.hex('#fff') | ||
const solutionChalk = chalk.hex('#999') | ||
|
||
function printReport (reports) { | ||
_.forEach(report => { | ||
console.log('\n' + titleChalk(report.desc)) | ||
|
||
if (report.raw) { | ||
console.log(report.raw) | ||
return | ||
} | ||
|
||
if (_.getOr(0, 'lines.length', report) === 0) { | ||
console.log(` ${NOTE_ALL_RIGHT}没有发现问题`) | ||
return | ||
} | ||
|
||
_.forEach(line => { | ||
console.log( | ||
' ' + | ||
(line.valid ? NOTE_VALID : NOTE_INVALID) + | ||
lineChalk(line.desc) | ||
) | ||
if (line.solution) { | ||
console.log(' ' + solutionChalk(line.solution)) | ||
} | ||
}, report.lines) | ||
}, reports) | ||
} | ||
|
||
program | ||
.option('-v --verbose', 'Print all message') | ||
.parse(process.argv) | ||
|
||
async function diagnose () { | ||
const spinner = ora('正在诊断项目...').start() | ||
const reportsP = _.map(validator => validator(), validators) | ||
const reports = await Promise.all(reportsP) | ||
spinner.succeed('诊断完成') | ||
printReport(reports) | ||
} | ||
diagnose() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.