presetter-preset-rollup v7.1.0
šš» A collection of opinionated configurations for a building a code bundle via rollup for presetter
ā¢ā āQuick Startā āā¢ā āProject Structureā āā¢ā āCustomizationā āā¢ā āScriptsā āā¢
Features
presetter-preset-rollup is an opinionated preset for you to setup rollup in a fraction of time you usually take via presetter.
- šļø Rollup 4
- 2ļøā£ Dual CJS and ESM modules export by default
- š Common rollup packages included as one single bundle
@rollup/plugin-commonjs
@rollup/plugin-graphql
@rollup/plugin-image
@rollup/plugin-json
@rollup/plugin-typescript
@rollup/plugin-yaml
rollup
<~ of course including rollup itselfrollup-plugin-postcss
rollup-plugin-tsconfig-paths
rollup-plugin-visualizer
Quick Start
To kickstart a library, set the following in your package.json
and follow the guide below.
{
"main": "lib/index.js",
"module": "lib/index.mjs",
"types": "lib/index.d.ts",
"exports": {
"require": "./lib/index.js",
"import": "./lib/index.mjs"
},
"scripts": {
"prepare": "run prepare",
"build": "run build",
"clean": "run clean",
"test": "run test",
"watch": "run watch",
"coverage": "run coverage"
}
}
FULL DOCUMENTATION IS AVAILABLE HERE
1. Bootstrap your project with presetter-preset-web
On your project root, create a presetter.config.ts
file with the following content:
// presetter.config.ts
import { preset } from 'presetter';
import essentials from 'presetter-preset-essentials';
import rollup from 'presetter-preset-rollup';
export default preset('project name', {
// NOTE
// you may need an additional preset like presetter-preset-essentials for typescript support and other basic toolings
extends: [essentials, rollup],
override: {
// override the configuration here
},
});
Then, install your project as usual with npm install
or any package manager you prefer.
2. Develop and run life cycle scripts provided by the preset
At this point, all development packages specified in the preset are installed, and now you can try to run some example life cycle scripts (e.g. run prepare).
Project Structure
After installation, your project file structure should resemble the following or with more configuration files if you also installed other presets such as presetter-preset-esm
.
Implement your business logic under source
and prepare tests under spec
.
TIPS You can always change the source directory to other (e.g. src) by setting the source
variable in presetter.config.ts
. See the customization section below for more details.
(root)
āā .git
āā presetter.config.ts
āā node_modules
āā source
ā āā <folders>
ā āā index.ts
ā āā (auxiliary).ts
āā spec
ā āā *.spec.ts
āā package.json
āā rollup.config.ts
Customization
By default, this preset exports a handy configuration for a typescript project.
You can further customize (either extending or replacing) the configuration by specifying the changes in the config file presetter.config.ts
.
Script Template Summary
run build
: Transpile source code from typescript and replace any mapped pathsrun clean
: Clean up any previously transpiled coderun develop -- <file path>
: Create a service that run the specified file whenever the source has changedrun test
: Run all testsrun watch
: Rerun all tests whenever the source has changerun coverage
: Run all test with coverage reportrun release
: Bump the version and automatically generate a change logrun release -- --prerelease <tag>
: Release with a prerelease tag
12 months ago
7 months ago
8 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago