js lab2017_Андрей Кучеренко _Разработка мультипакетных...
TRANSCRIPT
Test Suites: 55 passed, 55 totalTests: 303 passed, 303 totalSnapshots: 0 totalTime: 5.131s
Test Suites: 458 passed, 458 totalTests: 3007 passed, 3007 totalSnapshots: 0 totalTime: 90.131s
|----------|| % Lines ||----------|| 100|
Было СталоUnit Tests
Coverage|----------|| % Lines ||----------|| 89.7 |
$ tslint 'packages/*/{src/**/,test/**/}*.ts{,x}' --force Done in 0.47s.
Found 0 exact clones with 0 duplicated lines in 0 files0.0% (0 lines) duplicated lines out of 2302 total lines of code.Done in 0.18s.
Took 2 min 56 sec on Jenkins
Linters
Duplications
CI
$ tslint 'packages/*/{src/**/,test/**/}*Done in 19.47s.
Found 69 exact clones with 1467 duplicated 4.97% (1467 lines) duplicated lines out Done in 2.75s.
Took 10 min 47 sec on Jenkins
Проблемы NPMТяжело управлять всеми пакетами одновременноТяжело следить за версиямиТяжело уследить за зависимостями
Возможности LernaInit projectBootstrap projectPublish projectManage versionsnpm link internal packages
├── lerna.json├── package.json└── packages ├── awesome-component │ └── package.json ├── awesome-module │ └── package.json ├── awesome-package │ └── package.json └── awesome-service └── package.json
{ "lerna": "2.0.0-beta.38", "packages": [ "packages/*" ], "version": "0.0.1"}
➜ awesome-lerna git:(master) ✗ lerna initLerna v2.0.0-beta.38Updating package.json.Updating lerna.json.Successfully created Lerna files
➜ awesome-lerna git:(master) ✗ lerna bootstrap Lerna v2.0.0-beta.38Bootstrapping 4 packagesPreinstalling packagesSymlinking packages and binariesPostinstalling packagesPrepublishing packages
➜ awesome-lerna git:(master) ✗ lerna publishLerna v2.0.0-beta.38Current version: 0.0.1Checking for updated packages...Comparing with: v0.0.1
➜ awesome-lerna git:(master) ✗ lerna run testLerna v2.0.0-beta.38
Successfully ran npm script 'test' in packages:- awesome-component- awesome-module- awesome-package- awesome-service
➜ awesome-lerna git:(master) ✗ lerna exec -- rm -rf ./node_modules Lerna v2.0.0-beta.38
Проблемы LernaЗависимости с разными версиями у пакетовnpm link и все, что с этим связаноМного node_modues
Возможности @knitjsВсе зависимости в одном package.jsonНет node_modules в каждом репозиторииПоказывает неиспользуемые и неустановленыезависимости
✗ create-knit-app lets-start-knitting
info creating a new knit app in lets-start-knitting
success finished creating your project!
info start exploring by running:
cd lets-start-knitting yarn start
info read more about what you can do with knit: info https://github.com/knitjs/knit
➜ lets-start-knitting git:(master) ✗ tree.├── modules│ └── node_modules│ ├── @myscope│ │ ├── body-component│ │ │ ├── help.png│ │ │ ├── index.js│ │ │ ├── list_missing.png│ │ │ ├── list.png│ │ │ ├── package.json│ │ │ ├── validate_missing.png│ │ │ ├── validate_unused.png│ │ │ └── valid.png│ │ └── header-component│ │ ├── index.js│ │ ├── knit_logo.svg│ │ └── package.json│ ├── page-component│ │ ├── index.js│ │ ├── package.json│ │ └── __tests__│ │ └── page-component.test.js│ └── webpack_entry│ ├── index.html│ ├── index.js│ ├── package.json│ └── README.md├── node_modules├── package.json└── yarn.lock
➜ lets-start-knitting git:(master) ✗ tail modules/node_modules/@myscope/header-component/package.json { "name": "@myscope/header-component", "version": "0.0.0", "browser": true}
➜ lets-start-knitting git:(master) ✗ yarn knit buildyarn knit v0.21.3$ knit build ✔ discovering modules ✔ validating package.json ✔ discovering modules ✔ validating package.json ✔ check for missing dependencies ✔ check for unused dependencies ✔ reading package.json of modules ✔ getting last tag ✔ determining updated modules since last release ✔ rebuilding project ✔ rebuilding updated modules ✔ @myscope/body-component ✔ @myscope/header-component ✔ page-componentDone in 14.92s.
➜ lets-start-knitting git:(master) ✗ yarn knit help yarn knit v0.21.3$ knit helpCommands: list [modules...] list modules and their dependencies validate validate modules for release server start a dev server schema update graphql schema version <version> version updated modules build build updated modules stitch update the package.json of all modules with knitted dependencies and project meta data publish publish updated modules release <version> run full release pipeline on updated modules. version > build > knit > publish > push
➜ lets-start-knitting git:(master) ✗ yarn knit listyarn knit v0.21.3$ knit list ✔ discovering modules ✔ reading package.json of modules
info showing dependencies for 3 modules
- @myscope/body-component (0.0.0) [2 dependencies]- @myscope/header-component (0.0.0) [2 dependencies]- page-component (0.0.0) [4 dependencies]Done in 0.79s.
➜ lets-start-knitting git:(master) ✗ yarn knit validateyarn knit v0.21.3$ knit validate ✔ looking for `node_modules` in .*ignore files ✔ discovering modules ✔ validating package.json ✔ check for missing dependencies ✔ check for unused dependenciesDone in 0.87s.
Проблемы @knitjsРаботает только с babel, не поддерживаетtypescript, coffeescript, etc.Тяжело менять под свои нуждыРабота с версиями только в одном стилеНе очень большое комьюнити