├── .github └── workflows │ └── deploy-blog.yml ├── .gitignore ├── README.md ├── code ├── scripts │ └── ng.sh └── test-demo │ ├── karma.conf.js │ ├── package.json │ └── src │ ├── add.js │ └── add.spec.js ├── docs ├── .vuepress │ └── config.js └── README.md ├── package-lock.json └── package.json /.github/workflows/deploy-blog.yml: -------------------------------------------------------------------------------- 1 | name: GitHub Actions blog # 自动部署的名称 2 | on: 3 | push: 4 | branches: 5 | - master 6 | jobs: 7 | build-and-deploy: 8 | runs-on: ubuntu-latest # 运行环境,告诉它运行在什么环境 9 | steps: # 步骤 10 | # 第一步:下载源码(CI/CD拉取代码到自己的本地) 11 | - name: Checkout 12 | uses: actions/checkout@master 13 | # 第二步:打包构建 14 | - name: Build and Deploy 15 | uses: JamesIves/github-pages-deploy-action@master 16 | env: 17 | ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} 18 | BRANCH: gh-pages 19 | FOLDER: docs/.vuepress/dist 20 | BUILD_SCRIPT: npm install && npm run build -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | 3 | # .vuepress 4 | /docs/.vuepress/dist 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Blog 2 | 3 | ## 2023年 4 | 5 | 1. [从零构建一个 Monorepo 项目工程](https://github.com/jiayisheji/blog/issues/64) 6 | 2. [Angular 自定义表单控件](https://github.com/jiayisheji/blog/issues/66) 7 | 8 | ## 2022年 9 | 10 | 1. [第一次使用Typeorm的挖坑总结](https://github.com/jiayisheji/blog/issues/54) 11 | 12 | ## 2021年 13 | 14 | 1. [TypeScript 指南](https://github.com/jiayisheji/blog/issues/44) 15 | 2. [TypeScript 实现依赖注入](https://github.com/jiayisheji/blog/issues/45) 16 | 3. [学习 TypeScript 中的内置实用工具类型](https://github.com/jiayisheji/blog/issues/46) 17 | 18 | ## 2020年 19 | 20 | 1. [在NestJS中使用Typegoose分享](https://github.com/jiayisheji/blog/issues/30) 21 | 2. [JavaScript中最常用的几种数组操作](https://github.com/jiayisheji/blog/issues/31) 22 | 3. [Angular 事件绑定扩展增强 - Angular Events Plugin](https://github.com/jiayisheji/blog/issues/33) 23 | 24 | ## 2019年 25 | 26 | 1. [一招让Angular-cli速度增强](https://github.com/jiayisheji/blog/issues/22) 27 | 2. [让我们用Nestjs来重写一个CNode(中)](https://github.com/jiayisheji/blog/issues/19) 28 | 3. [Angular常见错误及解决方案【持续更新中】](https://github.com/jiayisheji/blog/issues/24) 29 | 4. [使用angular schematics快速生成代码](https://github.com/jiayisheji/blog/issues/28) 30 | 5. [类与数据结构](https://github.com/jiayisheji/blog/issues/29) 31 | 32 | ## 2018年 33 | 34 | 1. [学习Angular从入门到放弃](https://github.com/jiayisheji/blog/issues/16) 35 | 2. [使用 Angular6 创建一个 CRUD 应用程序--Todolist](https://github.com/jiayisheji/blog/issues/17) 36 | 3. [让我们用Nestjs来重写一个CNode(上)](https://github.com/jiayisheji/blog/issues/18) 37 | 38 | ## 2017年 39 | 40 | 1. [2017开博客了](https://github.com/jiayisheji/blog/issues/1) 41 | 2. [设计模式分类(创建型模式、结构型模式、行为模式)](https://github.com/jiayisheji/blog/issues/2) 42 | 3. [npm常用你应该懂的使用技巧](https://github.com/jiayisheji/blog/issues/5) 43 | 4. [10分钟教你撸一个nodejs爬虫系统](https://github.com/jiayisheji/blog/issues/7) 44 | 5. [RxJS学习笔记](https://github.com/jiayisheji/blog/issues/9) 45 | 6. [Karma+Jasmine+istanbul+webpack自动化单元测试](https://github.com/jiayisheji/blog/issues/10) 46 | 7. [GET新技能之Git commit message](https://github.com/jiayisheji/blog/issues/12) 47 | 8. [愉快使用Angular-cli构建项目](https://github.com/jiayisheji/blog/issues/13) 48 | -------------------------------------------------------------------------------- /code/scripts/ng.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") 3 | case `uname` in 4 | *CYGWIN*) basedir=`cygpath -w "$basedir"`;; 5 | esac 6 | if [ -x "$basedir/node" ]; then 7 | "$basedir/node" --max_old_space_size=8192 "./node_modules/@angular/cli/bin/ng" "$@" 8 | ret=$? 9 | else 10 | node --max_old_space_size=8192 "./node_modules/@angular/cli/bin/ng" "$@" 11 | ret=$? 12 | fi 13 | exit $ret 14 | -------------------------------------------------------------------------------- /code/test-demo/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration 2 | // Generated on Sat Aug 26 2017 20:31:19 GMT+0800 (中国标准时间) 3 | 4 | module.exports = function(config) { 5 | config.set({ 6 | // 将用于解析所有模式的基本路径(例如,文件,排除)ps: 修改它会影响files和exclude路径,没有特殊需求默认就行。 7 | basePath: '', 8 | // 选择测试框架我们选的‘jasmine’ 可以在这里去找更多相关的框架 https://npmjs.org/browse/keyword/karma-adapter 9 | frameworks: ['jasmine'], 10 | // 在浏览器中加载的匹配的文件列表 就是我们的第4步 11 | files: [ 12 | 'src/**/*.spec.js' 13 | ], 14 | // 要排除的文件列表 就是我们的第5步 15 | exclude: [], 16 | // 在将其提供给浏览器之前,预处理匹配的文件, 可用的预处理器 https://npmjs.org/browse/keyword/karma-preprocessor 17 | // 测试文件需要处理一下,各框架和库都不一样,可以在链接中找到你对应的框架的处理器 18 | // key是文件夹路径,也是就files的路径,value是一个数组,也就是预处理器集合 19 | preprocessors: { 20 | 'src/**/*.spec.js': ['webpack', 'sourcemap'] 21 | }, 22 | // webpack配置 不需要入口(entry)和输出(output)配置 23 | webpack: { 24 | devtool: 'inline-source-map', 25 | module: { 26 | rules: [{ 27 | test: /\.js$/, 28 | use: { 29 | loader: 'istanbul-instrumenter-loader', 30 | options: { esModules: true } 31 | }, 32 | enforce: 'pre', 33 | exclude: /node_modules|\.spec\.js$/, 34 | }, { 35 | test: /\.js$/, 36 | use: { 37 | loader: 'babel-loader', 38 | options: { 39 | presets: ['es2015'], 40 | plugins: ['istanbul'] 41 | } 42 | }, 43 | exclude: /node_modules/ 44 | }] 45 | } 46 | }, 47 | // 依赖插件 48 | plugins: [ 49 | 'karma-chrome-launcher', 50 | 'karma-jasmine', 51 | 'karma-webpack', 52 | 'karma-sourcemap-loader', 53 | 'karma-coverage-istanbul-reporter' 54 | ], 55 | // 怎么显示测试结果 测试结果显示插件https://npmjs.org/browse/keyword/karma-reporter 56 | reporters: ['coverage-istanbul'], 57 | // 配置覆盖率报告的查看方式配置 58 | coverageIstanbulReporter: { 59 | // 可以用什么形式展示 支持以下格式:clover、cobertura、html、json-summary、json、lcov、lcovonly、none、teamcity、text-lcov、text-summary、text 60 | // 可以看连接 : https://github.com/istanbuljs/istanbul-reports/tree/590e6b0089f67b723a1fdf57bc7ccc080ff189d7/lib 61 | reports: ['html', 'text-summary'], 62 | // 结果存放的位置 63 | dir: 'coverage/', 64 | // 如果使用webpack和预加载器,可以绕过webpack打破源路径 65 | fixWebpackSourcePaths: true, 66 | // 停止输出消息,如`File [$ {filename}]忽略,没有任何东西可以映射 67 | skipFilesWithNoCoverage: true, 68 | // 大多数记录接受额外的配置选项。 你可以通过`report-config`选项传递这些 69 | 'report-config': { 70 | // 配置html 71 | html: { 72 | // 输出到 ./coverage/html 73 | subdir: 'html' 74 | } 75 | } 76 | }, 77 | // 运行的服务端口,可以自己修改 78 | port: 9876, 79 | // 在输出中启用/禁用颜色(记录(reporters)和日志(logs)) 肯定需要看到运行的结果,不然出错了也不好调试 80 | colors: true, 81 | // 显示日志记录的级别 (默认就好) 82 | // 可能的值: config.LOG_DISABLE (禁用) || config.LOG_ERROR (错误) || config.LOG_WARN (警告)|| config.LOG_INFO (信息)|| config.LOG_DEBUG (调试) 83 | logLevel: config.LOG_INFO, 84 | // 每当任何测试文件更改时,启用/禁用监听文件并执行测试 这就是第6步 85 | autoWatch: true, 86 | // 可以启动的浏览器列表 需要去下载对应的启动插件 https://npmjs.org/browse/keyword/karma-launcher 87 | browsers: ['Chrome'], 88 | // 持续集成模式 如果是,Karma启动浏览器,运行测试并退出 默认就好,设true你会后悔的。 89 | singleRun: false, 90 | // 并发级别 可以同时启动多少浏览器 默认无限大 91 | concurrency: Infinity 92 | }) 93 | } 94 | -------------------------------------------------------------------------------- /code/test-demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-demo", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "unit": "karma start" 9 | }, 10 | "keywords": [], 11 | "author": { 12 | "name": "jiayi", 13 | "url": "https://github.com/jiayisheji" 14 | }, 15 | "homepage": "https://github.com/jiayisheji/blog", 16 | "license": "ISC", 17 | "devDependencies": { 18 | "babel-core": "^6.26.0", 19 | "babel-loader": "^7.1.2", 20 | "babel-plugin-istanbul": "^4.1.4", 21 | "babel-preset-es2015": "^6.24.1", 22 | "istanbul-instrumenter-loader": "^3.0.0", 23 | "jasmine-core": "^2.8.0", 24 | "karma": "^1.7.0", 25 | "karma-chrome-launcher": "^2.2.0", 26 | "karma-coverage-istanbul-reporter": "^1.3.0", 27 | "karma-jasmine": "^1.1.0", 28 | "karma-sourcemap-loader": "^0.3.7", 29 | "karma-webpack": "^2.0.4", 30 | "webpack": "^3.5.5" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /code/test-demo/src/add.js: -------------------------------------------------------------------------------- 1 | export default function add(num1, num2) { 2 | if (num1 === undefined) num1 = 0; 3 | if (num2 === undefined) num2 = 0; 4 | return num1 + num2; 5 | } 6 | -------------------------------------------------------------------------------- /code/test-demo/src/add.spec.js: -------------------------------------------------------------------------------- 1 | import add from './add'; 2 | 3 | describe('第一个测试套件', function() { 4 | it('第一个测试用例: 1+1 === 2', function() { 5 | expect(1 + 1).toBe(2); 6 | }); 7 | it('第二个测试用例: 1+1 === 2', function() { 8 | expect(1 + 1).toBe(2); 9 | }); 10 | }); 11 | 12 | describe('第二个测试套件', function() { 13 | it('第一个测试用例: 1+1 === 2', function() { 14 | expect(add(1, 1)).toBe(2); 15 | }); 16 | it('第二个测试用例: 1+1 === 2', function() { 17 | expect(add()).toBe(0); 18 | }); 19 | it('第二个测试用例: 1+1 === 2', function() { 20 | expect(add(1)).toBe(1); 21 | }); 22 | it('第二个测试用例: 1+1 === 2', function() { 23 | expect(add(undefined, 1)).toBe(2); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /docs/.vuepress/config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | base: "/blog/", 3 | title: "Hello VuePress", 4 | description: "Just playing around", 5 | }; 6 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Blog 2 | 3 | ## 2017年 4 | 5 | 1. [2017开博客了](https://github.com/jiayisheji/blog/issues/1) 6 | 2. [设计模式分类(创建型模式、结构型模式、行为模式)](https://github.com/jiayisheji/blog/issues/2) 7 | 3. [npm常用你应该懂的使用技巧](https://github.com/jiayisheji/blog/issues/5) 8 | 4. [10分钟教你撸一个nodejs爬虫系统](https://github.com/jiayisheji/blog/issues/7) 9 | 5. [RxJS学习笔记](https://github.com/jiayisheji/blog/issues/9) 10 | 6. [Karma+Jasmine+istanbul+webpack自动化单元测试](https://github.com/jiayisheji/blog/issues/10) 11 | 7. [GET新技能之Git commit message](https://github.com/jiayisheji/blog/issues/12) 12 | 8. [愉快使用Angular-cli构建项目](https://github.com/jiayisheji/blog/issues/13) 13 | 14 | ## 2018年 15 | 16 | 1. [学习Angular从入门到放弃](https://github.com/jiayisheji/blog/issues/16) 17 | 2. [使用 Angular6 创建一个 CRUD 应用程序--Todolist](https://github.com/jiayisheji/blog/issues/17) 18 | 3. [让我们用Nestjs来重写一个CNode(上)](https://github.com/jiayisheji/blog/issues/18) 19 | 20 | ## 2019年 21 | 22 | 1. [一招让Angular-cli速度增强](https://github.com/jiayisheji/blog/issues/22) 23 | 2. [让我们用Nestjs来重写一个CNode(中)](https://github.com/jiayisheji/blog/issues/19) 24 | 3. [Angular常见错误及解决方案【持续更新中】](https://github.com/jiayisheji/blog/issues/24) 25 | 4. [使用angular schematics快速生成代码](https://github.com/jiayisheji/blog/issues/28) 26 | 5. [类与数据结构](https://github.com/jiayisheji/blog/issues/29) 27 | 28 | ## 2020年 29 | 30 | 1. [在NestJS中使用Typegoose分享](https://github.com/jiayisheji/blog/issues/30) 31 | 2. [JavaScript中最常用的几种数组操作](https://github.com/jiayisheji/blog/issues/31) 32 | 3. [Angular 事件绑定扩展增强 - Angular Events Plugin](https://github.com/jiayisheji/blog/issues/33) 33 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "blog", 3 | "version": "1.0.0", 4 | "description": "Jiayi blog", 5 | "keywords": [ 6 | "js", 7 | "blog" 8 | ], 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/jiayisheji/blog" 12 | }, 13 | "main": "index.js", 14 | "scripts": { 15 | "dev": "vuepress dev docs", 16 | "build": "vuepress build docs" 17 | }, 18 | "author": "jiayi", 19 | "license": "ISC", 20 | "devDependencies": { 21 | "vuepress": "^1.8.2" 22 | } 23 | } 24 | --------------------------------------------------------------------------------