Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fabrique

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fabrique - npm Package Compare versions

Comparing version 0.2.0-beta-1 to 0.2.0

2

package.json
{
"name": "fabrique",
"version": "0.2.0-beta-1",
"version": "0.2.0",
"type": "module",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

@@ -6,8 +6,8 @@ [![npm (scoped)](https://img.shields.io/npm/v/fabrique.svg)](https://www.npmjs.com/package/fabrique)

## Fabrique
# Fabrique
`Fabrique` is a **cli to create and build libraries**,
`fabrique` is a **cli to create and build libraries**,
letting the user **focus on the functionalities** of its library, instead of the build process.
With `Fabrique` you'll be able to:
With `fabrique` you'll be able to:

@@ -21,8 +21,10 @@ - create rapidly a library with all the tools and scripts to:

`Fabrique` is not intended to provide ci scripts and pipelines to automate the processes.
`fabrique` is not intended to provide ci scripts and pipelines to automate the processes.
Instead, it gives a uniform and simple entry point for everyone, to publish rapidly our own libraries,
on which we may add automation, scripts, and complexity.
### Motivation
> `fabrique` is the French word for "made/factory"
## Motivation
When we develop javascript/typescript libraries, we frequently create new repositories,

@@ -32,3 +34,3 @@ and maintains the scripts to build, test, and debug them.

We may choose to opt in for a _monorepo_, and I'll tell you: yes, in many cases, this is the optimal solution.
However, in many other cases, one library per-repo makes sense, and this is where `Fabrique` comes in.
However, in many other cases, one library per-repo makes sense, and this is where `fabrique` comes in.

@@ -38,8 +40,183 @@ Another goal is to focus on simplicity: for new incomers in javascript,

You want to write your library, but you have to learn `vite`, `jest`, how to build and publish a lib,
install `prettier`, etc. With `Fabrique` all comes in pre-configured.
install `prettier`, etc. With `fabrique` all comes in pre-configured.
## 📦 Installation
## 📝 Documentation
### Requirements
The library requires [Node.js](https://nodejs.org/en) `22+` and [yarn](https://yarnpkg.com/) `4+`.
### Installation
We recommend to use [npx](https://docs.npmjs.com/cli/v8/commands/npx):
```shell
yarn add fabrique
npx fabrique CMD
```
But, you may prefer to install globally `fabrique`:
```shell
npm install -g fabrique
```
And run a command with:
```shell
fabrique CMD
```
### List of commands
#### create
```shell
npx fabrique upgrade lib [name]
```
##### example
```shell
npx fabrique create @my-company/my-library
```
##### action
This command creates a new library with the name `[name]` inside the folder `./[name]` (in our example: `./@my-company/my-library`).
You'll be prompted for a description, author and git url.
> INFO: run the command where you want to create your project.
##### options
- `[name]`: the library name
#### upgrade
```shell
npx fabrique upgrade
```
##### action
This command updates an existing `fabrique` project: it updates the build files, the scripts, etc.
It tries to be non-destructive.
> INFO: run the command **inside** the `fabrique` project.
##### options
- `--force`: forces an upgrade even if the lib is not a `fabrique` project or if the version is identical. _Use with caution._
#### refactor
```shell
npx fabrique refactor [from] [to]
```
##### example
```shell
npx fabrique refactor my-component my-new-component
```
> Refactors all files and directories containing `my-component` as name into `my-new-component` (recursively).
> And all text content `my-component` (or derived cases) into `my-new-component` (keeping the same case).
If we run it with the following files:
- some-component
- my-component
- my-component.ts
- my-component-abc
- my-component-abc.ts
We get:
- some-component
- my-new-component
- my-new-component.ts
- my-new-component-abc
- my-new-component-abc.ts
And with this file content:
```ts
class MyComponent {}
// my-component
const MY_COMPONENT = null;
function my_component(myComponent: MyComponent) {}
```
We get:
```ts
class MyNewComponent {}
// my-new-component
const MY_NEW_COMPONENT = null;
function my_new_component(myNewComponent: MyNewComponent) {}
```
##### action
This command refactors files and directories recursively from the `cwd` (by default, the current directory in which the script is executed).
It preserves the case of the names (ex: `dash-case`, or `cameCase`).
> INFO: run the command inside the folder that you want to refactor.
##### options
- `[from]`: the "source" text to refactor. Must be `dash-case`.
- `[to]`: the "destination" text to refactor. Must be `dash-case`.
- `--dry` (default: false): runs without modifying the files. This is useful to check if your refactoring is safe or not.
- `--cwd` (default: current folder): specifies the directory to start from.
#### verdaccio
```shell
npx fabrique verdaccio
```
Installs and lauches [verdaccio](https://verdaccio.org/). This is useful to debug interdependent libraries.
Let's say we have:
- a library `my-lib-a`
- a library `my-lib-b` with `my-lib-a` as `dependency`
If we're working on `my-lib-a`, and want to test if it works on `my-lib-b`, we'll publish a `dev` version of `my-lib-a` on a local `verdaccio`.
And consume this dev version on `my-lib-b`.
> We choose verdaccio instead of `npm link` because versions and dev packages are unique with a package registry.
>
> Thus, we may have `my-lib-b` consuming `my-lib-a-dev.0` and `my-lib-c` consuming `my-lib-a-dev.1`, which is not possible with `npm link`.
#### version
```shell
npx fabrique --version
# or
npx fabrique -v
```
Returns the current `fabrique` version.
#### help
```shell
npx fabrique --help
# or
npx fabrique -h
```
You may get help on individual commands:
```shell
npx fabrique create -h
```

@@ -7,3 +7,3 @@ # Contributing

The library requires [Node.js](https://nodejs.org/en) `22+` and `yarn`.
The library requires [Node.js](https://nodejs.org/en) `22+` and [yarn](https://yarnpkg.com/).

@@ -16,3 +16,3 @@ First, we have to switch to the correct version of node:

If you don't have `nvm`, you may manually install and use Node.js 22+.
If you don't have [nvm](https://github.com/nvm-sh/nvm), you may manually install and use Node.js 22+.

@@ -19,0 +19,0 @@ Then, we have to use the proper package manager (here `yarn`):

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc