1.0.3 • Published 5 years ago
osequi-test-lerna-react-p2 v1.0.3
test-lerna-react
Playin
Init
- init independent
- "npmClient": "yarn",
- ts / tsconfig
- lerna create p1
- lerna run tsc
- publish:
- unique package names
- private: false
- npm config set access public
- lerna publish
Basics
- l add lodash --scope=osequi-test-lerna-react-p1
- lerna create p2
- add package.json/scripts: tsc
- publish
- l add osequi-test-lerna-react-p1@1.0.4 --scope=osequi-test-lerna-react-p2
- import p1 from "osequi-test-lerna-react-p1";
- p2.name: "Zolika +" + p1.name,
- add jest
- yarn ts-jest config:init
- remove tests folders
- add p2.test.ts inside /src
Unpublished packages
- create p3
- l add osequi-test-lerna-react-p3 --scope=osequi-test-lerna-react-p2
importing p3 into p2 will throw an errorIT WAS A COPY/PASTE ERROReven after publishing p3 p2 will throw an error: error TS2307: Cannot find module 'osequi-test-lerna-react-p3' or its corresponding type declarations.create p4
- y tsc
- l add osequi-test-lerna-react-p4 --scope=osequi-test-lerna-react-p2
- y tsc
- all works fine!
Folders
- theme, hooks, components, apps
- l bootstrap
- y tsc
Watch
- "tsc": "lerna exec --parallel -- tsc --watch",
Components
- https://blog.logrocket.com/the-complete-guide-to-publishing-a-react-package-to-npm/
- https://dev.to/debojitroy/react-project-idea-to-production-part-two-setting-up-a-component-library-41fk
- https://github.com/osequi/react-lerna
- l create Button
- l add react -D --scope=osequi-test-lerna-react-button, l add react-dom -D --scope=osequi-test-lerna-react-button, l add react -P --scope=osequi-test-lerna-react-button, l add react-dom -P --scope=osequi-test-lerna-react-button
- Button.tsx
- tsconfig.json : "jsx": "react", "esModuleInterop": true
- Button packages.json
"@babel/cli": "^7.12.1",
...
"build": "babel src --out-dir lib --copy-files --source-maps --extensions \".ts,.tsx,.js,.jsx,.mjs\""
- Button .babelrc
{
"presets": [
"@babel/preset-typescript",
[
"@babel/preset-env",
{
"useBuiltIns": "entry",
"corejs": "3",
"modules": false
}
],
"@babel/preset-react"
]
}
- global package.json: "build": "lerna exec --parallel -- yarn build"
- Button.test.tsx