@jscad/cli

Command Line Interface (CLI) for JSCAD

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
1,704117Jun 12, 2021Mar 10, 2013Minified + gzip package size for @jscad/cli in KB

Readme

@jscad/cli : JSCAD Command Line Interface (CLI)

This is the Command Line Interface (CLI) application for creating designs using Node.js.

NPM version NPM downloads Build Status Stability License

User Group Lerna JavaScript Style Guide

Backers Sponsors

Open Collective

Table of Contents

Usage

The next steps require NPM and Node.js. The JSCAD project always develops with the latest LTS releases, so install these versions.

Install the CLI for General Use

The CLI can be installed for general use using NPM.

npm install -g @jscad/cli

Once installed, the CLI can be invoked using

jscad -v
jscad

Install the CLI as Part of a Project

If a general installation is not possible or desired, then installation as part of a project is possible.

cd myproject
npm install -D @jscad/cli@alpha

This will add the CLI package as a development dependency. The CLI can be invoked using

npx jscad -v
npx jscad

These two commands will show the version of the CLI, and a general help message.

Using the CLI

Simply invoke 'jscad' using various options. Here are some examples.

Examples:

jscad mydesign.js # -- convert mydesign.js to mydesign.stl as default

jscad mydesign.js -o test.stl # -- convert mydesign.js to test.stl

jscad frog.stl -o test.js # -- convert frog.stl to test.js

jscad mydesign.js -of amf # -- convert mydesign.js into mydesign.amf

The '-o' option can be used to control where the output will be placed. While, the '-of' option can be used to control the format of the output.

You can also provide the parameters to a design by passing -- to the CLI.

jscad mydesign.js --name "Just Me" --title "Geek" -o output.stl

Also, design projects (directories) can be used as the input to the CLI.

jscad myproject/ -o ./test.stl # -- convert the project mydesign to test.stl

Note: The CLI will search for the design entry point just like NPM.

  • if there is a package.json file in the project, then try to use the 'main' property
  • if not, then try to look for 'index.js'

Using the CLI with the JSCAD Examples

The easiest way to use the examples is to create a new NPM project.

mkdir newproject
cd newproject
npm init

Then add both the examples and the CLI to the project.

npm install @jscad/examples@alpha
npm install @jscad/cli@alpha

And finally, make the examples local to the project.

ln -s node_modules/@jscad/examples ./examples

The examples are just single file designs, or multiple file projects.

npx jscad examples/core/booleans/basicBooleans.js -o ./test.stl
npx jscad examples/module-design/ -of dxf

Documentation

Contributing

The various JSCAD packages and all source code are part of the JSCAD Organization, and maintained by a group of volunteers. We welcome and encourage anyone to pitch in but please take a moment to read the following guidelines.

  • If you want to submit a bug report please make sure to follow the Reporting Issues guide. Bug reports are accepted as Issues via GitHub.

  • If you want to submit a change or a patch, please read the Contributing Guide . New contributions are accepted as Pull Requests via GithHub.

  • We only accept bug reports and pull requests on GitHub.

  • If you have a question about how to use JSCAD, then please start a conversation at the JSCAD User Group. You might find the answer in the JSCAD User Guide.

  • If you have a change or new feature in mind, please start a conversation with the Core Developers and start contributing changes.

Small Note: If editing this README, please conform to the standard-readme specification.

Community

See for more details

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

License

The MIT License (MIT) (unless specified otherwise)

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.