New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

main-js

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

main-js

Watches (current) directory **/*.js files and re-generates main.js

  • 0.1.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Watches (current) directory **/*.js files and re-generates main.js, responsible for loading whole client-side application

  • it does so by injecting <script src=""> tags during development
  • files are loaded synchronously
  • debugging is still possible, original files are left untouched
  • can be also minified to one dist file during build process (using uglifyjs --no-mangle)

###Ignored files Directories starting with dot are ignored, this makes it perfect place for your bower dependencies. Use .bowerrc to override bower components directory.

###Order of loading Files as loaded alphabetically, with each directory treated as module, dependent on its children. This can be better understood with following example:

/test-app/
  /!deps/
    jquery.js
    jquery.plugin.js
  /common/
    BaseModel.js
  /eshop/
    /products/
      Product.js
    Cart.js
  /users/
    User.js
  app.js

Where app.js will be loaded last, Product will be loaded before Cart but after ActiveRecord, because it is in folder above. Jquery will be loaded first in this example.

Resulting order:

  1. !deps/jquery.js
  2. !deps/jquery.plugin.js
  3. common/BaseModel.js
  4. eshop/products/Product.js
  5. eshop/Cart.js
  6. users/User.js
  7. app.js'

###Options It is possible to override both filename, directory and/or glob-pattern, however it is discouraged to do so except for timestamped dist files.

###Install npm install -g main-js

###Usage

Usage: main-js [options]
       Watches (current) directory **/*.js files and re-generates main.js

Options:

  -h, --help                output usage information
  -V, --version             output the version number
  --target [file]           target file name (main.js)
  --directory [dir]         dir to scan for js files (.)
  --pattern [glob-pattern]  custom js-file pattern (**/*.js)
  --build                   minify sources to target file, do not watch

Development - watch for file changes:
  cd my-web-app
  main-js

Build - generate "big" dist file:
  cd my-web-app
  main-js --build

NOTE: Do not commit generated files to SCM, use --build flag during build instead

FAQs

Package last updated on 24 Oct 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc