Skip to content

Commit

Permalink
feat: add package.json cheatsheet.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Sep 28, 2022
1 parent 5234cdc commit 7ab9ddf
Show file tree
Hide file tree
Showing 16 changed files with 715 additions and 110 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Quick Reference
## 工具包

[npm](./docs/npm.md)
[package.json](./docs/package.json.md)
[VSCode](./docs/vscode.md)
[Sketch](./docs/sketch.md)
[Jest](./docs/jest.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/cron.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Min Hour Day Mon Weekday


### 特殊字符
<!--rehype:warp-class=col-span-2-->
<!--rehype:wrap-class=col-span-2-->

<!--rehype:-->
| 特殊字符 | 说明 |
Expand Down
10 changes: 5 additions & 5 deletions docs/git.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ $ git clone git_url 指定目录
```

### 做出改变
<!--rehype:warp-class=row-span-2-->
<!--rehype:wrap-class=row-span-2-->

<!--rehype:-->
在工作目录中**显示**修改后的文件,为您的下一次提交暂存
Expand Down Expand Up @@ -368,10 +368,10 @@ $ git log -p <file_name>
```shell
$ git log --pretty=oneline --graph --decorate --all
```
<!--rehype:className=wrap-->
<!--rehype:className=wrap-text-->

### 分支
<!--rehype:warp-class=row-span-2-->
<!--rehype:wrap-class=row-span-2-->

列出所有分支及其上游

Expand Down Expand Up @@ -442,7 +442,7 @@ $ git rm -r --cached <目录/文件>
```

### 修改远程 Commit 记录
<!--rehype:warp-class=row-span-4-->
<!--rehype:wrap-class=row-span-4-->

<!--rehype:-->
```shell
Expand Down Expand Up @@ -519,7 +519,7 @@ $ git rev-parse --short HEAD # e10721c
```shell
$ git branch --merged master | grep -v '^\*\| master' | xargs -n 1 git branch -d
```
<!--rehype:className=wrap-->
<!--rehype:className=wrap-text-->

### 中文乱码的解决方案

Expand Down
36 changes: 18 additions & 18 deletions docs/javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ let age = 7;
```

### 字符串
<!--rehype:warp-class=col-span-2-->
<!--rehype:wrap-class=col-span-2-->

<!--rehype:-->
```js
Expand All @@ -154,7 +154,7 @@ abc.split("");
```

### 数字
<!--rehype:warp-class=row-span-2-->
<!--rehype:wrap-class=row-span-2-->

<!--rehype:-->
```js
Expand Down Expand Up @@ -211,7 +211,7 @@ Math.floor(Math.random() * 5) + 1;
```

### 全局函数
<!--rehype:warp-class=col-span-2-->
<!--rehype:wrap-class=col-span-2-->

<!--rehype:-->
```js
Expand Down Expand Up @@ -247,7 +247,7 @@ JavaScript 条件


### 操作符
<!--rehype:warp-class=row-span-3-->
<!--rehype:wrap-class=row-span-3-->

<!--rehype:-->
```javascript
Expand Down Expand Up @@ -401,7 +401,7 @@ const rocketToMars = function() {
```
### 箭头函数 (ES6)
<!--rehype:warp-class=row-span-2-->
<!--rehype:wrap-class=row-span-2-->
<!--rehype:-->
#### 有两个参数
Expand Down Expand Up @@ -494,7 +494,7 @@ JavaScript 范围
----
### 范围
<!--rehype:warp-class=row-span-2-->
<!--rehype:wrap-class=row-span-2-->
<!--rehype:-->
```javascript
Expand Down Expand Up @@ -793,7 +793,7 @@ for (let index in fruits) {
```
### label 语句
<!--rehype:warp-class= row-span-2-->
<!--rehype:wrap-class= row-span-2-->
<!--rehype:-->
```js
Expand Down Expand Up @@ -827,7 +827,7 @@ for (let fruit of fruits) {
```
### for await...of
<!--rehype:warp-class= row-span-2-->
<!--rehype:wrap-class= row-span-2-->
<!--rehype:-->
```javascript
Expand Down Expand Up @@ -972,7 +972,7 @@ console.log(classElection.place); // undefined
```
### 可变的
<!--rehype:warp-class=row-span-2-->
<!--rehype:wrap-class=row-span-2-->
<!--rehype:-->
```javascript
Expand Down Expand Up @@ -1041,7 +1041,7 @@ console.log(origObj.color);
```
### 工厂函数
<!--rehype:warp-class=row-span-2-->
<!--rehype:wrap-class=row-span-2-->
<!--rehype:-->
```javascript
Expand Down Expand Up @@ -1119,7 +1119,7 @@ JavaScript Classes
----
### 静态方法/字段
<!--rehype:warp-class=row-span-2-->
<!--rehype:wrap-class=row-span-2-->
<!--rehype:-->
```javascript
Expand Down Expand Up @@ -1311,7 +1311,7 @@ JavaScript Promises
----
### Promise
<!--rehype:warp-class=row-span-2-->
<!--rehype:wrap-class=row-span-2-->
<!--rehype:-->
创建 promises
Expand Down Expand Up @@ -1416,7 +1416,7 @@ promise.catch((err) => {
```
### Promise.all()
<!--rehype:warp-class=col-span-2-->
<!--rehype:wrap-class=col-span-2-->
<!--rehype:-->
```javascript
Expand Down Expand Up @@ -1457,7 +1457,7 @@ promise.then(res => {
```
### 避免嵌套的 Promise 和 .then()
<!--rehype:warp-class=col-span-2-->
<!--rehype:wrap-class=col-span-2-->
<!--rehype:-->
```javascript
Expand All @@ -1484,7 +1484,7 @@ JavaScript Async-Await
<!--rehype:body-class=cols-2-->
### 异步
<!--rehype:warp-class=row-span-2-->
<!--rehype:wrap-class=row-span-2-->
<!--rehype:-->
```javascript
Expand Down Expand Up @@ -1611,7 +1611,7 @@ req.send();
```
### POST
<!--rehype:warp-class=row-span-2-->
<!--rehype:wrap-class=row-span-2-->
<!--rehype:-->
```javascript
Expand All @@ -1634,7 +1634,7 @@ xhr.onerror = () => {
```
### fetch api
<!--rehype:warp-class=row-span-2-->
<!--rehype:wrap-class=row-span-2-->
<!--rehype:-->
```javascript
Expand Down Expand Up @@ -1695,7 +1695,7 @@ fetch('https://api-xxx.com/endpoint', {
```
### async await 语法
<!--rehype:warp-class=col-span-2-->
<!--rehype:wrap-class=col-span-2-->
<!--rehype:-->
```javascript
Expand Down
16 changes: 8 additions & 8 deletions docs/jest.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Jest 是一款优雅、简洁的 JavaScript 测试框架。
- 代码覆盖, 无需其他操作,您仅需添加 --coverage 参数来生成代码覆盖率报告。

### 测试结构
<!--rehype:warp-class=col-span-2-->
<!--rehype:wrap-class=col-span-2-->

<!--rehype:-->
```js
Expand Down Expand Up @@ -150,7 +150,7 @@ expect([{ a: 1 }, { b: 2 }]).toEqual([
```

### 模拟函数
<!--rehype:warp-class=row-span-2-->
<!--rehype:wrap-class=row-span-2-->

<!--rehype:-->
```js
Expand Down Expand Up @@ -293,7 +293,7 @@ expect(fn).toThrowErrorMatchingSnapshot()
----

### 实例
<!--rehype:warp-class=row-span-2-->
<!--rehype:wrap-class=row-span-2-->

<!--rehype:-->
请参阅 Jest 文档中的 [更多示例](https://jestjs.io/docs/en/tutorial-async)
Expand Down Expand Up @@ -330,7 +330,7 @@ test('async test', async () => {
```

### done() 回调
<!--rehype:warp-class=row-span-2-->
<!--rehype:wrap-class=row-span-2-->

<!--rehype:-->
```js
Expand Down Expand Up @@ -371,7 +371,7 @@ test('async test', () => {
## 模拟

### 模拟函数
<!--rehype:warp-class=row-span-2-->
<!--rehype:wrap-class=row-span-2-->

<!--rehype:-->
```js
Expand Down Expand Up @@ -409,7 +409,7 @@ const callback = jest.fn(() => true)
[模拟函数文档](https://jestjs.io/docs/en/mock-function-api)

### 返回、解析和拒绝值
<!--rehype:warp-class=row-span-2-->
<!--rehype:wrap-class=row-span-2-->

您的模拟可以返回值:

Expand Down Expand Up @@ -504,7 +504,7 @@ const setTitle = jest
```

### 定时器模拟
<!--rehype:warp-class=row-span-3-->
<!--rehype:wrap-class=row-span-3-->

<!--rehype:-->
为使用本机计时器函数(`setTimeout``setInterval``clearTimeout``clearInterval`)的代码编写同步测试。
Expand Down Expand Up @@ -556,7 +556,7 @@ Object.defineProperty(location, 'title', {
```

### 清除和恢复模拟
<!--rehype:warp-class=row-span-2-->
<!--rehype:wrap-class=row-span-2-->

<!--rehype:-->
对于一个模拟
Expand Down
8 changes: 4 additions & 4 deletions docs/json.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ JSON 备忘清单
<!--rehype:class=table-thead-hide-->

### 字符串
<!--rehype:data-warp-style=grid-row: span 3/span 3;-->
<!--rehype:data-wrap-style=grid-row: span 3/span 3;-->

<!--rehype:-->
| | |
Expand Down Expand Up @@ -82,7 +82,7 @@ Have to be delimited by double quotes


### 数字
<!--rehype:warp-class=row-span-2-->
<!--rehype:wrap-class=row-span-2-->

<!--rehype:-->
| Type | Description |
Expand Down Expand Up @@ -229,7 +229,7 @@ let myObject = {
<!--rehype:class=table-thead-hide-->

### 访问嵌套
<!--rehype:data-warp-style=grid-row: span 2/span 2;-->
<!--rehype:data-wrap-style=grid-row: span 2/span 2;-->

<!--rehype:-->
```javascript
Expand Down Expand Up @@ -273,7 +273,7 @@ let myObject = {
<!--rehype:class=table-thead-hide-->

### 访问对象数组
<!--rehype:data-warp-style=grid-row: span 2/span 2;-->
<!--rehype:data-wrap-style=grid-row: span 2/span 2;-->

<!--rehype:-->
```javascript
Expand Down
6 changes: 3 additions & 3 deletions docs/markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Header 2
```

### 无序列表
<!--rehype:data-warp-style=grid-row: span 2/span 2;-->
<!--rehype:data-wrap-style=grid-row: span 2/span 2;-->

<!--rehype:-->
```markdown
Expand Down Expand Up @@ -166,7 +166,7 @@ console.log("This is a block code")
```

### 表格
<!--rehype:data-warp-style=grid-column: span 2/span 2;-->
<!--rehype:data-wrap-style=grid-column: span 2/span 2;-->

<!--rehype:-->
```markdown
Expand All @@ -188,7 +188,7 @@ console.log("This is a block code")
Markdown 表格生成器:[tableconvert.com](https://tableconvert.com/)

### 图片
<!--rehype:data-warp-style=grid-column: span 2/span 2;-->
<!--rehype:data-wrap-style=grid-column: span 2/span 2;-->

<!--rehype:-->
```markdown
Expand Down
2 changes: 1 addition & 1 deletion docs/npm.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ npm 备忘清单


### 杂项功能
<!--rehype:warp-class=col-span-2-->
<!--rehype:wrap-class=col-span-2-->

将某人添加为所有者

Expand Down
Loading

0 comments on commit 7ab9ddf

Please sign in to comment.