Gathering detailed insights and metrics for @pectin/babelrc
Gathering detailed insights and metrics for @pectin/babelrc
Gathering detailed insights and metrics for @pectin/babelrc
Gathering detailed insights and metrics for @pectin/babelrc
npm install @pectin/babelrc
rollup-config-pectin@4.0.4
Published on 22 May 2020
pectin@3.6.2
Published on 22 May 2020
@pectin/api@4.0.6
Published on 22 May 2020
@pectin/core@4.0.4
Published on 22 May 2020
@pectin/api@4.0.5
Published on 17 Oct 2019
pectin@3.6.1
Published on 17 Oct 2019
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
58 Stars
243 Commits
7 Forks
1 Watching
25 Branches
5 Contributors
Updated on 26 Apr 2024
TypeScript (97.13%)
JavaScript (2.87%)
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
-68.8%
5
Compared to previous week
Last month
33.3%
32
Compared to previous month
Last year
-65.5%
357
Compared to previous year
5
1
Rollup-related tools for incremental transpilation of packages in Lerna-based monorepos
The easiest way to start using Pectin is to install the CLI and run it during an npm lifecycle, such as "prerelease"
:
1npm i -D pectin
In your monorepo's root package.json
(aka "manifest"):
1{ 2 "scripts": { 3 "clean": "git clean -fdx packages", 4 "prerelease": "npm run clean && pectin", 5 "release": "lerna publish", 6 "lint": "eslint .", 7 "pretest": "pectin && npm run lint", 8 "test": "jest" 9 } 10}
Configured this way, you can always ensure your packages have the latest build output whenever anyone executes npm run release
or incrementally build recent changes before npm test
.
Once installed locally, you can experiment with the CLI via npx
:
1npx pectin -h
To watch packages and rebuild on source change, pass -w
, just like Rollup's CLI:
1npx pectin -w
One advantage of a Lerna monorepo is that you can reduce the amount of repetition between modules by running all development-related tasks (build, lint, test, and so on) from the root of the repository instead of each package one-by-one. This works fine for tools that are capable of running over many packages simultaneously without breaking a sweat, like jest
and eslint
.
Running Rollup builds over many different package roots, however, is a much trickier business. Pectin was built to facilitate running Rollup builds for all packages in a monorepo, with special consideration for unique monorepo circumstances such as incremental builds, npm lifecycle behavior, and per-package options.
For example, it isn't always the case that every package in a monorepo actually needs to be rebuilt every time the build is run. Consider running jest --watch
in a monorepo with 15 packages, but you're only working on one. The naïve approach finds all the packages and passes all of them to Rollup, which means Rollup builds for every package. Pectin optimizes this by testing the "freshness" of the built output against the source tree and only building when a file in the source tree has a more recent change (a higher mtime
, for filesystem wizards).
Pectin's CLI was written to seamlessly wrap rollup
. It helps avoid, among other things, Rollup's CLI emitting a warning and exiting non-zero when you pass an empty array (that is, no changes since the last build) to Rollup via the default export of rollup.config.js
. Pectin's CLI supports all options supported by Rollup's CLI.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
@pectin/api
@pectin/babelrc
@pectin/core
pectin
rollup-config-pectin
rollup-plugin-main-entry
rollup-plugin-subpath-externals
When calling the pectin
CLI, there is no support for adding plugins beyond those already included.
However, as pectin
is mostly just a fancy wrapper around the rollup
CLI, it is possible to generate Rollup config programmatically and simulate the "lazy build" behavior of pectin
.
First, create a rollup.config.js
in the root of your monorepo:
1import * as path from 'path'; 2import { findConfigs } from '@pectin/api'; 3import visualizer from 'rollup-plugin-visualizer'; 4 5export default findConfigs().then(configs => 6 configs.map(cfg => { 7 const { 8 // format can be 'cjs', 'esm', or 'umd' 9 format, 10 // absolute directory from pkg.main, 11 // e.g. '<root>/packages/<pkg>/dist' 12 dir: outputDir, 13 } = cfg.output[0]; 14 15 // plugins are assigned per-format, as certain 16 // formats require different plugin configuration 17 if (format === 'esm') { 18 cfg.plugins.push( 19 visualizer({ 20 filename: path.join(outputDir, 'stats.html'), 21 }) 22 ); 23 } 24 25 return cfg; 26 }) 27);
Then change any references to pectin
in your npm scripts to rollup -c
:
1{ 2 "scripts": { 3 "build": "rollup -c || echo 'no changed packages to build, probably?'", 4 "watch": "rollup -c -w" 5 } 6}
The caveat highlighted by the ||
alternation above is that rollup
will complain if the array generated by findConfigs()
is empty, and exits non-zero. Unless caught by the ||
, npm run build
would exit with an error.
If you have a package that you do not want Pectin to build, you can add the following to its package.json
:
1"rollup": { 2 "skip": true 3}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 1/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
64 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More