It appears you have a well-structured Git repository with various files, including SVG icons and HTML documents. Here's a brief overview:
This commit is contained in:
21
backend/node_modules/chokidar-cli/LICENSE
generated
vendored
Normal file
21
backend/node_modules/chokidar-cli/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Kimmo Brunfeldt
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
148
backend/node_modules/chokidar-cli/README.md
generated
vendored
Normal file
148
backend/node_modules/chokidar-cli/README.md
generated
vendored
Normal file
@ -0,0 +1,148 @@
|
||||
# Chokidar CLI
|
||||
|
||||
[](https://github.com/open-npm-tools/chokidar-cli/actions?workflow=Tests)
|
||||
|
||||
Fast cross-platform command line utility to watch file system changes.
|
||||
|
||||
The underlying watch library is [Chokidar](https://github.com/paulmillr/chokidar), which is one of the best watch utilities for Node. Chokidar is battle-tested:
|
||||
|
||||
> It is used in
|
||||
> [brunch](http://brunch.io),
|
||||
> [gulp](https://github.com/gulpjs/gulp/),
|
||||
> [karma](http://karma-runner.github.io),
|
||||
> [PM2](https://github.com/Unitech/PM2),
|
||||
> [browserify](http://browserify.org/),
|
||||
> [webpack](http://webpack.github.io/),
|
||||
> [BrowserSync](http://www.browsersync.io/),
|
||||
> [socketstream](http://www.socketstream.org),
|
||||
> [derby](http://derbyjs.com/),
|
||||
> and [many others](https://www.npmjs.org/browse/depended/chokidar/).
|
||||
> It has proven itself in production environments.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Node.js v8.10.0 or newer
|
||||
|
||||
## Install
|
||||
|
||||
If you need it only with npm scripts:
|
||||
|
||||
```bash
|
||||
npm install chokidar-cli
|
||||
```
|
||||
|
||||
Or globally
|
||||
|
||||
```bash
|
||||
npm install -g chokidar-cli
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Chokidar can be invoked using the `chokidar` command, without the `-cli` suffix.
|
||||
|
||||
Arguments use the form of runtime flags with string parameters, delimited by quotes. While in principal both single and double quotes are supported by `chokidar-cli`, the actual command line argument parsing is dependent on the operating system and shell used; for cross-platform compatibility, use double quotes (with escaping, if necessary), as single quotes are not universally supported by all operating systems.
|
||||
|
||||
This is particularly important when using chokidar-cli for run scripts specified in `package.json`. For maximum platform compatibility, make sure to use escaped double quotes around chokidar's parameters:
|
||||
|
||||
```json
|
||||
"run": {
|
||||
"chokidar": "chokidar \"**/*.js\" -c \"...\""
|
||||
},
|
||||
```
|
||||
|
||||
## Default behavior
|
||||
|
||||
By default `chokidar` streams changes for all patterns to stdout:
|
||||
|
||||
```bash
|
||||
$ chokidar "**/*.js" "**/*.less"
|
||||
change:test/dir/a.js
|
||||
change:test/dir/a.less
|
||||
add:test/b.js
|
||||
unlink:test/b.js
|
||||
```
|
||||
|
||||
Each change is represented with format `event:relativepath`. Possible events: `add`, `unlink`, `addDir`, `unlinkDir`, `change`.
|
||||
|
||||
**Output only relative paths on each change**
|
||||
|
||||
```bash
|
||||
$ chokidar "**/*.js" "**/*.less" | cut -d ":" -f 2-
|
||||
test/dir/a.js
|
||||
test/dir/a.less
|
||||
test/b.js
|
||||
test/b.js
|
||||
```
|
||||
|
||||
**Run *npm run build-js* whenever any .js file changes in the current work directory tree**
|
||||
|
||||
```chokidar "**/*.js" -c "npm run build-js"```
|
||||
|
||||
**Watching in network directories must use polling**
|
||||
|
||||
```chokidar "**/*.less" -c "npm run build-less" --polling```
|
||||
|
||||
**Pass the path and event details in to your custom command**
|
||||
|
||||
```chokidar "**/*.less" -c "if [ '{event}' = 'change' ]; then npm run build-less -- {path}; fi;"```
|
||||
|
||||
**Detailed help**
|
||||
|
||||
```
|
||||
Usage: chokidar <pattern> [<pattern>...] [options]
|
||||
|
||||
<pattern>:
|
||||
Glob pattern to specify files to be watched.
|
||||
Multiple patterns can be watched by separating patterns with spaces.
|
||||
To prevent shell globbing, write pattern inside quotes.
|
||||
Guide to globs: https://github.com/isaacs/node-glob#glob-primer
|
||||
|
||||
|
||||
Options:
|
||||
-c, --command Command to run after each change. Needs to be
|
||||
surrounded with quotes when command contains spaces.
|
||||
Instances of `{path}` or `{event}` within the command
|
||||
will be replaced by the corresponding values from the
|
||||
chokidar event.
|
||||
-d, --debounce Debounce timeout in ms for executing command
|
||||
[default: 400]
|
||||
-t, --throttle Throttle timeout in ms for executing command
|
||||
[default: 0]
|
||||
-s, --follow-symlinks When not set, only the symlinks themselves will be
|
||||
watched for changes instead of following the link
|
||||
references and bubbling events through the links path
|
||||
[boolean] [default: false]
|
||||
-i, --ignore Pattern for files which should be ignored. Needs to be
|
||||
surrounded with quotes to prevent shell globbing. The
|
||||
whole relative or absolute path is tested, not just
|
||||
filename. Supports glob patterns or regexes using
|
||||
format: /yourmatch/i
|
||||
--initial When set, command is initially run once
|
||||
[boolean] [default: false]
|
||||
-p, --polling Whether to use fs.watchFile(backed by polling) instead
|
||||
of fs.watch. This might lead to high CPU utilization.
|
||||
It is typically necessary to set this to true to
|
||||
successfully watch files over a network, and it may be
|
||||
necessary to successfully watch files in other non-
|
||||
standard situations [boolean] [default: false]
|
||||
--poll-interval Interval of file system polling. Effective when --
|
||||
polling is set [default: 100]
|
||||
--poll-interval-binary Interval of file system polling for binary files.
|
||||
Effective when --polling is set [default: 300]
|
||||
--verbose When set, output is more verbose and human readable.
|
||||
[boolean] [default: false]
|
||||
--silent When set, internal messages of chokidar-cli won't be
|
||||
written. [boolean] [default: false]
|
||||
-h, --help Show help [boolean]
|
||||
-v, --version Show version number [boolean]
|
||||
|
||||
Examples:
|
||||
chokidar "**/*.js" -c "npm run build-js" build when any .js file changes
|
||||
chokidar "**/*.js" "**/*.less" output changes of .js and .less
|
||||
files
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
232
backend/node_modules/chokidar-cli/index.js
generated
vendored
Normal file
232
backend/node_modules/chokidar-cli/index.js
generated
vendored
Normal file
@ -0,0 +1,232 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
const throttle = require('lodash.throttle');
|
||||
const debounce = require('lodash.debounce');
|
||||
const chokidar = require('chokidar');
|
||||
const yargs = require('yargs');
|
||||
const { version: chokidarVersion } = require('chokidar/package.json');
|
||||
const { version } = require('./package.json');
|
||||
const utils = require('./utils');
|
||||
|
||||
const EVENT_DESCRIPTIONS = {
|
||||
add: 'File added',
|
||||
addDir: 'Directory added',
|
||||
unlink: 'File removed',
|
||||
unlinkDir: 'Directory removed',
|
||||
change: 'File changed'
|
||||
};
|
||||
|
||||
const defaultOpts = {
|
||||
debounce: 400,
|
||||
throttle: 0,
|
||||
followSymlinks: false,
|
||||
ignore: null,
|
||||
polling: false,
|
||||
pollInterval: 100,
|
||||
pollIntervalBinary: 300,
|
||||
verbose: false,
|
||||
silent: false,
|
||||
initial: false,
|
||||
command: null
|
||||
};
|
||||
|
||||
const VERSION = `chokidar-cli: ${version}\nchokidar: ${chokidarVersion}`;
|
||||
|
||||
const {argv} = yargs
|
||||
.usage(
|
||||
'Usage: chokidar <pattern> [<pattern>...] [options]\n\n' +
|
||||
'<pattern>:\n' +
|
||||
'Glob pattern to specify files to be watched.\n' +
|
||||
'Multiple patterns can be watched by separating patterns with spaces.\n' +
|
||||
'To prevent shell globbing, write pattern inside quotes.\n' +
|
||||
'Guide to globs: https://github.com/isaacs/node-glob#glob-primer\n'
|
||||
)
|
||||
.example('chokidar "**/*.js" -c "npm run build-js"', 'build when any .js file changes')
|
||||
.example('chokidar "**/*.js" "**/*.less"', 'output changes of .js and .less files')
|
||||
.demand(1)
|
||||
.option('c', {
|
||||
alias: 'command',
|
||||
describe: 'Command to run after each change. ' +
|
||||
'Needs to be surrounded with quotes when command contains ' +
|
||||
'spaces. Instances of `{path}` or `{event}` within the ' +
|
||||
'command will be replaced by the corresponding values from ' +
|
||||
'the chokidar event.'
|
||||
})
|
||||
.option('d', {
|
||||
alias: 'debounce',
|
||||
default: defaultOpts.debounce,
|
||||
describe: 'Debounce timeout in ms for executing command',
|
||||
type: 'number'
|
||||
})
|
||||
.option('t', {
|
||||
alias: 'throttle',
|
||||
default: defaultOpts.throttle,
|
||||
describe: 'Throttle timeout in ms for executing command',
|
||||
type: 'number'
|
||||
})
|
||||
.option('s', {
|
||||
alias: 'follow-symlinks',
|
||||
default: defaultOpts.followSymlinks,
|
||||
describe: 'When not set, only the symlinks themselves will be watched ' +
|
||||
'for changes instead of following the link references and ' +
|
||||
'bubbling events through the links path',
|
||||
type: 'boolean'
|
||||
})
|
||||
.option('i', {
|
||||
alias: 'ignore',
|
||||
describe: 'Pattern for files which should be ignored. ' +
|
||||
'Needs to be surrounded with quotes to prevent shell globbing. ' +
|
||||
'The whole relative or absolute path is tested, not just filename. ' +
|
||||
'Supports glob patters or regexes using format: /yourmatch/i'
|
||||
})
|
||||
.option('initial', {
|
||||
describe: 'When set, command is initially run once',
|
||||
default: defaultOpts.initial,
|
||||
type: 'boolean'
|
||||
})
|
||||
.option('p', {
|
||||
alias: 'polling',
|
||||
describe: 'Whether to use fs.watchFile(backed by polling) instead of ' +
|
||||
'fs.watch. This might lead to high CPU utilization. ' +
|
||||
'It is typically necessary to set this to true to ' +
|
||||
'successfully watch files over a network, and it may be ' +
|
||||
'necessary to successfully watch files in other ' +
|
||||
'non-standard situations',
|
||||
default: defaultOpts.polling,
|
||||
type: 'boolean'
|
||||
})
|
||||
.option('poll-interval', {
|
||||
describe: 'Interval of file system polling. Effective when --polling ' +
|
||||
'is set',
|
||||
default: defaultOpts.pollInterval,
|
||||
type: 'number'
|
||||
})
|
||||
.option('poll-interval-binary', {
|
||||
describe: 'Interval of file system polling for binary files. ' +
|
||||
'Effective when --polling is set',
|
||||
default: defaultOpts.pollIntervalBinary,
|
||||
type: 'number'
|
||||
})
|
||||
.option('verbose', {
|
||||
describe: 'When set, output is more verbose and human readable.',
|
||||
default: defaultOpts.verbose,
|
||||
type: 'boolean'
|
||||
})
|
||||
.option('silent', {
|
||||
describe: 'When set, internal messages of chokidar-cli won\'t be written.',
|
||||
default: defaultOpts.silent,
|
||||
type: 'boolean'
|
||||
})
|
||||
.help('h')
|
||||
.alias('h', 'help')
|
||||
.alias('v', 'version')
|
||||
.version(VERSION);
|
||||
|
||||
function main() {
|
||||
const userOpts = getUserOpts(argv);
|
||||
const opts = Object.assign(defaultOpts, userOpts);
|
||||
startWatching(opts);
|
||||
}
|
||||
|
||||
function getUserOpts(argv) {
|
||||
argv.patterns = argv._;
|
||||
return argv;
|
||||
}
|
||||
|
||||
// Estimates spent working hours based on commit dates
|
||||
function startWatching(opts) {
|
||||
const chokidarOpts = createChokidarOpts(opts);
|
||||
const watcher = chokidar.watch(opts.patterns, chokidarOpts);
|
||||
|
||||
let throttledRun = run;
|
||||
if (opts.throttle > 0) {
|
||||
throttledRun = throttle(run, opts.throttle);
|
||||
}
|
||||
|
||||
let debouncedRun = throttledRun;
|
||||
if (opts.debounce > 0) {
|
||||
debouncedRun = debounce(throttledRun, opts.debounce);
|
||||
}
|
||||
|
||||
watcher.on('all', (event, path) => {
|
||||
const description = `${EVENT_DESCRIPTIONS[event]}:`;
|
||||
|
||||
if (opts.verbose) {
|
||||
console.error(description, path);
|
||||
} else if (!opts.silent) {
|
||||
console.log(`${event}:${path}`);
|
||||
}
|
||||
|
||||
// XXX: commands might be still run concurrently
|
||||
if (opts.command) {
|
||||
debouncedRun(
|
||||
opts.command
|
||||
.replace(/\{path\}/ig, path)
|
||||
.replace(/\{event\}/ig, event)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
watcher.on('error', error => {
|
||||
console.error('Error:', error);
|
||||
console.error(error.stack);
|
||||
});
|
||||
|
||||
watcher.once('ready', () => {
|
||||
const list = opts.patterns.join('", "');
|
||||
if (!opts.silent) {
|
||||
console.error('Watching', `"${list}" ..`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createChokidarOpts(opts) {
|
||||
// Transform e.g. regex ignores to real regex objects
|
||||
opts.ignore = _resolveIgnoreOpt(opts.ignore);
|
||||
|
||||
const chokidarOpts = {
|
||||
followSymlinks: opts.followSymlinks,
|
||||
usePolling: opts.polling,
|
||||
interval: opts.pollInterval,
|
||||
binaryInterval: opts.pollIntervalBinary,
|
||||
ignoreInitial: !opts.initial
|
||||
};
|
||||
|
||||
if (opts.ignore) {
|
||||
chokidarOpts.ignored = opts.ignore;
|
||||
}
|
||||
|
||||
return chokidarOpts;
|
||||
}
|
||||
|
||||
// Takes string or array of strings
|
||||
function _resolveIgnoreOpt(ignoreOpt) {
|
||||
if (!ignoreOpt) {
|
||||
return ignoreOpt;
|
||||
}
|
||||
|
||||
const ignores = Array.isArray(ignoreOpt) ? ignoreOpt : [ignoreOpt];
|
||||
|
||||
return ignores.map(ignore => {
|
||||
const isRegex = ignore[0] === '/' && ignore[ignore.length - 1] === '/';
|
||||
if (isRegex) {
|
||||
// Convert user input to regex object
|
||||
const match = ignore.match(/^\/(.*)\/(.*?)$/);
|
||||
return new RegExp(match[1], match[2]);
|
||||
}
|
||||
|
||||
return ignore;
|
||||
});
|
||||
}
|
||||
|
||||
function run(cmd) {
|
||||
return utils.run(cmd)
|
||||
.catch(error => {
|
||||
console.error('Error when executing', cmd);
|
||||
console.error(error.stack);
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
106
backend/node_modules/chokidar-cli/package.json
generated
vendored
Normal file
106
backend/node_modules/chokidar-cli/package.json
generated
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
{
|
||||
"name": "chokidar-cli",
|
||||
"description": "Ultra-fast cross-platform command line utility to watch file system changes.",
|
||||
"version": "3.0.0",
|
||||
"keywords": [
|
||||
"fs",
|
||||
"watch",
|
||||
"watchFile",
|
||||
"watcher",
|
||||
"watching",
|
||||
"file",
|
||||
"fsevents",
|
||||
"chokidar",
|
||||
"cli",
|
||||
"command",
|
||||
"shell",
|
||||
"bash"
|
||||
],
|
||||
"bin": {
|
||||
"chokidar": "index.js"
|
||||
},
|
||||
"homepage": "https://github.com/open-npm-tools/chokidar-cli",
|
||||
"author": "Kimmo Brunfeldt <kimmobrunfeldt@gmail.com>",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/open-npm-tools/chokidar-cli.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "http://github.com/open-npm-tools/chokidar-cli/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"chokidar": "^3.5.2",
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"lodash.throttle": "^4.1.1",
|
||||
"yargs": "^13.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^6.6.0",
|
||||
"mocha": "^6.2.2"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --report-unused-disable-directives --ignore-path .gitignore .",
|
||||
"mocha": "mocha",
|
||||
"test": "npm run lint && npm run mocha"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8.10.0"
|
||||
},
|
||||
"files": [
|
||||
"*.js"
|
||||
],
|
||||
"eslintConfig": {
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 9,
|
||||
"sourceType": "script"
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true
|
||||
},
|
||||
"rules": {
|
||||
"array-callback-return": "error",
|
||||
"indent": [
|
||||
"error",
|
||||
4
|
||||
],
|
||||
"no-empty": [
|
||||
"error",
|
||||
{
|
||||
"allowEmptyCatch": true
|
||||
}
|
||||
],
|
||||
"object-shorthand": "error",
|
||||
"prefer-arrow-callback": [
|
||||
"error",
|
||||
{
|
||||
"allowNamedFunctions": true
|
||||
}
|
||||
],
|
||||
"prefer-const": [
|
||||
"error",
|
||||
{
|
||||
"ignoreReadBeforeAssign": true
|
||||
}
|
||||
],
|
||||
"prefer-destructuring": [
|
||||
"error",
|
||||
{
|
||||
"object": true,
|
||||
"array": false
|
||||
}
|
||||
],
|
||||
"prefer-spread": "error",
|
||||
"prefer-template": "error",
|
||||
"radix": "error",
|
||||
"strict": "error",
|
||||
"quotes": [
|
||||
"error",
|
||||
"single"
|
||||
],
|
||||
"no-var": "error"
|
||||
}
|
||||
}
|
||||
}
|
61
backend/node_modules/chokidar-cli/utils.js
generated
vendored
Normal file
61
backend/node_modules/chokidar-cli/utils.js
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
'use strict';
|
||||
|
||||
const {spawn} = require('child_process');
|
||||
|
||||
// Try to resolve path to shell.
|
||||
// We assume that Windows provides COMSPEC env variable
|
||||
// and other platforms provide SHELL env variable
|
||||
const SHELL_PATH = process.env.SHELL || process.env.COMSPEC;
|
||||
const EXECUTE_OPTION = process.env.COMSPEC !== undefined && process.env.SHELL === undefined ? '/c' : '-c';
|
||||
|
||||
// XXX: Wrapping tos to a promise is a bit wrong abstraction. Maybe RX suits
|
||||
// better?
|
||||
function run(cmd, opts) {
|
||||
if (!SHELL_PATH) {
|
||||
// If we cannot resolve shell, better to just crash
|
||||
throw new Error('$SHELL environment variable is not set.');
|
||||
}
|
||||
|
||||
opts = {
|
||||
pipe: true,
|
||||
cwd: undefined,
|
||||
callback(child) { // eslint-disable-line no-unused-vars
|
||||
// Since we return promise, we need to provide
|
||||
// this callback if one wants to access the child
|
||||
// process reference
|
||||
// Called immediately after successful child process
|
||||
// spawn
|
||||
}, ...opts};
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
let child;
|
||||
|
||||
try {
|
||||
child = spawn(SHELL_PATH, [EXECUTE_OPTION, cmd], {
|
||||
cwd: opts.cwd,
|
||||
stdio: opts.pipe ? 'inherit' : null
|
||||
});
|
||||
} catch (error) {
|
||||
return reject(error);
|
||||
}
|
||||
|
||||
opts.callback(child);
|
||||
|
||||
function errorHandler(err) {
|
||||
child.removeListener('close', closeHandler);
|
||||
reject(err);
|
||||
}
|
||||
|
||||
function closeHandler(exitCode) {
|
||||
child.removeListener('error', errorHandler);
|
||||
resolve(exitCode);
|
||||
}
|
||||
|
||||
child.once('error', errorHandler);
|
||||
child.once('close', closeHandler);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
run
|
||||
};
|
Reference in New Issue
Block a user