Coder Social home page Coder Social logo

gimme-assets's Introduction

Experimental asset manager, based on cdnjs and microjs libs.

Description

gimme is a little, experimental tool to manage web assets from the CLI.

It comes with 250+ available package to install right off the bat, and if that's not enough you can create your own package definition.

Usage

Experimental asset manager for cdnjs / microjs libs.

Usage: gimme <cmd> [options]

Commands:
  add                     Add a new bundle definition
  bundle                  Concat and minifiy the given package(s) and local files
  completion              Setup tab completion
  docs                    Tries to open package's documentation using default browser
  help                    Shows the appropriate documentation page for the given command
  html                    Show HTML snippet to include given package(s)
  install                 Installs the lib(s) <name ...>
  list                    List available packages
  readme                  Show the appropriate documentation manpage generated from readme file

Options:
 -l, --loglevel           What level of log to report
 -o, --output             Output directory, defaults to ./js/libs
 -v, --version            Output program version
 -d, --debug              Slighly more verbose error output when set to true, defaults false
 -ll, --limit             Maximum number of results to output with paginated list
 -h, --help               Display help information
 --props                  Optional list of package properties to output with list
 --usage                  Display usage for given subcommand
 --viewer                 The program to use to view help content, if `markdown` then output to stdout
 --bundle                 When turned on, list will only display added bundles with `gimme add`
 --url                    When turned on, html command will output url without surrounding <script>
 -clipboard, --copy       When turned on, html command will pipe the output to pbocpy instead of stdout
 --nocompress             Disable minification for js files with `bundle` command

Documentation

Commands

  • add Add a new bundle definition

  • bundle Concat and minifiy the given package(s) and local files

  • docs Tries to open package's documentation using default browser

  • help Shows the appropriate documentation page for the given command

  • html Show HTML snippet to include given package(s)

  • install Installs the given packages

  • list List available packages

  • readme Show the appropriate documentation manpage generated from readme file

  • commands creating a new command

Install

npm install gimme-assets -g

Tests Build Status

npm test

Create a new test

node test --create testname

gimme-assets's People

Contributors

mklabs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

gimme-assets's Issues

commands

Implement other commands:

  • update
  • uninstall
  • help
  • browse
  • docs
  • search

bundle command

minifiy / concat bunch of lib into a single bundle.

not sure about the api yet, probably something like:

gimme bundle jquery underscore backbone js/libs/bundle.min.js

# same, without minification
gimme bundle jquery underscore backbone js/libs/bundle.js

# same, use default bundle output option (js/libs/bundle.min.js)
gimme bundle jquery underscore backbone

last positional arg, if it has some / in it is considered as bundle output destination.

possible usage with local js files:

gimme bundle jquery underscore backbone js/app/router.js js/app/model/*.js js/app/ui/*.js js/libs/app.min.js 

should expand glob patterns.

install: with no args

when no args, tries to read the gimme entry of your package.json. The format is simply an array of library names (since there's no version management).

html command

synopsis:

gimme html <lib, ...>
# -> <script src="//cdnjs.cloudflare.com/ajax/libs/<lib>/1.7.1/<lib>.min.js"></script>


gimme html <lib, ...> --fallback
# -> <script src="//cdnjs.cloudflare.com/ajax/libs/<lib>/1.7.1/<lib>.min.js"></script>
# -> <script>window.<lib> || document.write('<script src="js/libs/<lib>.min.js"><\/script>')</script>

something like --append path/to/file.html may be added to directly import necessary script tags into one (or a set of) html file.

semver versions

Should edit the post install script to better validate satisfying semver versions, editing package version if necessary, same goes for versions folders.

(or find a workaround at npm install level).

compress / minify option

--compress (or minify not sure yet) would simply run the installed lib into uglify before copying them into js/libs. Should prevent minification on files ending with min.js (case of most of cdnjs libs).

windows install fail

D:\src\mklabs\test\mockup\assets>gimme list
   info  - Unable to find ~/.gimme/packages.json, fetch in the first place.
   info  - Unable to find ~/.gimme/data.js, fetch in the first place.
   error - connect Unknown system errno 10060

D:\src\mklabs\test\mockup\assets>set http_proxy=http://<proxy>:<port>

D:\src\mklabs\test\mockup\assets>gimme list
   info  - Unable to find ~/.gimme/packages.json, fetch in the first place.
   info  - Unable to find ~/.gimme/data.js, fetch in the first place.
   error - UNKNOWN, unknown error 'C:\Users\mklabs\AppData\Roaming\npm\node_mod
ules\gimme-assets\node_modules\gh-fetch\lib\_cache\api\v2\json\blob\show\madrobb
y\microjs.com\ff02d2514677f20d77c2a52efc4bea85a798002a\https:\raw.github.com\mad
robby\microjs.com\master'

D:\src\mklabs\test\mockup\assets>gimme list
   info  - Unable to find ~/.gimme/packages.json, fetch in the first place.
   info  - Unable to find ~/.gimme/data.js, fetch in the first place.
   error - UNKNOWN, unknown error 'C:\Users\mklabs\AppData\Roaming\npm\node_mod
ules\gimme-assets\node_modules\gh-fetch\lib\_cache\api\v2\json\blob\show\madrobb
y\microjs.com\ff02d2514677f20d77c2a52efc4bea85a798002a\https:\raw.github.com\mad
robby\microjs.com\master'

D:\src\mklabs\test\mockup\assets>

regexp subpath replace issue, maybe.

related to #8, maybe.

list: query

right now, list is a dumb list, add optional query args. Simply a regexp validating results (on pkg.name).

gimme install jquery

Hello

under windows (xp) i launch gimme install jquery

and then :

log   - Installing... jquery
error - ENOENT, no such file or directory 'D:\jsproj\.gimme\ajax\libs\jquery\1.7.1\jquery.min.js'

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.