1.0.4 • Published 3 years ago
countcores v1.0.4
Gets the number of cores of machine
Summary
- Write your library in
index.ts npm run build: Generate typesindex.d.tsand libraryindex.jsvia typescript tsc intodist/folder- Create a story for your library like
trial1.stories.ts, importing fromindex.jsto demo it on localhost:6006 npm pubPackage and publishdist/folder
How to Use
npm install countcoresimport numcores from 'countcores';
console.log(numcores)publishing npm package
- package.json
- Add
"main": "dist/index.js",- Published module entry point is here - Add
"files" : ["dist","README.md"],- Only publishes files in dist and README.md to npm - Add
"types" : "dist/index.d.ts"- Detect types entry point
- Add
- tsconfig.json
- Add
"outDir": "./dist",- Output to dist folder - Add
"exclude": ["dist",...]- Do not typecheck generated files - Add
"declaration": true,- generate index.d.ts - Add
"typeRoots": ["@types", "node_modules/@types"],- detect your own custom types folder@typesmkdir @typesand addglobal.d.ts
- Add
Typedoc
- Note: no need to install typedoc since the plugins with install the appropriate version
npm install typedoc-plugin-missing-exports
npm install --save-dev typedoc-umlclassAdd these script to package.json
"scripts": {
"build": "npm run clean && tsc",
"clean": "tsc --build --clean",
"cleandoc": "rm -r docs",
"doc": "typedoc --entryPointStrategy resolve .",
"test": "echo \"Error: no test specified\" && exit 1"
},npm run build
npm run cleandoc
npm run docStorybook
trial.stores.tsis the story that uses our demo library.
npx storybook init
# select HTML
export NODE_OPTIONS=--openssl-legacy-provider
npm storybook start
#visit localhost:6006Deploy docs
Choose to deploy w/ github action as static page template
Modify path: '.' ==> path: './docs'
with:
# Upload entire repository
path: './docs'