install gulp to process code
This commit is contained in:
parent
24f6606c2c
commit
b6a3900ee2
1651 changed files with 253427 additions and 39 deletions
10
node_modules/gulp-rename/CHANGELOG.md
generated
vendored
Normal file
10
node_modules/gulp-rename/CHANGELOG.md
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# v2.0.0
|
||||
|
||||
#### Breaking
|
||||
|
||||
- Add the ability to use the function argument as an immutable map function (This may be breaking for users who were relying on the return value of the function being ignored)
|
||||
|
||||
#### Chores
|
||||
|
||||
- Update deps
|
||||
- Switch from JSCS/JSHint to Prettier
|
||||
20
node_modules/gulp-rename/LICENSE
generated
vendored
Normal file
20
node_modules/gulp-rename/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
Copyright 2013 Hector Guillermo Parra Alvarez
|
||||
|
||||
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.
|
||||
70
node_modules/gulp-rename/README.md
generated
vendored
Normal file
70
node_modules/gulp-rename/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
# gulp-rename
|
||||
|
||||
gulp-rename is a [gulp](https://github.com/wearefractal/gulp) plugin to rename files easily.
|
||||
|
||||
[](https://nodei.co/npm/gulp-rename/)
|
||||
|
||||
[](http://travis-ci.org/hparra/gulp-rename)
|
||||
[](https://david-dm.org/hparra/gulp-rename#info=devDependencies)
|
||||
|
||||
## Usage
|
||||
|
||||
gulp-rename provides simple file renaming methods.
|
||||
|
||||
```javascript
|
||||
var rename = require("gulp-rename");
|
||||
|
||||
// rename to a fixed value
|
||||
gulp.src("./src/main/text/hello.txt")
|
||||
.pipe(rename("main/text/ciao/goodbye.md"))
|
||||
.pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/goodbye.md
|
||||
|
||||
// rename via mutating function
|
||||
gulp.src("./src/**/hello.txt")
|
||||
.pipe(rename(function (path) {
|
||||
// Updates the object in-place
|
||||
path.dirname += "/ciao";
|
||||
path.basename += "-goodbye";
|
||||
path.extname = ".md";
|
||||
}))
|
||||
.pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/hello-goodbye.md
|
||||
|
||||
// rename via a map function
|
||||
gulp.src("./src/**/hello.txt")
|
||||
.pipe(rename(function (path) {
|
||||
// Returns a completely new object, make sure you return all keys needed!
|
||||
return {
|
||||
dirname: path.dirname + "/ciao",
|
||||
basename: path.basename + "-goodbye",
|
||||
extname: ".md"
|
||||
};
|
||||
}))
|
||||
.pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/hello-goodbye.md
|
||||
|
||||
// rename via a fixed object
|
||||
gulp.src("./src/main/text/hello.txt", { base: process.cwd() })
|
||||
.pipe(rename({
|
||||
dirname: "main/text/ciao",
|
||||
basename: "aloha",
|
||||
prefix: "bonjour-",
|
||||
suffix: "-hola",
|
||||
extname: ".md"
|
||||
}))
|
||||
.pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/bonjour-aloha-hola.md
|
||||
```
|
||||
|
||||
**See [test/rename.spec.js](test/rename.spec.js) for more examples and [test/path-parsing.spec.js](test/path-parsing.spec.js) for hairy details.**
|
||||
|
||||
## Notes
|
||||
|
||||
* `dirname` is the relative path from the base directory set by `gulp.src` to the filename.
|
||||
* `gulp.src()` uses glob-stream which sets the base to the parent of the first directory glob (`*`, `**`, [], or extglob). `dirname` is the remaining directories or `./` if none. glob-stream versions >= 3.1.0 (used by gulp >= 3.2.2) accept a `base` option, which can be used to explicitly set the base.
|
||||
* `gulp.dest()` renames the directories between `process.cwd()` and `dirname` (i.e. the base relative to CWD). Use `dirname` to rename the directories matched by the glob or descendents of the base of option.
|
||||
* `basename` is the filename without the extension like `path.basename(filename, path.extname(filename))`.
|
||||
* `extname` is the file extension including the `.` like `path.extname(filename)`.
|
||||
* when using a function, a second `file` argument is provided with the whole context and original file value.
|
||||
* when using a function, if no `Object` is returned then the passed parameter object (along with any modifications) is re-used.
|
||||
|
||||
## License
|
||||
|
||||
[MIT License](http://en.wikipedia.org/wiki/MIT_License)
|
||||
70
node_modules/gulp-rename/index.js
generated
vendored
Normal file
70
node_modules/gulp-rename/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
'use strict';
|
||||
|
||||
var Stream = require('stream');
|
||||
var Path = require('path');
|
||||
|
||||
function gulpRename(obj, options) {
|
||||
options = options || {};
|
||||
|
||||
var stream = new Stream.Transform({ objectMode: true });
|
||||
|
||||
function parsePath(path) {
|
||||
var extname = options.multiExt
|
||||
? Path.basename(path).slice(Path.basename(path).indexOf('.'))
|
||||
: Path.extname(path);
|
||||
return {
|
||||
dirname: Path.dirname(path),
|
||||
basename: Path.basename(path, extname),
|
||||
extname: extname
|
||||
};
|
||||
}
|
||||
|
||||
stream._transform = function(originalFile, unused, callback) {
|
||||
var file = originalFile.clone({ contents: false });
|
||||
var parsedPath = parsePath(file.relative);
|
||||
var path;
|
||||
|
||||
var type = typeof obj;
|
||||
|
||||
if (type === 'string' && obj !== '') {
|
||||
path = obj;
|
||||
} else if (type === 'function') {
|
||||
let newParsedPath = obj(parsedPath, file);
|
||||
if (typeof newParsedPath === 'object' && newParsedPath !== null) {
|
||||
parsedPath = newParsedPath;
|
||||
}
|
||||
|
||||
path = Path.join(
|
||||
parsedPath.dirname,
|
||||
parsedPath.basename + parsedPath.extname
|
||||
);
|
||||
} else if (type === 'object' && obj !== undefined && obj !== null) {
|
||||
var dirname = 'dirname' in obj ? obj.dirname : parsedPath.dirname,
|
||||
prefix = obj.prefix || '',
|
||||
suffix = obj.suffix || '',
|
||||
basename = 'basename' in obj ? obj.basename : parsedPath.basename,
|
||||
extname = 'extname' in obj ? obj.extname : parsedPath.extname;
|
||||
|
||||
path = Path.join(dirname, prefix + basename + suffix + extname);
|
||||
} else {
|
||||
callback(
|
||||
new Error('Unsupported renaming parameter type supplied'),
|
||||
undefined
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
file.path = Path.join(file.base, path);
|
||||
|
||||
// Rename sourcemap if present
|
||||
if (file.sourceMap) {
|
||||
file.sourceMap.file = file.relative;
|
||||
}
|
||||
|
||||
callback(null, file);
|
||||
};
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
module.exports = gulpRename;
|
||||
40
node_modules/gulp-rename/package.json
generated
vendored
Normal file
40
node_modules/gulp-rename/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"name": "gulp-rename",
|
||||
"version": "2.0.0",
|
||||
"description": "Rename files",
|
||||
"keywords": [
|
||||
"gulpplugin"
|
||||
],
|
||||
"homepage": "https://github.com/hparra/gulp-rename",
|
||||
"bugs": "https://github.com/hparra/gulp-rename/issues",
|
||||
"author": {
|
||||
"name": "Hector Guillermo Parra Alvarez",
|
||||
"email": "hector@hectorparra.com",
|
||||
"url": "https://github.com/hparra"
|
||||
},
|
||||
"main": "./index.js",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/hparra/gulp-rename.git"
|
||||
},
|
||||
"scripts": {
|
||||
"pretest": "prettier --single-quote --write index.js test/**/*.js",
|
||||
"test": "mocha"
|
||||
},
|
||||
"devDependencies": {
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-sourcemaps": "^2.6.5",
|
||||
"map-stream": "^0.0.7",
|
||||
"mocha": "^6.0.0",
|
||||
"prettier": "^1.19.1",
|
||||
"should": "^13.2.3",
|
||||
"vinyl": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue