Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chinanf-boy/explain-yarn
explain --> yarn - manger your project
https://github.com/chinanf-boy/explain-yarn
explain explain-yarn yarn
Last synced: about 1 month ago
JSON representation
explain --> yarn - manger your project
- Host: GitHub
- URL: https://github.com/chinanf-boy/explain-yarn
- Owner: chinanf-boy
- Created: 2017-12-20T08:40:50.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-20T08:44:13.000Z (about 7 years ago)
- Last Synced: 2024-10-28T05:19:43.697Z (3 months ago)
- Topics: explain, explain-yarn, yarn
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README-src.md
Awesome Lists containing this project
README
# yarn-src
[![explain](http://llever.com/explain.svg)](https://github.com/chinanf-boy/Source-Explain)
explain-yarn ``"version": "1.3.2"``
yarn解释-全目录
- [yarn-bin/yarn.js](./README.md)
- [yarn-src/](README-src.md) <--- 你在这里
``yarn`` 的 ``star`` 基本是 ``npm`` 的两倍了
---
本章节
## 目录
- [命令行](#命令cli)
---
## 命令cli
[src/cli/index.js](yarn/src/cli/index.js)
[代码1-13](yarn/src/cli/index.js)
``` js
/* @flow */import http from 'http';
import net from 'net';
import path from 'path';
// 上面内置函数import commander from 'commander'; // tj 命令行解析
import fs from 'fs';
import invariant from 'invariant';
//在开发中提供描述性错误的一种方法,但在生产中存在一般性错误。import lockfile from 'proper-lockfile';
import loudRejection from 'loud-rejection';
import onDeath from 'death';
import semver from 'semver';```
### > commander
[try/try_commander.js](./try/try_commander.js)
``` js
#!/usr/bin/env nodevar program = require('commander');
program
.version('0.1.0')
.option('-p, --peppers', 'Add peppers')
.option('-P, --pineapple', 'Add pineapple')
.option('-b, --bbq-sauce', 'Add bbq sauce')
.option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
.parse(process.argv);console.log('you ordered a pizza with:');
if (program.peppers) console.log(' - peppers');
if (program.pineapple) console.log(' - pineapple');
if (program.bbqSauce) console.log(' - bbq');
if (program.cheese) console.log(' - ',program.cheese);console.log(' - %s cheese', program.cheese);
```>try
```
npm run commander:try
```### > invariant
[try/try_invariant.js](./try/try_invariant.js)
``` js
var invariant = require('invariant');invariant(true, 'This will not throw');
// 没有invariant(false, 'This will throw an error with this message');
// Error: Invariant Violation: This will throw an error with this message
```>try
```
npm run invariant:try
```