Comments (1)
This sounds like a great idea and as it turns out klap
already has a JS api. It is largely undocumented though, since the primary use for klap was from command line.
For the basic JS, I think something like this should work: (untested code below)
const { klap } = require("klap");
const isProd = process.env.NODE_ENV === "production";
const command = isProd ? "build" : "start";
const pkg = { name: "my-project-name", version: "5.4.0", };
(async () => {
await klap(command, pkg);
})();
It would be great to formalize this API and document it to be able to create a middleware like you noted above. However, the actual middleware should be outside the core for klap
to keep the scope limited for this project.
from klap.
Related Issues (20)
- Klap can't find typescript on init HOT 11
- Custom babel config HOT 4
- Have an option to remove index.js from public directory HOT 6
- Unexpected token HOT 5
- Unhandled child_process exception: init.js HOT 1
- klap adds LICENSE even if LICENSE.md exists HOT 7
- Build development environment? HOT 2
- Make prettier config optional HOT 2
- Question: ncc vs rollup HOT 9
- klap vs microbundle? HOT 7
- Enable support for the experimental syntax 'importAssertions' HOT 3
- No way to override the options that are set by "defaultOptions" HOT 1
- Bundle async function expression used as an IIFE HOT 3
- Bundle and minify es6 modules breaks the named exports HOT 6
- Dynamic imports generates error HOT 1
- Let the user add more Rollup plugins and configure them differently HOT 6
- Support Dev Expressions HOT 1
- Strange import behaviour on importing external dependency HOT 4
- Bundle external dependency instead of treating it as external HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from klap.