Libraries
In LemmeBuild, you can enhance your workflows by importing and using any NPM package or Node.js modules directly within your scripts. There's no need to prefix imports with npm:
, making it simpler and cleaner to integrate external libraries into your workflows. This gives you the flexibility to tap into a wide range of functionalities available in the Node.js ecosystem.
Usage
- Import NPM Packages: You can easily import any NPM package by simply calling it directly in your scripts, without the
npm:
prefix. This helps streamline your code and maintain clarity.
import collect from 'collect.js';
export const data = collect([12, 30]).sum();
- Version Control: Always specify a version number when needed to avoid breaking changes, especially with packages that may update frequently.
import { createId } from '@paralleldrive/cuid2@v2';
- Node.js Modules: You can also leverage core Node.js modules, which provide powerful tools for handling encryption, file management, path resolution, and more.
import { createHash } from 'crypto';
import { resolve } from 'path';
Best Practices
- Versioning: When using external libraries, always specify the version to maintain stability in your workflows. This ensures that future updates to the package don’t introduce breaking changes to your scripts.
- Core Node Modules: Make the most of built-in Node.js modules. These modules, such as
crypto
,fs
, andpath
, can handle essential tasks like encryption, file handling, and path resolution within your workflow, offering powerful capabilities without the need for external packages.
Why Use Libraries in LemmeBuild?
Using libraries in LemmeBuild unlocks endless possibilities for your workflows. Whether you’re automating complex tasks, integrating with external APIs, or managing data, NPM packages and Node.js modules give you the tools to extend functionality easily. With no need to prefix with npm:
, importing and using libraries has never been easier.
With Libraries in LemmeBuild, you can supercharge your workflows by integrating popular NPM packages or leveraging Node.js’s native capabilities. Simplify your scripts, and take advantage of the vast resources available in the JavaScript ecosystem to build more efficient and powerful workflows.