Angular-组件库-NGNEST-源码解析项目结构
前言从本文开始将逐步介绍 NG-NEST UI 库的项目源码结构和组件是如何设计制作的。 环境准备通过以下命令来下载 ng-nest 源码: $ git clone https://github.com/NG-NEST/ng-nest.git$ cd ng-nest$ npm install核心目录介绍| 文件夹名称 | 说明 | | docs | 非组件文档,项目简介、快速上手、教程等 || lib | 组件文件夹,包含框架组件源码 || scripts | ts 脚本,主要用来生成文档页面组件以及相关的路由配置 || src | 文档项目,生成的文档会自动放到 src/main/docs 下 |package.json 文件中的 scripts 说明..."scripts": { "ng": "ng", "postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points", // 加快 ngcc 编译 "start": "ng serve", // 启动文档项目 "start:en": "ng serve --configuration=en", "start:zh": "ng serve --configuration=zh", "build": "node --max_old_space_size=81920 ./node_modules/@angular/cli/bin/ng build --prod ", // 打包文档项目 "build:en": "ng build --prod --configuration=production-en", "build:zh": "ng build --prod --configuration=production-zh", "build:ng-nest-ui": "node --max_old_space_size=81920 ./node_modules/@angular/cli/bin/ng build ng-nest-ui --prod && npm run build:scss", // 打包组件库并拷贝相关scss样式文件 "build:docs": "npm run build:scripts && node ./scripts/build/generate/docs", // 生成文档页面 "build:scripts": "tsc -p scripts", // ts 脚本编译成 js "build:scss": "cpx ./lib/ng-nest/ui/style/**/* ./dist/ng-nest/ui/style", // 拷贝组件库样式文件 "test": "ng test ng-nest-site", // 测试文档项目 "test:ng-nest-ui": "ng test ng-nest-ui", // 组件测试,通过此处开发测试单个组件 "lint": "ng lint", "e2e": "ng e2e", "extract": "ng xi18n --output-path=locale" // 文档项目的本地化配置},...组件结构我们以 Button 组件来介绍一下组件的结构,所有组件的结构都是遵循此格式。 ...