chore(package): re-init package with commitizen and standard-release

This commit is contained in:
Pavel Pertsev
2018-05-16 12:54:46 +03:00
parent cb4e7a5643
commit eaf2328575
10640 changed files with 609660 additions and 117 deletions

700
node_modules/shelljs/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,700 @@
# Change Log
## [Unreleased](https://github.com/shelljs/shelljs/tree/HEAD)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.7.5...HEAD)
**Closed issues:**
- QUESTION: Feedback while an operation is running? [\#629](https://github.com/shelljs/shelljs/issues/629)
- Test setup/cleanup is broken [\#621](https://github.com/shelljs/shelljs/issues/621)
- Ignore temp directories when running lint [\#620](https://github.com/shelljs/shelljs/issues/620)
- parseOptions should throw an error if the option string doesn't start with '-' [\#614](https://github.com/shelljs/shelljs/issues/614)
- chore: LGTM.co is gone [\#595](https://github.com/shelljs/shelljs/issues/595)
- refactor: objectAssign should refer to Object.assign if it exists, or the internal polyfill otherwise [\#592](https://github.com/shelljs/shelljs/issues/592)
- parseOptions: allow a way to keep errors silent \(exception only\) [\#591](https://github.com/shelljs/shelljs/issues/591)
- \[Question\] commands with multiple options / arguments? [\#589](https://github.com/shelljs/shelljs/issues/589)
- feature: GNU Parallel [\#585](https://github.com/shelljs/shelljs/issues/585)
- write to file [\#568](https://github.com/shelljs/shelljs/issues/568)
- Cannot figure out how to disable globbing for rm [\#567](https://github.com/shelljs/shelljs/issues/567)
- Switch to the ava test framework [\#560](https://github.com/shelljs/shelljs/issues/560)
- feature: echo -n [\#559](https://github.com/shelljs/shelljs/issues/559)
- Option not recognized [\#556](https://github.com/shelljs/shelljs/issues/556)
- chore: add @freitagbr to LGTM maintainers [\#552](https://github.com/shelljs/shelljs/issues/552)
- chore: set up dev branch [\#548](https://github.com/shelljs/shelljs/issues/548)
- bug: cp\(\) doesn't always copy everything [\#547](https://github.com/shelljs/shelljs/issues/547)
- User-friendly lint command [\#544](https://github.com/shelljs/shelljs/issues/544)
- Lint warning [\#542](https://github.com/shelljs/shelljs/issues/542)
- Possible Regression: cp from 0.6.0 to 0.7.x version [\#538](https://github.com/shelljs/shelljs/issues/538)
- chore: add nodejs v7 to CI [\#537](https://github.com/shelljs/shelljs/issues/537)
- error.code is not always available [\#536](https://github.com/shelljs/shelljs/issues/536)
- Add shx as a dependency for testing [\#525](https://github.com/shelljs/shelljs/issues/525)
- Feature request: allow `common.error\(\)` to optionally not insert a prefix and optionally not print to console [\#523](https://github.com/shelljs/shelljs/issues/523)
- Feature request: Add "shelljs.unlink" [\#519](https://github.com/shelljs/shelljs/issues/519)
- Sed should allow a replacement string to contain `\1` for match groups [\#507](https://github.com/shelljs/shelljs/issues/507)
- Don't kill the node process upon unexpected error [\#483](https://github.com/shelljs/shelljs/issues/483)
- Usage with neodoc [\#445](https://github.com/shelljs/shelljs/issues/445)
- \[ Feature idea \] synchronous sleep command [\#441](https://github.com/shelljs/shelljs/issues/441)
- Add a way to prevent shell-expansion on commands \(this issue is not for exec\) [\#345](https://github.com/shelljs/shelljs/issues/345)
- Chown [\#183](https://github.com/shelljs/shelljs/issues/183)
- spawn EMFILE [\#81](https://github.com/shelljs/shelljs/issues/81)
- Rewrite exec using execsync-ng \(which uses node-ffi\) [\#66](https://github.com/shelljs/shelljs/issues/66)
- `exec` gets stuck on my Debian box [\#51](https://github.com/shelljs/shelljs/issues/51)
- 100% cpu usage when a nodejs script goes side ways executing a command. [\#5](https://github.com/shelljs/shelljs/issues/5)
**Merged pull requests:**
- Finalize moving to ava [\#630](https://github.com/shelljs/shelljs/pull/630) ([freitagbr](https://github.com/freitagbr))
- test: refactor pushd tests to AVA [\#627](https://github.com/shelljs/shelljs/pull/627) ([nfischer](https://github.com/nfischer))
- test: refactor popd tests to AVA [\#626](https://github.com/shelljs/shelljs/pull/626) ([nfischer](https://github.com/nfischer))
- test: refactor shjs tests to AVA [\#625](https://github.com/shelljs/shelljs/pull/625) ([nfischer](https://github.com/nfischer))
- test: remove tests for make \(deprecated\) [\#624](https://github.com/shelljs/shelljs/pull/624) ([nfischer](https://github.com/nfischer))
- Ignore test temp directories during linting [\#623](https://github.com/shelljs/shelljs/pull/623) ([freitagbr](https://github.com/freitagbr))
- refactor: list all commands in commands.json [\#616](https://github.com/shelljs/shelljs/pull/616) ([nfischer](https://github.com/nfischer))
- Throw an error if the options string does not start with '-' [\#615](https://github.com/shelljs/shelljs/pull/615) ([freitagbr](https://github.com/freitagbr))
- chore: switch to files attribute from npmignore [\#613](https://github.com/shelljs/shelljs/pull/613) ([nfischer](https://github.com/nfischer))
- test: refactor 'test' command tests to AVA [\#612](https://github.com/shelljs/shelljs/pull/612) ([nfischer](https://github.com/nfischer))
- test: refactor find tests to AVA [\#611](https://github.com/shelljs/shelljs/pull/611) ([nfischer](https://github.com/nfischer))
- test: refactor ln tests to AVA [\#610](https://github.com/shelljs/shelljs/pull/610) ([nfischer](https://github.com/nfischer))
- test: refactor ls to use AVA [\#609](https://github.com/shelljs/shelljs/pull/609) ([nfischer](https://github.com/nfischer))
- test: refactor pipe tests to AVA [\#608](https://github.com/shelljs/shelljs/pull/608) ([nfischer](https://github.com/nfischer))
- test: refactor sed tests to AVA [\#607](https://github.com/shelljs/shelljs/pull/607) ([nfischer](https://github.com/nfischer))
- test: refactor grep tests to AVA [\#606](https://github.com/shelljs/shelljs/pull/606) ([nfischer](https://github.com/nfischer))
- test: refactor global tests to AVA [\#605](https://github.com/shelljs/shelljs/pull/605) ([nfischer](https://github.com/nfischer))
- test: refactor touch tests to AVA [\#604](https://github.com/shelljs/shelljs/pull/604) ([nfischer](https://github.com/nfischer))
- test: refactor uniq tests to AVA [\#603](https://github.com/shelljs/shelljs/pull/603) ([nfischer](https://github.com/nfischer))
- test: refactor sort tests to AVA [\#602](https://github.com/shelljs/shelljs/pull/602) ([nfischer](https://github.com/nfischer))
- test: refactor tail tests to AVA [\#601](https://github.com/shelljs/shelljs/pull/601) ([nfischer](https://github.com/nfischer))
- test: refactor head tests to AVA [\#600](https://github.com/shelljs/shelljs/pull/600) ([nfischer](https://github.com/nfischer))
- test: refactor mkdir tests to AVA [\#599](https://github.com/shelljs/shelljs/pull/599) ([nfischer](https://github.com/nfischer))
- Fix: rm behavior regarding symlinks [\#598](https://github.com/shelljs/shelljs/pull/598) ([freitagbr](https://github.com/freitagbr))
- test: refactor mv tests to AVA [\#597](https://github.com/shelljs/shelljs/pull/597) ([nfischer](https://github.com/nfischer))
- Remove files related to lgtm.co [\#596](https://github.com/shelljs/shelljs/pull/596) ([freitagbr](https://github.com/freitagbr))
- Add ability to configure error from parseOptions [\#594](https://github.com/shelljs/shelljs/pull/594) ([freitagbr](https://github.com/freitagbr))
- Use Object.assign if possible [\#593](https://github.com/shelljs/shelljs/pull/593) ([freitagbr](https://github.com/freitagbr))
- Add "-n" option to echo [\#590](https://github.com/shelljs/shelljs/pull/590) ([freitagbr](https://github.com/freitagbr))
- test: refactor rm tests to AVA [\#586](https://github.com/shelljs/shelljs/pull/586) ([nfischer](https://github.com/nfischer))
- test: refactor pwd tests to AVA [\#582](https://github.com/shelljs/shelljs/pull/582) ([nfischer](https://github.com/nfischer))
- test: refactor tempdir tests to AVA [\#581](https://github.com/shelljs/shelljs/pull/581) ([nfischer](https://github.com/nfischer))
- test: refactor 'which' tests to AVA [\#580](https://github.com/shelljs/shelljs/pull/580) ([nfischer](https://github.com/nfischer))
- test: refactor plugin tests to AVA [\#579](https://github.com/shelljs/shelljs/pull/579) ([nfischer](https://github.com/nfischer))
- test: refactor toEnd tests to AVA [\#578](https://github.com/shelljs/shelljs/pull/578) ([nfischer](https://github.com/nfischer))
- test: refactor to tests to AVA [\#577](https://github.com/shelljs/shelljs/pull/577) ([nfischer](https://github.com/nfischer))
- test: refactor 'set' tests to AVA [\#576](https://github.com/shelljs/shelljs/pull/576) ([nfischer](https://github.com/nfischer))
- test: refactor echo tests to AVA [\#575](https://github.com/shelljs/shelljs/pull/575) ([nfischer](https://github.com/nfischer))
- test: refactor exec tests to AVA [\#574](https://github.com/shelljs/shelljs/pull/574) ([nfischer](https://github.com/nfischer))
- test: refactor env tests to AVA [\#573](https://github.com/shelljs/shelljs/pull/573) ([nfischer](https://github.com/nfischer))
- test: refactor dirs tests to AVA [\#572](https://github.com/shelljs/shelljs/pull/572) ([nfischer](https://github.com/nfischer))
- test: refactor config tests to AVA [\#571](https://github.com/shelljs/shelljs/pull/571) ([nfischer](https://github.com/nfischer))
- test: refactor common tests to AVA [\#570](https://github.com/shelljs/shelljs/pull/570) ([nfischer](https://github.com/nfischer))
- test: refactor chmod tests to AVA [\#569](https://github.com/shelljs/shelljs/pull/569) ([nfischer](https://github.com/nfischer))
- test: refactor cp tests to ava [\#565](https://github.com/shelljs/shelljs/pull/565) ([nfischer](https://github.com/nfischer))
- test: refactor cat tests to ava [\#564](https://github.com/shelljs/shelljs/pull/564) ([nfischer](https://github.com/nfischer))
- test: set up ava and move cd.js [\#561](https://github.com/shelljs/shelljs/pull/561) ([nfischer](https://github.com/nfischer))
- Update sed documentation regarding capture groups [\#558](https://github.com/shelljs/shelljs/pull/558) ([freitagbr](https://github.com/freitagbr))
- Add newline to output of echo [\#557](https://github.com/shelljs/shelljs/pull/557) ([freitagbr](https://github.com/freitagbr))
- fix: handle code-less errors more carefully in exec [\#554](https://github.com/shelljs/shelljs/pull/554) ([nfischer](https://github.com/nfischer))
- Add Brandon Freitag to maintainers/contributors [\#553](https://github.com/shelljs/shelljs/pull/553) ([freitagbr](https://github.com/freitagbr))
- Get pipe tests running on Windows. [\#550](https://github.com/shelljs/shelljs/pull/550) ([binki](https://github.com/binki))
- fix: maxdepth doesn't limit total number of copies [\#549](https://github.com/shelljs/shelljs/pull/549) ([nfischer](https://github.com/nfischer))
- Safely exit by throwing an error [\#546](https://github.com/shelljs/shelljs/pull/546) ([freitagbr](https://github.com/freitagbr))
- Fix lint warning [\#543](https://github.com/shelljs/shelljs/pull/543) ([freitagbr](https://github.com/freitagbr))
- chore: remove v0.10 from Travis CI [\#540](https://github.com/shelljs/shelljs/pull/540) ([nfischer](https://github.com/nfischer))
- chore: add Node v7 for CI [\#539](https://github.com/shelljs/shelljs/pull/539) ([nfischer](https://github.com/nfischer))
## [v0.7.5](https://github.com/shelljs/shelljs/tree/v0.7.5) (2016-10-27)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.7.4...v0.7.5)
**Closed issues:**
- Project objectives: there is some higher goal to achieve? [\#533](https://github.com/shelljs/shelljs/issues/533)
- fs.existsSync is un-deprecated [\#531](https://github.com/shelljs/shelljs/issues/531)
- Inadvertent breaking change to shell.test\(\) [\#529](https://github.com/shelljs/shelljs/issues/529)
- Add -u flag support for cp [\#526](https://github.com/shelljs/shelljs/issues/526)
- API request: allow `plugin.error\(\)` to take an options parameter [\#522](https://github.com/shelljs/shelljs/issues/522)
- FS Real Path error thrown when requiring shelljs [\#521](https://github.com/shelljs/shelljs/issues/521)
- Question: passing code via pipe? [\#520](https://github.com/shelljs/shelljs/issues/520)
- The performance in `cp` is different between `0.6.0` and `0.7.4` [\#517](https://github.com/shelljs/shelljs/issues/517)
- ShellJS in Electron package don't find ffmpeg anymore [\#516](https://github.com/shelljs/shelljs/issues/516)
- Exec issues with string option introduced in 0.7.4 [\#515](https://github.com/shelljs/shelljs/issues/515)
- \[ Feature \] SSH command [\#435](https://github.com/shelljs/shelljs/issues/435)
- Synchronous exec stalls permenantly when there is an error/w the shell [\#7](https://github.com/shelljs/shelljs/issues/7)
**Merged pull requests:**
- feat: plugin.error\(\) takes an options parameter [\#535](https://github.com/shelljs/shelljs/pull/535) ([nfischer](https://github.com/nfischer))
- Revert "refactor: replace fs.existsSync" fixes\(\#531\) [\#532](https://github.com/shelljs/shelljs/pull/532) ([gyandeeps](https://github.com/gyandeeps))
- Fix: Remove default glob from shell.test \(fixes \#529\) [\#530](https://github.com/shelljs/shelljs/pull/530) ([gyandeeps](https://github.com/gyandeeps))
- feat: cp -u option [\#527](https://github.com/shelljs/shelljs/pull/527) ([nfischer](https://github.com/nfischer))
- chore: add downloads per month on README [\#513](https://github.com/shelljs/shelljs/pull/513) ([nfischer](https://github.com/nfischer))
## [v0.7.4](https://github.com/shelljs/shelljs/tree/v0.7.4) (2016-08-26)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.7.3...v0.7.4)
**Closed issues:**
- fix: echo -e should not print "-e" [\#510](https://github.com/shelljs/shelljs/issues/510)
- Wrong method signature in doc [\#498](https://github.com/shelljs/shelljs/issues/498)
- readFromPipe should be a function with no arguments [\#485](https://github.com/shelljs/shelljs/issues/485)
- TypeError: Cannot read property 'toString' of undefined [\#471](https://github.com/shelljs/shelljs/issues/471)
**Merged pull requests:**
- fix: echo supports -e option properly [\#511](https://github.com/shelljs/shelljs/pull/511) ([nfischer](https://github.com/nfischer))
- refactor: replace fs.existsSync [\#509](https://github.com/shelljs/shelljs/pull/509) ([nfischer](https://github.com/nfischer))
- refactor: readFromPipe\(\) requires no arguments [\#506](https://github.com/shelljs/shelljs/pull/506) ([nfischer](https://github.com/nfischer))
- chore: switch to eslint [\#504](https://github.com/shelljs/shelljs/pull/504) ([nfischer](https://github.com/nfischer))
- feat: add overWrite option for commands [\#503](https://github.com/shelljs/shelljs/pull/503) ([nfischer](https://github.com/nfischer))
- chore: update issue template [\#502](https://github.com/shelljs/shelljs/pull/502) ([nfischer](https://github.com/nfischer))
- fixed head/tail readme [\#499](https://github.com/shelljs/shelljs/pull/499) ([charlesread](https://github.com/charlesread))
## [v0.7.3](https://github.com/shelljs/shelljs/tree/v0.7.3) (2016-07-27)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.7.2...v0.7.3)
**Closed issues:**
- expose execSync [\#494](https://github.com/shelljs/shelljs/issues/494)
- Add a way to create commands that can receive from a pipe without being standalone commands [\#487](https://github.com/shelljs/shelljs/issues/487)
- cp -r breaks when the directory contains a softlink [\#193](https://github.com/shelljs/shelljs/issues/193)
- Redirect output to file fails [\#60](https://github.com/shelljs/shelljs/issues/60)
- We need sed -n ? [\#38](https://github.com/shelljs/shelljs/issues/38)
**Merged pull requests:**
- refactor: allow pipeOnly commands \(methods on ShellStrings\) [\#493](https://github.com/shelljs/shelljs/pull/493) ([nfischer](https://github.com/nfischer))
- refactor: glob by default for commands [\#492](https://github.com/shelljs/shelljs/pull/492) ([nfischer](https://github.com/nfischer))
- refactor: switch from notUnix to unix in wrap\(\) [\#491](https://github.com/shelljs/shelljs/pull/491) ([nfischer](https://github.com/nfischer))
- refactor: switch common.extend\(\) to Object.assign ponyfill [\#490](https://github.com/shelljs/shelljs/pull/490) ([nfischer](https://github.com/nfischer))
- fix: conflicting options now properly override each other [\#489](https://github.com/shelljs/shelljs/pull/489) ([nfischer](https://github.com/nfischer))
- refactor: expose plugin utils & add initial tests [\#484](https://github.com/shelljs/shelljs/pull/484) ([nfischer](https://github.com/nfischer))
## [v0.7.2](https://github.com/shelljs/shelljs/tree/v0.7.2) (2016-07-25)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.7.1...v0.7.2)
**Closed issues:**
- shelljs should not kill process if node call throws exception [\#473](https://github.com/shelljs/shelljs/issues/473)
- `cp` work incorrectly when folder name contains '@' [\#463](https://github.com/shelljs/shelljs/issues/463)
- Something went wrong [\#158](https://github.com/shelljs/shelljs/issues/158)
**Merged pull requests:**
- fix: resolve a cylcic-dependency problem [\#482](https://github.com/shelljs/shelljs/pull/482) ([nfischer](https://github.com/nfischer))
- refactor: add wrapOutput option to auto-ShellString-ify command output [\#481](https://github.com/shelljs/shelljs/pull/481) ([nfischer](https://github.com/nfischer))
- refactor: move option parsing into common.wrap\(\) [\#479](https://github.com/shelljs/shelljs/pull/479) ([nfischer](https://github.com/nfischer))
- refactor: hook new uniq\(\) command using new format [\#478](https://github.com/shelljs/shelljs/pull/478) ([nfischer](https://github.com/nfischer))
- Fix mkdir malformed path [\#477](https://github.com/shelljs/shelljs/pull/477) ([nfischer](https://github.com/nfischer))
- fix: mkdir for invalid perms does not kill process [\#474](https://github.com/shelljs/shelljs/pull/474) ([nfischer](https://github.com/nfischer))
- feat\(command\): new command: uniq\(\) [\#453](https://github.com/shelljs/shelljs/pull/453) ([joshi-sh](https://github.com/joshi-sh))
## [v0.7.1](https://github.com/shelljs/shelljs/tree/v0.7.1) (2016-07-22)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.7.0...v0.7.1)
**Closed issues:**
- cp -n doesn't work correctly [\#465](https://github.com/shelljs/shelljs/issues/465)
- how can i run sudo apt-get install xtodotool by your plugin? [\#448](https://github.com/shelljs/shelljs/issues/448)
- shell.js grep: internal error, Invalid regular expression [\#447](https://github.com/shelljs/shelljs/issues/447)
- Stdout is empty on Git log command [\#439](https://github.com/shelljs/shelljs/issues/439)
- Cannot read toString of null when using execSync [\#415](https://github.com/shelljs/shelljs/issues/415)
- cp -R dir/ target fails to copy hidden files in dir [\#140](https://github.com/shelljs/shelljs/issues/140)
- Adding callback to basic commands [\#102](https://github.com/shelljs/shelljs/issues/102)
- \#mv Won't Work Across Disks [\#1](https://github.com/shelljs/shelljs/issues/1)
**Merged pull requests:**
- refactor: commands now register themselves [\#475](https://github.com/shelljs/shelljs/pull/475) ([nfischer](https://github.com/nfischer))
- chore: switch to shields.io, and add npm badge [\#470](https://github.com/shelljs/shelljs/pull/470) ([nfischer](https://github.com/nfischer))
- fix\(cp\): -n option no longer raises error [\#466](https://github.com/shelljs/shelljs/pull/466) ([nfischer](https://github.com/nfischer))
- refactor: expose pipe-ability to command configuration [\#464](https://github.com/shelljs/shelljs/pull/464) ([nfischer](https://github.com/nfischer))
- fix\(mv\): works across partitions [\#461](https://github.com/shelljs/shelljs/pull/461) ([nfischer](https://github.com/nfischer))
- chore: switch to shelljs-changelog [\#460](https://github.com/shelljs/shelljs/pull/460) ([nfischer](https://github.com/nfischer))
- chore: update release process [\#459](https://github.com/shelljs/shelljs/pull/459) ([nfischer](https://github.com/nfischer))
- chore: revert depreciate shelljs/make \(\#431\) [\#458](https://github.com/shelljs/shelljs/pull/458) ([zephraph](https://github.com/zephraph))
- chore: clarify message for when docs are not generated [\#457](https://github.com/shelljs/shelljs/pull/457) ([nfischer](https://github.com/nfischer))
- chore\(gendocs\): add `npm run gendocs` command [\#455](https://github.com/shelljs/shelljs/pull/455) ([nfischer](https://github.com/nfischer))
- chore: update jshint and move it to an npm script [\#454](https://github.com/shelljs/shelljs/pull/454) ([nfischer](https://github.com/nfischer))
- test\(ls\): add case for trailing slash on dir name [\#450](https://github.com/shelljs/shelljs/pull/450) ([nfischer](https://github.com/nfischer))
- docs\(exec\): explicitly mention the `shell` option [\#449](https://github.com/shelljs/shelljs/pull/449) ([nfischer](https://github.com/nfischer))
- chore: setup changelog [\#443](https://github.com/shelljs/shelljs/pull/443) ([levithomason](https://github.com/levithomason))
- docs: comment code better to help contributors [\#437](https://github.com/shelljs/shelljs/pull/437) ([nfischer](https://github.com/nfischer))
- chore\(CI\): update appveyor [\#436](https://github.com/shelljs/shelljs/pull/436) ([nfischer](https://github.com/nfischer))
- chore: test against node v6 [\#433](https://github.com/shelljs/shelljs/pull/433) ([nfischer](https://github.com/nfischer))
- chore\(make\): depreciate shelljs/make [\#431](https://github.com/shelljs/shelljs/pull/431) ([ariporad](https://github.com/ariporad))
- docs: warn that README contains newest features [\#410](https://github.com/shelljs/shelljs/pull/410) ([nfischer](https://github.com/nfischer))
## [v0.7.0](https://github.com/shelljs/shelljs/tree/v0.7.0) (2016-04-25)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.6.0...v0.7.0)
**Closed issues:**
- exec\('nohup node some.js &'\) [\#426](https://github.com/shelljs/shelljs/issues/426)
- cp copy to symlinked folder [\#414](https://github.com/shelljs/shelljs/issues/414)
- Invalid version number \(0.0.1alpha1\) [\#399](https://github.com/shelljs/shelljs/issues/399)
- shelljs Breaks SemVer for Alpha and Pre-Release Versions [\#390](https://github.com/shelljs/shelljs/issues/390)
- Copy not accepting source end with wildcards \* when using -r on v0.6.0 [\#389](https://github.com/shelljs/shelljs/issues/389)
- Support globbing in `shjs` [\#388](https://github.com/shelljs/shelljs/issues/388)
- Refactor more commands to return ShellString [\#373](https://github.com/shelljs/shelljs/issues/373)
- ln\('-sf', './', '\<destination\>'\) is not linking the right folder [\#363](https://github.com/shelljs/shelljs/issues/363)
- v0.6.0 - shell.cp\('r', '/foo/\*, '/bar'\) fails with /foo/\* no such file or directory [\#342](https://github.com/shelljs/shelljs/issues/342)
- Add documentup as a webhook [\#327](https://github.com/shelljs/shelljs/issues/327)
- Dir glob breaks when in the middle of path [\#245](https://github.com/shelljs/shelljs/issues/245)
- could you switch off wiki page? [\#233](https://github.com/shelljs/shelljs/issues/233)
- ls globbing does not behave like shell, consider using glob.sync [\#225](https://github.com/shelljs/shelljs/issues/225)
- Cannot run shell.exec\('heroku config:push'\) -- just hangs [\#218](https://github.com/shelljs/shelljs/issues/218)
- `cp` does not overwrite files by default [\#210](https://github.com/shelljs/shelljs/issues/210)
- exec failed to return [\#208](https://github.com/shelljs/shelljs/issues/208)
- CLI Version [\#202](https://github.com/shelljs/shelljs/issues/202)
- Bracket expansion not working [\#176](https://github.com/shelljs/shelljs/issues/176)
- "exec" causes LiveScript interpreter \(lsc\) to hang [\#160](https://github.com/shelljs/shelljs/issues/160)
- Don't modify string prototype [\#159](https://github.com/shelljs/shelljs/issues/159)
- `exec\(...\).to\(file\)` should work [\#154](https://github.com/shelljs/shelljs/issues/154)
- Would like to see more async variants for cp/rm etc [\#144](https://github.com/shelljs/shelljs/issues/144)
- Can't install shelljs locally instead of globally [\#136](https://github.com/shelljs/shelljs/issues/136)
- shelljs and node 0.10.28 [\#125](https://github.com/shelljs/shelljs/issues/125)
- Use case for global installed shelljs [\#123](https://github.com/shelljs/shelljs/issues/123)
- Only get stdout from `exec` [\#92](https://github.com/shelljs/shelljs/issues/92)
- What about other commands? [\#90](https://github.com/shelljs/shelljs/issues/90)
- Flesh out example of exit\(\) [\#73](https://github.com/shelljs/shelljs/issues/73)
- exec doesn't work with qualified paths on windows [\#41](https://github.com/shelljs/shelljs/issues/41)
- exec does not working in mingw bash in windows [\#17](https://github.com/shelljs/shelljs/issues/17)
- Add support for cp -P option [\#413](https://github.com/shelljs/shelljs/issues/413)
- cp -L: Incorrect behavior for symlinks to regular files [\#407](https://github.com/shelljs/shelljs/issues/407)
- Edit the docs to emphasize ShellStrings and Pipes [\#398](https://github.com/shelljs/shelljs/issues/398)
- Error message isn't always printed [\#372](https://github.com/shelljs/shelljs/issues/372)
- Standardize command output [\#356](https://github.com/shelljs/shelljs/issues/356)
- exec\(\) doesn't clean up all temp files [\#353](https://github.com/shelljs/shelljs/issues/353)
- Document that exec\(\) options don't work on early versions of node [\#350](https://github.com/shelljs/shelljs/issues/350)
- Add -f option to set\(\) [\#344](https://github.com/shelljs/shelljs/issues/344)
- Glob commands by default [\#343](https://github.com/shelljs/shelljs/issues/343)
- rm -rf incorrect behaviour [\#332](https://github.com/shelljs/shelljs/issues/332)
- Switch `exec\(\)` to use bash by default [\#281](https://github.com/shelljs/shelljs/issues/281)
- pipe to proc [\#148](https://github.com/shelljs/shelljs/issues/148)
- shell builtin [\#138](https://github.com/shelljs/shelljs/issues/138)
- add timeout option for exec [\#132](https://github.com/shelljs/shelljs/issues/132)
- shelljs cp handling symlinks badly [\#69](https://github.com/shelljs/shelljs/issues/69)
**Merged pull requests:**
- chore: add "Team" section to README [\#423](https://github.com/shelljs/shelljs/pull/423) ([nfischer](https://github.com/nfischer))
- Contributing guidelines [\#422](https://github.com/shelljs/shelljs/pull/422) ([nfischer](https://github.com/nfischer))
- feat\(glob\): expose config.globOptions. [\#400](https://github.com/shelljs/shelljs/pull/400) ([nfischer](https://github.com/nfischer))
- Add shelljs as a keyword in package.json [\#393](https://github.com/shelljs/shelljs/pull/393) ([nfischer](https://github.com/nfischer))
- docs: add link to wiki page [\#392](https://github.com/shelljs/shelljs/pull/392) ([nfischer](https://github.com/nfischer))
- refactor\(cd\): use process.env.OLDPWD to store previous dir [\#383](https://github.com/shelljs/shelljs/pull/383) ([nfischer](https://github.com/nfischer))
- chore\(appveyor\): add in node 4 for appveyor [\#381](https://github.com/shelljs/shelljs/pull/381) ([nfischer](https://github.com/nfischer))
- Add Cash cross-reference [\#375](https://github.com/shelljs/shelljs/pull/375) ([dthree](https://github.com/dthree))
- Ignore gitattributes from npm package [\#361](https://github.com/shelljs/shelljs/pull/361) ([nfischer](https://github.com/nfischer))
- Consistently use LF line endings [\#355](https://github.com/shelljs/shelljs/pull/355) ([TimothyGu](https://github.com/TimothyGu))
- Release v0.7.0 [\#429](https://github.com/shelljs/shelljs/pull/429) ([nfischer](https://github.com/nfischer))
- fix: null is no longer confused for an object [\#428](https://github.com/shelljs/shelljs/pull/428) ([nfischer](https://github.com/nfischer))
- fix\(ls\): no trailing newline for empty directories [\#425](https://github.com/shelljs/shelljs/pull/425) ([nfischer](https://github.com/nfischer))
- feat\(cp\): -P option, plus better handling of symlinks [\#421](https://github.com/shelljs/shelljs/pull/421) ([nfischer](https://github.com/nfischer))
- docs\(exec\): fix docs about exec return type [\#419](https://github.com/shelljs/shelljs/pull/419) ([nfischer](https://github.com/nfischer))
- docs\(error\): deprecate relying on string value [\#418](https://github.com/shelljs/shelljs/pull/418) ([nfischer](https://github.com/nfischer))
- fix: error message now printed for fatal failures [\#417](https://github.com/shelljs/shelljs/pull/417) ([nfischer](https://github.com/nfischer))
- issue-407: Add regular files unit tests and fix symlink copy behavior [\#409](https://github.com/shelljs/shelljs/pull/409) ([charlesverge](https://github.com/charlesverge))
- refactor\(rm\): Remove duplicate code [\#408](https://github.com/shelljs/shelljs/pull/408) ([nfischer](https://github.com/nfischer))
- docs: wildcards for all commands, other docs cleanups [\#404](https://github.com/shelljs/shelljs/pull/404) ([nfischer](https://github.com/nfischer))
- test\(rm\): add tests to prevent a future regression [\#403](https://github.com/shelljs/shelljs/pull/403) ([nfischer](https://github.com/nfischer))
- refactor\(string\): modify string protoype, but only for shelljs/global [\#401](https://github.com/shelljs/shelljs/pull/401) ([nfischer](https://github.com/nfischer))
- feat: adding error codes to ShellJS [\#394](https://github.com/shelljs/shelljs/pull/394) ([nfischer](https://github.com/nfischer))
- feature: use rechoir [\#384](https://github.com/shelljs/shelljs/pull/384) ([nfischer](https://github.com/nfischer))
- refactor\(cp\): clean up code and fix \#376 [\#380](https://github.com/shelljs/shelljs/pull/380) ([nfischer](https://github.com/nfischer))
- New commands: sort\(\), head\(\), and tail\(\) [\#379](https://github.com/shelljs/shelljs/pull/379) ([nfischer](https://github.com/nfischer))
- Add unit tests to prevent regression \(see \#376\) [\#378](https://github.com/shelljs/shelljs/pull/378) ([nfischer](https://github.com/nfischer))
- feat\(pipe\): add support for pipes between commands [\#370](https://github.com/shelljs/shelljs/pull/370) ([nfischer](https://github.com/nfischer))
- refactor\(ls\): greatly simplify ls implimentation [\#369](https://github.com/shelljs/shelljs/pull/369) ([ariporad](https://github.com/ariporad))
- chore: drop node v0.10 support [\#368](https://github.com/shelljs/shelljs/pull/368) ([ariporad](https://github.com/ariporad))
- perf\(cd\): only run `stat` once [\#367](https://github.com/shelljs/shelljs/pull/367) ([ariporad](https://github.com/ariporad))
- fix\(exec\): properly handles paths with spaces and quotes [\#365](https://github.com/shelljs/shelljs/pull/365) ([nfischer](https://github.com/nfischer))
- test\(ln\): add tests for linking to cwd [\#364](https://github.com/shelljs/shelljs/pull/364) ([nfischer](https://github.com/nfischer))
- fix\(verbose\): verbose-style logging is consistent [\#362](https://github.com/shelljs/shelljs/pull/362) ([nfischer](https://github.com/nfischer))
- Refactor shellstring [\#360](https://github.com/shelljs/shelljs/pull/360) ([nfischer](https://github.com/nfischer))
- feat\(glob\): use glob module for globbing [\#359](https://github.com/shelljs/shelljs/pull/359) ([nfischer](https://github.com/nfischer))
- feat\(set\): add -f option to disable globbing [\#358](https://github.com/shelljs/shelljs/pull/358) ([nfischer](https://github.com/nfischer))
- config.fatal now throws an exception [\#357](https://github.com/shelljs/shelljs/pull/357) ([jrmclaurin](https://github.com/jrmclaurin))
- fix\(exec\): temp files are now cleaned up [\#354](https://github.com/shelljs/shelljs/pull/354) ([nfischer](https://github.com/nfischer))
- feat\(glob\): glob support for \(almost\) all commands [\#352](https://github.com/shelljs/shelljs/pull/352) ([nfischer](https://github.com/nfischer))
- feat\(grep\): add -l option [\#349](https://github.com/shelljs/shelljs/pull/349) ([nfischer](https://github.com/nfischer))
- fix\(exec\): now actually supports shell option [\#348](https://github.com/shelljs/shelljs/pull/348) ([nfischer](https://github.com/nfischer))
- feat\(touch\): supports multiple files [\#346](https://github.com/shelljs/shelljs/pull/346) ([nfischer](https://github.com/nfischer))
## [v0.6.0](https://github.com/shelljs/shelljs/tree/v0.6.0) (2016-02-05)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.5.3...v0.6.0)
**Closed issues:**
- option not recognized [\#334](https://github.com/shelljs/shelljs/issues/334)
- Feature request: Metadata with `ls` [\#323](https://github.com/shelljs/shelljs/issues/323)
- Gen-docs is broken [\#309](https://github.com/shelljs/shelljs/issues/309)
- `link -s` is broken for files on Windows [\#301](https://github.com/shelljs/shelljs/issues/301)
- Shelljs quits unexpectedly: [\#300](https://github.com/shelljs/shelljs/issues/300)
- Failing tests on Windows [\#296](https://github.com/shelljs/shelljs/issues/296)
- run-tests.js is broken for cmd.exe [\#294](https://github.com/shelljs/shelljs/issues/294)
- Support echo-ing environment variables [\#291](https://github.com/shelljs/shelljs/issues/291)
- Add Windows CI [\#287](https://github.com/shelljs/shelljs/issues/287)
- Add tests for the shjs utility [\#280](https://github.com/shelljs/shelljs/issues/280)
- Allow shjs utility to infer the extension for "filename." [\#278](https://github.com/shelljs/shelljs/issues/278)
- Ability to read the stdout buffer line-by-line [\#277](https://github.com/shelljs/shelljs/issues/277)
- Poor output for commands with multiple errors [\#267](https://github.com/shelljs/shelljs/issues/267)
- Travis ci build status says "unknown" [\#266](https://github.com/shelljs/shelljs/issues/266)
- wild card characters in filename not working as expected [\#262](https://github.com/shelljs/shelljs/issues/262)
- shell.exec - read internal variable [\#260](https://github.com/shelljs/shelljs/issues/260)
- cp and rename directory with -r doesn't match unix behavior [\#256](https://github.com/shelljs/shelljs/issues/256)
- console.log.apply throwing TypeError: Illegal Invocation [\#255](https://github.com/shelljs/shelljs/issues/255)
- How to exit on first error [\#253](https://github.com/shelljs/shelljs/issues/253)
- why not support set 'cwd' when invoke execAsync ? [\#250](https://github.com/shelljs/shelljs/issues/250)
- Not possible to check the failure of cd? [\#247](https://github.com/shelljs/shelljs/issues/247)
- By default shelljs runs command in root [\#246](https://github.com/shelljs/shelljs/issues/246)
- /usr/bin/env: node: No such file or directory [\#243](https://github.com/shelljs/shelljs/issues/243)
- "Which" command not working properly on Windows Platform. [\#238](https://github.com/shelljs/shelljs/issues/238)
- Arguments [\#237](https://github.com/shelljs/shelljs/issues/237)
- sed\(\) should accept multiple file arguments [\#231](https://github.com/shelljs/shelljs/issues/231)
- shelljs.exec\('aaa && bbb'\) blocks [\#229](https://github.com/shelljs/shelljs/issues/229)
- Consider creating a GitHub Organization with more maintainers [\#223](https://github.com/shelljs/shelljs/issues/223)
- Doesn't work inside Electron [\#220](https://github.com/shelljs/shelljs/issues/220)
- \[idea\] Add chmodr function. [\#219](https://github.com/shelljs/shelljs/issues/219)
- Execute a file [\#211](https://github.com/shelljs/shelljs/issues/211)
- Where is standard error going to? [\#209](https://github.com/shelljs/shelljs/issues/209)
- boolean return value for string.to\(\) [\#205](https://github.com/shelljs/shelljs/issues/205)
- `common.error` doesn't throw [\#199](https://github.com/shelljs/shelljs/issues/199)
- Problems with exec \(sync\) on 0.12/io.js [\#197](https://github.com/shelljs/shelljs/issues/197)
- cp --update flag [\#172](https://github.com/shelljs/shelljs/issues/172)
- Is there a way to suppress pushd/popd output? [\#171](https://github.com/shelljs/shelljs/issues/171)
- Cannot recursively list all \*.js files [\#162](https://github.com/shelljs/shelljs/issues/162)
- exec\(\) breaks if executed in a deleted directory [\#157](https://github.com/shelljs/shelljs/issues/157)
- shjs command always exits with zero code [\#133](https://github.com/shelljs/shelljs/issues/133)
- Windows failing tests [\#127](https://github.com/shelljs/shelljs/issues/127)
- touch command [\#122](https://github.com/shelljs/shelljs/issues/122)
- Symbolic links are broken! [\#100](https://github.com/shelljs/shelljs/issues/100)
- interpret `--` as stdin [\#55](https://github.com/shelljs/shelljs/issues/55)
- Error ENOTEMPTY when deleting a directory recursively. [\#49](https://github.com/shelljs/shelljs/issues/49)
- Cross-platform way to add to PATH [\#32](https://github.com/shelljs/shelljs/issues/32)
- `mv` fails on block, character, fifo [\#25](https://github.com/shelljs/shelljs/issues/25)
- ls -l [\#22](https://github.com/shelljs/shelljs/issues/22)
**Merged pull requests:**
- feat\(set\): add new set\(\) command [\#329](https://github.com/shelljs/shelljs/pull/329) ([nfischer](https://github.com/nfischer))
- Fix symlinking on Windows [\#322](https://github.com/shelljs/shelljs/pull/322) ([BYK](https://github.com/BYK))
- Rewrite .gitignore to be more comprehensive [\#321](https://github.com/shelljs/shelljs/pull/321) ([BYK](https://github.com/BYK))
- chore\(gitter/travis\): add gitter webhook to travis [\#313](https://github.com/shelljs/shelljs/pull/313) ([ariporad](https://github.com/ariporad))
- chore\(LGTM\): add LGTM config files [\#312](https://github.com/shelljs/shelljs/pull/312) ([ariporad](https://github.com/ariporad))
- feat\(ls\): add -d flag to ls\(\) [\#311](https://github.com/shelljs/shelljs/pull/311) ([nfischer](https://github.com/nfischer))
- fix\(gen-docs\): fix issue where docs are generated wrong [\#310](https://github.com/shelljs/shelljs/pull/310) ([nfischer](https://github.com/nfischer))
- chore\(package\): remove v0.8 from engines list [\#308](https://github.com/shelljs/shelljs/pull/308) ([nfischer](https://github.com/nfischer))
- travis: Mark as not using `sudo` and do not test 0.11 [\#307](https://github.com/shelljs/shelljs/pull/307) ([TimothyGu](https://github.com/TimothyGu))
- fix: jshint works on Windows [\#295](https://github.com/shelljs/shelljs/pull/295) ([nfischer](https://github.com/nfischer))
- feat: add tilde expansion to expand\(\) [\#293](https://github.com/shelljs/shelljs/pull/293) ([nfischer](https://github.com/nfischer))
- style: make docs more consistent [\#292](https://github.com/shelljs/shelljs/pull/292) ([nfischer](https://github.com/nfischer))
- update `exec` docs to match implemented behaviour [\#289](https://github.com/shelljs/shelljs/pull/289) ([vise890](https://github.com/vise890))
- chore: update github URL in package.json [\#288](https://github.com/shelljs/shelljs/pull/288) ([nfischer](https://github.com/nfischer))
- docs\(spelling\): fix typo in source comment [\#285](https://github.com/shelljs/shelljs/pull/285) ([nfischer](https://github.com/nfischer))
- chore\(travis\): add OS X to Travis CI [\#283](https://github.com/shelljs/shelljs/pull/283) ([nfischer](https://github.com/nfischer))
- Don't do `console.log.apply\(this, ...\)`. [\#274](https://github.com/shelljs/shelljs/pull/274) ([ariporad](https://github.com/ariporad))
- Implementing cd\('-'\) to behave like Bash's "cd -" [\#273](https://github.com/shelljs/shelljs/pull/273) ([nfischer](https://github.com/nfischer))
- Fix cp to match unix behavior [\#271](https://github.com/shelljs/shelljs/pull/271) ([freitagbr](https://github.com/freitagbr))
- Commands that have multiple errors now produce cleaner log output [\#268](https://github.com/shelljs/shelljs/pull/268) ([nfischer](https://github.com/nfischer))
- Support exit code in shjs. [\#252](https://github.com/shelljs/shelljs/pull/252) ([bryce-gibson](https://github.com/bryce-gibson))
- add touch\(1\) [\#249](https://github.com/shelljs/shelljs/pull/249) ([blockloop](https://github.com/blockloop))
- Fix `os.tmpdir` bug [\#240](https://github.com/shelljs/shelljs/pull/240) ([BYK](https://github.com/BYK))
- Make sure Which\(\) on Windows platform always return the command with … [\#239](https://github.com/shelljs/shelljs/pull/239) ([TingluoHuang](https://github.com/TingluoHuang))
- Add target node.js \(iojs v1, v2, v3\) [\#230](https://github.com/shelljs/shelljs/pull/230) ([sanemat](https://github.com/sanemat))
- feat-multisymbolic + Support for directory entry \(capital X in chmod terms\) [\#228](https://github.com/shelljs/shelljs/pull/228) ([rezonant](https://github.com/rezonant))
- Fixes an issue with multi-symbolic mode specification \(ie a-rwx,u+rw\) [\#227](https://github.com/shelljs/shelljs/pull/227) ([rezonant](https://github.com/rezonant))
- Memoized the result of target invocation [\#216](https://github.com/shelljs/shelljs/pull/216) ([rizowski](https://github.com/rizowski))
- remove empty for loop and leaked i var [\#166](https://github.com/shelljs/shelljs/pull/166) ([ratbeard](https://github.com/ratbeard))
- Wrap script name in double quotes [\#135](https://github.com/shelljs/shelljs/pull/135) ([ndelitski](https://github.com/ndelitski))
- Fixed coffeescript syntax in top example [\#99](https://github.com/shelljs/shelljs/pull/99) ([maxnordlund](https://github.com/maxnordlund))
- fix\(touch\): enhance parseOptions and fix touch's -r flag [\#341](https://github.com/shelljs/shelljs/pull/341) ([nfischer](https://github.com/nfischer))
- chore\(.npmignore\): update npmignore [\#339](https://github.com/shelljs/shelljs/pull/339) ([ariporad](https://github.com/ariporad))
- Release v0.6.0 [\#338](https://github.com/shelljs/shelljs/pull/338) ([ariporad](https://github.com/ariporad))
- docs\(README\): remove coffeescript from README [\#337](https://github.com/shelljs/shelljs/pull/337) ([ariporad](https://github.com/ariporad))
- fix\(cp\): add -n option, make -f default behavior [\#336](https://github.com/shelljs/shelljs/pull/336) ([nfischer](https://github.com/nfischer))
- feat\(exec\): allow all exec options to pass through [\#335](https://github.com/shelljs/shelljs/pull/335) ([nfischer](https://github.com/nfischer))
- fix\(mv\): add -n option, make -f default behavior [\#328](https://github.com/shelljs/shelljs/pull/328) ([nfischer](https://github.com/nfischer))
- fix\(cat\): make behavior more like unix [\#326](https://github.com/shelljs/shelljs/pull/326) ([nfischer](https://github.com/nfischer))
- feat\(ls\): add -l option [\#324](https://github.com/shelljs/shelljs/pull/324) ([nfischer](https://github.com/nfischer))
- style\(test/which\): make test/which.js conform to the style guidelines [\#320](https://github.com/shelljs/shelljs/pull/320) ([ariporad](https://github.com/ariporad))
- chore\(appveyor\): add badge [\#316](https://github.com/shelljs/shelljs/pull/316) ([nfischer](https://github.com/nfischer))
- fix\(windows\): fix shjs commands for windows [\#315](https://github.com/shelljs/shelljs/pull/315) ([nfischer](https://github.com/nfischer))
- feat\(sed\): support multiple file names [\#314](https://github.com/shelljs/shelljs/pull/314) ([nfischer](https://github.com/nfischer))
- feat\(cd\): cd\(\) \(no args\) changes to home directory [\#306](https://github.com/shelljs/shelljs/pull/306) ([nfischer](https://github.com/nfischer))
- test\(shjs\): add tests for shjs [\#304](https://github.com/shelljs/shelljs/pull/304) ([ariporad](https://github.com/ariporad))
- fix: regexes are more consistent with sed and grep [\#303](https://github.com/shelljs/shelljs/pull/303) ([nfischer](https://github.com/nfischer))
- Add appveyor.yml config file [\#299](https://github.com/shelljs/shelljs/pull/299) ([nfischer](https://github.com/nfischer))
- Fix tests on Windows [\#297](https://github.com/shelljs/shelljs/pull/297) ([BYK](https://github.com/BYK))
- Search PATHEXT instead of 3 hardcoded values [\#290](https://github.com/shelljs/shelljs/pull/290) ([isiahmeadows](https://github.com/isiahmeadows))
- Fix relative symlinks [\#282](https://github.com/shelljs/shelljs/pull/282) ([freitagbr](https://github.com/freitagbr))
- Make to and toEnd chainable [\#276](https://github.com/shelljs/shelljs/pull/276) ([TimothyGu](https://github.com/TimothyGu))
## [v0.5.3](https://github.com/shelljs/shelljs/tree/v0.5.3) (2015-08-11)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.5.2...v0.5.3)
**Merged pull requests:**
- Manually closing streams [\#222](https://github.com/shelljs/shelljs/pull/222) ([JulianLaval](https://github.com/JulianLaval))
## [v0.5.2](https://github.com/shelljs/shelljs/tree/v0.5.2) (2015-08-10)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.5.1...v0.5.2)
**Closed issues:**
- Cannot run shell.exec [\#217](https://github.com/shelljs/shelljs/issues/217)
- write after end: internal error [\#206](https://github.com/shelljs/shelljs/issues/206)
**Merged pull requests:**
- Update README.md [\#221](https://github.com/shelljs/shelljs/pull/221) ([giosh94mhz](https://github.com/giosh94mhz))
- prevent internal error: write after end [\#214](https://github.com/shelljs/shelljs/pull/214) ([charlierudolph](https://github.com/charlierudolph))
## [v0.5.1](https://github.com/shelljs/shelljs/tree/v0.5.1) (2015-06-05)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.5.0...v0.5.1)
**Closed issues:**
- cd into home directory [\#9](https://github.com/shelljs/shelljs/issues/9)
**Merged pull requests:**
- Fix issue \#49: Retry rmdirSync on Windows for up to 1 second if files still exist. [\#179](https://github.com/shelljs/shelljs/pull/179) ([andreialecu](https://github.com/andreialecu))
## [v0.5.0](https://github.com/shelljs/shelljs/tree/v0.5.0) (2015-05-19)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.3.0...v0.5.0)
**Closed issues:**
- Enter text to prompt [\#203](https://github.com/shelljs/shelljs/issues/203)
- Find which shell is being used [\#195](https://github.com/shelljs/shelljs/issues/195)
- Pass command line params to the make tool [\#188](https://github.com/shelljs/shelljs/issues/188)
- Is it possible to call exec with a command containing new lines ? [\#177](https://github.com/shelljs/shelljs/issues/177)
- The installation would break on Windows 7 [\#161](https://github.com/shelljs/shelljs/issues/161)
- Q.ninvoke\(\) returns undefined [\#153](https://github.com/shelljs/shelljs/issues/153)
- installed shelljs on osx but reported error: npm ERR! 404 '%5B-g%5D' is not in the npm registry. [\#124](https://github.com/shelljs/shelljs/issues/124)
- "ln" not found \(OS X\) [\#106](https://github.com/shelljs/shelljs/issues/106)
- Using shelljs in a CLI app. [\#91](https://github.com/shelljs/shelljs/issues/91)
**Merged pull requests:**
- Breaking: Allow -- as args separators \(fixes \#188\) [\#207](https://github.com/shelljs/shelljs/pull/207) ([nzakas](https://github.com/nzakas))
- Update .travis.yml [\#190](https://github.com/shelljs/shelljs/pull/190) ([arturadib](https://github.com/arturadib))
- Use new child\_process.execSync instead of busywaiting [\#189](https://github.com/shelljs/shelljs/pull/189) ([devTristan](https://github.com/devTristan))
- Update README.md: explains how to access "config" [\#145](https://github.com/shelljs/shelljs/pull/145) ([kerphi](https://github.com/kerphi))
- Fix to set state.error before throw the exception [\#120](https://github.com/shelljs/shelljs/pull/120) ([abdul-martinez](https://github.com/abdul-martinez))
- Add -l and -s support to grep. [\#116](https://github.com/shelljs/shelljs/pull/116) ([idearat](https://github.com/idearat))
## [v0.3.0](https://github.com/shelljs/shelljs/tree/v0.3.0) (2014-05-08)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.2.6...v0.3.0)
**Closed issues:**
- grep\(\) should fully support globing [\#118](https://github.com/shelljs/shelljs/issues/118)
- sed\(\) could support replacement function [\#115](https://github.com/shelljs/shelljs/issues/115)
- How would you close an exec process that runs indefinitely? [\#113](https://github.com/shelljs/shelljs/issues/113)
- listen for intermittent output of a long-running child process [\#111](https://github.com/shelljs/shelljs/issues/111)
- Cannot find module 'shelljs' after installing shelljs with npm [\#109](https://github.com/shelljs/shelljs/issues/109)
- Massive CPU usage on exec\(\) windows [\#108](https://github.com/shelljs/shelljs/issues/108)
- cp skipping dot files? [\#79](https://github.com/shelljs/shelljs/issues/79)
- $variables in exec\(\) aren't handled correctly [\#11](https://github.com/shelljs/shelljs/issues/11)
- debug flag that prints commands instead of executing [\#8](https://github.com/shelljs/shelljs/issues/8)
**Merged pull requests:**
- grep\(\) support for globing, fixes \#118 [\#119](https://github.com/shelljs/shelljs/pull/119) ([utensil](https://github.com/utensil))
- make sed\(\) support replacement function, fixes \#115 [\#117](https://github.com/shelljs/shelljs/pull/117) ([utensil](https://github.com/utensil))
- which\(\) should only find files, not directories [\#110](https://github.com/shelljs/shelljs/pull/110) ([panrafal](https://github.com/panrafal))
- Added the New BSD license to the package.json. [\#105](https://github.com/shelljs/shelljs/pull/105) ([keskival](https://github.com/keskival))
- Added win32 support to ln [\#104](https://github.com/shelljs/shelljs/pull/104) ([jamon](https://github.com/jamon))
- Fix ln using bad paths when given abspaths. [\#89](https://github.com/shelljs/shelljs/pull/89) ([Schoonology](https://github.com/Schoonology))
- Add ln support, including both -s and -f options. [\#88](https://github.com/shelljs/shelljs/pull/88) ([Schoonology](https://github.com/Schoonology))
- add support for symlinking \(junctions\) on win32 [\#87](https://github.com/shelljs/shelljs/pull/87) ([jamon](https://github.com/jamon))
## [v0.2.6](https://github.com/shelljs/shelljs/tree/v0.2.6) (2013-09-22)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.2.5...v0.2.6)
**Closed issues:**
- Versions 0.2.4 and 0.2.3 keep throwing strange errors [\#82](https://github.com/shelljs/shelljs/issues/82)
- Add global pollution tests [\#33](https://github.com/shelljs/shelljs/issues/33)
## [v0.2.5](https://github.com/shelljs/shelljs/tree/v0.2.5) (2013-09-11)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.2.4...v0.2.5)
**Closed issues:**
- shelljs.exec stalls on Red Hat when script is invoked with 'sudo -u username' [\#72](https://github.com/shelljs/shelljs/issues/72)
## [v0.2.4](https://github.com/shelljs/shelljs/tree/v0.2.4) (2013-09-11)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.2.3...v0.2.4)
## [v0.2.3](https://github.com/shelljs/shelljs/tree/v0.2.3) (2013-09-09)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.2.2...v0.2.3)
**Merged pull requests:**
- Make shell.exec\(\) treat process error return codes as shelljs errors [\#80](https://github.com/shelljs/shelljs/pull/80) ([nilsbunger](https://github.com/nilsbunger))
## [v0.2.2](https://github.com/shelljs/shelljs/tree/v0.2.2) (2013-09-02)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.1.4...v0.2.2)
**Closed issues:**
- which and node\_modules [\#63](https://github.com/shelljs/shelljs/issues/63)
- cannot install with nodejs 0.10.2 [\#57](https://github.com/shelljs/shelljs/issues/57)
**Merged pull requests:**
- Addition of a toEnd\(\) function modeled after the Unix \>\> pipe. [\#78](https://github.com/shelljs/shelljs/pull/78) ([andreweduffy](https://github.com/andreweduffy))
- Added appendTo\(\) function to imitate '\>\>' redirect-and-append pipe. [\#75](https://github.com/shelljs/shelljs/pull/75) ([andreweduffy](https://github.com/andreweduffy))
- Fix a small typo in README.md [\#71](https://github.com/shelljs/shelljs/pull/71) ([asmblah](https://github.com/asmblah))
- adding an `.npmignore` file [\#70](https://github.com/shelljs/shelljs/pull/70) ([stephenmathieson](https://github.com/stephenmathieson))
- tempdir: use `os.tmpDir` when possible [\#67](https://github.com/shelljs/shelljs/pull/67) ([stephenmathieson](https://github.com/stephenmathieson))
## [v0.1.4](https://github.com/shelljs/shelljs/tree/v0.1.4) (2013-05-10)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.1.3...v0.1.4)
**Merged pull requests:**
- removing extra fs calls [\#62](https://github.com/shelljs/shelljs/pull/62) ([stephenmathieson](https://github.com/stephenmathieson))
- moving \_jshint\_ to a development dependency [\#61](https://github.com/shelljs/shelljs/pull/61) ([stephenmathieson](https://github.com/stephenmathieson))
- Make the maximum buffersize 20 MB. [\#59](https://github.com/shelljs/shelljs/pull/59) ([waddlesplash](https://github.com/waddlesplash))
## [v0.1.3](https://github.com/shelljs/shelljs/tree/v0.1.3) (2013-04-21)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.1.2...v0.1.3)
**Merged pull requests:**
- test\('-L', badlink\) should return true [\#56](https://github.com/shelljs/shelljs/pull/56) ([lge88](https://github.com/lge88))
- exec options now allows `silent:true` with callback. [\#54](https://github.com/shelljs/shelljs/pull/54) ([iapain](https://github.com/iapain))
- Add Zepto to README [\#53](https://github.com/shelljs/shelljs/pull/53) ([madrobby](https://github.com/madrobby))
## [v0.1.2](https://github.com/shelljs/shelljs/tree/v0.1.2) (2013-01-08)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.1.1...v0.1.2)
**Closed issues:**
- pushd/popd [\#24](https://github.com/shelljs/shelljs/issues/24)
**Merged pull requests:**
- Implemented chmod command. Github issue 35 [\#48](https://github.com/shelljs/shelljs/pull/48) ([brandonramirez](https://github.com/brandonramirez))
## [v0.1.1](https://github.com/shelljs/shelljs/tree/v0.1.1) (2013-01-01)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.1.0...v0.1.1)
**Merged pull requests:**
- Work in progress: pushd/popd/dirs [\#47](https://github.com/shelljs/shelljs/pull/47) ([mstade](https://github.com/mstade))
## [v0.1.0](https://github.com/shelljs/shelljs/tree/v0.1.0) (2012-12-26)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.0.9...v0.1.0)
**Closed issues:**
- test\(\) for binary file? [\#45](https://github.com/shelljs/shelljs/issues/45)
- Inconsistent behaviour of cp command with directories. [\#44](https://github.com/shelljs/shelljs/issues/44)
- Executing SSH with ShellJs [\#43](https://github.com/shelljs/shelljs/issues/43)
**Merged pull requests:**
- Fix for \#44 [\#46](https://github.com/shelljs/shelljs/pull/46) ([mstade](https://github.com/mstade))
- Fix single/double quotes in exec [\#42](https://github.com/shelljs/shelljs/pull/42) ([danielepolencic](https://github.com/danielepolencic))
## [v0.0.9](https://github.com/shelljs/shelljs/tree/v0.0.9) (2012-12-01)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.0.8...v0.0.9)
**Closed issues:**
- silent output [\#40](https://github.com/shelljs/shelljs/issues/40)
- asynchronous exec [\#34](https://github.com/shelljs/shelljs/issues/34)
**Merged pull requests:**
- Passed process arguments to executable script [\#36](https://github.com/shelljs/shelljs/pull/36) ([Zanisimo](https://github.com/Zanisimo))
## [v0.0.8](https://github.com/shelljs/shelljs/tree/v0.0.8) (2012-10-11)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.0.7...v0.0.8)
**Closed issues:**
- exec with callback should automatically be async [\#31](https://github.com/shelljs/shelljs/issues/31)
- Exporting variables. [\#30](https://github.com/shelljs/shelljs/issues/30)
- Detecting shelljs/node [\#27](https://github.com/shelljs/shelljs/issues/27)
**Merged pull requests:**
- fix: global leak 'stats' [\#29](https://github.com/shelljs/shelljs/pull/29) ([ando-takahiro](https://github.com/ando-takahiro))
- -a includes . and ..; -A does not [\#28](https://github.com/shelljs/shelljs/pull/28) ([aeosynth](https://github.com/aeosynth))
## [v0.0.7](https://github.com/shelljs/shelljs/tree/v0.0.7) (2012-09-23)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.0.6...v0.0.7)
**Closed issues:**
- gh-pages: clicking 'fork me' just reloads the page [\#26](https://github.com/shelljs/shelljs/issues/26)
- Not declared local var implies possible memory leak [\#21](https://github.com/shelljs/shelljs/issues/21)
- Cannot echo a string that starts with - [\#20](https://github.com/shelljs/shelljs/issues/20)
- Unexpected cp behaviour with directories [\#15](https://github.com/shelljs/shelljs/issues/15)
**Merged pull requests:**
- add primaries to \_test [\#23](https://github.com/shelljs/shelljs/pull/23) ([aeosynth](https://github.com/aeosynth))
## [v0.0.6](https://github.com/shelljs/shelljs/tree/v0.0.6) (2012-08-07)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.0.6pre2...v0.0.6)
**Merged pull requests:**
- Fixed a global variable leak [\#16](https://github.com/shelljs/shelljs/pull/16) ([dallonf](https://github.com/dallonf))
## [v0.0.6pre2](https://github.com/shelljs/shelljs/tree/v0.0.6pre2) (2012-05-25)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.0.6pre1...v0.0.6pre2)
## [v0.0.6pre1](https://github.com/shelljs/shelljs/tree/v0.0.6pre1) (2012-05-25)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.0.5...v0.0.6pre1)
## [v0.0.5](https://github.com/shelljs/shelljs/tree/v0.0.5) (2012-05-24)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.0.5pre4...v0.0.5)
**Closed issues:**
- global.key assigned value 'async' as a result of shell.exec\(...\) [\#12](https://github.com/shelljs/shelljs/issues/12)
**Merged pull requests:**
- Add support for grep option -v. [\#13](https://github.com/shelljs/shelljs/pull/13) ([kkujala](https://github.com/kkujala))
## [v0.0.5pre4](https://github.com/shelljs/shelljs/tree/v0.0.5pre4) (2012-03-27)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.0.5pre3...v0.0.5pre4)
## [v0.0.5pre3](https://github.com/shelljs/shelljs/tree/v0.0.5pre3) (2012-03-27)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.0.5pre2...v0.0.5pre3)
## [v0.0.5pre2](https://github.com/shelljs/shelljs/tree/v0.0.5pre2) (2012-03-26)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.0.5pre1...v0.0.5pre2)
## [v0.0.5pre1](https://github.com/shelljs/shelljs/tree/v0.0.5pre1) (2012-03-26)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.0.4...v0.0.5pre1)
**Closed issues:**
- rm\(\) does not respect read/write modes [\#6](https://github.com/shelljs/shelljs/issues/6)
## [v0.0.4](https://github.com/shelljs/shelljs/tree/v0.0.4) (2012-03-22)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.0.3...v0.0.4)
**Closed issues:**
- "For convenient iteration via `for in`, ..."? [\#4](https://github.com/shelljs/shelljs/issues/4)
## [v0.0.3](https://github.com/shelljs/shelljs/tree/v0.0.3) (2012-03-21)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.0.2...v0.0.3)
## [v0.0.2](https://github.com/shelljs/shelljs/tree/v0.0.2) (2012-03-15)
[Full Changelog](https://github.com/shelljs/shelljs/compare/v0.0.2pre1...v0.0.2)
## [v0.0.2pre1](https://github.com/shelljs/shelljs/tree/v0.0.2pre1) (2012-03-03)
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

26
node_modules/shelljs/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,26 @@
Copyright (c) 2012, Artur Adib <arturadib@gmail.com>
All rights reserved.
You may use this project under the terms of the New BSD license as follows:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Artur Adib nor the
names of the contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL ARTUR ADIB BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

817
node_modules/shelljs/README.md generated vendored Normal file
View File

@@ -0,0 +1,817 @@
# ShellJS - Unix shell commands for Node.js
[![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg?style=flat-square)](https://gitter.im/shelljs/shelljs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Travis](https://img.shields.io/travis/shelljs/shelljs/master.svg?style=flat-square&label=unix)](https://travis-ci.org/shelljs/shelljs)
[![AppVeyor](https://img.shields.io/appveyor/ci/shelljs/shelljs/master.svg?style=flat-square&label=windows)](https://ci.appveyor.com/project/shelljs/shelljs/branch/master)
[![npm version](https://img.shields.io/npm/v/shelljs.svg?style=flat-square)](https://www.npmjs.com/package/shelljs)
[![npm downloads](https://img.shields.io/npm/dm/shelljs.svg?style=flat-square)](https://www.npmjs.com/package/shelljs)
ShellJS is a portable **(Windows/Linux/OS X)** implementation of Unix shell commands on top of the
Node.js API. You can use it to eliminate your shell script's dependency on Unix while still keeping
its familiar and powerful commands. You can also install it globally so you can run it from outside
Node projects - say goodbye to those gnarly Bash scripts!
ShellJS is proudly tested on every node release since `v0.11`!
The project is [unit-tested](http://travis-ci.org/shelljs/shelljs) and battled-tested in projects like:
+ [PDF.js](http://github.com/mozilla/pdf.js) - Firefox's next-gen PDF reader
+ [Firebug](http://getfirebug.com/) - Firefox's infamous debugger
+ [JSHint](http://jshint.com) - Most popular JavaScript linter
+ [Zepto](http://zeptojs.com) - jQuery-compatible JavaScript library for modern browsers
+ [Yeoman](http://yeoman.io/) - Web application stack and development tool
+ [Deployd.com](http://deployd.com) - Open source PaaS for quick API backend generation
+ And [many more](https://npmjs.org/browse/depended/shelljs).
If you have feedback, suggestions, or need help, feel free to post in our [issue tracker](https://github.com/shelljs/shelljs/issues).
Think ShellJS is cool? Check out some related projects (like
[cash](https://github.com/dthree/cash)--a javascript-based POSIX shell)
in our [Wiki page](https://github.com/shelljs/shelljs/wiki)!
Upgrading from an older version? Check out our [breaking
changes](https://github.com/shelljs/shelljs/wiki/Breaking-Changes) page to see
what changes to watch out for while upgrading.
## Command line use
If you just want cross platform UNIX commands, checkout our new project
[shelljs/shx](https://github.com/shelljs/shx), a utility to expose `shelljs` to
the command line.
For example:
```
$ shx mkdir -p foo
$ shx touch foo/bar.txt
$ shx rm -rf foo
```
## A quick note about the docs
For documentation on all the latest features, check out our
[README](https://github.com/shelljs/shelljs). To read docs that are consistent
with the latest release, check out [the npm
page](https://www.npmjs.com/package/shelljs) or
[shelljs.org](http://documentup.com/shelljs/shelljs).
## Installing
Via npm:
```bash
$ npm install [-g] shelljs
```
If the global option `-g` is specified, the binary `shjs` will be installed. This makes it possible to
run ShellJS scripts much like any shell script from the command line, i.e. without requiring a `node_modules` folder:
```bash
$ shjs my_script
```
## Examples
### JavaScript
```javascript
require('shelljs/global');
if (!which('git')) {
echo('Sorry, this script requires git');
exit(1);
}
// Copy files to release dir
rm('-rf', 'out/Release');
cp('-R', 'stuff/', 'out/Release');
// Replace macros in each .js file
cd('lib');
ls('*.js').forEach(function(file) {
sed('-i', 'BUILD_VERSION', 'v0.1.2', file);
sed('-i', /^.*REMOVE_THIS_LINE.*$/, '', file);
sed('-i', /.*REPLACE_LINE_WITH_MACRO.*\n/, cat('macro.js'), file);
});
cd('..');
// Run external tool synchronously
if (exec('git commit -am "Auto-commit"').code !== 0) {
echo('Error: Git commit failed');
exit(1);
}
```
### CoffeeScript
CoffeeScript is also supported automatically:
```coffeescript
require 'shelljs/global'
if not which 'git'
echo 'Sorry, this script requires git'
exit 1
# Copy files to release dir
rm '-rf', 'out/Release'
cp '-R', 'stuff/', 'out/Release'
# Replace macros in each .js file
cd 'lib'
for file in ls '*.js'
sed '-i', 'BUILD_VERSION', 'v0.1.2', file
sed '-i', /^.*REMOVE_THIS_LINE.*$/, '', file
sed '-i', /.*REPLACE_LINE_WITH_MACRO.*\n/, cat('macro.js'), file
cd '..'
# Run external tool synchronously
if (exec 'git commit -am "Auto-commit"').code != 0
echo 'Error: Git commit failed'
exit 1
```
## Global vs. Local
The example above uses the convenience script `shelljs/global` to reduce verbosity. If polluting your global namespace is not desirable, simply require `shelljs`.
Example:
```javascript
var shell = require('shelljs');
shell.echo('hello world');
```
<!-- DO NOT MODIFY BEYOND THIS POINT - IT'S AUTOMATICALLY GENERATED -->
## Command reference
All commands run synchronously, unless otherwise stated.
All commands accept standard bash globbing characters (`*`, `?`, etc.),
compatible with the [node glob module](https://github.com/isaacs/node-glob).
For less-commonly used commands and features, please check out our [wiki
page](https://github.com/shelljs/shelljs/wiki).
### cat(file [, file ...])
### cat(file_array)
Examples:
```javascript
var str = cat('file*.txt');
var str = cat('file1', 'file2');
var str = cat(['file1', 'file2']); // same as above
```
Returns a string containing the given file, or a concatenated string
containing the files if more than one file is given (a new line character is
introduced between each file).
### cd([dir])
Changes to directory `dir` for the duration of the script. Changes to home
directory if no argument is supplied.
### chmod(octal_mode || octal_string, file)
### chmod(symbolic_mode, file)
Available options:
+ `-v`: output a diagnostic for every file processed
+ `-c`: like verbose but report only when a change is made
+ `-R`: change files and directories recursively
Examples:
```javascript
chmod(755, '/Users/brandon');
chmod('755', '/Users/brandon'); // same as above
chmod('u+x', '/Users/brandon');
```
Alters the permissions of a file or directory by either specifying the
absolute permissions in octal form or expressing the changes in symbols.
This command tries to mimic the POSIX behavior as much as possible.
Notable exceptions:
+ In symbolic modes, 'a-r' and '-r' are identical. No consideration is
given to the umask.
+ There is no "quiet" option since default behavior is to run silent.
### cp([options,] source [, source ...], dest)
### cp([options,] source_array, dest)
Available options:
+ `-f`: force (default behavior)
+ `-n`: no-clobber
+ `-u`: only copy if source is newer than dest
+ `-r`, `-R`: recursive
+ `-L`: follow symlinks
+ `-P`: don't follow symlinks
Examples:
```javascript
cp('file1', 'dir1');
cp('-R', 'path/to/dir/', '~/newCopy/');
cp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp');
cp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above
```
Copies files.
### pushd([options,] [dir | '-N' | '+N'])
Available options:
+ `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.
Arguments:
+ `dir`: Makes the current working directory be the top of the stack, and then executes the equivalent of `cd dir`.
+ `+N`: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
+ `-N`: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
Examples:
```javascript
// process.cwd() === '/usr'
pushd('/etc'); // Returns /etc /usr
pushd('+1'); // Returns /usr /etc
```
Save the current directory on the top of the directory stack and then cd to `dir`. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack.
### popd([options,] ['-N' | '+N'])
Available options:
+ `-n`: Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated.
Arguments:
+ `+N`: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero.
+ `-N`: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero.
Examples:
```javascript
echo(process.cwd()); // '/usr'
pushd('/etc'); // '/etc /usr'
echo(process.cwd()); // '/etc'
popd(); // '/usr'
echo(process.cwd()); // '/usr'
```
When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack.
### dirs([options | '+N' | '-N'])
Available options:
+ `-c`: Clears the directory stack by deleting all of the elements.
Arguments:
+ `+N`: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero.
+ `-N`: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero.
Display the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified.
See also: pushd, popd
### echo([options,] string [, string ...])
Available options:
+ `-e`: interpret backslash escapes (default)
Examples:
```javascript
echo('hello world');
var str = echo('hello world');
```
Prints string to stdout, and returns string with additional utility methods
like `.to()`.
### exec(command [, options] [, callback])
Available options (all `false` by default):
+ `async`: Asynchronous execution. If a callback is provided, it will be set to
`true`, regardless of the passed value.
+ `silent`: Do not echo program output to console.
+ and any option available to NodeJS's
[child_process.exec()](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback)
Examples:
```javascript
var version = exec('node --version', {silent:true}).stdout;
var child = exec('some_long_running_process', {async:true});
child.stdout.on('data', function(data) {
/* ... do something with data ... */
});
exec('some_long_running_process', function(code, stdout, stderr) {
console.log('Exit code:', code);
console.log('Program output:', stdout);
console.log('Program stderr:', stderr);
});
```
Executes the given `command` _synchronously_, unless otherwise specified. When in synchronous
mode, this returns a ShellString (compatible with ShellJS v0.6.x, which returns an object
of the form `{ code:..., stdout:... , stderr:... }`). Otherwise, this returns the child process
object, and the `callback` gets the arguments `(code, stdout, stderr)`.
Not seeing the behavior you want? `exec()` runs everything through `sh`
by default (or `cmd.exe` on Windows), which differs from `bash`. If you
need bash-specific behavior, try out the `{shell: 'path/to/bash'}` option.
**Note:** For long-lived processes, it's best to run `exec()` asynchronously as
the current synchronous implementation uses a lot of CPU. This should be getting
fixed soon.
### find(path [, path ...])
### find(path_array)
Examples:
```javascript
find('src', 'lib');
find(['src', 'lib']); // same as above
find('.').filter(function(file) { return file.match(/\.js$/); });
```
Returns array of all files (however deep) in the given paths.
The main difference from `ls('-R', path)` is that the resulting file names
include the base directories, e.g. `lib/resources/file1` instead of just `file1`.
### grep([options,] regex_filter, file [, file ...])
### grep([options,] regex_filter, file_array)
Available options:
+ `-v`: Inverse the sense of the regex and print the lines not matching the criteria.
+ `-l`: Print only filenames of matching files
Examples:
```javascript
grep('-v', 'GLOBAL_VARIABLE', '*.js');
grep('GLOBAL_VARIABLE', '*.js');
```
Reads input string from given files and returns a string containing all lines of the
file that match the given `regex_filter`.
### head([{'-n': \<num\>},] file [, file ...])
### head([{'-n': \<num\>},] file_array)
Available options:
+ `-n <num>`: Show the first `<num>` lines of the files
Examples:
```javascript
var str = head({'-n': 1}, 'file*.txt');
var str = head('file1', 'file2');
var str = head(['file1', 'file2']); // same as above
```
Read the start of a file.
### ln([options,] source, dest)
Available options:
+ `-s`: symlink
+ `-f`: force
Examples:
```javascript
ln('file', 'newlink');
ln('-sf', 'file', 'existing');
```
Links source to dest. Use -f to force the link, should dest already exist.
### ls([options,] [path, ...])
### ls([options,] path_array)
Available options:
+ `-R`: recursive
+ `-A`: all files (include files beginning with `.`, except for `.` and `..`)
+ `-d`: list directories themselves, not their contents
+ `-l`: list objects representing each file, each with fields containing `ls
-l` output fields. See
[fs.Stats](https://nodejs.org/api/fs.html#fs_class_fs_stats)
for more info
Examples:
```javascript
ls('projs/*.js');
ls('-R', '/users/me', '/tmp');
ls('-R', ['/users/me', '/tmp']); // same as above
ls('-l', 'file.txt'); // { name: 'file.txt', mode: 33188, nlink: 1, ...}
```
Returns array of files in the given path, or in current directory if no path provided.
### mkdir([options,] dir [, dir ...])
### mkdir([options,] dir_array)
Available options:
+ `-p`: full path (will create intermediate dirs if necessary)
Examples:
```javascript
mkdir('-p', '/tmp/a/b/c/d', '/tmp/e/f/g');
mkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above
```
Creates directories.
### mv([options ,] source [, source ...], dest')
### mv([options ,] source_array, dest')
Available options:
+ `-f`: force (default behavior)
+ `-n`: no-clobber
Examples:
```javascript
mv('-n', 'file', 'dir/');
mv('file1', 'file2', 'dir/');
mv(['file1', 'file2'], 'dir/'); // same as above
```
Moves files.
### pwd()
Returns the current directory.
### rm([options,] file [, file ...])
### rm([options,] file_array)
Available options:
+ `-f`: force
+ `-r, -R`: recursive
Examples:
```javascript
rm('-rf', '/tmp/*');
rm('some_file.txt', 'another_file.txt');
rm(['some_file.txt', 'another_file.txt']); // same as above
```
Removes files.
### sed([options,] search_regex, replacement, file [, file ...])
### sed([options,] search_regex, replacement, file_array)
Available options:
+ `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_
Examples:
```javascript
sed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js');
sed(/.*DELETE_THIS_LINE.*\n/, '', 'source.js');
```
Reads an input string from `files` and performs a JavaScript `replace()` on the input
using the given search regex and replacement string or function. Returns the new string after replacement.
Note:
Like unix `sed`, ShellJS `sed` supports capture groups. Capture groups are specified
using the `$n` syntax:
```javascript
sed(/(\w+)\s(\w+)/, '$2, $1', 'file.txt');
```
### set(options)
Available options:
+ `+/-e`: exit upon error (`config.fatal`)
+ `+/-v`: verbose: show all commands (`config.verbose`)
+ `+/-f`: disable filename expansion (globbing)
Examples:
```javascript
set('-e'); // exit upon first error
set('+e'); // this undoes a "set('-e')"
```
Sets global configuration variables
### sort([options,] file [, file ...])
### sort([options,] file_array)
Available options:
+ `-r`: Reverse the result of comparisons
+ `-n`: Compare according to numerical value
Examples:
```javascript
sort('foo.txt', 'bar.txt');
sort('-r', 'foo.txt');
```
Return the contents of the files, sorted line-by-line. Sorting multiple
files mixes their content, just like unix sort does.
### tail([{'-n': \<num\>},] file [, file ...])
### tail([{'-n': \<num\>},] file_array)
Available options:
+ `-n <num>`: Show the last `<num>` lines of the files
Examples:
```javascript
var str = tail({'-n': 1}, 'file*.txt');
var str = tail('file1', 'file2');
var str = tail(['file1', 'file2']); // same as above
```
Read the end of a file.
### tempdir()
Examples:
```javascript
var tmp = tempdir(); // "/tmp" for most *nix platforms
```
Searches and returns string containing a writeable, platform-dependent temporary directory.
Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir).
### test(expression)
Available expression primaries:
+ `'-b', 'path'`: true if path is a block device
+ `'-c', 'path'`: true if path is a character device
+ `'-d', 'path'`: true if path is a directory
+ `'-e', 'path'`: true if path exists
+ `'-f', 'path'`: true if path is a regular file
+ `'-L', 'path'`: true if path is a symbolic link
+ `'-p', 'path'`: true if path is a pipe (FIFO)
+ `'-S', 'path'`: true if path is a socket
Examples:
```javascript
if (test('-d', path)) { /* do something with dir */ };
if (!test('-f', path)) continue; // skip if it's a regular file
```
Evaluates expression using the available primaries and returns corresponding value.
### ShellString.prototype.to(file)
Examples:
```javascript
cat('input.txt').to('output.txt');
```
Analogous to the redirection operator `>` in Unix, but works with
ShellStrings (such as those returned by `cat`, `grep`, etc). _Like Unix
redirections, `to()` will overwrite any existing file!_
### ShellString.prototype.toEnd(file)
Examples:
```javascript
cat('input.txt').toEnd('output.txt');
```
Analogous to the redirect-and-append operator `>>` in Unix, but works with
ShellStrings (such as those returned by `cat`, `grep`, etc).
### touch([options,] file [, file ...])
### touch([options,] file_array)
Available options:
+ `-a`: Change only the access time
+ `-c`: Do not create any files
+ `-m`: Change only the modification time
+ `-d DATE`: Parse DATE and use it instead of current time
+ `-r FILE`: Use FILE's times instead of current time
Examples:
```javascript
touch('source.js');
touch('-c', '/path/to/some/dir/source.js');
touch({ '-r': FILE }, '/path/to/some/dir/source.js');
```
Update the access and modification times of each FILE to the current time.
A FILE argument that does not exist is created empty, unless -c is supplied.
This is a partial implementation of *[touch(1)](http://linux.die.net/man/1/touch)*.
### uniq([options,] [input, [output]])
Available options:
+ `-i`: Ignore case while comparing
+ `-c`: Prefix lines by the number of occurrences
+ `-d`: Only print duplicate lines, one for each group of identical lines
Examples:
```javascript
uniq('foo.txt');
uniq('-i', 'foo.txt');
uniq('-cd', 'foo.txt', 'bar.txt');
```
Filter adjacent matching lines from input
### which(command)
Examples:
```javascript
var nodeExec = which('node');
```
Searches for `command` in the system's PATH. On Windows, this uses the
`PATHEXT` variable to append the extension if it's not already executable.
Returns string containing the absolute path to the command.
### exit(code)
Exits the current process with the given exit code.
### error()
Tests if error occurred in the last command. Returns a truthy value if an
error returned and a falsy value otherwise.
**Note**: do not rely on the
return value to be an error message. If you need the last error message, use
the `.stderr` attribute from the last command's return value instead.
### ShellString(str)
Examples:
```javascript
var foo = ShellString('hello world');
```
Turns a regular string into a string-like object similar to what each
command returns. This has special methods, like `.to()` and `.toEnd()`
### env['VAR_NAME']
Object containing environment variables (both getter and setter). Shortcut
to process.env.
### Pipes
Examples:
```javascript
grep('foo', 'file1.txt', 'file2.txt').sed(/o/g, 'a').to('output.txt');
echo('files with o\'s in the name:\n' + ls().grep('o'));
cat('test.js').exec('node'); // pipe to exec() call
```
Commands can send their output to another command in a pipe-like fashion.
`sed`, `grep`, `cat`, `exec`, `to`, and `toEnd` can appear on the right-hand
side of a pipe. Pipes can be chained.
## Configuration
### config.silent
Example:
```javascript
var sh = require('shelljs');
var silentState = sh.config.silent; // save old silent state
sh.config.silent = true;
/* ... */
sh.config.silent = silentState; // restore old silent state
```
Suppresses all command output if `true`, except for `echo()` calls.
Default is `false`.
### config.fatal
Example:
```javascript
require('shelljs/global');
config.fatal = true; // or set('-e');
cp('this_file_does_not_exist', '/dev/null'); // throws Error here
/* more commands... */
```
If `true` the script will throw a Javascript error when any shell.js
command encounters an error. Default is `false`. This is analogous to
Bash's `set -e`
### config.verbose
Example:
```javascript
config.verbose = true; // or set('-v');
cd('dir/');
ls('subdir/');
```
Will print each command as follows:
```
cd dir/
ls subdir/
```
### config.globOptions
Example:
```javascript
config.globOptions = {nodir: true};
```
Use this value for calls to `glob.sync()` instead of the default options.
### config.reset()
Example:
```javascript
var shell = require('shelljs');
// Make changes to shell.config, and do stuff...
/* ... */
shell.config.reset(); // reset to original state
// Do more stuff, but with original settings
/* ... */
```
Reset shell.config to the defaults:
```javascript
{
fatal: false,
globOptions: {},
maxdepth: 255,
noglob: false,
silent: false,
verbose: false,
}
```
## Team
| [![Nate Fischer](https://avatars.githubusercontent.com/u/5801521?s=130)](https://github.com/nfischer) | [![Ari Porad](https://avatars1.githubusercontent.com/u/1817508?v=3&s=130)](http://github.com/ariporad) |
|:---:|:---:|
| [Nate Fischer](https://github.com/nfischer) | [Ari Porad](http://github.com/ariporad) |

39
node_modules/shelljs/bin/shjs generated vendored Executable file
View File

@@ -0,0 +1,39 @@
#!/usr/bin/env node
require('../global');
if (process.argv.length < 3) {
console.log('ShellJS: missing argument (script name)');
console.log();
process.exit(1);
}
var args,
scriptName = process.argv[2];
env['NODE_PATH'] = __dirname + '/../..';
if (!scriptName.match(/\.js/) && !scriptName.match(/\.coffee/)) {
if (test('-f', scriptName + '.js'))
scriptName += '.js';
if (test('-f', scriptName + '.coffee'))
scriptName += '.coffee';
}
if (!test('-f', scriptName)) {
console.log('ShellJS: script not found ('+scriptName+')');
console.log();
process.exit(1);
}
args = process.argv.slice(3);
for (var i = 0, l = args.length; i < l; i++) {
if (args[i][0] !== "-"){
args[i] = '"' + args[i] + '"'; // fixes arguments with multiple words
}
}
var path = require('path');
var extensions = require('interpret').extensions;
var rechoir = require('rechoir');
rechoir.prepare(extensions, scriptName);
require(require.resolve(path.resolve(process.cwd(), scriptName)));

29
node_modules/shelljs/commands.json generated vendored Normal file
View File

@@ -0,0 +1,29 @@
[
"cat",
"cd",
"chmod",
"cp",
"dirs",
"echo",
"exec",
"find",
"grep",
"head",
"ln",
"ls",
"mkdir",
"mv",
"pwd",
"rm",
"sed",
"set",
"sort",
"tail",
"tempdir",
"test",
"to",
"toEnd",
"touch",
"uniq",
"which"
]

12
node_modules/shelljs/global.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
/* eslint no-extend-native: 0 */
var shell = require('./shell.js');
var common = require('./src/common');
Object.keys(shell).forEach(function (cmd) {
global[cmd] = shell[cmd];
});
var _to = require('./src/to');
String.prototype.to = common.wrap('to', _to);
var _toEnd = require('./src/toEnd');
String.prototype.toEnd = common.wrap('toEnd', _toEnd);

57
node_modules/shelljs/make.js generated vendored Normal file
View File

@@ -0,0 +1,57 @@
require('./global');
global.config.fatal = true;
global.target = {};
var args = process.argv.slice(2),
targetArgs,
dashesLoc = args.indexOf('--');
// split args, everything after -- if only for targets
if (dashesLoc > -1) {
targetArgs = args.slice(dashesLoc + 1, args.length);
args = args.slice(0, dashesLoc);
}
// This ensures we only execute the script targets after the entire script has
// been evaluated
setTimeout(function() {
var t;
if (args.length === 1 && args[0] === '--help') {
console.log('Available targets:');
for (t in global.target)
console.log(' ' + t);
return;
}
// Wrap targets to prevent duplicate execution
for (t in global.target) {
(function(t, oldTarget){
// Wrap it
global.target[t] = function() {
if (!oldTarget.done){
oldTarget.done = true;
oldTarget.result = oldTarget.apply(oldTarget, arguments);
}
return oldTarget.result;
};
})(t, global.target[t]);
}
// Execute desired targets
if (args.length > 0) {
args.forEach(function(arg) {
if (arg in global.target)
global.target[arg](targetArgs);
else {
console.log('no such target: ' + arg);
}
});
} else if ('all' in global.target) {
global.target.all(targetArgs);
}
}, 0);

15
node_modules/shelljs/node_modules/glob/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,15 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

368
node_modules/shelljs/node_modules/glob/README.md generated vendored Normal file
View File

@@ -0,0 +1,368 @@
# Glob
Match files using the patterns the shell uses, like stars and stuff.
[![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Build Status](https://ci.appveyor.com/api/projects/status/kd7f3yftf7unxlsx?svg=true)](https://ci.appveyor.com/project/isaacs/node-glob) [![Coverage Status](https://coveralls.io/repos/isaacs/node-glob/badge.svg?branch=master&service=github)](https://coveralls.io/github/isaacs/node-glob?branch=master)
This is a glob implementation in JavaScript. It uses the `minimatch`
library to do its matching.
![](oh-my-glob.gif)
## Usage
Install with npm
```
npm i glob
```
```javascript
var glob = require("glob")
// options is optional
glob("**/*.js", options, function (er, files) {
// files is an array of filenames.
// If the `nonull` option is set, and nothing
// was found, then files is ["**/*.js"]
// er is an error object or null.
})
```
## Glob Primer
"Globs" are the patterns you type when you do stuff like `ls *.js` on
the command line, or put `build/*` in a `.gitignore` file.
Before parsing the path part patterns, braced sections are expanded
into a set. Braced sections start with `{` and end with `}`, with any
number of comma-delimited sections within. Braced sections may contain
slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`.
The following characters have special magic meaning when used in a
path portion:
* `*` Matches 0 or more characters in a single path portion
* `?` Matches 1 character
* `[...]` Matches a range of characters, similar to a RegExp range.
If the first character of the range is `!` or `^` then it matches
any character not in the range.
* `!(pattern|pattern|pattern)` Matches anything that does not match
any of the patterns provided.
* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the
patterns provided.
* `+(pattern|pattern|pattern)` Matches one or more occurrences of the
patterns provided.
* `*(a|b|c)` Matches zero or more occurrences of the patterns provided
* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns
provided
* `**` If a "globstar" is alone in a path portion, then it matches
zero or more directories and subdirectories searching for matches.
It does not crawl symlinked directories.
### Dots
If a file or directory path portion has a `.` as the first character,
then it will not match any glob pattern unless that pattern's
corresponding path part also has a `.` as its first character.
For example, the pattern `a/.*/c` would match the file at `a/.b/c`.
However the pattern `a/*/c` would not, because `*` does not start with
a dot character.
You can make glob treat dots as normal characters by setting
`dot:true` in the options.
### Basename Matching
If you set `matchBase:true` in the options, and the pattern has no
slashes in it, then it will seek for any file anywhere in the tree
with a matching basename. For example, `*.js` would match
`test/simple/basic.js`.
### Empty Sets
If no matching files are found, then an empty array is returned. This
differs from the shell, where the pattern itself is returned. For
example:
$ echo a*s*d*f
a*s*d*f
To get the bash-style behavior, set the `nonull:true` in the options.
### See Also:
* `man sh`
* `man bash` (Search for "Pattern Matching")
* `man 3 fnmatch`
* `man 5 gitignore`
* [minimatch documentation](https://github.com/isaacs/minimatch)
## glob.hasMagic(pattern, [options])
Returns `true` if there are any special characters in the pattern, and
`false` otherwise.
Note that the options affect the results. If `noext:true` is set in
the options object, then `+(a|b)` will not be considered a magic
pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}`
then that is considered magical, unless `nobrace:true` is set in the
options.
## glob(pattern, [options], cb)
* `pattern` `{String}` Pattern to be matched
* `options` `{Object}`
* `cb` `{Function}`
* `err` `{Error | null}`
* `matches` `{Array<String>}` filenames found matching the pattern
Perform an asynchronous glob search.
## glob.sync(pattern, [options])
* `pattern` `{String}` Pattern to be matched
* `options` `{Object}`
* return: `{Array<String>}` filenames found matching the pattern
Perform a synchronous glob search.
## Class: glob.Glob
Create a Glob object by instantiating the `glob.Glob` class.
```javascript
var Glob = require("glob").Glob
var mg = new Glob(pattern, options, cb)
```
It's an EventEmitter, and starts walking the filesystem to find matches
immediately.
### new glob.Glob(pattern, [options], [cb])
* `pattern` `{String}` pattern to search for
* `options` `{Object}`
* `cb` `{Function}` Called when an error occurs, or matches are found
* `err` `{Error | null}`
* `matches` `{Array<String>}` filenames found matching the pattern
Note that if the `sync` flag is set in the options, then matches will
be immediately available on the `g.found` member.
### Properties
* `minimatch` The minimatch object that the glob uses.
* `options` The options object passed in.
* `aborted` Boolean which is set to true when calling `abort()`. There
is no way at this time to continue a glob search after aborting, but
you can re-use the statCache to avoid having to duplicate syscalls.
* `cache` Convenience object. Each field has the following possible
values:
* `false` - Path does not exist
* `true` - Path exists
* `'FILE'` - Path exists, and is not a directory
* `'DIR'` - Path exists, and is a directory
* `[file, entries, ...]` - Path exists, is a directory, and the
array value is the results of `fs.readdir`
* `statCache` Cache of `fs.stat` results, to prevent statting the same
path multiple times.
* `symlinks` A record of which paths are symbolic links, which is
relevant in resolving `**` patterns.
* `realpathCache` An optional object which is passed to `fs.realpath`
to minimize unnecessary syscalls. It is stored on the instantiated
Glob object, and may be re-used.
### Events
* `end` When the matching is finished, this is emitted with all the
matches found. If the `nonull` option is set, and no match was found,
then the `matches` list contains the original pattern. The matches
are sorted, unless the `nosort` flag is set.
* `match` Every time a match is found, this is emitted with the specific
thing that matched. It is not deduplicated or resolved to a realpath.
* `error` Emitted when an unexpected error is encountered, or whenever
any fs error occurs if `options.strict` is set.
* `abort` When `abort()` is called, this event is raised.
### Methods
* `pause` Temporarily stop the search
* `resume` Resume the search
* `abort` Stop the search forever
### Options
All the options that can be passed to Minimatch can also be passed to
Glob to change pattern matching behavior. Also, some have been added,
or have glob-specific ramifications.
All options are false by default, unless otherwise noted.
All options are added to the Glob object, as well.
If you are running many `glob` operations, you can pass a Glob object
as the `options` argument to a subsequent operation to shortcut some
`stat` and `readdir` calls. At the very least, you may pass in shared
`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that
parallel glob operations will be sped up by sharing information about
the filesystem.
* `cwd` The current working directory in which to search. Defaults
to `process.cwd()`.
* `root` The place where patterns starting with `/` will be mounted
onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix
systems, and `C:\` or some such on Windows.)
* `dot` Include `.dot` files in normal matches and `globstar` matches.
Note that an explicit dot in a portion of the pattern will always
match dot files.
* `nomount` By default, a pattern starting with a forward-slash will be
"mounted" onto the root setting, so that a valid filesystem path is
returned. Set this flag to disable that behavior.
* `mark` Add a `/` character to directory matches. Note that this
requires additional stat calls.
* `nosort` Don't sort the results.
* `stat` Set to true to stat *all* results. This reduces performance
somewhat, and is completely unnecessary, unless `readdir` is presumed
to be an untrustworthy indicator of file existence.
* `silent` When an unusual error is encountered when attempting to
read a directory, a warning will be printed to stderr. Set the
`silent` option to true to suppress these warnings.
* `strict` When an unusual error is encountered when attempting to
read a directory, the process will just continue on in search of
other matches. Set the `strict` option to raise an error in these
cases.
* `cache` See `cache` property above. Pass in a previously generated
cache object to save some fs calls.
* `statCache` A cache of results of filesystem information, to prevent
unnecessary stat calls. While it should not normally be necessary
to set this, you may pass the statCache from one glob() call to the
options object of another, if you know that the filesystem will not
change between calls. (See "Race Conditions" below.)
* `symlinks` A cache of known symbolic links. You may pass in a
previously generated `symlinks` object to save `lstat` calls when
resolving `**` matches.
* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead.
* `nounique` In some cases, brace-expanded patterns can result in the
same file showing up multiple times in the result set. By default,
this implementation prevents duplicates in the result set. Set this
flag to disable that behavior.
* `nonull` Set to never return an empty set, instead returning a set
containing the pattern itself. This is the default in glob(3).
* `debug` Set to enable debug logging in minimatch and glob.
* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets.
* `noglobstar` Do not match `**` against multiple filenames. (Ie,
treat it as a normal `*` instead.)
* `noext` Do not match `+(a|b)` "extglob" patterns.
* `nocase` Perform a case-insensitive match. Note: on
case-insensitive filesystems, non-magic patterns will match by
default, since `stat` and `readdir` will not raise errors.
* `matchBase` Perform a basename-only match if the pattern does not
contain any slash characters. That is, `*.js` would be treated as
equivalent to `**/*.js`, matching all js files in all directories.
* `nodir` Do not match directories, only files. (Note: to match
*only* directories, simply put a `/` at the end of the pattern.)
* `ignore` Add a pattern or an array of glob patterns to exclude matches.
Note: `ignore` patterns are *always* in `dot:true` mode, regardless
of any other settings.
* `follow` Follow symlinked directories when expanding `**` patterns.
Note that this can result in a lot of duplicate references in the
presence of cyclic links.
* `realpath` Set to true to call `fs.realpath` on all of the results.
In the case of a symlink that cannot be resolved, the full absolute
path to the matched entry is returned (though it will usually be a
broken symlink)
* `absolute` Set to true to always receive absolute paths for matched
files. Unlike `realpath`, this also affects the values returned in
the `match` event.
## Comparisons to other fnmatch/glob implementations
While strict compliance with the existing standards is a worthwhile
goal, some discrepancies exist between node-glob and other
implementations, and are intentional.
The double-star character `**` is supported by default, unless the
`noglobstar` flag is set. This is supported in the manner of bsdglob
and bash 4.3, where `**` only has special significance if it is the only
thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but
`a/**b` will not.
Note that symlinked directories are not crawled as part of a `**`,
though their contents may match against subsequent portions of the
pattern. This prevents infinite loops and duplicates and the like.
If an escaped pattern has no matches, and the `nonull` flag is set,
then glob returns the pattern as-provided, rather than
interpreting the character escapes. For example,
`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than
`"*a?"`. This is akin to setting the `nullglob` option in bash, except
that it does not resolve escaped pattern characters.
If brace expansion is not disabled, then it is performed before any
other interpretation of the glob pattern. Thus, a pattern like
`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded
**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are
checked for validity. Since those two are valid, matching proceeds.
### Comments and Negation
Previously, this module let you mark a pattern as a "comment" if it
started with a `#` character, or a "negated" pattern if it started
with a `!` character.
These options were deprecated in version 5, and removed in version 6.
To specify things that should not match, use the `ignore` option.
## Windows
**Please only use forward-slashes in glob expressions.**
Though windows uses either `/` or `\` as its path separator, only `/`
characters are used by this glob implementation. You must use
forward-slashes **only** in glob expressions. Back-slashes will always
be interpreted as escape characters, not path separators.
Results from absolute patterns such as `/foo/*` are mounted onto the
root setting using `path.join`. On windows, this will by default result
in `/foo/*` matching `C:\foo\bar.txt`.
## Race Conditions
Glob searching, by its very nature, is susceptible to race conditions,
since it relies on directory walking and such.
As a result, it is possible that a file that exists when glob looks for
it may have been deleted or modified by the time it returns the result.
As part of its internal implementation, this program caches all stat
and readdir calls that it makes, in order to cut down on system
overhead. However, this also makes it even more susceptible to races,
especially if the cache or statCache objects are reused between glob
calls.
Users are thus advised not to use a glob result as a guarantee of
filesystem state in the face of rapid changes. For the vast majority
of operations, this is never a problem.
## Contributing
Any change to behavior (including bugfixes) must come with a test.
Patches that fail tests or reduce performance will be rejected.
```
# to run tests
npm test
# to re-generate test fixtures
npm run test-regen
# to benchmark against bash/zsh
npm run bench
# to profile javascript
npm run prof
```

67
node_modules/shelljs/node_modules/glob/changelog.md generated vendored Normal file
View File

@@ -0,0 +1,67 @@
## 7.0
- Raise error if `options.cwd` is specified, and not a directory
## 6.0
- Remove comment and negation pattern support
- Ignore patterns are always in `dot:true` mode
## 5.0
- Deprecate comment and negation patterns
- Fix regression in `mark` and `nodir` options from making all cache
keys absolute path.
- Abort if `fs.readdir` returns an error that's unexpected
- Don't emit `match` events for ignored items
- Treat ENOTSUP like ENOTDIR in readdir
## 4.5
- Add `options.follow` to always follow directory symlinks in globstar
- Add `options.realpath` to call `fs.realpath` on all results
- Always cache based on absolute path
## 4.4
- Add `options.ignore`
- Fix handling of broken symlinks
## 4.3
- Bump minimatch to 2.x
- Pass all tests on Windows
## 4.2
- Add `glob.hasMagic` function
- Add `options.nodir` flag
## 4.1
- Refactor sync and async implementations for performance
- Throw if callback provided to sync glob function
- Treat symbolic links in globstar results the same as Bash 4.3
## 4.0
- Use `^` for dependency versions (bumped major because this breaks
older npm versions)
- Ensure callbacks are only ever called once
- switch to ISC license
## 3.x
- Rewrite in JavaScript
- Add support for setting root, cwd, and windows support
- Cache many fs calls
- Add globstar support
- emit match events
## 2.x
- Use `glob.h` and `fnmatch.h` from NetBSD
## 1.x
- `glob.h` static binding.

240
node_modules/shelljs/node_modules/glob/common.js generated vendored Normal file
View File

@@ -0,0 +1,240 @@
exports.alphasort = alphasort
exports.alphasorti = alphasorti
exports.setopts = setopts
exports.ownProp = ownProp
exports.makeAbs = makeAbs
exports.finish = finish
exports.mark = mark
exports.isIgnored = isIgnored
exports.childrenIgnored = childrenIgnored
function ownProp (obj, field) {
return Object.prototype.hasOwnProperty.call(obj, field)
}
var path = require("path")
var minimatch = require("minimatch")
var isAbsolute = require("path-is-absolute")
var Minimatch = minimatch.Minimatch
function alphasorti (a, b) {
return a.toLowerCase().localeCompare(b.toLowerCase())
}
function alphasort (a, b) {
return a.localeCompare(b)
}
function setupIgnores (self, options) {
self.ignore = options.ignore || []
if (!Array.isArray(self.ignore))
self.ignore = [self.ignore]
if (self.ignore.length) {
self.ignore = self.ignore.map(ignoreMap)
}
}
// ignore patterns are always in dot:true mode.
function ignoreMap (pattern) {
var gmatcher = null
if (pattern.slice(-3) === '/**') {
var gpattern = pattern.replace(/(\/\*\*)+$/, '')
gmatcher = new Minimatch(gpattern, { dot: true })
}
return {
matcher: new Minimatch(pattern, { dot: true }),
gmatcher: gmatcher
}
}
function setopts (self, pattern, options) {
if (!options)
options = {}
// base-matching: just use globstar for that.
if (options.matchBase && -1 === pattern.indexOf("/")) {
if (options.noglobstar) {
throw new Error("base matching requires globstar")
}
pattern = "**/" + pattern
}
self.silent = !!options.silent
self.pattern = pattern
self.strict = options.strict !== false
self.realpath = !!options.realpath
self.realpathCache = options.realpathCache || Object.create(null)
self.follow = !!options.follow
self.dot = !!options.dot
self.mark = !!options.mark
self.nodir = !!options.nodir
if (self.nodir)
self.mark = true
self.sync = !!options.sync
self.nounique = !!options.nounique
self.nonull = !!options.nonull
self.nosort = !!options.nosort
self.nocase = !!options.nocase
self.stat = !!options.stat
self.noprocess = !!options.noprocess
self.absolute = !!options.absolute
self.maxLength = options.maxLength || Infinity
self.cache = options.cache || Object.create(null)
self.statCache = options.statCache || Object.create(null)
self.symlinks = options.symlinks || Object.create(null)
setupIgnores(self, options)
self.changedCwd = false
var cwd = process.cwd()
if (!ownProp(options, "cwd"))
self.cwd = cwd
else {
self.cwd = path.resolve(options.cwd)
self.changedCwd = self.cwd !== cwd
}
self.root = options.root || path.resolve(self.cwd, "/")
self.root = path.resolve(self.root)
if (process.platform === "win32")
self.root = self.root.replace(/\\/g, "/")
// TODO: is an absolute `cwd` supposed to be resolved against `root`?
// e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd)
if (process.platform === "win32")
self.cwdAbs = self.cwdAbs.replace(/\\/g, "/")
self.nomount = !!options.nomount
// disable comments and negation in Minimatch.
// Note that they are not supported in Glob itself anyway.
options.nonegate = true
options.nocomment = true
self.minimatch = new Minimatch(pattern, options)
self.options = self.minimatch.options
}
function finish (self) {
var nou = self.nounique
var all = nou ? [] : Object.create(null)
for (var i = 0, l = self.matches.length; i < l; i ++) {
var matches = self.matches[i]
if (!matches || Object.keys(matches).length === 0) {
if (self.nonull) {
// do like the shell, and spit out the literal glob
var literal = self.minimatch.globSet[i]
if (nou)
all.push(literal)
else
all[literal] = true
}
} else {
// had matches
var m = Object.keys(matches)
if (nou)
all.push.apply(all, m)
else
m.forEach(function (m) {
all[m] = true
})
}
}
if (!nou)
all = Object.keys(all)
if (!self.nosort)
all = all.sort(self.nocase ? alphasorti : alphasort)
// at *some* point we statted all of these
if (self.mark) {
for (var i = 0; i < all.length; i++) {
all[i] = self._mark(all[i])
}
if (self.nodir) {
all = all.filter(function (e) {
var notDir = !(/\/$/.test(e))
var c = self.cache[e] || self.cache[makeAbs(self, e)]
if (notDir && c)
notDir = c !== 'DIR' && !Array.isArray(c)
return notDir
})
}
}
if (self.ignore.length)
all = all.filter(function(m) {
return !isIgnored(self, m)
})
self.found = all
}
function mark (self, p) {
var abs = makeAbs(self, p)
var c = self.cache[abs]
var m = p
if (c) {
var isDir = c === 'DIR' || Array.isArray(c)
var slash = p.slice(-1) === '/'
if (isDir && !slash)
m += '/'
else if (!isDir && slash)
m = m.slice(0, -1)
if (m !== p) {
var mabs = makeAbs(self, m)
self.statCache[mabs] = self.statCache[abs]
self.cache[mabs] = self.cache[abs]
}
}
return m
}
// lotta situps...
function makeAbs (self, f) {
var abs = f
if (f.charAt(0) === '/') {
abs = path.join(self.root, f)
} else if (isAbsolute(f) || f === '') {
abs = f
} else if (self.changedCwd) {
abs = path.resolve(self.cwd, f)
} else {
abs = path.resolve(f)
}
if (process.platform === 'win32')
abs = abs.replace(/\\/g, '/')
return abs
}
// Return true, if pattern ends with globstar '**', for the accompanying parent directory.
// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents
function isIgnored (self, path) {
if (!self.ignore.length)
return false
return self.ignore.some(function(item) {
return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path))
})
}
function childrenIgnored (self, path) {
if (!self.ignore.length)
return false
return self.ignore.some(function(item) {
return !!(item.gmatcher && item.gmatcher.match(path))
})
}

790
node_modules/shelljs/node_modules/glob/glob.js generated vendored Normal file
View File

@@ -0,0 +1,790 @@
// Approach:
//
// 1. Get the minimatch set
// 2. For each pattern in the set, PROCESS(pattern, false)
// 3. Store matches per-set, then uniq them
//
// PROCESS(pattern, inGlobStar)
// Get the first [n] items from pattern that are all strings
// Join these together. This is PREFIX.
// If there is no more remaining, then stat(PREFIX) and
// add to matches if it succeeds. END.
//
// If inGlobStar and PREFIX is symlink and points to dir
// set ENTRIES = []
// else readdir(PREFIX) as ENTRIES
// If fail, END
//
// with ENTRIES
// If pattern[n] is GLOBSTAR
// // handle the case where the globstar match is empty
// // by pruning it out, and testing the resulting pattern
// PROCESS(pattern[0..n] + pattern[n+1 .. $], false)
// // handle other cases.
// for ENTRY in ENTRIES (not dotfiles)
// // attach globstar + tail onto the entry
// // Mark that this entry is a globstar match
// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true)
//
// else // not globstar
// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
// Test ENTRY against pattern[n]
// If fails, continue
// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
//
// Caveat:
// Cache all stats and readdirs results to minimize syscall. Since all
// we ever care about is existence and directory-ness, we can just keep
// `true` for files, and [children,...] for directories, or `false` for
// things that don't exist.
module.exports = glob
var fs = require('fs')
var rp = require('fs.realpath')
var minimatch = require('minimatch')
var Minimatch = minimatch.Minimatch
var inherits = require('inherits')
var EE = require('events').EventEmitter
var path = require('path')
var assert = require('assert')
var isAbsolute = require('path-is-absolute')
var globSync = require('./sync.js')
var common = require('./common.js')
var alphasort = common.alphasort
var alphasorti = common.alphasorti
var setopts = common.setopts
var ownProp = common.ownProp
var inflight = require('inflight')
var util = require('util')
var childrenIgnored = common.childrenIgnored
var isIgnored = common.isIgnored
var once = require('once')
function glob (pattern, options, cb) {
if (typeof options === 'function') cb = options, options = {}
if (!options) options = {}
if (options.sync) {
if (cb)
throw new TypeError('callback provided to sync glob')
return globSync(pattern, options)
}
return new Glob(pattern, options, cb)
}
glob.sync = globSync
var GlobSync = glob.GlobSync = globSync.GlobSync
// old api surface
glob.glob = glob
function extend (origin, add) {
if (add === null || typeof add !== 'object') {
return origin
}
var keys = Object.keys(add)
var i = keys.length
while (i--) {
origin[keys[i]] = add[keys[i]]
}
return origin
}
glob.hasMagic = function (pattern, options_) {
var options = extend({}, options_)
options.noprocess = true
var g = new Glob(pattern, options)
var set = g.minimatch.set
if (!pattern)
return false
if (set.length > 1)
return true
for (var j = 0; j < set[0].length; j++) {
if (typeof set[0][j] !== 'string')
return true
}
return false
}
glob.Glob = Glob
inherits(Glob, EE)
function Glob (pattern, options, cb) {
if (typeof options === 'function') {
cb = options
options = null
}
if (options && options.sync) {
if (cb)
throw new TypeError('callback provided to sync glob')
return new GlobSync(pattern, options)
}
if (!(this instanceof Glob))
return new Glob(pattern, options, cb)
setopts(this, pattern, options)
this._didRealPath = false
// process each pattern in the minimatch set
var n = this.minimatch.set.length
// The matches are stored as {<filename>: true,...} so that
// duplicates are automagically pruned.
// Later, we do an Object.keys() on these.
// Keep them as a list so we can fill in when nonull is set.
this.matches = new Array(n)
if (typeof cb === 'function') {
cb = once(cb)
this.on('error', cb)
this.on('end', function (matches) {
cb(null, matches)
})
}
var self = this
this._processing = 0
this._emitQueue = []
this._processQueue = []
this.paused = false
if (this.noprocess)
return this
if (n === 0)
return done()
var sync = true
for (var i = 0; i < n; i ++) {
this._process(this.minimatch.set[i], i, false, done)
}
sync = false
function done () {
--self._processing
if (self._processing <= 0) {
if (sync) {
process.nextTick(function () {
self._finish()
})
} else {
self._finish()
}
}
}
}
Glob.prototype._finish = function () {
assert(this instanceof Glob)
if (this.aborted)
return
if (this.realpath && !this._didRealpath)
return this._realpath()
common.finish(this)
this.emit('end', this.found)
}
Glob.prototype._realpath = function () {
if (this._didRealpath)
return
this._didRealpath = true
var n = this.matches.length
if (n === 0)
return this._finish()
var self = this
for (var i = 0; i < this.matches.length; i++)
this._realpathSet(i, next)
function next () {
if (--n === 0)
self._finish()
}
}
Glob.prototype._realpathSet = function (index, cb) {
var matchset = this.matches[index]
if (!matchset)
return cb()
var found = Object.keys(matchset)
var self = this
var n = found.length
if (n === 0)
return cb()
var set = this.matches[index] = Object.create(null)
found.forEach(function (p, i) {
// If there's a problem with the stat, then it means that
// one or more of the links in the realpath couldn't be
// resolved. just return the abs value in that case.
p = self._makeAbs(p)
rp.realpath(p, self.realpathCache, function (er, real) {
if (!er)
set[real] = true
else if (er.syscall === 'stat')
set[p] = true
else
self.emit('error', er) // srsly wtf right here
if (--n === 0) {
self.matches[index] = set
cb()
}
})
})
}
Glob.prototype._mark = function (p) {
return common.mark(this, p)
}
Glob.prototype._makeAbs = function (f) {
return common.makeAbs(this, f)
}
Glob.prototype.abort = function () {
this.aborted = true
this.emit('abort')
}
Glob.prototype.pause = function () {
if (!this.paused) {
this.paused = true
this.emit('pause')
}
}
Glob.prototype.resume = function () {
if (this.paused) {
this.emit('resume')
this.paused = false
if (this._emitQueue.length) {
var eq = this._emitQueue.slice(0)
this._emitQueue.length = 0
for (var i = 0; i < eq.length; i ++) {
var e = eq[i]
this._emitMatch(e[0], e[1])
}
}
if (this._processQueue.length) {
var pq = this._processQueue.slice(0)
this._processQueue.length = 0
for (var i = 0; i < pq.length; i ++) {
var p = pq[i]
this._processing--
this._process(p[0], p[1], p[2], p[3])
}
}
}
}
Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
assert(this instanceof Glob)
assert(typeof cb === 'function')
if (this.aborted)
return
this._processing++
if (this.paused) {
this._processQueue.push([pattern, index, inGlobStar, cb])
return
}
//console.error('PROCESS %d', this._processing, pattern)
// Get the first [n] parts of pattern that are all strings.
var n = 0
while (typeof pattern[n] === 'string') {
n ++
}
// now n is the index of the first one that is *not* a string.
// see if there's anything else
var prefix
switch (n) {
// if not, then this is rather simple
case pattern.length:
this._processSimple(pattern.join('/'), index, cb)
return
case 0:
// pattern *starts* with some non-trivial item.
// going to readdir(cwd), but not include the prefix in matches.
prefix = null
break
default:
// pattern has some string bits in the front.
// whatever it starts with, whether that's 'absolute' like /foo/bar,
// or 'relative' like '../baz'
prefix = pattern.slice(0, n).join('/')
break
}
var remain = pattern.slice(n)
// get the list of entries.
var read
if (prefix === null)
read = '.'
else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
if (!prefix || !isAbsolute(prefix))
prefix = '/' + prefix
read = prefix
} else
read = prefix
var abs = this._makeAbs(read)
//if ignored, skip _processing
if (childrenIgnored(this, read))
return cb()
var isGlobStar = remain[0] === minimatch.GLOBSTAR
if (isGlobStar)
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb)
else
this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb)
}
Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) {
var self = this
this._readdir(abs, inGlobStar, function (er, entries) {
return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
})
}
Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
// if the abs isn't a dir, then nothing can match!
if (!entries)
return cb()
// It will only match dot entries if it starts with a dot, or if
// dot is set. Stuff like @(.foo|.bar) isn't allowed.
var pn = remain[0]
var negate = !!this.minimatch.negate
var rawGlob = pn._glob
var dotOk = this.dot || rawGlob.charAt(0) === '.'
var matchedEntries = []
for (var i = 0; i < entries.length; i++) {
var e = entries[i]
if (e.charAt(0) !== '.' || dotOk) {
var m
if (negate && !prefix) {
m = !e.match(pn)
} else {
m = e.match(pn)
}
if (m)
matchedEntries.push(e)
}
}
//console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries)
var len = matchedEntries.length
// If there are no matched entries, then nothing matches.
if (len === 0)
return cb()
// if this is the last remaining pattern bit, then no need for
// an additional stat *unless* the user has specified mark or
// stat explicitly. We know they exist, since readdir returned
// them.
if (remain.length === 1 && !this.mark && !this.stat) {
if (!this.matches[index])
this.matches[index] = Object.create(null)
for (var i = 0; i < len; i ++) {
var e = matchedEntries[i]
if (prefix) {
if (prefix !== '/')
e = prefix + '/' + e
else
e = prefix + e
}
if (e.charAt(0) === '/' && !this.nomount) {
e = path.join(this.root, e)
}
this._emitMatch(index, e)
}
// This was the last one, and no stats were needed
return cb()
}
// now test all matched entries as stand-ins for that part
// of the pattern.
remain.shift()
for (var i = 0; i < len; i ++) {
var e = matchedEntries[i]
var newPattern
if (prefix) {
if (prefix !== '/')
e = prefix + '/' + e
else
e = prefix + e
}
this._process([e].concat(remain), index, inGlobStar, cb)
}
cb()
}
Glob.prototype._emitMatch = function (index, e) {
if (this.aborted)
return
if (isIgnored(this, e))
return
if (this.paused) {
this._emitQueue.push([index, e])
return
}
var abs = isAbsolute(e) ? e : this._makeAbs(e)
if (this.mark)
e = this._mark(e)
if (this.absolute)
e = abs
if (this.matches[index][e])
return
if (this.nodir) {
var c = this.cache[abs]
if (c === 'DIR' || Array.isArray(c))
return
}
this.matches[index][e] = true
var st = this.statCache[abs]
if (st)
this.emit('stat', e, st)
this.emit('match', e)
}
Glob.prototype._readdirInGlobStar = function (abs, cb) {
if (this.aborted)
return
// follow all symlinked directories forever
// just proceed as if this is a non-globstar situation
if (this.follow)
return this._readdir(abs, false, cb)
var lstatkey = 'lstat\0' + abs
var self = this
var lstatcb = inflight(lstatkey, lstatcb_)
if (lstatcb)
fs.lstat(abs, lstatcb)
function lstatcb_ (er, lstat) {
if (er && er.code === 'ENOENT')
return cb()
var isSym = lstat && lstat.isSymbolicLink()
self.symlinks[abs] = isSym
// If it's not a symlink or a dir, then it's definitely a regular file.
// don't bother doing a readdir in that case.
if (!isSym && lstat && !lstat.isDirectory()) {
self.cache[abs] = 'FILE'
cb()
} else
self._readdir(abs, false, cb)
}
}
Glob.prototype._readdir = function (abs, inGlobStar, cb) {
if (this.aborted)
return
cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb)
if (!cb)
return
//console.error('RD %j %j', +inGlobStar, abs)
if (inGlobStar && !ownProp(this.symlinks, abs))
return this._readdirInGlobStar(abs, cb)
if (ownProp(this.cache, abs)) {
var c = this.cache[abs]
if (!c || c === 'FILE')
return cb()
if (Array.isArray(c))
return cb(null, c)
}
var self = this
fs.readdir(abs, readdirCb(this, abs, cb))
}
function readdirCb (self, abs, cb) {
return function (er, entries) {
if (er)
self._readdirError(abs, er, cb)
else
self._readdirEntries(abs, entries, cb)
}
}
Glob.prototype._readdirEntries = function (abs, entries, cb) {
if (this.aborted)
return
// if we haven't asked to stat everything, then just
// assume that everything in there exists, so we can avoid
// having to stat it a second time.
if (!this.mark && !this.stat) {
for (var i = 0; i < entries.length; i ++) {
var e = entries[i]
if (abs === '/')
e = abs + e
else
e = abs + '/' + e
this.cache[e] = true
}
}
this.cache[abs] = entries
return cb(null, entries)
}
Glob.prototype._readdirError = function (f, er, cb) {
if (this.aborted)
return
// handle errors, and cache the information
switch (er.code) {
case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
case 'ENOTDIR': // totally normal. means it *does* exist.
var abs = this._makeAbs(f)
this.cache[abs] = 'FILE'
if (abs === this.cwdAbs) {
var error = new Error(er.code + ' invalid cwd ' + this.cwd)
error.path = this.cwd
error.code = er.code
this.emit('error', error)
this.abort()
}
break
case 'ENOENT': // not terribly unusual
case 'ELOOP':
case 'ENAMETOOLONG':
case 'UNKNOWN':
this.cache[this._makeAbs(f)] = false
break
default: // some unusual error. Treat as failure.
this.cache[this._makeAbs(f)] = false
if (this.strict) {
this.emit('error', er)
// If the error is handled, then we abort
// if not, we threw out of here
this.abort()
}
if (!this.silent)
console.error('glob error', er)
break
}
return cb()
}
Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) {
var self = this
this._readdir(abs, inGlobStar, function (er, entries) {
self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
})
}
Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
//console.error('pgs2', prefix, remain[0], entries)
// no entries means not a dir, so it can never have matches
// foo.txt/** doesn't match foo.txt
if (!entries)
return cb()
// test without the globstar, and with every child both below
// and replacing the globstar.
var remainWithoutGlobStar = remain.slice(1)
var gspref = prefix ? [ prefix ] : []
var noGlobStar = gspref.concat(remainWithoutGlobStar)
// the noGlobStar pattern exits the inGlobStar state
this._process(noGlobStar, index, false, cb)
var isSym = this.symlinks[abs]
var len = entries.length
// If it's a symlink, and we're in a globstar, then stop
if (isSym && inGlobStar)
return cb()
for (var i = 0; i < len; i++) {
var e = entries[i]
if (e.charAt(0) === '.' && !this.dot)
continue
// these two cases enter the inGlobStar state
var instead = gspref.concat(entries[i], remainWithoutGlobStar)
this._process(instead, index, true, cb)
var below = gspref.concat(entries[i], remain)
this._process(below, index, true, cb)
}
cb()
}
Glob.prototype._processSimple = function (prefix, index, cb) {
// XXX review this. Shouldn't it be doing the mounting etc
// before doing stat? kinda weird?
var self = this
this._stat(prefix, function (er, exists) {
self._processSimple2(prefix, index, er, exists, cb)
})
}
Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
//console.error('ps2', prefix, exists)
if (!this.matches[index])
this.matches[index] = Object.create(null)
// If it doesn't exist, then just mark the lack of results
if (!exists)
return cb()
if (prefix && isAbsolute(prefix) && !this.nomount) {
var trail = /[\/\\]$/.test(prefix)
if (prefix.charAt(0) === '/') {
prefix = path.join(this.root, prefix)
} else {
prefix = path.resolve(this.root, prefix)
if (trail)
prefix += '/'
}
}
if (process.platform === 'win32')
prefix = prefix.replace(/\\/g, '/')
// Mark this as a match
this._emitMatch(index, prefix)
cb()
}
// Returns either 'DIR', 'FILE', or false
Glob.prototype._stat = function (f, cb) {
var abs = this._makeAbs(f)
var needDir = f.slice(-1) === '/'
if (f.length > this.maxLength)
return cb()
if (!this.stat && ownProp(this.cache, abs)) {
var c = this.cache[abs]
if (Array.isArray(c))
c = 'DIR'
// It exists, but maybe not how we need it
if (!needDir || c === 'DIR')
return cb(null, c)
if (needDir && c === 'FILE')
return cb()
// otherwise we have to stat, because maybe c=true
// if we know it exists, but not what it is.
}
var exists
var stat = this.statCache[abs]
if (stat !== undefined) {
if (stat === false)
return cb(null, stat)
else {
var type = stat.isDirectory() ? 'DIR' : 'FILE'
if (needDir && type === 'FILE')
return cb()
else
return cb(null, type, stat)
}
}
var self = this
var statcb = inflight('stat\0' + abs, lstatcb_)
if (statcb)
fs.lstat(abs, statcb)
function lstatcb_ (er, lstat) {
if (lstat && lstat.isSymbolicLink()) {
// If it's a symlink, then treat it as the target, unless
// the target does not exist, then treat it as a file.
return fs.stat(abs, function (er, stat) {
if (er)
self._stat2(f, abs, null, lstat, cb)
else
self._stat2(f, abs, er, stat, cb)
})
} else {
self._stat2(f, abs, er, lstat, cb)
}
}
}
Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
this.statCache[abs] = false
return cb()
}
var needDir = f.slice(-1) === '/'
this.statCache[abs] = stat
if (abs.slice(-1) === '/' && stat && !stat.isDirectory())
return cb(null, false, stat)
var c = true
if (stat)
c = stat.isDirectory() ? 'DIR' : 'FILE'
this.cache[abs] = this.cache[abs] || c
if (needDir && c === 'FILE')
return cb()
return cb(null, c, stat)
}

43
node_modules/shelljs/node_modules/glob/package.json generated vendored Normal file
View File

@@ -0,0 +1,43 @@
{
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
"name": "glob",
"description": "a little globber",
"version": "7.1.2",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-glob.git"
},
"main": "glob.js",
"files": [
"glob.js",
"sync.js",
"common.js"
],
"engines": {
"node": "*"
},
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
},
"devDependencies": {
"mkdirp": "0",
"rimraf": "^2.2.8",
"tap": "^7.1.2",
"tick": "0.0.6"
},
"scripts": {
"prepublish": "npm run benchclean",
"profclean": "rm -f v8.log profile.txt",
"test": "tap test/*.js --cov",
"test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js",
"bench": "bash benchmark.sh",
"prof": "bash prof.sh && cat profile.txt",
"benchclean": "node benchclean.js"
},
"license": "ISC"
}

486
node_modules/shelljs/node_modules/glob/sync.js generated vendored Normal file
View File

@@ -0,0 +1,486 @@
module.exports = globSync
globSync.GlobSync = GlobSync
var fs = require('fs')
var rp = require('fs.realpath')
var minimatch = require('minimatch')
var Minimatch = minimatch.Minimatch
var Glob = require('./glob.js').Glob
var util = require('util')
var path = require('path')
var assert = require('assert')
var isAbsolute = require('path-is-absolute')
var common = require('./common.js')
var alphasort = common.alphasort
var alphasorti = common.alphasorti
var setopts = common.setopts
var ownProp = common.ownProp
var childrenIgnored = common.childrenIgnored
var isIgnored = common.isIgnored
function globSync (pattern, options) {
if (typeof options === 'function' || arguments.length === 3)
throw new TypeError('callback provided to sync glob\n'+
'See: https://github.com/isaacs/node-glob/issues/167')
return new GlobSync(pattern, options).found
}
function GlobSync (pattern, options) {
if (!pattern)
throw new Error('must provide pattern')
if (typeof options === 'function' || arguments.length === 3)
throw new TypeError('callback provided to sync glob\n'+
'See: https://github.com/isaacs/node-glob/issues/167')
if (!(this instanceof GlobSync))
return new GlobSync(pattern, options)
setopts(this, pattern, options)
if (this.noprocess)
return this
var n = this.minimatch.set.length
this.matches = new Array(n)
for (var i = 0; i < n; i ++) {
this._process(this.minimatch.set[i], i, false)
}
this._finish()
}
GlobSync.prototype._finish = function () {
assert(this instanceof GlobSync)
if (this.realpath) {
var self = this
this.matches.forEach(function (matchset, index) {
var set = self.matches[index] = Object.create(null)
for (var p in matchset) {
try {
p = self._makeAbs(p)
var real = rp.realpathSync(p, self.realpathCache)
set[real] = true
} catch (er) {
if (er.syscall === 'stat')
set[self._makeAbs(p)] = true
else
throw er
}
}
})
}
common.finish(this)
}
GlobSync.prototype._process = function (pattern, index, inGlobStar) {
assert(this instanceof GlobSync)
// Get the first [n] parts of pattern that are all strings.
var n = 0
while (typeof pattern[n] === 'string') {
n ++
}
// now n is the index of the first one that is *not* a string.
// See if there's anything else
var prefix
switch (n) {
// if not, then this is rather simple
case pattern.length:
this._processSimple(pattern.join('/'), index)
return
case 0:
// pattern *starts* with some non-trivial item.
// going to readdir(cwd), but not include the prefix in matches.
prefix = null
break
default:
// pattern has some string bits in the front.
// whatever it starts with, whether that's 'absolute' like /foo/bar,
// or 'relative' like '../baz'
prefix = pattern.slice(0, n).join('/')
break
}
var remain = pattern.slice(n)
// get the list of entries.
var read
if (prefix === null)
read = '.'
else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
if (!prefix || !isAbsolute(prefix))
prefix = '/' + prefix
read = prefix
} else
read = prefix
var abs = this._makeAbs(read)
//if ignored, skip processing
if (childrenIgnored(this, read))
return
var isGlobStar = remain[0] === minimatch.GLOBSTAR
if (isGlobStar)
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar)
else
this._processReaddir(prefix, read, abs, remain, index, inGlobStar)
}
GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) {
var entries = this._readdir(abs, inGlobStar)
// if the abs isn't a dir, then nothing can match!
if (!entries)
return
// It will only match dot entries if it starts with a dot, or if
// dot is set. Stuff like @(.foo|.bar) isn't allowed.
var pn = remain[0]
var negate = !!this.minimatch.negate
var rawGlob = pn._glob
var dotOk = this.dot || rawGlob.charAt(0) === '.'
var matchedEntries = []
for (var i = 0; i < entries.length; i++) {
var e = entries[i]
if (e.charAt(0) !== '.' || dotOk) {
var m
if (negate && !prefix) {
m = !e.match(pn)
} else {
m = e.match(pn)
}
if (m)
matchedEntries.push(e)
}
}
var len = matchedEntries.length
// If there are no matched entries, then nothing matches.
if (len === 0)
return
// if this is the last remaining pattern bit, then no need for
// an additional stat *unless* the user has specified mark or
// stat explicitly. We know they exist, since readdir returned
// them.
if (remain.length === 1 && !this.mark && !this.stat) {
if (!this.matches[index])
this.matches[index] = Object.create(null)
for (var i = 0; i < len; i ++) {
var e = matchedEntries[i]
if (prefix) {
if (prefix.slice(-1) !== '/')
e = prefix + '/' + e
else
e = prefix + e
}
if (e.charAt(0) === '/' && !this.nomount) {
e = path.join(this.root, e)
}
this._emitMatch(index, e)
}
// This was the last one, and no stats were needed
return
}
// now test all matched entries as stand-ins for that part
// of the pattern.
remain.shift()
for (var i = 0; i < len; i ++) {
var e = matchedEntries[i]
var newPattern
if (prefix)
newPattern = [prefix, e]
else
newPattern = [e]
this._process(newPattern.concat(remain), index, inGlobStar)
}
}
GlobSync.prototype._emitMatch = function (index, e) {
if (isIgnored(this, e))
return
var abs = this._makeAbs(e)
if (this.mark)
e = this._mark(e)
if (this.absolute) {
e = abs
}
if (this.matches[index][e])
return
if (this.nodir) {
var c = this.cache[abs]
if (c === 'DIR' || Array.isArray(c))
return
}
this.matches[index][e] = true
if (this.stat)
this._stat(e)
}
GlobSync.prototype._readdirInGlobStar = function (abs) {
// follow all symlinked directories forever
// just proceed as if this is a non-globstar situation
if (this.follow)
return this._readdir(abs, false)
var entries
var lstat
var stat
try {
lstat = fs.lstatSync(abs)
} catch (er) {
if (er.code === 'ENOENT') {
// lstat failed, doesn't exist
return null
}
}
var isSym = lstat && lstat.isSymbolicLink()
this.symlinks[abs] = isSym
// If it's not a symlink or a dir, then it's definitely a regular file.
// don't bother doing a readdir in that case.
if (!isSym && lstat && !lstat.isDirectory())
this.cache[abs] = 'FILE'
else
entries = this._readdir(abs, false)
return entries
}
GlobSync.prototype._readdir = function (abs, inGlobStar) {
var entries
if (inGlobStar && !ownProp(this.symlinks, abs))
return this._readdirInGlobStar(abs)
if (ownProp(this.cache, abs)) {
var c = this.cache[abs]
if (!c || c === 'FILE')
return null
if (Array.isArray(c))
return c
}
try {
return this._readdirEntries(abs, fs.readdirSync(abs))
} catch (er) {
this._readdirError(abs, er)
return null
}
}
GlobSync.prototype._readdirEntries = function (abs, entries) {
// if we haven't asked to stat everything, then just
// assume that everything in there exists, so we can avoid
// having to stat it a second time.
if (!this.mark && !this.stat) {
for (var i = 0; i < entries.length; i ++) {
var e = entries[i]
if (abs === '/')
e = abs + e
else
e = abs + '/' + e
this.cache[e] = true
}
}
this.cache[abs] = entries
// mark and cache dir-ness
return entries
}
GlobSync.prototype._readdirError = function (f, er) {
// handle errors, and cache the information
switch (er.code) {
case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
case 'ENOTDIR': // totally normal. means it *does* exist.
var abs = this._makeAbs(f)
this.cache[abs] = 'FILE'
if (abs === this.cwdAbs) {
var error = new Error(er.code + ' invalid cwd ' + this.cwd)
error.path = this.cwd
error.code = er.code
throw error
}
break
case 'ENOENT': // not terribly unusual
case 'ELOOP':
case 'ENAMETOOLONG':
case 'UNKNOWN':
this.cache[this._makeAbs(f)] = false
break
default: // some unusual error. Treat as failure.
this.cache[this._makeAbs(f)] = false
if (this.strict)
throw er
if (!this.silent)
console.error('glob error', er)
break
}
}
GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) {
var entries = this._readdir(abs, inGlobStar)
// no entries means not a dir, so it can never have matches
// foo.txt/** doesn't match foo.txt
if (!entries)
return
// test without the globstar, and with every child both below
// and replacing the globstar.
var remainWithoutGlobStar = remain.slice(1)
var gspref = prefix ? [ prefix ] : []
var noGlobStar = gspref.concat(remainWithoutGlobStar)
// the noGlobStar pattern exits the inGlobStar state
this._process(noGlobStar, index, false)
var len = entries.length
var isSym = this.symlinks[abs]
// If it's a symlink, and we're in a globstar, then stop
if (isSym && inGlobStar)
return
for (var i = 0; i < len; i++) {
var e = entries[i]
if (e.charAt(0) === '.' && !this.dot)
continue
// these two cases enter the inGlobStar state
var instead = gspref.concat(entries[i], remainWithoutGlobStar)
this._process(instead, index, true)
var below = gspref.concat(entries[i], remain)
this._process(below, index, true)
}
}
GlobSync.prototype._processSimple = function (prefix, index) {
// XXX review this. Shouldn't it be doing the mounting etc
// before doing stat? kinda weird?
var exists = this._stat(prefix)
if (!this.matches[index])
this.matches[index] = Object.create(null)
// If it doesn't exist, then just mark the lack of results
if (!exists)
return
if (prefix && isAbsolute(prefix) && !this.nomount) {
var trail = /[\/\\]$/.test(prefix)
if (prefix.charAt(0) === '/') {
prefix = path.join(this.root, prefix)
} else {
prefix = path.resolve(this.root, prefix)
if (trail)
prefix += '/'
}
}
if (process.platform === 'win32')
prefix = prefix.replace(/\\/g, '/')
// Mark this as a match
this._emitMatch(index, prefix)
}
// Returns either 'DIR', 'FILE', or false
GlobSync.prototype._stat = function (f) {
var abs = this._makeAbs(f)
var needDir = f.slice(-1) === '/'
if (f.length > this.maxLength)
return false
if (!this.stat && ownProp(this.cache, abs)) {
var c = this.cache[abs]
if (Array.isArray(c))
c = 'DIR'
// It exists, but maybe not how we need it
if (!needDir || c === 'DIR')
return c
if (needDir && c === 'FILE')
return false
// otherwise we have to stat, because maybe c=true
// if we know it exists, but not what it is.
}
var exists
var stat = this.statCache[abs]
if (!stat) {
var lstat
try {
lstat = fs.lstatSync(abs)
} catch (er) {
if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
this.statCache[abs] = false
return false
}
}
if (lstat && lstat.isSymbolicLink()) {
try {
stat = fs.statSync(abs)
} catch (er) {
stat = lstat
}
} else {
stat = lstat
}
}
this.statCache[abs] = stat
var c = true
if (stat)
c = stat.isDirectory() ? 'DIR' : 'FILE'
this.cache[abs] = this.cache[abs] || c
if (needDir && c === 'FILE')
return false
return c
}
GlobSync.prototype._mark = function (p) {
return common.mark(this, p)
}
GlobSync.prototype._makeAbs = function (f) {
return common.makeAbs(this, f)
}

72
node_modules/shelljs/package.json generated vendored Normal file
View File

@@ -0,0 +1,72 @@
{
"name": "shelljs",
"version": "0.7.6",
"description": "Portable Unix shell commands for Node.js",
"keywords": [
"shelljs",
"bash",
"unix",
"shell",
"makefile",
"make",
"jake",
"synchronous"
],
"contributors": [
"Nate Fischer <ntfschr@gmail.com> (https://github.com/nfischer)",
"Brandon Freitag <freitagbr@gmail.com> (https://github.com/freitagbr)"
],
"repository": {
"type": "git",
"url": "git://github.com/shelljs/shelljs.git"
},
"license": "BSD-3-Clause",
"homepage": "http://github.com/shelljs/shelljs",
"main": "./shell.js",
"files": [
"commands.json",
"global.js",
"make.js",
"plugin.js",
"shell.js",
"bin",
"src"
],
"scripts": {
"posttest": "npm run lint",
"test": "nyc --reporter=text --reporter=lcov ava --serial test/*.js",
"test-no-coverage": "ava --serial test/*.js",
"gendocs": "node scripts/generate-docs",
"lint": "eslint .",
"after-travis": "travis-check-changes",
"changelog": "shelljs-changelog",
"release:major": "shelljs-release major",
"release:minor": "shelljs-release minor",
"release:patch": "shelljs-release patch"
},
"bin": {
"shjs": "./bin/shjs"
},
"dependencies": {
"glob": "^7.0.0",
"interpret": "^1.0.0",
"rechoir": "^0.6.2"
},
"devDependencies": {
"ava": "^0.16.0",
"coffee-script": "^1.10.0",
"eslint": "^2.0.0",
"eslint-config-airbnb-base": "^3.0.0",
"eslint-plugin-import": "^1.11.1",
"nyc": "^10.0.0",
"shelljs-changelog": "^0.2.0",
"shelljs-release": "^0.2.0",
"shx": "^0.2.0",
"travis-check-changes": "^0.2.0"
},
"optionalDependencies": {},
"engines": {
"node": ">=0.11.0",
"iojs": "*"
}
}

16
node_modules/shelljs/plugin.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
// Various utilties exposed to plugins
require('./shell'); // Create the ShellJS instance (mandatory)
var common = require('./src/common');
var exportedAttributes = [
'error', // For signaling errors from within commands
'parseOptions', // For custom option parsing
'readFromPipe', // For commands with the .canReceivePipe attribute
'register', // For registering plugins
];
exportedAttributes.forEach(function (attr) {
exports[attr] = common[attr];
});

152
node_modules/shelljs/shell.js generated vendored Normal file
View File

@@ -0,0 +1,152 @@
//
// ShellJS
// Unix shell commands on top of Node's API
//
// Copyright (c) 2012 Artur Adib
// http://github.com/shelljs/shelljs
//
var common = require('./src/common');
//@
//@ All commands run synchronously, unless otherwise stated.
//@ All commands accept standard bash globbing characters (`*`, `?`, etc.),
//@ compatible with the [node glob module](https://github.com/isaacs/node-glob).
//@
//@ For less-commonly used commands and features, please check out our [wiki
//@ page](https://github.com/shelljs/shelljs/wiki).
//@
// Include the docs for all the default commands
//@commands
// Load all default commands
require('./commands.json').forEach(function (command) {
require('./src/' + command);
});
//@
//@ ### exit(code)
//@ Exits the current process with the given exit code.
exports.exit = process.exit;
//@include ./src/error
exports.error = require('./src/error');
//@include ./src/common
exports.ShellString = common.ShellString;
//@
//@ ### env['VAR_NAME']
//@ Object containing environment variables (both getter and setter). Shortcut
//@ to process.env.
exports.env = process.env;
//@
//@ ### Pipes
//@
//@ Examples:
//@
//@ ```javascript
//@ grep('foo', 'file1.txt', 'file2.txt').sed(/o/g, 'a').to('output.txt');
//@ echo('files with o\'s in the name:\n' + ls().grep('o'));
//@ cat('test.js').exec('node'); // pipe to exec() call
//@ ```
//@
//@ Commands can send their output to another command in a pipe-like fashion.
//@ `sed`, `grep`, `cat`, `exec`, `to`, and `toEnd` can appear on the right-hand
//@ side of a pipe. Pipes can be chained.
//@
//@ ## Configuration
//@
exports.config = common.config;
//@
//@ ### config.silent
//@
//@ Example:
//@
//@ ```javascript
//@ var sh = require('shelljs');
//@ var silentState = sh.config.silent; // save old silent state
//@ sh.config.silent = true;
//@ /* ... */
//@ sh.config.silent = silentState; // restore old silent state
//@ ```
//@
//@ Suppresses all command output if `true`, except for `echo()` calls.
//@ Default is `false`.
//@
//@ ### config.fatal
//@
//@ Example:
//@
//@ ```javascript
//@ require('shelljs/global');
//@ config.fatal = true; // or set('-e');
//@ cp('this_file_does_not_exist', '/dev/null'); // throws Error here
//@ /* more commands... */
//@ ```
//@
//@ If `true` the script will throw a Javascript error when any shell.js
//@ command encounters an error. Default is `false`. This is analogous to
//@ Bash's `set -e`
//@
//@ ### config.verbose
//@
//@ Example:
//@
//@ ```javascript
//@ config.verbose = true; // or set('-v');
//@ cd('dir/');
//@ ls('subdir/');
//@ ```
//@
//@ Will print each command as follows:
//@
//@ ```
//@ cd dir/
//@ ls subdir/
//@ ```
//@
//@ ### config.globOptions
//@
//@ Example:
//@
//@ ```javascript
//@ config.globOptions = {nodir: true};
//@ ```
//@
//@ Use this value for calls to `glob.sync()` instead of the default options.
//@
//@ ### config.reset()
//@
//@ Example:
//@
//@ ```javascript
//@ var shell = require('shelljs');
//@ // Make changes to shell.config, and do stuff...
//@ /* ... */
//@ shell.config.reset(); // reset to original state
//@ // Do more stuff, but with original settings
//@ /* ... */
//@ ```
//@
//@ Reset shell.config to the defaults:
//@
//@ ```javascript
//@ {
//@ fatal: false,
//@ globOptions: {},
//@ maxdepth: 255,
//@ noglob: false,
//@ silent: false,
//@ verbose: false,
//@ }
//@ ```

40
node_modules/shelljs/src/cat.js generated vendored Normal file
View File

@@ -0,0 +1,40 @@
var common = require('./common');
var fs = require('fs');
common.register('cat', _cat, {
canReceivePipe: true,
});
//@
//@ ### cat(file [, file ...])
//@ ### cat(file_array)
//@
//@ Examples:
//@
//@ ```javascript
//@ var str = cat('file*.txt');
//@ var str = cat('file1', 'file2');
//@ var str = cat(['file1', 'file2']); // same as above
//@ ```
//@
//@ Returns a string containing the given file, or a concatenated string
//@ containing the files if more than one file is given (a new line character is
//@ introduced between each file).
function _cat(options, files) {
var cat = common.readFromPipe();
if (!files && !cat) common.error('no paths given');
files = [].slice.call(arguments, 1);
files.forEach(function (file) {
if (!fs.existsSync(file)) {
common.error('no such file or directory: ' + file);
}
cat += fs.readFileSync(file, 'utf8');
});
return cat;
}
module.exports = _cat;

38
node_modules/shelljs/src/cd.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
var fs = require('fs');
var common = require('./common');
common.register('cd', _cd, {});
//@
//@ ### cd([dir])
//@ Changes to directory `dir` for the duration of the script. Changes to home
//@ directory if no argument is supplied.
function _cd(options, dir) {
if (!dir) dir = common.getUserHome();
if (dir === '-') {
if (!process.env.OLDPWD) {
common.error('could not find previous directory');
} else {
dir = process.env.OLDPWD;
}
}
try {
var curDir = process.cwd();
process.chdir(dir);
process.env.OLDPWD = curDir;
} catch (e) {
// something went wrong, let's figure out the error
var err;
try {
fs.statSync(dir); // if this succeeds, it must be some sort of file
err = 'not a directory: ' + dir;
} catch (e2) {
err = 'no such file or directory: ' + dir;
}
if (err) common.error(err);
}
return '';
}
module.exports = _cd;

215
node_modules/shelljs/src/chmod.js generated vendored Normal file
View File

@@ -0,0 +1,215 @@
var common = require('./common');
var fs = require('fs');
var path = require('path');
var PERMS = (function (base) {
return {
OTHER_EXEC: base.EXEC,
OTHER_WRITE: base.WRITE,
OTHER_READ: base.READ,
GROUP_EXEC: base.EXEC << 3,
GROUP_WRITE: base.WRITE << 3,
GROUP_READ: base.READ << 3,
OWNER_EXEC: base.EXEC << 6,
OWNER_WRITE: base.WRITE << 6,
OWNER_READ: base.READ << 6,
// Literal octal numbers are apparently not allowed in "strict" javascript.
STICKY: parseInt('01000', 8),
SETGID: parseInt('02000', 8),
SETUID: parseInt('04000', 8),
TYPE_MASK: parseInt('0770000', 8)
};
}({
EXEC: 1,
WRITE: 2,
READ: 4
}));
common.register('chmod', _chmod, {
});
//@
//@ ### chmod(octal_mode || octal_string, file)
//@ ### chmod(symbolic_mode, file)
//@
//@ Available options:
//@
//@ + `-v`: output a diagnostic for every file processed//@
//@ + `-c`: like verbose but report only when a change is made//@
//@ + `-R`: change files and directories recursively//@
//@
//@ Examples:
//@
//@ ```javascript
//@ chmod(755, '/Users/brandon');
//@ chmod('755', '/Users/brandon'); // same as above
//@ chmod('u+x', '/Users/brandon');
//@ ```
//@
//@ Alters the permissions of a file or directory by either specifying the
//@ absolute permissions in octal form or expressing the changes in symbols.
//@ This command tries to mimic the POSIX behavior as much as possible.
//@ Notable exceptions:
//@
//@ + In symbolic modes, 'a-r' and '-r' are identical. No consideration is
//@ given to the umask.
//@ + There is no "quiet" option since default behavior is to run silent.
function _chmod(options, mode, filePattern) {
if (!filePattern) {
if (options.length > 0 && options.charAt(0) === '-') {
// Special case where the specified file permissions started with - to subtract perms, which
// get picked up by the option parser as command flags.
// If we are down by one argument and options starts with -, shift everything over.
[].unshift.call(arguments, '');
} else {
common.error('You must specify a file.');
}
}
options = common.parseOptions(options, {
'R': 'recursive',
'c': 'changes',
'v': 'verbose'
});
filePattern = [].slice.call(arguments, 2);
var files;
// TODO: replace this with a call to common.expand()
if (options.recursive) {
files = [];
filePattern.forEach(function addFile(expandedFile) {
var stat = fs.lstatSync(expandedFile);
if (!stat.isSymbolicLink()) {
files.push(expandedFile);
if (stat.isDirectory()) { // intentionally does not follow symlinks.
fs.readdirSync(expandedFile).forEach(function (child) {
addFile(expandedFile + '/' + child);
});
}
}
});
} else {
files = filePattern;
}
files.forEach(function innerChmod(file) {
file = path.resolve(file);
if (!fs.existsSync(file)) {
common.error('File not found: ' + file);
}
// When recursing, don't follow symlinks.
if (options.recursive && fs.lstatSync(file).isSymbolicLink()) {
return;
}
var stat = fs.statSync(file);
var isDir = stat.isDirectory();
var perms = stat.mode;
var type = perms & PERMS.TYPE_MASK;
var newPerms = perms;
if (isNaN(parseInt(mode, 8))) {
// parse options
mode.split(',').forEach(function (symbolicMode) {
var pattern = /([ugoa]*)([=\+-])([rwxXst]*)/i;
var matches = pattern.exec(symbolicMode);
if (matches) {
var applyTo = matches[1];
var operator = matches[2];
var change = matches[3];
var changeOwner = applyTo.indexOf('u') !== -1 || applyTo === 'a' || applyTo === '';
var changeGroup = applyTo.indexOf('g') !== -1 || applyTo === 'a' || applyTo === '';
var changeOther = applyTo.indexOf('o') !== -1 || applyTo === 'a' || applyTo === '';
var changeRead = change.indexOf('r') !== -1;
var changeWrite = change.indexOf('w') !== -1;
var changeExec = change.indexOf('x') !== -1;
var changeExecDir = change.indexOf('X') !== -1;
var changeSticky = change.indexOf('t') !== -1;
var changeSetuid = change.indexOf('s') !== -1;
if (changeExecDir && isDir) {
changeExec = true;
}
var mask = 0;
if (changeOwner) {
mask |= (changeRead ? PERMS.OWNER_READ : 0) + (changeWrite ? PERMS.OWNER_WRITE : 0) + (changeExec ? PERMS.OWNER_EXEC : 0) + (changeSetuid ? PERMS.SETUID : 0);
}
if (changeGroup) {
mask |= (changeRead ? PERMS.GROUP_READ : 0) + (changeWrite ? PERMS.GROUP_WRITE : 0) + (changeExec ? PERMS.GROUP_EXEC : 0) + (changeSetuid ? PERMS.SETGID : 0);
}
if (changeOther) {
mask |= (changeRead ? PERMS.OTHER_READ : 0) + (changeWrite ? PERMS.OTHER_WRITE : 0) + (changeExec ? PERMS.OTHER_EXEC : 0);
}
// Sticky bit is special - it's not tied to user, group or other.
if (changeSticky) {
mask |= PERMS.STICKY;
}
switch (operator) {
case '+':
newPerms |= mask;
break;
case '-':
newPerms &= ~mask;
break;
case '=':
newPerms = type + mask;
// According to POSIX, when using = to explicitly set the
// permissions, setuid and setgid can never be cleared.
if (fs.statSync(file).isDirectory()) {
newPerms |= (PERMS.SETUID + PERMS.SETGID) & perms;
}
break;
default:
common.error('Could not recognize operator: `' + operator + '`');
}
if (options.verbose) {
console.log(file + ' -> ' + newPerms.toString(8));
}
if (perms !== newPerms) {
if (!options.verbose && options.changes) {
console.log(file + ' -> ' + newPerms.toString(8));
}
fs.chmodSync(file, newPerms);
perms = newPerms; // for the next round of changes!
}
} else {
common.error('Invalid symbolic mode change: ' + symbolicMode);
}
});
} else {
// they gave us a full number
newPerms = type + parseInt(mode, 8);
// POSIX rules are that setuid and setgid can only be added using numeric
// form, but not cleared.
if (fs.statSync(file).isDirectory()) {
newPerms |= (PERMS.SETUID + PERMS.SETGID) & perms;
}
fs.chmodSync(file, newPerms);
}
});
return '';
}
module.exports = _chmod;

430
node_modules/shelljs/src/common.js generated vendored Normal file
View File

@@ -0,0 +1,430 @@
// Ignore warning about 'new String()'
/* eslint no-new-wrappers: 0 */
'use strict';
var os = require('os');
var fs = require('fs');
var glob = require('glob');
var shell = require('..');
var shellMethods = Object.create(shell);
// objectAssign(target_obj, source_obj1 [, source_obj2 ...])
// "Ponyfill" for Object.assign
// objectAssign({A:1}, {b:2}, {c:3}) returns {A:1, b:2, c:3}
var objectAssign = typeof Object.assign === 'function' ?
Object.assign :
function objectAssign(target) {
var sources = [].slice.call(arguments, 1);
sources.forEach(function (source) {
Object.keys(source).forEach(function (key) {
target[key] = source[key];
});
});
return target;
};
exports.extend = objectAssign;
// Check if we're running under electron
var isElectron = Boolean(process.versions.electron);
// Module globals (assume no execPath by default)
var DEFAULT_CONFIG = {
fatal: false,
globOptions: {},
maxdepth: 255,
noglob: false,
silent: false,
verbose: false,
execPath: null,
};
var config = {
reset: function () {
objectAssign(this, DEFAULT_CONFIG);
if (!isElectron) {
this.execPath = process.execPath;
}
},
resetForTesting: function () {
this.reset();
this.silent = true;
},
};
config.reset();
exports.config = config;
var state = {
error: null,
errorCode: 0,
currentCmd: 'shell.js',
tempDir: null
};
exports.state = state;
delete process.env.OLDPWD; // initially, there's no previous directory
var platform = os.type().match(/^Win/) ? 'win' : 'unix';
exports.platform = platform;
// This is populated by calls to commonl.wrap()
var pipeMethods = [];
function log() {
if (!config.silent) {
console.error.apply(console, arguments);
}
}
exports.log = log;
// Shows error message. Throws if config.fatal is true
function error(msg, _code, options) {
// Validate input
if (typeof msg !== 'string') throw new Error('msg must be a string');
var DEFAULT_OPTIONS = {
continue: false,
code: 1,
prefix: state.currentCmd + ': ',
silent: false,
};
if (typeof _code === 'number' && typeof options === 'object') {
options.code = _code;
} else if (typeof _code === 'object') { // no 'code'
options = _code;
} else if (typeof _code === 'number') { // no 'options'
options = { code: _code };
} else if (typeof _code !== 'number') { // only 'msg'
options = {};
}
options = objectAssign({}, DEFAULT_OPTIONS, options);
if (!state.errorCode) state.errorCode = options.code;
var logEntry = options.prefix + msg;
state.error = state.error ? state.error + '\n' : '';
state.error += logEntry;
// Throw an error, or log the entry
if (config.fatal) throw new Error(logEntry);
if (msg.length > 0 && !options.silent) log(logEntry);
if (!options.continue) {
throw {
msg: 'earlyExit',
retValue: (new ShellString('', state.error, state.errorCode))
};
}
}
exports.error = error;
//@
//@ ### ShellString(str)
//@
//@ Examples:
//@
//@ ```javascript
//@ var foo = ShellString('hello world');
//@ ```
//@
//@ Turns a regular string into a string-like object similar to what each
//@ command returns. This has special methods, like `.to()` and `.toEnd()`
function ShellString(stdout, stderr, code) {
var that;
if (stdout instanceof Array) {
that = stdout;
that.stdout = stdout.join('\n');
if (stdout.length > 0) that.stdout += '\n';
} else {
that = new String(stdout);
that.stdout = stdout;
}
that.stderr = stderr;
that.code = code;
// A list of all commands that can appear on the right-hand side of a pipe
// (populated by calls to common.wrap())
pipeMethods.forEach(function (cmd) {
that[cmd] = shellMethods[cmd].bind(that);
});
return that;
}
exports.ShellString = ShellString;
// Return the home directory in a platform-agnostic way, with consideration for
// older versions of node
function getUserHome() {
var result;
if (os.homedir) {
result = os.homedir(); // node 3+
} else {
result = process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'];
}
return result;
}
exports.getUserHome = getUserHome;
// Returns {'alice': true, 'bob': false} when passed a string and dictionary as follows:
// parseOptions('-a', {'a':'alice', 'b':'bob'});
// Returns {'reference': 'string-value', 'bob': false} when passed two dictionaries of the form:
// parseOptions({'-r': 'string-value'}, {'r':'reference', 'b':'bob'});
function parseOptions(opt, map, errorOptions) {
if (!map) error('parseOptions() internal error: no map given');
// All options are false by default
var options = {};
Object.keys(map).forEach(function (letter) {
if (map[letter][0] !== '!') {
options[map[letter]] = false;
}
});
if (!opt) return options; // defaults
var optionName;
if (typeof opt === 'string') {
if (opt[0] !== '-') {
return options;
}
// e.g. chars = ['R', 'f']
var chars = opt.slice(1).split('');
chars.forEach(function (c) {
if (c in map) {
optionName = map[c];
if (optionName[0] === '!') {
options[optionName.slice(1)] = false;
} else {
options[optionName] = true;
}
} else if (typeof errorOptions === 'object') {
error('option not recognized: ' + c, errorOptions);
} else {
error('option not recognized: ' + c);
}
});
} else if (typeof opt === 'object') {
Object.keys(opt).forEach(function (key) {
// key is a string of the form '-r', '-d', etc.
var c = key[1];
if (c in map) {
optionName = map[c];
options[optionName] = opt[key]; // assign the given value
} else if (typeof errorOptions === 'object') {
error('option not recognized: ' + c, errorOptions);
} else {
error('option not recognized: ' + c);
}
});
} else if (typeof errorOptions === 'object') {
error('options must be strings or key-value pairs', errorOptions);
} else {
error('options must be strings or key-value pairs');
}
return options;
}
exports.parseOptions = parseOptions;
// Expands wildcards with matching (ie. existing) file names.
// For example:
// expand(['file*.js']) = ['file1.js', 'file2.js', ...]
// (if the files 'file1.js', 'file2.js', etc, exist in the current dir)
function expand(list) {
if (!Array.isArray(list)) {
throw new TypeError('must be an array');
}
var expanded = [];
list.forEach(function (listEl) {
// Don't expand non-strings
if (typeof listEl !== 'string') {
expanded.push(listEl);
} else {
var ret = glob.sync(listEl, config.globOptions);
// if glob fails, interpret the string literally
expanded = expanded.concat(ret.length > 0 ? ret : [listEl]);
}
});
return expanded;
}
exports.expand = expand;
// Normalizes _unlinkSync() across platforms to match Unix behavior, i.e.
// file can be unlinked even if it's read-only, see https://github.com/joyent/node/issues/3006
function unlinkSync(file) {
try {
fs.unlinkSync(file);
} catch (e) {
// Try to override file permission
if (e.code === 'EPERM') {
fs.chmodSync(file, '0666');
fs.unlinkSync(file);
} else {
throw e;
}
}
}
exports.unlinkSync = unlinkSync;
// e.g. 'shelljs_a5f185d0443ca...'
function randomFileName() {
function randomHash(count) {
if (count === 1) {
return parseInt(16 * Math.random(), 10).toString(16);
}
var hash = '';
for (var i = 0; i < count; i++) {
hash += randomHash(1);
}
return hash;
}
return 'shelljs_' + randomHash(20);
}
exports.randomFileName = randomFileName;
// Common wrapper for all Unix-like commands that performs glob expansion,
// command-logging, and other nice things
function wrap(cmd, fn, options) {
options = options || {};
if (options.canReceivePipe) {
pipeMethods.push(cmd);
}
return function () {
var retValue = null;
state.currentCmd = cmd;
state.error = null;
state.errorCode = 0;
try {
var args = [].slice.call(arguments, 0);
// Log the command to stderr, if appropriate
if (config.verbose) {
console.error.apply(console, [cmd].concat(args));
}
// If this is coming from a pipe, let's set the pipedValue (otherwise, set
// it to the empty string)
state.pipedValue = (this && typeof this.stdout === 'string') ? this.stdout : '';
if (options.unix === false) { // this branch is for exec()
retValue = fn.apply(this, args);
} else { // and this branch is for everything else
if (args[0] instanceof Object && args[0].constructor.name === 'Object') {
// a no-op, allowing the syntax `touch({'-r': file}, ...)`
} else if (args.length === 0 || typeof args[0] !== 'string' || args[0].length <= 1 || args[0][0] !== '-') {
args.unshift(''); // only add dummy option if '-option' not already present
}
// flatten out arrays that are arguments, to make the syntax:
// `cp([file1, file2, file3], dest);`
// equivalent to:
// `cp(file1, file2, file3, dest);`
args = args.reduce(function (accum, cur) {
if (Array.isArray(cur)) {
return accum.concat(cur);
}
accum.push(cur);
return accum;
}, []);
// Convert ShellStrings (basically just String objects) to regular strings
args = args.map(function (arg) {
if (arg instanceof Object && arg.constructor.name === 'String') {
return arg.toString();
}
return arg;
});
// Expand the '~' if appropriate
var homeDir = getUserHome();
args = args.map(function (arg) {
if (typeof arg === 'string' && arg.slice(0, 2) === '~/' || arg === '~') {
return arg.replace(/^~/, homeDir);
}
return arg;
});
// Perform glob-expansion on all arguments after globStart, but preserve
// the arguments before it (like regexes for sed and grep)
if (!config.noglob && options.allowGlobbing === true) {
args = args.slice(0, options.globStart).concat(expand(args.slice(options.globStart)));
}
try {
// parse options if options are provided
if (typeof options.cmdOptions === 'object') {
args[0] = parseOptions(args[0], options.cmdOptions);
}
retValue = fn.apply(this, args);
} catch (e) {
if (e.msg === 'earlyExit') {
retValue = e.retValue;
} else {
throw e; // this is probably a bug that should be thrown up the call stack
}
}
}
} catch (e) {
if (!state.error) {
// If state.error hasn't been set it's an error thrown by Node, not us - probably a bug...
console.error('ShellJS: internal error');
console.error(e.stack || e);
process.exit(1);
}
if (config.fatal) throw e;
}
if (options.wrapOutput &&
(typeof retValue === 'string' || Array.isArray(retValue))) {
retValue = new ShellString(retValue, state.error, state.errorCode);
}
state.currentCmd = 'shell.js';
return retValue;
};
} // wrap
exports.wrap = wrap;
// This returns all the input that is piped into the current command (or the
// empty string, if this isn't on the right-hand side of a pipe
function _readFromPipe() {
return state.pipedValue;
}
exports.readFromPipe = _readFromPipe;
var DEFAULT_WRAP_OPTIONS = {
allowGlobbing: true,
canReceivePipe: false,
cmdOptions: false,
globStart: 1,
pipeOnly: false,
unix: true,
wrapOutput: true,
overWrite: false,
};
// Register a new ShellJS command
function _register(name, implementation, wrapOptions) {
wrapOptions = wrapOptions || {};
// If an option isn't specified, use the default
wrapOptions = objectAssign({}, DEFAULT_WRAP_OPTIONS, wrapOptions);
if (shell[name] && !wrapOptions.overWrite) {
throw new Error('unable to overwrite `' + name + '` command');
}
if (wrapOptions.pipeOnly) {
wrapOptions.canReceivePipe = true;
shellMethods[name] = wrap(name, implementation, wrapOptions);
} else {
shell[name] = wrap(name, implementation, wrapOptions);
}
}
exports.register = _register;

268
node_modules/shelljs/src/cp.js generated vendored Normal file
View File

@@ -0,0 +1,268 @@
var fs = require('fs');
var path = require('path');
var common = require('./common');
var os = require('os');
common.register('cp', _cp, {
cmdOptions: {
'f': '!no_force',
'n': 'no_force',
'u': 'update',
'R': 'recursive',
'r': 'recursive',
'L': 'followsymlink',
'P': 'noFollowsymlink',
},
wrapOutput: false,
});
// Buffered file copy, synchronous
// (Using readFileSync() + writeFileSync() could easily cause a memory overflow
// with large files)
function copyFileSync(srcFile, destFile, options) {
if (!fs.existsSync(srcFile)) {
common.error('copyFileSync: no such file or directory: ' + srcFile);
}
// Check the mtimes of the files if the '-u' flag is provided
try {
if (options.update && fs.statSync(srcFile).mtime < fs.statSync(destFile).mtime) {
return;
}
} catch (e) {
// If we're here, destFile probably doesn't exist, so just do a normal copy
}
if (fs.lstatSync(srcFile).isSymbolicLink() && !options.followsymlink) {
try {
fs.lstatSync(destFile);
common.unlinkSync(destFile); // re-link it
} catch (e) {
// it doesn't exist, so no work needs to be done
}
var symlinkFull = fs.readlinkSync(srcFile);
fs.symlinkSync(symlinkFull, destFile, os.platform() === 'win32' ? 'junction' : null);
} else {
var BUF_LENGTH = 64 * 1024;
var buf = new Buffer(BUF_LENGTH);
var bytesRead = BUF_LENGTH;
var pos = 0;
var fdr = null;
var fdw = null;
try {
fdr = fs.openSync(srcFile, 'r');
} catch (e) {
common.error('copyFileSync: could not read src file (' + srcFile + ')');
}
try {
fdw = fs.openSync(destFile, 'w');
} catch (e) {
common.error('copyFileSync: could not write to dest file (code=' + e.code + '):' + destFile);
}
while (bytesRead === BUF_LENGTH) {
bytesRead = fs.readSync(fdr, buf, 0, BUF_LENGTH, pos);
fs.writeSync(fdw, buf, 0, bytesRead);
pos += bytesRead;
}
fs.closeSync(fdr);
fs.closeSync(fdw);
fs.chmodSync(destFile, fs.statSync(srcFile).mode);
}
}
// Recursively copies 'sourceDir' into 'destDir'
// Adapted from https://github.com/ryanmcgrath/wrench-js
//
// Copyright (c) 2010 Ryan McGrath
// Copyright (c) 2012 Artur Adib
//
// Licensed under the MIT License
// http://www.opensource.org/licenses/mit-license.php
function cpdirSyncRecursive(sourceDir, destDir, currentDepth, opts) {
if (!opts) opts = {};
// Ensure there is not a run away recursive copy
if (currentDepth >= common.config.maxdepth) return;
currentDepth++;
// Create the directory where all our junk is moving to; read the mode of the
// source directory and mirror it
try {
var checkDir = fs.statSync(sourceDir);
fs.mkdirSync(destDir, checkDir.mode);
} catch (e) {
// if the directory already exists, that's okay
if (e.code !== 'EEXIST') throw e;
}
var files = fs.readdirSync(sourceDir);
for (var i = 0; i < files.length; i++) {
var srcFile = sourceDir + '/' + files[i];
var destFile = destDir + '/' + files[i];
var srcFileStat = fs.lstatSync(srcFile);
var symlinkFull;
if (opts.followsymlink) {
if (cpcheckcycle(sourceDir, srcFile)) {
// Cycle link found.
console.error('Cycle link found.');
symlinkFull = fs.readlinkSync(srcFile);
fs.symlinkSync(symlinkFull, destFile, os.platform() === 'win32' ? 'junction' : null);
continue;
}
}
if (srcFileStat.isDirectory()) {
/* recursion this thing right on back. */
cpdirSyncRecursive(srcFile, destFile, currentDepth, opts);
} else if (srcFileStat.isSymbolicLink() && !opts.followsymlink) {
symlinkFull = fs.readlinkSync(srcFile);
try {
fs.lstatSync(destFile);
common.unlinkSync(destFile); // re-link it
} catch (e) {
// it doesn't exist, so no work needs to be done
}
fs.symlinkSync(symlinkFull, destFile, os.platform() === 'win32' ? 'junction' : null);
} else if (srcFileStat.isSymbolicLink() && opts.followsymlink) {
srcFileStat = fs.statSync(srcFile);
if (srcFileStat.isDirectory()) {
cpdirSyncRecursive(srcFile, destFile, currentDepth, opts);
} else {
copyFileSync(srcFile, destFile, opts);
}
} else {
/* At this point, we've hit a file actually worth copying... so copy it on over. */
if (fs.existsSync(destFile) && opts.no_force) {
common.log('skipping existing file: ' + files[i]);
} else {
copyFileSync(srcFile, destFile, opts);
}
}
} // for files
} // cpdirSyncRecursive
function cpcheckcycle(sourceDir, srcFile) {
var srcFileStat = fs.lstatSync(srcFile);
if (srcFileStat.isSymbolicLink()) {
// Do cycle check. For example:
// $ mkdir -p 1/2/3/4
// $ cd 1/2/3/4
// $ ln -s ../../3 link
// $ cd ../../../..
// $ cp -RL 1 copy
var cyclecheck = fs.statSync(srcFile);
if (cyclecheck.isDirectory()) {
var sourcerealpath = fs.realpathSync(sourceDir);
var symlinkrealpath = fs.realpathSync(srcFile);
var re = new RegExp(symlinkrealpath);
if (re.test(sourcerealpath)) {
return true;
}
}
}
return false;
}
//@
//@ ### cp([options,] source [, source ...], dest)
//@ ### cp([options,] source_array, dest)
//@ Available options:
//@
//@ + `-f`: force (default behavior)
//@ + `-n`: no-clobber
//@ + `-u`: only copy if source is newer than dest
//@ + `-r`, `-R`: recursive
//@ + `-L`: follow symlinks
//@ + `-P`: don't follow symlinks
//@
//@ Examples:
//@
//@ ```javascript
//@ cp('file1', 'dir1');
//@ cp('-R', 'path/to/dir/', '~/newCopy/');
//@ cp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp');
//@ cp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above
//@ ```
//@
//@ Copies files.
function _cp(options, sources, dest) {
// If we're missing -R, it actually implies -L (unless -P is explicit)
if (options.followsymlink) {
options.noFollowsymlink = false;
}
if (!options.recursive && !options.noFollowsymlink) {
options.followsymlink = true;
}
// Get sources, dest
if (arguments.length < 3) {
common.error('missing <source> and/or <dest>');
} else {
sources = [].slice.call(arguments, 1, arguments.length - 1);
dest = arguments[arguments.length - 1];
}
var destExists = fs.existsSync(dest);
var destStat = destExists && fs.statSync(dest);
// Dest is not existing dir, but multiple sources given
if ((!destExists || !destStat.isDirectory()) && sources.length > 1) {
common.error('dest is not a directory (too many sources)');
}
// Dest is an existing file, but -n is given
if (destExists && destStat.isFile() && options.no_force) {
return new common.ShellString('', '', 0);
}
sources.forEach(function (src) {
if (!fs.existsSync(src)) {
common.error('no such file or directory: ' + src, { continue: true });
return; // skip file
}
var srcStat = fs.statSync(src);
if (!options.noFollowsymlink && srcStat.isDirectory()) {
if (!options.recursive) {
// Non-Recursive
common.error("omitting directory '" + src + "'", { continue: true });
} else {
// Recursive
// 'cp /a/source dest' should create 'source' in 'dest'
var newDest = (destStat && destStat.isDirectory()) ?
path.join(dest, path.basename(src)) :
dest;
try {
fs.statSync(path.dirname(dest));
cpdirSyncRecursive(src, newDest, 0, { no_force: options.no_force, followsymlink: options.followsymlink });
} catch (e) {
common.error("cannot create directory '" + dest + "': No such file or directory");
}
}
} else {
// If here, src is a file
// When copying to '/path/dir':
// thisDest = '/path/dir/file1'
var thisDest = dest;
if (destStat && destStat.isDirectory()) {
thisDest = path.normalize(dest + '/' + path.basename(src));
}
if (fs.existsSync(thisDest) && options.no_force) {
return; // skip file
}
copyFileSync(src, thisDest, options);
}
}); // forEach(src)
return new common.ShellString('', common.state.error, common.state.errorCode);
}
module.exports = _cp;

200
node_modules/shelljs/src/dirs.js generated vendored Normal file
View File

@@ -0,0 +1,200 @@
var common = require('./common');
var _cd = require('./cd');
var path = require('path');
common.register('dirs', _dirs, {
wrapOutput: false,
});
common.register('pushd', _pushd, {
wrapOutput: false,
});
common.register('popd', _popd, {
wrapOutput: false,
});
// Pushd/popd/dirs internals
var _dirStack = [];
function _isStackIndex(index) {
return (/^[\-+]\d+$/).test(index);
}
function _parseStackIndex(index) {
if (_isStackIndex(index)) {
if (Math.abs(index) < _dirStack.length + 1) { // +1 for pwd
return (/^-/).test(index) ? Number(index) - 1 : Number(index);
}
common.error(index + ': directory stack index out of range');
} else {
common.error(index + ': invalid number');
}
}
function _actualDirStack() {
return [process.cwd()].concat(_dirStack);
}
//@
//@ ### pushd([options,] [dir | '-N' | '+N'])
//@
//@ Available options:
//@
//@ + `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.
//@
//@ Arguments:
//@
//@ + `dir`: Makes the current working directory be the top of the stack, and then executes the equivalent of `cd dir`.
//@ + `+N`: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
//@ + `-N`: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
//@
//@ Examples:
//@
//@ ```javascript
//@ // process.cwd() === '/usr'
//@ pushd('/etc'); // Returns /etc /usr
//@ pushd('+1'); // Returns /usr /etc
//@ ```
//@
//@ Save the current directory on the top of the directory stack and then cd to `dir`. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack.
function _pushd(options, dir) {
if (_isStackIndex(options)) {
dir = options;
options = '';
}
options = common.parseOptions(options, {
'n': 'no-cd'
});
var dirs = _actualDirStack();
if (dir === '+0') {
return dirs; // +0 is a noop
} else if (!dir) {
if (dirs.length > 1) {
dirs = dirs.splice(1, 1).concat(dirs);
} else {
return common.error('no other directory');
}
} else if (_isStackIndex(dir)) {
var n = _parseStackIndex(dir);
dirs = dirs.slice(n).concat(dirs.slice(0, n));
} else {
if (options['no-cd']) {
dirs.splice(1, 0, dir);
} else {
dirs.unshift(dir);
}
}
if (options['no-cd']) {
dirs = dirs.slice(1);
} else {
dir = path.resolve(dirs.shift());
_cd('', dir);
}
_dirStack = dirs;
return _dirs('');
}
exports.pushd = _pushd;
//@
//@ ### popd([options,] ['-N' | '+N'])
//@
//@ Available options:
//@
//@ + `-n`: Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated.
//@
//@ Arguments:
//@
//@ + `+N`: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero.
//@ + `-N`: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero.
//@
//@ Examples:
//@
//@ ```javascript
//@ echo(process.cwd()); // '/usr'
//@ pushd('/etc'); // '/etc /usr'
//@ echo(process.cwd()); // '/etc'
//@ popd(); // '/usr'
//@ echo(process.cwd()); // '/usr'
//@ ```
//@
//@ When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack.
function _popd(options, index) {
if (_isStackIndex(options)) {
index = options;
options = '';
}
options = common.parseOptions(options, {
'n': 'no-cd'
});
if (!_dirStack.length) {
return common.error('directory stack empty');
}
index = _parseStackIndex(index || '+0');
if (options['no-cd'] || index > 0 || _dirStack.length + index === 0) {
index = index > 0 ? index - 1 : index;
_dirStack.splice(index, 1);
} else {
var dir = path.resolve(_dirStack.shift());
_cd('', dir);
}
return _dirs('');
}
exports.popd = _popd;
//@
//@ ### dirs([options | '+N' | '-N'])
//@
//@ Available options:
//@
//@ + `-c`: Clears the directory stack by deleting all of the elements.
//@
//@ Arguments:
//@
//@ + `+N`: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero.
//@ + `-N`: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero.
//@
//@ Display the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified.
//@
//@ See also: pushd, popd
function _dirs(options, index) {
if (_isStackIndex(options)) {
index = options;
options = '';
}
options = common.parseOptions(options, {
'c': 'clear'
});
if (options.clear) {
_dirStack = [];
return _dirStack;
}
var stack = _actualDirStack();
if (index) {
index = _parseStackIndex(index);
if (index < 0) {
index = stack.length + index;
}
common.log(stack[index]);
return stack[index];
}
common.log(stack.join(' '));
return stack;
}
exports.dirs = _dirs;

34
node_modules/shelljs/src/echo.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
var common = require('./common');
common.register('echo', _echo, {
allowGlobbing: false,
});
//@
//@ ### echo([options,] string [, string ...])
//@ Available options:
//@
//@ + `-e`: interpret backslash escapes (default)
//@
//@ Examples:
//@
//@ ```javascript
//@ echo('hello world');
//@ var str = echo('hello world');
//@ ```
//@
//@ Prints string to stdout, and returns string with additional utility methods
//@ like `.to()`.
function _echo(opts, messages) {
// allow strings starting with '-', see issue #20
messages = [].slice.call(arguments, opts ? 0 : 1);
if (messages[0] === '-e') {
// ignore -e
messages.shift();
}
console.log.apply(console, messages);
return messages.join(' ');
}
module.exports = _echo;

14
node_modules/shelljs/src/error.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
var common = require('./common');
//@
//@ ### error()
//@ Tests if error occurred in the last command. Returns a truthy value if an
//@ error returned and a falsy value otherwise.
//@
//@ **Note**: do not rely on the
//@ return value to be an error message. If you need the last error message, use
//@ the `.stderr` attribute from the last command's return value instead.
function error() {
return common.state.error;
}
module.exports = error;

295
node_modules/shelljs/src/exec.js generated vendored Normal file
View File

@@ -0,0 +1,295 @@
var common = require('./common');
var _tempDir = require('./tempdir');
var _pwd = require('./pwd');
var path = require('path');
var fs = require('fs');
var child = require('child_process');
var DEFAULT_MAXBUFFER_SIZE = 20 * 1024 * 1024;
common.register('exec', _exec, {
unix: false,
canReceivePipe: true,
wrapOutput: false,
});
// Hack to run child_process.exec() synchronously (sync avoids callback hell)
// Uses a custom wait loop that checks for a flag file, created when the child process is done.
// (Can't do a wait loop that checks for internal Node variables/messages as
// Node is single-threaded; callbacks and other internal state changes are done in the
// event loop).
function execSync(cmd, opts, pipe) {
if (!common.config.execPath) {
common.error('Unable to find a path to the node binary. Please manually set config.execPath');
}
var tempDir = _tempDir();
var stdoutFile = path.resolve(tempDir + '/' + common.randomFileName());
var stderrFile = path.resolve(tempDir + '/' + common.randomFileName());
var codeFile = path.resolve(tempDir + '/' + common.randomFileName());
var scriptFile = path.resolve(tempDir + '/' + common.randomFileName());
var sleepFile = path.resolve(tempDir + '/' + common.randomFileName());
opts = common.extend({
silent: common.config.silent,
cwd: _pwd().toString(),
env: process.env,
maxBuffer: DEFAULT_MAXBUFFER_SIZE
}, opts);
var previousStdoutContent = '';
var previousStderrContent = '';
// Echoes stdout and stderr changes from running process, if not silent
function updateStream(streamFile) {
if (opts.silent || !fs.existsSync(streamFile)) {
return;
}
var previousStreamContent;
var procStream;
if (streamFile === stdoutFile) {
previousStreamContent = previousStdoutContent;
procStream = process.stdout;
} else { // assume stderr
previousStreamContent = previousStderrContent;
procStream = process.stderr;
}
var streamContent = fs.readFileSync(streamFile, 'utf8');
// No changes since last time?
if (streamContent.length <= previousStreamContent.length) {
return;
}
procStream.write(streamContent.substr(previousStreamContent.length));
previousStreamContent = streamContent;
}
if (fs.existsSync(scriptFile)) common.unlinkSync(scriptFile);
if (fs.existsSync(stdoutFile)) common.unlinkSync(stdoutFile);
if (fs.existsSync(stderrFile)) common.unlinkSync(stderrFile);
if (fs.existsSync(codeFile)) common.unlinkSync(codeFile);
var execCommand = JSON.stringify(common.config.execPath) + ' ' + JSON.stringify(scriptFile);
var script;
opts.cwd = path.resolve(opts.cwd);
var optString = JSON.stringify(opts);
if (typeof child.execSync === 'function') {
script = [
"var child = require('child_process')",
" , fs = require('fs');",
'var childProcess = child.exec(' + JSON.stringify(cmd) + ', ' + optString + ', function(err) {',
' var fname = ' + JSON.stringify(codeFile) + ';',
' if (!err) {',
' fs.writeFileSync(fname, "0");',
' } else if (err.code === undefined) {',
' fs.writeFileSync(fname, "1");',
' } else {',
' fs.writeFileSync(fname, err.code.toString());',
' }',
'});',
'var stdoutStream = fs.createWriteStream(' + JSON.stringify(stdoutFile) + ');',
'var stderrStream = fs.createWriteStream(' + JSON.stringify(stderrFile) + ');',
'childProcess.stdout.pipe(stdoutStream, {end: false});',
'childProcess.stderr.pipe(stderrStream, {end: false});',
'childProcess.stdout.pipe(process.stdout);',
'childProcess.stderr.pipe(process.stderr);',
].join('\n') +
(pipe ? '\nchildProcess.stdin.end(' + JSON.stringify(pipe) + ');\n' : '\n') +
[
'var stdoutEnded = false, stderrEnded = false;',
'function tryClosingStdout(){ if(stdoutEnded){ stdoutStream.end(); } }',
'function tryClosingStderr(){ if(stderrEnded){ stderrStream.end(); } }',
"childProcess.stdout.on('end', function(){ stdoutEnded = true; tryClosingStdout(); });",
"childProcess.stderr.on('end', function(){ stderrEnded = true; tryClosingStderr(); });",
].join('\n');
fs.writeFileSync(scriptFile, script);
if (opts.silent) {
opts.stdio = 'ignore';
} else {
opts.stdio = [0, 1, 2];
}
// Welcome to the future
try {
child.execSync(execCommand, opts);
} catch (e) {
// Clean up immediately if we have an exception
try { common.unlinkSync(scriptFile); } catch (e2) {}
try { common.unlinkSync(stdoutFile); } catch (e2) {}
try { common.unlinkSync(stderrFile); } catch (e2) {}
try { common.unlinkSync(codeFile); } catch (e2) {}
throw e;
}
} else {
cmd += ' > ' + stdoutFile + ' 2> ' + stderrFile; // works on both win/unix
script = [
"var child = require('child_process')",
" , fs = require('fs');",
'var childProcess = child.exec(' + JSON.stringify(cmd) + ', ' + optString + ', function(err) {',
' var fname = ' + JSON.stringify(codeFile) + ';',
' if (!err) {',
' fs.writeFileSync(fname, "0");',
' } else if (err.code === undefined) {',
' fs.writeFileSync(fname, "1");',
' } else {',
' fs.writeFileSync(fname, err.code.toString());',
' }',
'});',
].join('\n') +
(pipe ? '\nchildProcess.stdin.end(' + JSON.stringify(pipe) + ');\n' : '\n');
fs.writeFileSync(scriptFile, script);
child.exec(execCommand, opts);
// The wait loop
// sleepFile is used as a dummy I/O op to mitigate unnecessary CPU usage
// (tried many I/O sync ops, writeFileSync() seems to be only one that is effective in reducing
// CPU usage, though apparently not so much on Windows)
while (!fs.existsSync(codeFile)) { updateStream(stdoutFile); fs.writeFileSync(sleepFile, 'a'); }
while (!fs.existsSync(stdoutFile)) { updateStream(stdoutFile); fs.writeFileSync(sleepFile, 'a'); }
while (!fs.existsSync(stderrFile)) { updateStream(stderrFile); fs.writeFileSync(sleepFile, 'a'); }
try { common.unlinkSync(sleepFile); } catch (e) {}
}
// At this point codeFile exists, but it's not necessarily flushed yet.
// Keep reading it until it is.
var code = parseInt('', 10);
while (isNaN(code)) {
code = parseInt(fs.readFileSync(codeFile, 'utf8'), 10);
}
var stdout = fs.readFileSync(stdoutFile, 'utf8');
var stderr = fs.readFileSync(stderrFile, 'utf8');
// No biggie if we can't erase the files now -- they're in a temp dir anyway
try { common.unlinkSync(scriptFile); } catch (e) {}
try { common.unlinkSync(stdoutFile); } catch (e) {}
try { common.unlinkSync(stderrFile); } catch (e) {}
try { common.unlinkSync(codeFile); } catch (e) {}
if (code !== 0) {
common.error('', code, { continue: true });
}
var obj = common.ShellString(stdout, stderr, code);
return obj;
} // execSync()
// Wrapper around exec() to enable echoing output to console in real time
function execAsync(cmd, opts, pipe, callback) {
var stdout = '';
var stderr = '';
opts = common.extend({
silent: common.config.silent,
cwd: _pwd().toString(),
env: process.env,
maxBuffer: DEFAULT_MAXBUFFER_SIZE
}, opts);
var c = child.exec(cmd, opts, function (err) {
if (callback) {
if (!err) {
callback(0, stdout, stderr);
} else if (err.code === undefined) {
// See issue #536
callback(1, stdout, stderr);
} else {
callback(err.code, stdout, stderr);
}
}
});
if (pipe) c.stdin.end(pipe);
c.stdout.on('data', function (data) {
stdout += data;
if (!opts.silent) process.stdout.write(data);
});
c.stderr.on('data', function (data) {
stderr += data;
if (!opts.silent) process.stderr.write(data);
});
return c;
}
//@
//@ ### exec(command [, options] [, callback])
//@ Available options (all `false` by default):
//@
//@ + `async`: Asynchronous execution. If a callback is provided, it will be set to
//@ `true`, regardless of the passed value.
//@ + `silent`: Do not echo program output to console.
//@ + and any option available to NodeJS's
//@ [child_process.exec()](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback)
//@
//@ Examples:
//@
//@ ```javascript
//@ var version = exec('node --version', {silent:true}).stdout;
//@
//@ var child = exec('some_long_running_process', {async:true});
//@ child.stdout.on('data', function(data) {
//@ /* ... do something with data ... */
//@ });
//@
//@ exec('some_long_running_process', function(code, stdout, stderr) {
//@ console.log('Exit code:', code);
//@ console.log('Program output:', stdout);
//@ console.log('Program stderr:', stderr);
//@ });
//@ ```
//@
//@ Executes the given `command` _synchronously_, unless otherwise specified. When in synchronous
//@ mode, this returns a ShellString (compatible with ShellJS v0.6.x, which returns an object
//@ of the form `{ code:..., stdout:... , stderr:... }`). Otherwise, this returns the child process
//@ object, and the `callback` gets the arguments `(code, stdout, stderr)`.
//@
//@ Not seeing the behavior you want? `exec()` runs everything through `sh`
//@ by default (or `cmd.exe` on Windows), which differs from `bash`. If you
//@ need bash-specific behavior, try out the `{shell: 'path/to/bash'}` option.
//@
//@ **Note:** For long-lived processes, it's best to run `exec()` asynchronously as
//@ the current synchronous implementation uses a lot of CPU. This should be getting
//@ fixed soon.
function _exec(command, options, callback) {
options = options || {};
if (!command) common.error('must specify command');
var pipe = common.readFromPipe();
// Callback is defined instead of options.
if (typeof options === 'function') {
callback = options;
options = { async: true };
}
// Callback is defined with options.
if (typeof options === 'object' && typeof callback === 'function') {
options.async = true;
}
options = common.extend({
silent: common.config.silent,
async: false
}, options);
try {
if (options.async) {
return execAsync(command, options, pipe, callback);
} else {
return execSync(command, options, pipe);
}
} catch (e) {
common.error('internal error');
}
}
module.exports = _exec;

54
node_modules/shelljs/src/find.js generated vendored Normal file
View File

@@ -0,0 +1,54 @@
var fs = require('fs');
var path = require('path');
var common = require('./common');
var _ls = require('./ls');
common.register('find', _find, {});
//@
//@ ### find(path [, path ...])
//@ ### find(path_array)
//@ Examples:
//@
//@ ```javascript
//@ find('src', 'lib');
//@ find(['src', 'lib']); // same as above
//@ find('.').filter(function(file) { return file.match(/\.js$/); });
//@ ```
//@
//@ Returns array of all files (however deep) in the given paths.
//@
//@ The main difference from `ls('-R', path)` is that the resulting file names
//@ include the base directories, e.g. `lib/resources/file1` instead of just `file1`.
function _find(options, paths) {
if (!paths) {
common.error('no path specified');
} else if (typeof paths === 'string') {
paths = [].slice.call(arguments, 1);
}
var list = [];
function pushFile(file) {
if (common.platform === 'win') {
file = file.replace(/\\/g, '/');
}
list.push(file);
}
// why not simply do ls('-R', paths)? because the output wouldn't give the base dirs
// to get the base dir in the output, we need instead ls('-R', 'dir/*') for every directory
paths.forEach(function (file) {
pushFile(file);
if (fs.statSync(file).isDirectory()) {
_ls({ recursive: true, all: true }, file).forEach(function (subfile) {
pushFile(path.join(file, subfile));
});
}
});
return list;
}
module.exports = _find;

67
node_modules/shelljs/src/grep.js generated vendored Normal file
View File

@@ -0,0 +1,67 @@
var common = require('./common');
var fs = require('fs');
common.register('grep', _grep, {
globStart: 2, // don't glob-expand the regex
canReceivePipe: true,
cmdOptions: {
'v': 'inverse',
'l': 'nameOnly',
},
});
//@
//@ ### grep([options,] regex_filter, file [, file ...])
//@ ### grep([options,] regex_filter, file_array)
//@ Available options:
//@
//@ + `-v`: Inverse the sense of the regex and print the lines not matching the criteria.
//@ + `-l`: Print only filenames of matching files
//@
//@ Examples:
//@
//@ ```javascript
//@ grep('-v', 'GLOBAL_VARIABLE', '*.js');
//@ grep('GLOBAL_VARIABLE', '*.js');
//@ ```
//@
//@ Reads input string from given files and returns a string containing all lines of the
//@ file that match the given `regex_filter`.
function _grep(options, regex, files) {
// Check if this is coming from a pipe
var pipe = common.readFromPipe();
if (!files && !pipe) common.error('no paths given', 2);
files = [].slice.call(arguments, 2);
if (pipe) {
files.unshift('-');
}
var grep = [];
files.forEach(function (file) {
if (!fs.existsSync(file) && file !== '-') {
common.error('no such file or directory: ' + file, 2, { continue: true });
return;
}
var contents = file === '-' ? pipe : fs.readFileSync(file, 'utf8');
var lines = contents.split(/\r*\n/);
if (options.nameOnly) {
if (contents.match(regex)) {
grep.push(file);
}
} else {
lines.forEach(function (line) {
var matched = line.match(regex);
if ((options.inverse && !matched) || (!options.inverse && matched)) {
grep.push(line);
}
});
}
});
return grep.join('\n') + '\n';
}
module.exports = _grep;

104
node_modules/shelljs/src/head.js generated vendored Normal file
View File

@@ -0,0 +1,104 @@
var common = require('./common');
var fs = require('fs');
common.register('head', _head, {
canReceivePipe: true,
cmdOptions: {
'n': 'numLines',
},
});
// This reads n or more lines, or the entire file, whichever is less.
function readSomeLines(file, numLines) {
var BUF_LENGTH = 64 * 1024;
var buf = new Buffer(BUF_LENGTH);
var bytesRead = BUF_LENGTH;
var pos = 0;
var fdr = null;
try {
fdr = fs.openSync(file, 'r');
} catch (e) {
common.error('cannot read file: ' + file);
}
var numLinesRead = 0;
var ret = '';
while (bytesRead === BUF_LENGTH && numLinesRead < numLines) {
bytesRead = fs.readSync(fdr, buf, 0, BUF_LENGTH, pos);
var bufStr = buf.toString('utf8', 0, bytesRead);
numLinesRead += bufStr.split('\n').length - 1;
ret += bufStr;
pos += bytesRead;
}
fs.closeSync(fdr);
return ret;
}
//@
//@ ### head([{'-n': \<num\>},] file [, file ...])
//@ ### head([{'-n': \<num\>},] file_array)
//@ Available options:
//@
//@ + `-n <num>`: Show the first `<num>` lines of the files
//@
//@ Examples:
//@
//@ ```javascript
//@ var str = head({'-n': 1}, 'file*.txt');
//@ var str = head('file1', 'file2');
//@ var str = head(['file1', 'file2']); // same as above
//@ ```
//@
//@ Read the start of a file.
function _head(options, files) {
var head = [];
var pipe = common.readFromPipe();
if (!files && !pipe) common.error('no paths given');
var idx = 1;
if (options.numLines === true) {
idx = 2;
options.numLines = Number(arguments[1]);
} else if (options.numLines === false) {
options.numLines = 10;
}
files = [].slice.call(arguments, idx);
if (pipe) {
files.unshift('-');
}
var shouldAppendNewline = false;
files.forEach(function (file) {
if (!fs.existsSync(file) && file !== '-') {
common.error('no such file or directory: ' + file, { continue: true });
return;
}
var contents;
if (file === '-') {
contents = pipe;
} else if (options.numLines < 0) {
contents = fs.readFileSync(file, 'utf8');
} else {
contents = readSomeLines(file, options.numLines);
}
var lines = contents.split('\n');
var hasTrailingNewline = (lines[lines.length - 1] === '');
if (hasTrailingNewline) {
lines.pop();
}
shouldAppendNewline = (hasTrailingNewline || options.numLines < lines.length);
head = head.concat(lines.slice(0, options.numLines));
});
if (shouldAppendNewline) {
head.push(''); // to add a trailing newline once we join
}
return head.join('\n');
}
module.exports = _head;

72
node_modules/shelljs/src/ln.js generated vendored Normal file
View File

@@ -0,0 +1,72 @@
var fs = require('fs');
var path = require('path');
var common = require('./common');
common.register('ln', _ln, {
cmdOptions: {
's': 'symlink',
'f': 'force',
},
});
//@
//@ ### ln([options,] source, dest)
//@ Available options:
//@
//@ + `-s`: symlink
//@ + `-f`: force
//@
//@ Examples:
//@
//@ ```javascript
//@ ln('file', 'newlink');
//@ ln('-sf', 'file', 'existing');
//@ ```
//@
//@ Links source to dest. Use -f to force the link, should dest already exist.
function _ln(options, source, dest) {
if (!source || !dest) {
common.error('Missing <source> and/or <dest>');
}
source = String(source);
var sourcePath = path.normalize(source).replace(RegExp(path.sep + '$'), '');
var isAbsolute = (path.resolve(source) === sourcePath);
dest = path.resolve(process.cwd(), String(dest));
if (fs.existsSync(dest)) {
if (!options.force) {
common.error('Destination file exists', { continue: true });
}
fs.unlinkSync(dest);
}
if (options.symlink) {
var isWindows = common.platform === 'win';
var linkType = isWindows ? 'file' : null;
var resolvedSourcePath = isAbsolute ? sourcePath : path.resolve(process.cwd(), path.dirname(dest), source);
if (!fs.existsSync(resolvedSourcePath)) {
common.error('Source file does not exist', { continue: true });
} else if (isWindows && fs.statSync(resolvedSourcePath).isDirectory()) {
linkType = 'junction';
}
try {
fs.symlinkSync(linkType === 'junction' ? resolvedSourcePath : source, dest, linkType);
} catch (err) {
common.error(err.message);
}
} else {
if (!fs.existsSync(source)) {
common.error('Source file does not exist', { continue: true });
}
try {
fs.linkSync(source, dest);
} catch (err) {
common.error(err.message);
}
}
return '';
}
module.exports = _ln;

121
node_modules/shelljs/src/ls.js generated vendored Normal file
View File

@@ -0,0 +1,121 @@
var path = require('path');
var fs = require('fs');
var common = require('./common');
var glob = require('glob');
var globPatternRecursive = path.sep + '**' + path.sep + '*';
common.register('ls', _ls, {
cmdOptions: {
'R': 'recursive',
'A': 'all',
'a': 'all_deprecated',
'd': 'directory',
'l': 'long',
},
});
//@
//@ ### ls([options,] [path, ...])
//@ ### ls([options,] path_array)
//@ Available options:
//@
//@ + `-R`: recursive
//@ + `-A`: all files (include files beginning with `.`, except for `.` and `..`)
//@ + `-d`: list directories themselves, not their contents
//@ + `-l`: list objects representing each file, each with fields containing `ls
//@ -l` output fields. See
//@ [fs.Stats](https://nodejs.org/api/fs.html#fs_class_fs_stats)
//@ for more info
//@
//@ Examples:
//@
//@ ```javascript
//@ ls('projs/*.js');
//@ ls('-R', '/users/me', '/tmp');
//@ ls('-R', ['/users/me', '/tmp']); // same as above
//@ ls('-l', 'file.txt'); // { name: 'file.txt', mode: 33188, nlink: 1, ...}
//@ ```
//@
//@ Returns array of files in the given path, or in current directory if no path provided.
function _ls(options, paths) {
if (options.all_deprecated) {
// We won't support the -a option as it's hard to image why it's useful
// (it includes '.' and '..' in addition to '.*' files)
// For backwards compatibility we'll dump a deprecated message and proceed as before
common.log('ls: Option -a is deprecated. Use -A instead');
options.all = true;
}
if (!paths) {
paths = ['.'];
} else {
paths = [].slice.call(arguments, 1);
}
var list = [];
function pushFile(abs, relName, stat) {
if (process.platform === 'win32') {
relName = relName.replace(/\\/g, '/');
}
if (options.long) {
stat = stat || fs.lstatSync(abs);
list.push(addLsAttributes(relName, stat));
} else {
// list.push(path.relative(rel || '.', file));
list.push(relName);
}
}
paths.forEach(function (p) {
var stat;
try {
stat = fs.lstatSync(p);
} catch (e) {
common.error('no such file or directory: ' + p, 2, { continue: true });
return;
}
// If the stat succeeded
if (stat.isDirectory() && !options.directory) {
if (options.recursive) {
// use glob, because it's simple
glob.sync(p + globPatternRecursive, { dot: options.all })
.forEach(function (item) {
pushFile(item, path.relative(p, item));
});
} else if (options.all) {
// use fs.readdirSync, because it's fast
fs.readdirSync(p).forEach(function (item) {
pushFile(path.join(p, item), item);
});
} else {
// use fs.readdirSync and then filter out secret files
fs.readdirSync(p).forEach(function (item) {
if (item[0] !== '.') {
pushFile(path.join(p, item), item);
}
});
}
} else {
pushFile(p, p, stat);
}
});
// Add methods, to make this more compatible with ShellStrings
return list;
}
function addLsAttributes(pathName, stats) {
// Note: this object will contain more information than .toString() returns
stats.name = pathName;
stats.toString = function () {
// Return a string resembling unix's `ls -l` format
return [this.mode, this.nlink, this.uid, this.gid, this.size, this.mtime, this.name].join(' ');
};
return stats;
}
module.exports = _ls;

92
node_modules/shelljs/src/mkdir.js generated vendored Normal file
View File

@@ -0,0 +1,92 @@
var common = require('./common');
var fs = require('fs');
var path = require('path');
common.register('mkdir', _mkdir, {
cmdOptions: {
'p': 'fullpath',
},
});
// Recursively creates 'dir'
function mkdirSyncRecursive(dir) {
var baseDir = path.dirname(dir);
// Prevents some potential problems arising from malformed UNCs or
// insufficient permissions.
/* istanbul ignore next */
if (baseDir === dir) {
common.error('dirname() failed: [' + dir + ']');
}
// Base dir exists, no recursion necessary
if (fs.existsSync(baseDir)) {
fs.mkdirSync(dir, parseInt('0777', 8));
return;
}
// Base dir does not exist, go recursive
mkdirSyncRecursive(baseDir);
// Base dir created, can create dir
fs.mkdirSync(dir, parseInt('0777', 8));
}
//@
//@ ### mkdir([options,] dir [, dir ...])
//@ ### mkdir([options,] dir_array)
//@ Available options:
//@
//@ + `-p`: full path (will create intermediate dirs if necessary)
//@
//@ Examples:
//@
//@ ```javascript
//@ mkdir('-p', '/tmp/a/b/c/d', '/tmp/e/f/g');
//@ mkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above
//@ ```
//@
//@ Creates directories.
function _mkdir(options, dirs) {
if (!dirs) common.error('no paths given');
if (typeof dirs === 'string') {
dirs = [].slice.call(arguments, 1);
}
// if it's array leave it as it is
dirs.forEach(function (dir) {
try {
fs.lstatSync(dir);
if (!options.fullpath) {
common.error('path already exists: ' + dir, { continue: true });
}
return; // skip dir
} catch (e) {
// do nothing
}
// Base dir does not exist, and no -p option given
var baseDir = path.dirname(dir);
if (!fs.existsSync(baseDir) && !options.fullpath) {
common.error('no such file or directory: ' + baseDir, { continue: true });
return; // skip dir
}
try {
if (options.fullpath) {
mkdirSyncRecursive(path.resolve(dir));
} else {
fs.mkdirSync(dir, parseInt('0777', 8));
}
} catch (e) {
if (e.code === 'EACCES') {
common.error('cannot create directory ' + dir + ': Permission denied');
} else {
throw e;
}
}
});
return '';
} // mkdir
module.exports = _mkdir;

95
node_modules/shelljs/src/mv.js generated vendored Normal file
View File

@@ -0,0 +1,95 @@
var fs = require('fs');
var path = require('path');
var common = require('./common');
var cp = require('./cp');
var rm = require('./rm');
common.register('mv', _mv, {
cmdOptions: {
'f': '!no_force',
'n': 'no_force',
},
});
//@
//@ ### mv([options ,] source [, source ...], dest')
//@ ### mv([options ,] source_array, dest')
//@ Available options:
//@
//@ + `-f`: force (default behavior)
//@ + `-n`: no-clobber
//@
//@ Examples:
//@
//@ ```javascript
//@ mv('-n', 'file', 'dir/');
//@ mv('file1', 'file2', 'dir/');
//@ mv(['file1', 'file2'], 'dir/'); // same as above
//@ ```
//@
//@ Moves files.
function _mv(options, sources, dest) {
// Get sources, dest
if (arguments.length < 3) {
common.error('missing <source> and/or <dest>');
} else if (arguments.length > 3) {
sources = [].slice.call(arguments, 1, arguments.length - 1);
dest = arguments[arguments.length - 1];
} else if (typeof sources === 'string') {
sources = [sources];
} else {
common.error('invalid arguments');
}
var exists = fs.existsSync(dest);
var stats = exists && fs.statSync(dest);
// Dest is not existing dir, but multiple sources given
if ((!exists || !stats.isDirectory()) && sources.length > 1) {
common.error('dest is not a directory (too many sources)');
}
// Dest is an existing file, but no -f given
if (exists && stats.isFile() && options.no_force) {
common.error('dest file already exists: ' + dest);
}
sources.forEach(function (src) {
if (!fs.existsSync(src)) {
common.error('no such file or directory: ' + src, { continue: true });
return; // skip file
}
// If here, src exists
// When copying to '/path/dir':
// thisDest = '/path/dir/file1'
var thisDest = dest;
if (fs.existsSync(dest) && fs.statSync(dest).isDirectory()) {
thisDest = path.normalize(dest + '/' + path.basename(src));
}
if (fs.existsSync(thisDest) && options.no_force) {
common.error('dest file already exists: ' + thisDest, { continue: true });
return; // skip file
}
if (path.resolve(src) === path.dirname(path.resolve(thisDest))) {
common.error('cannot move to self: ' + src, { continue: true });
return; // skip file
}
try {
fs.renameSync(src, thisDest);
} catch (e) {
if (e.code === 'EXDEV') { // external partition
// if either of these fails, the appropriate error message will bubble
// up to the top level automatically
cp('-r', src, thisDest);
rm('-rf', src);
}
}
}); // forEach(src)
return '';
} // mv
module.exports = _mv;

1
node_modules/shelljs/src/popd.js generated vendored Normal file
View File

@@ -0,0 +1 @@
// see dirs.js

1
node_modules/shelljs/src/pushd.js generated vendored Normal file
View File

@@ -0,0 +1 @@
// see dirs.js

15
node_modules/shelljs/src/pwd.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
var path = require('path');
var common = require('./common');
common.register('pwd', _pwd, {
allowGlobbing: false,
});
//@
//@ ### pwd()
//@ Returns the current directory.
function _pwd() {
var pwd = path.resolve(process.cwd());
return pwd;
}
module.exports = _pwd;

146
node_modules/shelljs/src/rm.js generated vendored Normal file
View File

@@ -0,0 +1,146 @@
var common = require('./common');
var fs = require('fs');
common.register('rm', _rm, {
cmdOptions: {
'f': 'force',
'r': 'recursive',
'R': 'recursive',
},
});
// Recursively removes 'dir'
// Adapted from https://github.com/ryanmcgrath/wrench-js
//
// Copyright (c) 2010 Ryan McGrath
// Copyright (c) 2012 Artur Adib
//
// Licensed under the MIT License
// http://www.opensource.org/licenses/mit-license.php
function rmdirSyncRecursive(dir, force) {
var files;
files = fs.readdirSync(dir);
// Loop through and delete everything in the sub-tree after checking it
for (var i = 0; i < files.length; i++) {
var file = dir + '/' + files[i];
var currFile = fs.lstatSync(file);
if (currFile.isDirectory()) { // Recursive function back to the beginning
rmdirSyncRecursive(file, force);
} else { // Assume it's a file - perhaps a try/catch belongs here?
if (force || isWriteable(file)) {
try {
common.unlinkSync(file);
} catch (e) {
common.error('could not remove file (code ' + e.code + '): ' + file, { continue: true });
}
}
}
}
// Now that we know everything in the sub-tree has been deleted, we can delete the main directory.
// Huzzah for the shopkeep.
var result;
try {
// Retry on windows, sometimes it takes a little time before all the files in the directory are gone
var start = Date.now();
// TODO: replace this with a finite loop
for (;;) {
try {
result = fs.rmdirSync(dir);
if (fs.existsSync(dir)) throw { code: 'EAGAIN' };
break;
} catch (er) {
// In addition to error codes, also check if the directory still exists and loop again if true
if (process.platform === 'win32' && (er.code === 'ENOTEMPTY' || er.code === 'EBUSY' || er.code === 'EPERM' || er.code === 'EAGAIN')) {
if (Date.now() - start > 1000) throw er;
} else if (er.code === 'ENOENT') {
// Directory did not exist, deletion was successful
break;
} else {
throw er;
}
}
}
} catch (e) {
common.error('could not remove directory (code ' + e.code + '): ' + dir, { continue: true });
}
return result;
} // rmdirSyncRecursive
// Hack to determine if file has write permissions for current user
// Avoids having to check user, group, etc, but it's probably slow
function isWriteable(file) {
var writePermission = true;
try {
var __fd = fs.openSync(file, 'a');
fs.closeSync(__fd);
} catch (e) {
writePermission = false;
}
return writePermission;
}
//@
//@ ### rm([options,] file [, file ...])
//@ ### rm([options,] file_array)
//@ Available options:
//@
//@ + `-f`: force
//@ + `-r, -R`: recursive
//@
//@ Examples:
//@
//@ ```javascript
//@ rm('-rf', '/tmp/*');
//@ rm('some_file.txt', 'another_file.txt');
//@ rm(['some_file.txt', 'another_file.txt']); // same as above
//@ ```
//@
//@ Removes files.
function _rm(options, files) {
if (!files) common.error('no paths given');
// Convert to array
files = [].slice.call(arguments, 1);
files.forEach(function (file) {
var stats;
try {
stats = fs.lstatSync(file); // test for existence
} catch (e) {
// Path does not exist, no force flag given
if (!options.force) {
common.error('no such file or directory: ' + file, { continue: true });
}
return; // skip file
}
// If here, path exists
if (stats.isFile()) {
if (options.force || isWriteable(file)) {
// -f was passed, or file is writable, so it can be removed
common.unlinkSync(file);
} else {
common.error('permission denied: ' + file, { continue: true });
}
} else if (stats.isDirectory()) {
if (options.recursive) {
// -r was passed, so directory can be removed
rmdirSyncRecursive(file, options.force);
} else {
common.error('path is a directory', { continue: true });
}
} else if (stats.isSymbolicLink()) {
common.unlinkSync(file);
}
}); // forEach(file)
return '';
} // rm
module.exports = _rm;

86
node_modules/shelljs/src/sed.js generated vendored Normal file
View File

@@ -0,0 +1,86 @@
var common = require('./common');
var fs = require('fs');
common.register('sed', _sed, {
globStart: 3, // don't glob-expand regexes
canReceivePipe: true,
cmdOptions: {
'i': 'inplace',
},
});
//@
//@ ### sed([options,] search_regex, replacement, file [, file ...])
//@ ### sed([options,] search_regex, replacement, file_array)
//@ Available options:
//@
//@ + `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_
//@
//@ Examples:
//@
//@ ```javascript
//@ sed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js');
//@ sed(/.*DELETE_THIS_LINE.*\n/, '', 'source.js');
//@ ```
//@
//@ Reads an input string from `files` and performs a JavaScript `replace()` on the input
//@ using the given search regex and replacement string or function. Returns the new string after replacement.
//@
//@ Note:
//@
//@ Like unix `sed`, ShellJS `sed` supports capture groups. Capture groups are specified
//@ using the `$n` syntax:
//@
//@ ```javascript
//@ sed(/(\w+)\s(\w+)/, '$2, $1', 'file.txt');
//@ ```
function _sed(options, regex, replacement, files) {
// Check if this is coming from a pipe
var pipe = common.readFromPipe();
if (typeof replacement !== 'string' && typeof replacement !== 'function') {
if (typeof replacement === 'number') {
replacement = replacement.toString(); // fallback
} else {
common.error('invalid replacement string');
}
}
// Convert all search strings to RegExp
if (typeof regex === 'string') {
regex = RegExp(regex);
}
if (!files && !pipe) {
common.error('no files given');
}
files = [].slice.call(arguments, 3);
if (pipe) {
files.unshift('-');
}
var sed = [];
files.forEach(function (file) {
if (!fs.existsSync(file) && file !== '-') {
common.error('no such file or directory: ' + file, 2, { continue: true });
return;
}
var contents = file === '-' ? pipe : fs.readFileSync(file, 'utf8');
var lines = contents.split(/\r*\n/);
var result = lines.map(function (line) {
return line.replace(regex, replacement);
}).join('\n');
sed.push(result);
if (options.inplace) {
fs.writeFileSync(file, result, 'utf8');
}
});
return sed.join('\n');
}
module.exports = _sed;

55
node_modules/shelljs/src/set.js generated vendored Normal file
View File

@@ -0,0 +1,55 @@
var common = require('./common');
common.register('set', _set, {
allowGlobbing: false,
wrapOutput: false,
});
//@
//@ ### set(options)
//@ Available options:
//@
//@ + `+/-e`: exit upon error (`config.fatal`)
//@ + `+/-v`: verbose: show all commands (`config.verbose`)
//@ + `+/-f`: disable filename expansion (globbing)
//@
//@ Examples:
//@
//@ ```javascript
//@ set('-e'); // exit upon first error
//@ set('+e'); // this undoes a "set('-e')"
//@ ```
//@
//@ Sets global configuration variables
function _set(options) {
if (!options) {
var args = [].slice.call(arguments, 0);
if (args.length < 2) common.error('must provide an argument');
options = args[1];
}
var negate = (options[0] === '+');
if (negate) {
options = '-' + options.slice(1); // parseOptions needs a '-' prefix
}
options = common.parseOptions(options, {
'e': 'fatal',
'v': 'verbose',
'f': 'noglob'
});
if (negate) {
Object.keys(options).forEach(function (key) {
options[key] = !options[key];
});
}
Object.keys(options).forEach(function (key) {
// Only change the global config if `negate` is false and the option is true
// or if `negate` is true and the option is false (aka negate !== option)
if (negate !== options[key]) {
common.config[key] = options[key];
}
});
return;
}
module.exports = _set;

91
node_modules/shelljs/src/sort.js generated vendored Normal file
View File

@@ -0,0 +1,91 @@
var common = require('./common');
var fs = require('fs');
common.register('sort', _sort, {
canReceivePipe: true,
cmdOptions: {
'r': 'reverse',
'n': 'numerical',
},
});
// parse out the number prefix of a line
function parseNumber(str) {
var match = str.match(/^\s*(\d*)\s*(.*)$/);
return { num: Number(match[1]), value: match[2] };
}
// compare two strings case-insensitively, but examine case for strings that are
// case-insensitive equivalent
function unixCmp(a, b) {
var aLower = a.toLowerCase();
var bLower = b.toLowerCase();
return (aLower === bLower ?
-1 * a.localeCompare(b) : // unix sort treats case opposite how javascript does
aLower.localeCompare(bLower));
}
// compare two strings in the fashion that unix sort's -n option works
function numericalCmp(a, b) {
var objA = parseNumber(a);
var objB = parseNumber(b);
if (objA.hasOwnProperty('num') && objB.hasOwnProperty('num')) {
return ((objA.num !== objB.num) ?
(objA.num - objB.num) :
unixCmp(objA.value, objB.value));
} else {
return unixCmp(objA.value, objB.value);
}
}
//@
//@ ### sort([options,] file [, file ...])
//@ ### sort([options,] file_array)
//@ Available options:
//@
//@ + `-r`: Reverse the result of comparisons
//@ + `-n`: Compare according to numerical value
//@
//@ Examples:
//@
//@ ```javascript
//@ sort('foo.txt', 'bar.txt');
//@ sort('-r', 'foo.txt');
//@ ```
//@
//@ Return the contents of the files, sorted line-by-line. Sorting multiple
//@ files mixes their content, just like unix sort does.
function _sort(options, files) {
// Check if this is coming from a pipe
var pipe = common.readFromPipe();
if (!files && !pipe) common.error('no files given');
files = [].slice.call(arguments, 1);
if (pipe) {
files.unshift('-');
}
var lines = [];
files.forEach(function (file) {
if (!fs.existsSync(file) && file !== '-') {
// exit upon any sort of error
common.error('no such file or directory: ' + file);
}
var contents = file === '-' ? pipe : fs.readFileSync(file, 'utf8');
lines = lines.concat(contents.trimRight().split(/\r*\n/));
});
var sorted;
sorted = lines.sort(options.numerical ? numericalCmp : unixCmp);
if (options.reverse) {
sorted = sorted.reverse();
}
return sorted.join('\n') + '\n';
}
module.exports = _sort;

72
node_modules/shelljs/src/tail.js generated vendored Normal file
View File

@@ -0,0 +1,72 @@
var common = require('./common');
var fs = require('fs');
common.register('tail', _tail, {
canReceivePipe: true,
cmdOptions: {
'n': 'numLines',
},
});
//@
//@ ### tail([{'-n': \<num\>},] file [, file ...])
//@ ### tail([{'-n': \<num\>},] file_array)
//@ Available options:
//@
//@ + `-n <num>`: Show the last `<num>` lines of the files
//@
//@ Examples:
//@
//@ ```javascript
//@ var str = tail({'-n': 1}, 'file*.txt');
//@ var str = tail('file1', 'file2');
//@ var str = tail(['file1', 'file2']); // same as above
//@ ```
//@
//@ Read the end of a file.
function _tail(options, files) {
var tail = [];
var pipe = common.readFromPipe();
if (!files && !pipe) common.error('no paths given');
var idx = 1;
if (options.numLines === true) {
idx = 2;
options.numLines = Number(arguments[1]);
} else if (options.numLines === false) {
options.numLines = 10;
}
options.numLines = -1 * Math.abs(options.numLines);
files = [].slice.call(arguments, idx);
if (pipe) {
files.unshift('-');
}
var shouldAppendNewline = false;
files.forEach(function (file) {
if (!fs.existsSync(file) && file !== '-') {
common.error('no such file or directory: ' + file, { continue: true });
return;
}
var contents = file === '-' ? pipe : fs.readFileSync(file, 'utf8');
var lines = contents.split('\n');
if (lines[lines.length - 1] === '') {
lines.pop();
shouldAppendNewline = true;
} else {
shouldAppendNewline = false;
}
tail = tail.concat(lines.slice(options.numLines));
});
if (shouldAppendNewline) {
tail.push(''); // to add a trailing newline once we join
}
return tail.join('\n');
}
module.exports = _tail;

59
node_modules/shelljs/src/tempdir.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
var common = require('./common');
var os = require('os');
var fs = require('fs');
common.register('tempdir', _tempDir, {
allowGlobbing: false,
wrapOutput: false,
});
// Returns false if 'dir' is not a writeable directory, 'dir' otherwise
function writeableDir(dir) {
if (!dir || !fs.existsSync(dir)) return false;
if (!fs.statSync(dir).isDirectory()) return false;
var testFile = dir + '/' + common.randomFileName();
try {
fs.writeFileSync(testFile, ' ');
common.unlinkSync(testFile);
return dir;
} catch (e) {
return false;
}
}
//@
//@ ### tempdir()
//@
//@ Examples:
//@
//@ ```javascript
//@ var tmp = tempdir(); // "/tmp" for most *nix platforms
//@ ```
//@
//@ Searches and returns string containing a writeable, platform-dependent temporary directory.
//@ Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir).
function _tempDir() {
var state = common.state;
if (state.tempDir) return state.tempDir; // from cache
state.tempDir = writeableDir(os.tmpdir && os.tmpdir()) || // node 0.10+
writeableDir(os.tmpDir && os.tmpDir()) || // node 0.8+
writeableDir(process.env.TMPDIR) ||
writeableDir(process.env.TEMP) ||
writeableDir(process.env.TMP) ||
writeableDir(process.env.Wimp$ScrapDir) || // RiscOS
writeableDir('C:\\TEMP') || // Windows
writeableDir('C:\\TMP') || // Windows
writeableDir('\\TEMP') || // Windows
writeableDir('\\TMP') || // Windows
writeableDir('/tmp') ||
writeableDir('/var/tmp') ||
writeableDir('/usr/tmp') ||
writeableDir('.'); // last resort
return state.tempDir;
}
module.exports = _tempDir;

81
node_modules/shelljs/src/test.js generated vendored Normal file
View File

@@ -0,0 +1,81 @@
var common = require('./common');
var fs = require('fs');
common.register('test', _test, {
cmdOptions: {
'b': 'block',
'c': 'character',
'd': 'directory',
'e': 'exists',
'f': 'file',
'L': 'link',
'p': 'pipe',
'S': 'socket',
},
wrapOutput: false,
allowGlobbing: false,
});
//@
//@ ### test(expression)
//@ Available expression primaries:
//@
//@ + `'-b', 'path'`: true if path is a block device
//@ + `'-c', 'path'`: true if path is a character device
//@ + `'-d', 'path'`: true if path is a directory
//@ + `'-e', 'path'`: true if path exists
//@ + `'-f', 'path'`: true if path is a regular file
//@ + `'-L', 'path'`: true if path is a symbolic link
//@ + `'-p', 'path'`: true if path is a pipe (FIFO)
//@ + `'-S', 'path'`: true if path is a socket
//@
//@ Examples:
//@
//@ ```javascript
//@ if (test('-d', path)) { /* do something with dir */ };
//@ if (!test('-f', path)) continue; // skip if it's a regular file
//@ ```
//@
//@ Evaluates expression using the available primaries and returns corresponding value.
function _test(options, path) {
if (!path) common.error('no path given');
var canInterpret = false;
Object.keys(options).forEach(function (key) {
if (options[key] === true) {
canInterpret = true;
}
});
if (!canInterpret) common.error('could not interpret expression');
if (options.link) {
try {
return fs.lstatSync(path).isSymbolicLink();
} catch (e) {
return false;
}
}
if (!fs.existsSync(path)) return false;
if (options.exists) return true;
var stats = fs.statSync(path);
if (options.block) return stats.isBlockDevice();
if (options.character) return stats.isCharacterDevice();
if (options.directory) return stats.isDirectory();
if (options.file) return stats.isFile();
if (options.pipe) return stats.isFIFO();
if (options.socket) return stats.isSocket();
return false; // fallback
} // test
module.exports = _test;

36
node_modules/shelljs/src/to.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
var common = require('./common');
var fs = require('fs');
var path = require('path');
common.register('to', _to, {
pipeOnly: true,
wrapOutput: false,
});
//@
//@ ### ShellString.prototype.to(file)
//@
//@ Examples:
//@
//@ ```javascript
//@ cat('input.txt').to('output.txt');
//@ ```
//@
//@ Analogous to the redirection operator `>` in Unix, but works with
//@ ShellStrings (such as those returned by `cat`, `grep`, etc). _Like Unix
//@ redirections, `to()` will overwrite any existing file!_
function _to(options, file) {
if (!file) common.error('wrong arguments');
if (!fs.existsSync(path.dirname(file))) {
common.error('no such file or directory: ' + path.dirname(file));
}
try {
fs.writeFileSync(file, this.stdout || this.toString(), 'utf8');
return this;
} catch (e) {
common.error('could not write to file (code ' + e.code + '): ' + file, { continue: true });
}
}
module.exports = _to;

35
node_modules/shelljs/src/toEnd.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
var common = require('./common');
var fs = require('fs');
var path = require('path');
common.register('toEnd', _toEnd, {
pipeOnly: true,
wrapOutput: false,
});
//@
//@ ### ShellString.prototype.toEnd(file)
//@
//@ Examples:
//@
//@ ```javascript
//@ cat('input.txt').toEnd('output.txt');
//@ ```
//@
//@ Analogous to the redirect-and-append operator `>>` in Unix, but works with
//@ ShellStrings (such as those returned by `cat`, `grep`, etc).
function _toEnd(options, file) {
if (!file) common.error('wrong arguments');
if (!fs.existsSync(path.dirname(file))) {
common.error('no such file or directory: ' + path.dirname(file));
}
try {
fs.appendFileSync(file, this.stdout || this.toString(), 'utf8');
return this;
} catch (e) {
common.error('could not append to file (code ' + e.code + '): ' + file, { continue: true });
}
}
module.exports = _toEnd;

110
node_modules/shelljs/src/touch.js generated vendored Normal file
View File

@@ -0,0 +1,110 @@
var common = require('./common');
var fs = require('fs');
common.register('touch', _touch, {
cmdOptions: {
'a': 'atime_only',
'c': 'no_create',
'd': 'date',
'm': 'mtime_only',
'r': 'reference',
},
});
//@
//@ ### touch([options,] file [, file ...])
//@ ### touch([options,] file_array)
//@ Available options:
//@
//@ + `-a`: Change only the access time
//@ + `-c`: Do not create any files
//@ + `-m`: Change only the modification time
//@ + `-d DATE`: Parse DATE and use it instead of current time
//@ + `-r FILE`: Use FILE's times instead of current time
//@
//@ Examples:
//@
//@ ```javascript
//@ touch('source.js');
//@ touch('-c', '/path/to/some/dir/source.js');
//@ touch({ '-r': FILE }, '/path/to/some/dir/source.js');
//@ ```
//@
//@ Update the access and modification times of each FILE to the current time.
//@ A FILE argument that does not exist is created empty, unless -c is supplied.
//@ This is a partial implementation of *[touch(1)](http://linux.die.net/man/1/touch)*.
function _touch(opts, files) {
if (!files) {
common.error('no files given');
} else if (typeof files === 'string') {
files = [].slice.call(arguments, 1);
} else {
common.error('file arg should be a string file path or an Array of string file paths');
}
files.forEach(function (f) {
touchFile(opts, f);
});
return '';
}
function touchFile(opts, file) {
var stat = tryStatFile(file);
if (stat && stat.isDirectory()) {
// don't error just exit
return;
}
// if the file doesn't already exist and the user has specified --no-create then
// this script is finished
if (!stat && opts.no_create) {
return;
}
// open the file and then close it. this will create it if it doesn't exist but will
// not truncate the file
fs.closeSync(fs.openSync(file, 'a'));
//
// Set timestamps
//
// setup some defaults
var now = new Date();
var mtime = opts.date || now;
var atime = opts.date || now;
// use reference file
if (opts.reference) {
var refStat = tryStatFile(opts.reference);
if (!refStat) {
common.error('failed to get attributess of ' + opts.reference);
}
mtime = refStat.mtime;
atime = refStat.atime;
} else if (opts.date) {
mtime = opts.date;
atime = opts.date;
}
if (opts.atime_only && opts.mtime_only) {
// keep the new values of mtime and atime like GNU
} else if (opts.atime_only) {
mtime = stat.mtime;
} else if (opts.mtime_only) {
atime = stat.atime;
}
fs.utimesSync(file, atime, mtime);
}
module.exports = _touch;
function tryStatFile(filePath) {
try {
return fs.statSync(filePath);
} catch (e) {
return null;
}
}

80
node_modules/shelljs/src/uniq.js generated vendored Normal file
View File

@@ -0,0 +1,80 @@
var common = require('./common');
var fs = require('fs');
// add c spaces to the left of str
function lpad(c, str) {
var res = '' + str;
if (res.length < c) {
res = Array((c - res.length) + 1).join(' ') + res;
}
return res;
}
common.register('uniq', _uniq, {
canReceivePipe: true,
cmdOptions: {
'i': 'ignoreCase',
'c': 'count',
'd': 'duplicates',
},
});
//@
//@ ### uniq([options,] [input, [output]])
//@ Available options:
//@
//@ + `-i`: Ignore case while comparing
//@ + `-c`: Prefix lines by the number of occurrences
//@ + `-d`: Only print duplicate lines, one for each group of identical lines
//@
//@ Examples:
//@
//@ ```javascript
//@ uniq('foo.txt');
//@ uniq('-i', 'foo.txt');
//@ uniq('-cd', 'foo.txt', 'bar.txt');
//@ ```
//@
//@ Filter adjacent matching lines from input
function _uniq(options, input, output) {
// Check if this is coming from a pipe
var pipe = common.readFromPipe();
if (!input && !pipe) common.error('no input given');
var lines = (input ? fs.readFileSync(input, 'utf8') : pipe).
trimRight().
split(/\r*\n/);
var compare = function (a, b) {
return options.ignoreCase ?
a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()) :
a.localeCompare(b);
};
var uniqed = lines.reduceRight(function (res, e) {
// Perform uniq -c on the input
if (res.length === 0) {
return [{ count: 1, ln: e }];
} else if (compare(res[0].ln, e) === 0) {
return [{ count: res[0].count + 1, ln: e }].concat(res.slice(1));
} else {
return [{ count: 1, ln: e }].concat(res);
}
}, []).filter(function (obj) {
// Do we want only duplicated objects?
return options.duplicates ? obj.count > 1 : true;
}).map(function (obj) {
// Are we tracking the counts of each line?
return (options.count ? (lpad(7, obj.count) + ' ') : '') + obj.ln;
}).join('\n') + '\n';
if (output) {
(new common.ShellString(uniqed)).to(output);
// if uniq writes to output, nothing is passed to the next command in the pipeline (if any)
return '';
} else {
return uniqed;
}
}
module.exports = _uniq;

99
node_modules/shelljs/src/which.js generated vendored Normal file
View File

@@ -0,0 +1,99 @@
var common = require('./common');
var fs = require('fs');
var path = require('path');
common.register('which', _which, {
allowGlobbing: false,
});
// XP's system default value for PATHEXT system variable, just in case it's not
// set on Windows.
var XP_DEFAULT_PATHEXT = '.com;.exe;.bat;.cmd;.vbs;.vbe;.js;.jse;.wsf;.wsh';
// Cross-platform method for splitting environment PATH variables
function splitPath(p) {
if (!p) return [];
if (common.platform === 'win') {
return p.split(';');
} else {
return p.split(':');
}
}
function checkPath(pathName) {
return fs.existsSync(pathName) && !fs.statSync(pathName).isDirectory();
}
//@
//@ ### which(command)
//@
//@ Examples:
//@
//@ ```javascript
//@ var nodeExec = which('node');
//@ ```
//@
//@ Searches for `command` in the system's PATH. On Windows, this uses the
//@ `PATHEXT` variable to append the extension if it's not already executable.
//@ Returns string containing the absolute path to the command.
function _which(options, cmd) {
if (!cmd) common.error('must specify command');
var pathEnv = process.env.path || process.env.Path || process.env.PATH;
var pathArray = splitPath(pathEnv);
var where = null;
// No relative/absolute paths provided?
if (cmd.search(/\//) === -1) {
// Search for command in PATH
pathArray.forEach(function (dir) {
if (where) return; // already found it
var attempt = path.resolve(dir, cmd);
if (common.platform === 'win') {
attempt = attempt.toUpperCase();
// In case the PATHEXT variable is somehow not set (e.g.
// child_process.spawn with an empty environment), use the XP default.
var pathExtEnv = process.env.PATHEXT || XP_DEFAULT_PATHEXT;
var pathExtArray = splitPath(pathExtEnv.toUpperCase());
var i;
// If the extension is already in PATHEXT, just return that.
for (i = 0; i < pathExtArray.length; i++) {
var ext = pathExtArray[i];
if (attempt.slice(-ext.length) === ext && checkPath(attempt)) {
where = attempt;
return;
}
}
// Cycle through the PATHEXT variable
var baseAttempt = attempt;
for (i = 0; i < pathExtArray.length; i++) {
attempt = baseAttempt + pathExtArray[i];
if (checkPath(attempt)) {
where = attempt;
return;
}
}
} else {
// Assume it's Unix-like
if (checkPath(attempt)) {
where = attempt;
return;
}
}
});
}
// Command not found anywhere?
if (!checkPath(cmd) && !where) return null;
where = where || path.resolve(cmd);
return where;
}
module.exports = _which;