--
This commit is contained in:
parent
24f3d27984
commit
6b60015c02
9588 changed files with 1149251 additions and 49 deletions
66
node_modules/gulp-chmod/index.js
generated
vendored
Normal file
66
node_modules/gulp-chmod/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
'use strict';
|
||||
const through = require('through2');
|
||||
const deepAssign = require('deep-assign');
|
||||
const Mode = require('stat-mode');
|
||||
|
||||
const defaultMode = 0o777 & (~process.umask());
|
||||
|
||||
function normalize(mode) {
|
||||
let called = false;
|
||||
const newMode = {
|
||||
owner: {},
|
||||
group: {},
|
||||
others: {}
|
||||
};
|
||||
|
||||
['read', 'write', 'execute'].forEach(key => {
|
||||
if (typeof mode[key] === 'boolean') {
|
||||
newMode.owner[key] = mode[key];
|
||||
newMode.group[key] = mode[key];
|
||||
newMode.others[key] = mode[key];
|
||||
called = true;
|
||||
}
|
||||
});
|
||||
|
||||
return called ? newMode : mode;
|
||||
}
|
||||
|
||||
module.exports = (mode, dirMode) => {
|
||||
if (mode !== null && mode !== undefined && typeof mode !== 'number' && typeof mode !== 'object') {
|
||||
throw new TypeError('Expected mode to be null/undefined/number/Object');
|
||||
}
|
||||
|
||||
if (dirMode === true) {
|
||||
dirMode = mode;
|
||||
}
|
||||
|
||||
if (dirMode !== null && dirMode !== undefined && typeof dirMode !== 'number' && typeof dirMode !== 'object') {
|
||||
throw new TypeError('Expected dirMode to be null/undefined/true/number/Object');
|
||||
}
|
||||
|
||||
return through.obj((file, enc, cb) => {
|
||||
let curMode = mode;
|
||||
|
||||
if (file.isNull() && file.stat && file.stat.isDirectory()) {
|
||||
curMode = dirMode;
|
||||
}
|
||||
|
||||
if (curMode === undefined || curMode === null) {
|
||||
cb(null, file);
|
||||
return;
|
||||
}
|
||||
|
||||
file.stat = file.stat || {};
|
||||
file.stat.mode = file.stat.mode || defaultMode;
|
||||
|
||||
if (typeof curMode === 'object') {
|
||||
const statMode = new Mode(file.stat);
|
||||
deepAssign(statMode, normalize(curMode));
|
||||
file.stat.mode = statMode.stat.mode;
|
||||
} else {
|
||||
file.stat.mode = curMode;
|
||||
}
|
||||
|
||||
cb(null, file);
|
||||
});
|
||||
};
|
||||
21
node_modules/gulp-chmod/license
generated
vendored
Normal file
21
node_modules/gulp-chmod/license
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
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.
|
||||
110
node_modules/gulp-chmod/package.json
generated
vendored
Normal file
110
node_modules/gulp-chmod/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "gulp-chmod@^2.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "gulp-chmod",
|
||||
"name": "gulp-chmod",
|
||||
"rawSpec": "^2.0.0",
|
||||
"spec": ">=2.0.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/Users/jose/Documents/GitHub/Mods/node_modules/semantic-ui"
|
||||
]
|
||||
],
|
||||
"_from": "gulp-chmod@>=2.0.0 <3.0.0",
|
||||
"_id": "gulp-chmod@2.0.0",
|
||||
"_inCache": true,
|
||||
"_location": "/gulp-chmod",
|
||||
"_nodeVersion": "4.6.1",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/gulp-chmod-2.0.0.tgz_1478628758002_0.030133006861433387"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.15.9",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "gulp-chmod@^2.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "gulp-chmod",
|
||||
"name": "gulp-chmod",
|
||||
"rawSpec": "^2.0.0",
|
||||
"spec": ">=2.0.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/semantic-ui"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/gulp-chmod/-/gulp-chmod-2.0.0.tgz",
|
||||
"_shasum": "00c390b928a0799b251accf631aa09e01cc6299c",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "gulp-chmod@^2.0.0",
|
||||
"_where": "/Users/jose/Documents/GitHub/Mods/node_modules/semantic-ui",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/gulp-chmod/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"deep-assign": "^1.0.0",
|
||||
"stat-mode": "^0.2.0",
|
||||
"through2": "^2.0.0"
|
||||
},
|
||||
"description": "Change permissions of Vinyl files",
|
||||
"devDependencies": {
|
||||
"gulp-util": "^3.0.0",
|
||||
"mocha": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "00c390b928a0799b251accf631aa09e01cc6299c",
|
||||
"tarball": "https://registry.npmjs.org/gulp-chmod/-/gulp-chmod-2.0.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "68412ff128a0f60c21883555e3b480849e35d4b8",
|
||||
"homepage": "https://github.com/sindresorhus/gulp-chmod#readme",
|
||||
"keywords": [
|
||||
"gulpplugin",
|
||||
"chmod",
|
||||
"stat",
|
||||
"file",
|
||||
"vinyl",
|
||||
"stream",
|
||||
"permissions"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "gulp-chmod",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/gulp-chmod.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && mocha"
|
||||
},
|
||||
"version": "2.0.0",
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
||||
132
node_modules/gulp-chmod/readme.md
generated
vendored
Normal file
132
node_modules/gulp-chmod/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
# gulp-chmod [](https://travis-ci.org/sindresorhus/gulp-chmod)
|
||||
|
||||
> [Change permissions](https://en.wikipedia.org/wiki/Chmod) of [Vinyl](https://github.com/gulpjs/vinyl) files
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save-dev gulp-chmod
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const gulp = require('gulp');
|
||||
const chmod = require('gulp-chmod');
|
||||
|
||||
gulp.task('default', () =>
|
||||
gulp.src('src/app.js')
|
||||
.pipe(chmod(0o755))
|
||||
.pipe(gulp.dest('dist'))
|
||||
);
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```js
|
||||
const gulp = require('gulp');
|
||||
const chmod = require('gulp-chmod');
|
||||
|
||||
gulp.task('default', () =>
|
||||
gulp.src('src/app.js')
|
||||
.pipe(chmod({
|
||||
owner: {
|
||||
read: true,
|
||||
write: true,
|
||||
execute: true
|
||||
},
|
||||
group: {
|
||||
execute: true
|
||||
},
|
||||
others: {
|
||||
execute: true
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest('dist'))
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### chmod(mode, [dirMode])
|
||||
|
||||
#### mode
|
||||
|
||||
Type: `number` `Object`
|
||||
|
||||
Can either be a [chmod](http://ss64.com/bash/chmod.html) octal number or an object with the individual permissions specified.
|
||||
|
||||
Values depends on the current file, but these are the possible keys:
|
||||
|
||||
```js
|
||||
{
|
||||
owner: {
|
||||
read: true,
|
||||
write: true,
|
||||
execute: true
|
||||
},
|
||||
group: {
|
||||
read: true,
|
||||
write: true,
|
||||
execute: true
|
||||
},
|
||||
others: {
|
||||
read: true,
|
||||
write: true,
|
||||
execute: true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
When `read`, `write`, and `execute` are same, you can simplify the object:
|
||||
|
||||
```js
|
||||
{
|
||||
read: true
|
||||
}
|
||||
```
|
||||
|
||||
Pass `null` to not set permissions on files. Useful if you only want to set permissions on directories.
|
||||
|
||||
#### dirMode
|
||||
|
||||
Type: `true` `number` `Object`
|
||||
|
||||
Same as `mode`, but applies to directories. Specify `true` to use the same value as `mode`.
|
||||
|
||||
|
||||
## Tip
|
||||
|
||||
Combine it with [gulp-filter](https://github.com/sindresorhus/gulp-filter) to only change permissions on a subset of the files.
|
||||
|
||||
```js
|
||||
const gulp = require('gulp');
|
||||
const gFilter = require('gulp-filter');
|
||||
const chmod = require('gulp-chmod');
|
||||
|
||||
const filter = gFilter('src/cli.js', {restore: true});
|
||||
|
||||
gulp.task('default', () =>
|
||||
gulp.src('src/*.js')
|
||||
// filter a subset of the files
|
||||
.pipe(filter)
|
||||
// make them executable
|
||||
.pipe(chmod(0o755))
|
||||
// bring back the previously filtered out files
|
||||
.pipe(filter.restore)
|
||||
.pipe(gulp.dest('dist'))
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [gulp-chown](https://github.com/sindresorhus/gulp-chown) - Change owner of Vinyl files
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
Loading…
Reference in a new issue