0.1.14 • Published 4 years ago

diode-test-inspr v0.1.14

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

Diode

Installation

The first step is to install Diode cli. To Install Diode cli in your project with npm or yarn, use the commands below:

npm install @inspr/diode
yarn add @inspr/diode

It is possible to install Diode globally by typing the following commands:

npm -g install @inspr/diode
yarn global add @inspr/diode

Then, Diode can be used from anyware in your system.

Quick Start

To create a new Diode project, type:

diode init AwesomeProject 

Diode will create new folder named AwesomeProject, with a preconfigured diode.yaml file for config. It also create files to support babel, jest, typescript.

An example of diode.yaml file is:

version: 0.0.0
workspaces:
  main: 
    context: packages 
    description: This is an example project for diode
    private: true 

The specs in diode.yaml sets the configuration. A brief descrition of each field is in the list:

  • version: version in root package.json
  • workspaces: every workspace it's a folder where would be packages for bundling, workspaces can be more than one
  • main: workspace name to address it in cli commands
  • context: path to packages folder relative to root (where is diode.yaml)
  • description: description
  • private: boolean - it's private package or not

After creates the project, lets enter into the new created folder/project AwesomeProject. The next step is start creating packages on it.

Now, it is necessary to install the dependencies. This process can be done running the following:

    cd AwesomeProject
    yarn install OR npm install
    diode new project1

Diode will create new folder under workspaces.main.context path, with the name provided, project1 in this tutorial. Inside this folder, it is possible to configure the files package.json, tsconfig.json and src/index.ts to be used as entry points.

If you want to create another package, just type in the root directory of the project:

diode new [name]

After that, you can start the deployment of the project. To build your project, you may want to use:

diode build [packageName]

If packageName is not provided, Diode will build all packages for all workspaces. To build a subset of the packages, you must provide the packagesNames. It is the actual package name property in the file package.json, e.g, project1 comma separated.

It is also possible to rebuild the files after changes by using:

diode watch [packageName]

Commands

A brief description of the commads is given in this section.

diode init <projectName> --template? [-t]

Initializes new project. --template creates new project from `diode.yaml config.

diode new <libName> [workspace?]

Creates new library in the workspaces folder that is configured in diode .yaml config under workspaces.[name].context field, already preconfigured for the project. If workspace is not provided Diode will take first workspace from config.

diode build <libName?>

Builds your libraries by creating bundles and generating TS types definition files. Libraries names can be provided space separated. If no arguments is provide Build runs across all libraries from you diode.yaml context field.

didoe watch <libName?>

Run Build across projects provided space separated (if no arguments - across all projects). After that watches for changes in libraries files and rebuilds if needed.

diode clean <libName?>

Removes artifacts that diode has generated in the past.

diode list

Outputs the list of packages found in the project with their `package.json files and one object of their dependencies.

diode run <libName> [file]

Runs diode build <libName> then evaluates file from this libName with Node

diode sync

Merges dependencies across all libraries from diode.yaml context field by replacing to highest version found from all libraries.