initial commit
This commit is contained in:
37
node_modules/concat/.npmignore
generated
vendored
Normal file
37
node_modules/concat/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules
|
||||
jspm_packages
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
6
node_modules/concat/.travis.yml
generated
vendored
Normal file
6
node_modules/concat/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
language: node_js
|
||||
sudo: false
|
||||
node_js:
|
||||
- "7"
|
||||
- "6"
|
||||
- "node"
|
||||
21
node_modules/concat/LICENSE
generated
vendored
Normal file
21
node_modules/concat/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Konstantin Gorodinskii
|
||||
|
||||
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.
|
||||
51
node_modules/concat/README.md
generated
vendored
Normal file
51
node_modules/concat/README.md
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# Concat
|
||||
|
||||
[](https://travis-ci.org/gko/concat)
|
||||
|
||||
Concatenate multiple files
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
Usage: concat [options]
|
||||
|
||||
concatenate multiple files
|
||||
|
||||
Options:
|
||||
-h, --help output usage information
|
||||
-V, --version output the version number
|
||||
-o, --output <file> output file
|
||||
```
|
||||
|
||||
examples:
|
||||
```bash
|
||||
concat -o output.css ./1.css ./2.css ./3.css
|
||||
```
|
||||
|
||||
You can also use it from node:
|
||||
|
||||
```javascript
|
||||
const concat = require('concat');
|
||||
|
||||
concat([file1, file2, file3]).then(result => console.log(result))
|
||||
|
||||
// or
|
||||
concat([file1, file2, file3], outputFile)
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
To run tests you simply need to do:
|
||||
```bash
|
||||
npm run test
|
||||
```
|
||||
|
||||
## Like it?
|
||||
|
||||
:star: this repo
|
||||
|
||||
## License
|
||||
|
||||
[MIT](http://opensource.org/licenses/MIT)
|
||||
|
||||
Copyright (c) 2017 Konstantin Gorodinskiy
|
||||
21
node_modules/concat/bin/concat
generated
vendored
Normal file
21
node_modules/concat/bin/concat
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
const app = require('commander');
|
||||
const cfg = require('../package.json');
|
||||
const concat = require('../index');
|
||||
const path = require('path');
|
||||
app.version(cfg.version)
|
||||
.option('-o, --output <file>', 'output file')
|
||||
.description(cfg.description);
|
||||
app.parse(process.argv);
|
||||
let err = (err) => console.log(err);
|
||||
let output = (o) => {
|
||||
if (!app.output) {
|
||||
console.log(o);
|
||||
}
|
||||
};
|
||||
if (app.args.length) {
|
||||
concat(app.args, app.output).then(output).catch(err);
|
||||
}
|
||||
else
|
||||
throw new Error('no files specified');
|
||||
25
node_modules/concat/bin/concat.ts
generated
vendored
Normal file
25
node_modules/concat/bin/concat.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
const app = require('commander')
|
||||
const cfg = require('../package.json');
|
||||
const concat = require('../index');
|
||||
const path = require('path');
|
||||
|
||||
app.version(cfg.version)
|
||||
.option('-o, --output <file>', 'output file')
|
||||
.description(cfg.description)
|
||||
|
||||
app.parse(process.argv);
|
||||
|
||||
let err = (err: Error) => console.log(err);
|
||||
let output = (o: string) => {
|
||||
if (!app.output) {
|
||||
console.log(o);
|
||||
}
|
||||
};
|
||||
|
||||
if(app.args.length) {
|
||||
concat(app.args, app.output).then(output).catch(err)
|
||||
} else throw new Error('no files specified')
|
||||
50
node_modules/concat/index.js
generated
vendored
Normal file
50
node_modules/concat/index.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
const fs_1 = require("fs");
|
||||
const path_1 = require("path");
|
||||
const log = (err) => console.log(err);
|
||||
const isFile = (f) => fs_1.statSync(f).isFile();
|
||||
const write = (fName, str) => new Promise((res, rej) => {
|
||||
fs_1.writeFile(path_1.resolve(fName), str, (err) => {
|
||||
if (err)
|
||||
return rej(err);
|
||||
return res(str);
|
||||
});
|
||||
});
|
||||
const readFolder = (folder) => new Promise((res, rej) => {
|
||||
fs_1.readdir(path_1.resolve(folder), (err, files) => {
|
||||
if (err)
|
||||
rej(err);
|
||||
const fileList = files.map(f => path_1.join(folder, f));
|
||||
res(fileList.filter(isFile));
|
||||
});
|
||||
});
|
||||
const read = (fName) => new Promise((res, rej) => {
|
||||
fs_1.readFile(path_1.resolve(fName), (err, str) => {
|
||||
if (err)
|
||||
rej(err);
|
||||
res(str);
|
||||
});
|
||||
});
|
||||
const concat = (files) => new Promise((res, rej) => {
|
||||
return Promise.all(files.map(read))
|
||||
.then(src => res(src.join('\n')))
|
||||
.catch(rej);
|
||||
});
|
||||
module.exports = (folder, outFile) => new Promise((res, rej) => {
|
||||
let concatenated;
|
||||
if (typeof folder === 'string') {
|
||||
concatenated = readFolder(folder)
|
||||
.then(concat);
|
||||
}
|
||||
else {
|
||||
concatenated = concat(folder);
|
||||
}
|
||||
if (outFile) {
|
||||
concatenated.then((out) => write(outFile, out)
|
||||
.then(res)
|
||||
.catch(rej)).catch(rej);
|
||||
}
|
||||
else {
|
||||
concatenated.then(res).catch(rej);
|
||||
}
|
||||
});
|
||||
58
node_modules/concat/index.ts
generated
vendored
Normal file
58
node_modules/concat/index.ts
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
import {readFile, readdir, writeFile, statSync} from 'fs'
|
||||
import {resolve, join} from 'path'
|
||||
|
||||
const log = (err: Error) => console.log(err);
|
||||
|
||||
const isFile = (f: string) => statSync(f).isFile();
|
||||
|
||||
const write = (fName: string, str: string) => new Promise((res, rej) => {
|
||||
writeFile(resolve(fName), str, (err: Error) => {
|
||||
if (err) return rej(err)
|
||||
|
||||
return res(str)
|
||||
})
|
||||
});
|
||||
|
||||
const readFolder = (folder: string) => new Promise((res, rej) => {
|
||||
readdir(resolve(folder), (err, files) => {
|
||||
if (err) rej(err)
|
||||
|
||||
const fileList = files.map(f => join(folder, f));
|
||||
res(fileList.filter(isFile));
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
const read = (fName: string) => new Promise((res, rej) => {
|
||||
readFile(resolve(fName), (err, str) => {
|
||||
if (err) rej(err)
|
||||
|
||||
res(str)
|
||||
})
|
||||
});
|
||||
|
||||
const concat = (files: string[]) => new Promise((res, rej) => {
|
||||
return Promise.all(files.map(read))
|
||||
.then(src => res(src.join('\n')))
|
||||
.catch(rej);
|
||||
});
|
||||
|
||||
export = (folder: string[] | string, outFile?: string) => new Promise((res, rej) => {
|
||||
let concatenated;
|
||||
|
||||
if(typeof folder === 'string') {
|
||||
concatenated = readFolder(folder)
|
||||
.then(concat);
|
||||
} else {
|
||||
concatenated = concat(folder);
|
||||
}
|
||||
|
||||
if (outFile) {
|
||||
concatenated.then((out: string) => write(outFile, out)
|
||||
.then(res)
|
||||
.catch(rej)
|
||||
).catch(rej);
|
||||
} else {
|
||||
concatenated.then(res).catch(rej);
|
||||
}
|
||||
});
|
||||
72
node_modules/concat/package.json
generated
vendored
Normal file
72
node_modules/concat/package.json
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"_from": "concat",
|
||||
"_id": "concat@1.0.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-QPM1MInWVGdpXLGIa0Xt1jfYzKg=",
|
||||
"_location": "/concat",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "concat",
|
||||
"name": "concat",
|
||||
"escapedName": "concat",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#DEV:/",
|
||||
"#USER"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/concat/-/concat-1.0.3.tgz",
|
||||
"_shasum": "40f3353089d65467695cb1886b45edd637d8cca8",
|
||||
"_spec": "concat",
|
||||
"_where": "D:\\Air66 Files\\dev_sites\\www.airurl.dev.cc\\user\\plugins\\air66Theme",
|
||||
"author": {
|
||||
"name": "Konstantin Gorodinskiy",
|
||||
"email": "mail@konstantin.io"
|
||||
},
|
||||
"bin": {
|
||||
"concat": "./bin/concat"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/gko/concat/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"commander": "^2.9.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "concatenate multiple files",
|
||||
"devDependencies": {
|
||||
"@types/core-js": "^0.9.41",
|
||||
"@types/node": "^7.0.0",
|
||||
"core-js": "^2.4.1",
|
||||
"mocha": "^3.2.0",
|
||||
"typescript": "^2.1.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"homepage": "https://github.com/gko/concat#readme",
|
||||
"keywords": [
|
||||
"concatenate",
|
||||
"files",
|
||||
"concat",
|
||||
"join"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "concat",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/gko/concat.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bin": "tsc -t ES6 --moduleResolution node ./bin/concat.ts --outFile ./bin/concat",
|
||||
"build": "tsc -t ES6 --module commonjs --moduleResolution node index.ts && npm run bin",
|
||||
"test": "npm run build && _mocha"
|
||||
},
|
||||
"version": "1.0.3"
|
||||
}
|
||||
0
node_modules/concat/test/empty
generated
vendored
Normal file
0
node_modules/concat/test/empty
generated
vendored
Normal file
1
node_modules/concat/test/folder/a.js
generated
vendored
Normal file
1
node_modules/concat/test/folder/a.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
function A() {};
|
||||
1
node_modules/concat/test/folder/b.js
generated
vendored
Normal file
1
node_modules/concat/test/folder/b.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
function B() {};
|
||||
1
node_modules/concat/test/simple1
generated
vendored
Normal file
1
node_modules/concat/test/simple1
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
1
|
||||
1
node_modules/concat/test/simple2
generated
vendored
Normal file
1
node_modules/concat/test/simple2
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
2
|
||||
55
node_modules/concat/test/test.js
generated
vendored
Normal file
55
node_modules/concat/test/test.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
const concat = require('../index')
|
||||
const assert = require('assert');
|
||||
const read = require('fs').readFileSync;
|
||||
const exec = require('child_process').execSync;
|
||||
|
||||
const err = err => console.log(err)
|
||||
|
||||
describe('Concatenate', () => {
|
||||
it('empty files', done => {
|
||||
concat([__dirname + "/empty", __dirname + "/empty"]).then(f => {
|
||||
assert.equal(f, '\n')
|
||||
done()
|
||||
}).catch(err)
|
||||
})
|
||||
|
||||
it('simple concatenation', done => {
|
||||
concat([__dirname + "/simple1", __dirname + "/simple2"]).then(f => {
|
||||
assert.equal(f, '1\n\n2\n')
|
||||
done()
|
||||
}).catch(err)
|
||||
})
|
||||
|
||||
it('multiple files concatenation', done => {
|
||||
concat([
|
||||
__dirname + "/simple1",
|
||||
__dirname + "/simple2",
|
||||
__dirname + "/simple1",
|
||||
__dirname + "/simple2",
|
||||
__dirname + "/simple1",
|
||||
__dirname + "/simple2",
|
||||
__dirname + "/simple1",
|
||||
__dirname + "/simple2"
|
||||
]).then(f => {
|
||||
assert.equal(f, '1\n\n2\n\n1\n\n2\n\n1\n\n2\n\n1\n\n2\n')
|
||||
done()
|
||||
}).catch(err)
|
||||
})
|
||||
|
||||
it('should concatenate folder', done => {
|
||||
concat(__dirname + "/folder").then(f => {
|
||||
assert.equal(f.trim(), 'function A() {};\n\nfunction B() {};')
|
||||
done()
|
||||
}).catch(err)
|
||||
})
|
||||
})
|
||||
|
||||
describe('cli', () => {
|
||||
it('should write to output when no file specified', () => {
|
||||
assert.equal(exec(`node ./bin/concat ${__dirname + '/simple1'} ${__dirname + '/simple2'}`).toString(), '1\n\n2\n\n')
|
||||
})
|
||||
|
||||
it('should write to file', () => {
|
||||
assert.equal(exec(`node ./bin/concat -o ${__dirname + '/test'} ${__dirname + '/simple1'} ${__dirname + '/simple2'} && cat ${__dirname + '/test'}`).toString(), '1\n\n2\n')
|
||||
})
|
||||
})
|
||||
8
node_modules/concat/tsconfig.json
generated
vendored
Normal file
8
node_modules/concat/tsconfig.json
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"noImplicitAny": true,
|
||||
"target": "es6",
|
||||
"types" : [ "node", "core-js" ]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user