Giter Club home page Giter Club logo

npm-try's Introduction

npm-try

๐Ÿš† Quickly try npm packages without writing boilerplate code.

asciicast

Build Status Commitizen friendly npm latest version

npm-try provides a REPL interface for you to try NPM packages without writing any boilerplate code.

Simply run npm-try [packages ..] anywhere on the shell and npm-try will show a REPL interface which has all packages installed and assigned to variables.

Features

  • Super easy to use!
  • npm-try even defines variables for you
  • Top-level await support (requires Node.js >= 10)

Install

$ npm install -g npm-try-cli

Examples

Wanna try the capitalize method of lodash package?

$ npm-try lodash
โœ” const lodash = require('lodash')
> lodash.capitalize('hello world')
'Hello world'

Would like to try multiple packages at the same time?

$ npm-try lodash underscore
โœ” const lodash = require('lodash')
โœ” const underscore = require('underscore')
> lodash.first([1, 2, 3])
1
> underscore.first([1, 2, 3])
1

A previous version? You can specify versions with @ symbol (Missing the old days when the pluck still exists).:

$ npm-try lodash@3
โœ” const lodash = require('lodash')
> lodash.pluck
[Function: pluck]

Asynchronous operations? await is supported out-of-the-box. Let's try ioredis:

$ npm-try ioredis
โœ” const Redis = require('ioredis')
> const redis = new Redis()
undefined
> await redis.get('foo')
'123'

Create a Project

REPL is not enough sometimes when you want to write more code to test with packages. npm-try offers --out-dir/-o option to create a self-contained project so you can write your test code at the drop of a hat.

$ npm-try lodash -o try-lodash
โœ” Installing lodash...
โœ” The project created at /Users/luin/try-lodash

Limitations

Testing multiple versions of the same package is not supported. The following command will only have lodash@3 provided:

$ npm-try lodash@4 lodash@3
โœ” const lodash = require('lodash')
โœ” const lodash = require('lodash')
> lodash.VERSION
'3.10.1'

License

MIT

npm-try's People

Contributors

dependabot[bot] avatar fcannizzaro avatar luin avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

npm-try's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency @types/node to v20
  • chore(deps): update dependency chai to v5
  • chore(deps): update dependency mocha to v10 (mocha, @types/mocha)
  • chore(deps): update dependency ts-node to v10
  • chore(deps): update dependency typescript to v5
  • fix(deps): update dependency chalk to v5
  • fix(deps): update dependency fs-extra to v11 (fs-extra, @types/fs-extra)
  • fix(deps): update dependency meow to v13
  • fix(deps): update dependency ora to v8
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

npm
package.json
  • chalk ^3.0.0
  • fs-extra ^8.0.1
  • lodash.assign ^4.2.0
  • meow ^6.0.0
  • ora ^4.0.0
  • @types/chai 4.1.7
  • @types/fs-extra 7.0.0
  • @types/meow 5.0.0
  • @types/mocha 5.2.7
  • @types/node 12.0.5
  • @types/ora 3.2.0
  • chai 4.2.0
  • mocha 6.1.4
  • ts-node 8.2.0
  • tslint 5.17.0
  • typescript 3.5.1
  • semantic-release 15.13.12
travis
.travis.yml
  • node 6
  • node 8
  • node 9
  • node 10

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.