Usage

Project Configuration

Create 1build.yaml configuration file by

1
1build init --name <your_project_name>
Copied!
This will create default 1build.yaml file in current directory with project name provided.
default contents will be
1build.yaml
1
project: <your_project_name>
2
commands:
3
- build: echo 'Running build'
Copied!

Edit file according to project command list, Example of 1build.yaml for node project:

1build.yaml
1
project: Sample JVM Project Name
2
commands:
3
- build: npm run build
4
- test: npm run test
Copied!

Running 1build for the above sample project

building the project

1
1build build
Copied!

fix the coding guidelines lint and run tests (executing more than one commands at once)

1
1build lint test
Copied!

Set new or update existing configuration

Set new command configuration for lint to eslint server.js

1
1build set lint "eslint server.js"
Copied!

Unset/Remove existing configuration

Unset command configuration for lint

1
1build unset lint
Copied!

Unset multiple commands at once for lint, test, build

1
1build unset lint test build
Copied!
Unset will log missing commands

Running command before and after execution of 1build command

Consider that your project requires some environment variables to set before running any commands and you want to clean up those after running commands. It is a headache to always remember to set those environment variables. What you want is to set env variables automatically when you run the command in the project and remove those when the command is complete. Another example – a project requires Docker to be up and running or you need to clean up the database after running a test harness.
This is where before & after commands are useful. These commands are both optional – you can use one of them, both or neither.
Examples:
  1. 1.
    Setting env variables and cleaning those up
    1build.yaml
    1
    project: Sample JVM Project Name
    2
    before: export VARNAME="my value"
    3
    after: unset VARNAME
    4
    commands:
    5
    - build: npm run build
    Copied!
  2. 2.
    Ensure that Docker is up and running
    1build.yaml
    1
    project: Containerized Project
    2
    before: ./docker_run.sh
    3
    commands:
    4
    - build: npm run build
    Copied!
  3. 3.
    Clean up database after some commands
    1build.yaml
    1
    project: Containerized Project
    2
    after: ./clean_database.sh
    3
    commands:
    4
    - build: npm run build
    Copied!

See 1build --help for command usages.

Last modified 2yr ago