npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lightscript-cli

v1.0.0-alpha.3

Published

CLI utility for creating & managing LightScript packages.

Downloads

7

Readme

lightscript-cli · Version License LightScript

command line utility for working with LightScript code & packages

note: this project is a work in progress and, while usable, is not considered entirely stable

installation

$ npm i -g lightscript-cli

The lightscript command is then available from anywhere, as well as the shorter form lsc.

usage

compile

compile LightScript source files to JavaScript.

# compile an input file to an output file
$ lsc compile file.lsc -f file.js

# compile a directory of files to an output directory
$ lsc compile src -d dist

# use additional Babel presets or plugins
$ lsc compile src -d dist --presets react --plugins partial-application

# do not use existing .babelrc file
$ lsc compile src -d dist --no-babelrc

# do not apply `babel-preset-env`
$ lsc compile src -d dist --no-env-preset

# look up a configuration file (ie. `lightscript.config.lsc`)
$ lsc compile -c

# specify a path to a configuration file
$ lsc compile -c build/lightscript.config.lsc

Aliases: c

Note that, by default, lightscript-cli will use Babel's usual .babelrc lookup behavior, and merge this with its internally provided configuration. This means that if there is a .babelrc file present, those presets & plugins will be added after the relevant lightscript plugins. You can use the --no-babelrc flag to disable this.

babel-preset-env is also applied by default, but can be disabled using the --no-env-preset flag.

eval

run LightScript code or files containing LightScript code (similar to node -e <code | file>)

# evaluate the given code and output the result
$ lsc eval "f = (x, y) -> x + y; f(1, 2)"

# run the given file and output the result
$ lsc eval build.js

# same as above, using the `run` alias
$ lsc run build.js

Aliases: run, e

init

kickstart a LightScript package

This command currently has no function - input is needed as to how it should work and what it should do under various circumstances.

See this issue to join the discussion.

repl

start an interactive REPL for evaluating LightScript code (similar to the node command)

$ lsc repl

> fn = (x, y) -> x + y
'use strict'
> fn(1, 2)
3

Aliases: r

configuration file

Similar to webpack, you can create a config file for a more clear, reusable, & dynamic way to apply options. When passed the --config / -c flag without a parameter, lightscript-cli will search for a config file within the current working directory in the following order:

  1. lightscript.config.lsc
  2. lightscript.config.js
  3. lightscript.config.json

Obviously, lightscript.config.lsc allows you to use LightScript syntax to define your configuration. For example:

comments = process.env.NODE_ENV == 'development'

export default {
  inputs: ['src/**/*', '!src/*.spec.lsc']
  directory: ['dist']

  envPreset: false

  babel: {
    babelrc: false
    comments
    plugins
  }
}

The above configuration allows you to run only lsc compile -c. The CLI would locate this file and compile the inputs into directory while not using babel-preset-env or any existing .babelrc.

It also shows a tiny example of dynamic configuration by deciding whether or not to output comments based on environment.

You can also specify a config file by passing a parameter with the flag:

$ lsc compile -c build/compile-config.lsc

see also

  • LightScript - the compile-to-JS language this tool is written in and for, leveraging Babel

development

git clone https://github.com/citycide/lightscript-cli.git
cd lightscript-cli
npm run build
npm link

This will make your local development copy available globally.

contributing

Pull requests and any issues found are always welcome.

  1. Fork the project, and preferably create a branch named something like feat-make-better
  2. Modify as needed, where src contains the LightScript source of the project
  3. Make sure all tests continue to pass, and it never hurts to have more tests
  4. Push & pull request! :tada:

license

MIT © Bo Lingen / citycide