1.3.0 • Published 1 year ago
stubb v1.3.0
stubb
Stub dist link your project based on package.json during the development.
Install
npm install --save-dev stubbUsage
In the 'package.json' of the package in need:
{
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"scripts": {
"stub": "stubb"
}
}Generate folders and files based on the main, module, types and exports in package.json.
Default project structure:
|-- package
|-- dist/
|-- index.cjs
|-- index.mjs
|-- index.d.ts
|-- src/
|-- index.ts
|-- package.jsonAdd entry in the exports field to modify the entry file:
{
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"entry": "./test/index.ts"
}
},
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"scripts": {
"stub": "stubb"
}
}if exposing multiple entry points:
{
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
},
"./plugins": {
"types": "./dist/plugins.d.ts",
"import": "./dist/plugins.mjs",
"require": "./dist/plugins.cjs"
}
},
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"scripts": {
"stub": "stubb"
}
}