Compare commits
142 Commits
Author | SHA1 | Date | |
---|---|---|---|
d78ee87a82 | |||
fadf8782df | |||
8fcdc5ce44 | |||
878da9ff3a | |||
168136bebb | |||
16cecbefac | |||
24b890956e | |||
fe73e8edf7 | |||
5b2089044d | |||
9fa98c3804 | |||
f49c5af339 | |||
61a6cfd452 | |||
769a1a707e | |||
0408cff3fc | |||
533d71a6cd | |||
b3fd13506c | |||
4052337626 | |||
d823229bee | |||
5bdc6e1dc9 | |||
625f540978 | |||
459d2531b4 | |||
b5993560b1 | |||
b800957f19 | |||
d79e1180d8 | |||
ac99ecf743 | |||
897a46e12d | |||
64219f8f09 | |||
42c6c1eec5 | |||
ef3ca28a66 | |||
3beff3320c | |||
0343287775 | |||
e4180022b1 | |||
7909bd1a38 | |||
495c3afdc3 | |||
73ad2d6193 | |||
f5ffb7fc67 | |||
36364bb490 | |||
52f8fd2469 | |||
65dda3bcf1 | |||
d29dcc5a1c | |||
d22e0cde8f | |||
c8a21e8228 | |||
72bb3f33ac | |||
7694cc9c08 | |||
679c870229 | |||
30bc489822 | |||
5493d3cd5d | |||
bd50c122eb | |||
51f9d76a64 | |||
c2f809f9cf | |||
9f311984ac | |||
7515ecf9ce | |||
fb9766e93b | |||
9cfd147fdc | |||
18ff99aef7 | |||
46b1151201 | |||
8e19586e47 | |||
9fc581b866 | |||
dcc85a56b8 | |||
4899d454eb | |||
9d02fccc01 | |||
a5b24a7c33 | |||
06fb0acd52 | |||
97bf5ff74b | |||
531f169c11 | |||
e25675cc49 | |||
32cdac5b38 | |||
7457093476 | |||
f560b6b7bb | |||
ed01ebeee8 | |||
7eed9dd6d3 | |||
d9852e18a5 | |||
0be281746d | |||
6ac60cb3a5 | |||
eb3c720d4e | |||
c29084f000 | |||
b53240a2ea | |||
2ba39cf2ac | |||
675934d049 | |||
dda4c1af07 | |||
214bae9931 | |||
fde809eb02 | |||
9f3a71f0b9 | |||
e9c9e95118 | |||
943a0c30c2 | |||
2dad3707ee | |||
cd35d110a9 | |||
257939462b | |||
8104188b90 | |||
02842f1d0f | |||
f753c2c491 | |||
4ecb817bac | |||
909fcd6e2a | |||
d1538f939d | |||
3fef2a4ab9 | |||
77603ee736 | |||
353058ed73 | |||
bf618512e2 | |||
b276c5639d | |||
779c62dcbb | |||
3e1101c5e1 | |||
395504127c | |||
6dee92a3df | |||
0ba3c1794e | |||
0a810a3ac1 | |||
fc23f221eb | |||
cfcd1f7aaf | |||
2cb8c5117a | |||
2c52dec8ea | |||
1fdd492eff | |||
38354d2944 | |||
760913bad3 | |||
f7b8fe5498 | |||
37fbf9a409 | |||
49aba4c85f | |||
37d81fa4c6 | |||
0256166c2f | |||
bef2bd6b3a | |||
759e1655da | |||
d732d1ba97 | |||
eeab2cf0cd | |||
ab76cae75e | |||
f39daca6aa | |||
e70db71ec4 | |||
50ef41d5d4 | |||
2a417ba18f | |||
3516189940 | |||
10e3628a89 | |||
86eafe4568 | |||
fddde78b92 | |||
2a365b04a6 | |||
df1d82cb7c | |||
d20742f881 | |||
db2a0c2992 | |||
7d806f313b | |||
ff2e34696a | |||
23188dfe3f | |||
38f10e0d04 | |||
2e2b8351f8 | |||
8c386ee91c | |||
9828689f31 | |||
8205da5284 |
9
.gitignore
vendored
9
.gitignore
vendored
@ -1,12 +1,7 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
.settings/
|
|
||||||
.idea/
|
|
||||||
coverage/
|
coverage/
|
||||||
docs/
|
pages/
|
||||||
|
public/
|
||||||
ts/*.js
|
|
||||||
ts/*.js.map
|
|
||||||
ts/typings/
|
|
||||||
|
|
||||||
test/temp/
|
test/temp/
|
||||||
|
|
||||||
|
123
.gitlab-ci.yml
123
.gitlab-ci.yml
@ -1,36 +1,141 @@
|
|||||||
image: hosttoday/ht-docker-node:npmts
|
# gitzone standard
|
||||||
|
image: hosttoday/ht-docker-node:npmci
|
||||||
|
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- .npmci_cache/
|
||||||
|
key: "$CI_BUILD_STAGE"
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
|
- security
|
||||||
- test
|
- test
|
||||||
- release
|
- release
|
||||||
|
- metadata
|
||||||
|
|
||||||
|
# ====================
|
||||||
|
# security stage
|
||||||
|
# ====================
|
||||||
|
mirror:
|
||||||
|
stage: security
|
||||||
|
script:
|
||||||
|
- npmci git mirror
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
|
snyk:
|
||||||
|
stage: security
|
||||||
|
script:
|
||||||
|
- npmci command npm install -g snyk
|
||||||
|
- npmci command npm install --ignore-scripts
|
||||||
|
- npmci command snyk test
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
|
# ====================
|
||||||
|
# test stage
|
||||||
|
# ====================
|
||||||
testLEGACY:
|
testLEGACY:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci test legacy
|
- npmci node install legacy
|
||||||
|
- npmci npm install
|
||||||
|
- npmci npm test
|
||||||
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
|
||||||
testLTS:
|
testLTS:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci test lts
|
- npmci node install lts
|
||||||
|
- npmci npm install
|
||||||
|
- npmci npm test
|
||||||
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
testSTABLE:
|
testSTABLE:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci test stable
|
- npmci node install stable
|
||||||
|
- npmci npm install
|
||||||
|
- npmci npm test
|
||||||
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
release:
|
release:
|
||||||
stage: release
|
stage: release
|
||||||
script:
|
script:
|
||||||
- npmci publish
|
- npmci node install stable
|
||||||
|
- npmci npm publish
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
|
# ====================
|
||||||
|
# metadata stage
|
||||||
|
# ====================
|
||||||
|
codequality:
|
||||||
|
stage: metadata
|
||||||
|
image: docker:stable
|
||||||
|
allow_failure: true
|
||||||
|
services:
|
||||||
|
- docker:stable-dind
|
||||||
|
script:
|
||||||
|
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
||||||
|
- docker run
|
||||||
|
--env SOURCE_CODE="$PWD"
|
||||||
|
--volume "$PWD":/code
|
||||||
|
--volume /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
|
||||||
|
artifacts:
|
||||||
|
paths: [codeclimate.json]
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- priv
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
stage: metadata
|
||||||
|
script:
|
||||||
|
- npmci trigger
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
|
pages:
|
||||||
|
image: hosttoday/ht-docker-node:npmci
|
||||||
|
stage: metadata
|
||||||
|
script:
|
||||||
|
- npmci command npm install -g npmpage
|
||||||
|
- npmci command npmpage
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- notpriv
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
paths:
|
||||||
|
- public
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
|
windowsCompatibility:
|
||||||
|
image: stefanscherer/node-windows:10-build-tools
|
||||||
|
stage: metadata
|
||||||
|
script:
|
||||||
|
- npm install & npm test
|
||||||
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- windows
|
||||||
|
allow_failure: true
|
||||||
|
15
.travis.yml
15
.travis.yml
@ -1,15 +0,0 @@
|
|||||||
language: node_js
|
|
||||||
node_js:
|
|
||||||
- 4
|
|
||||||
- stable
|
|
||||||
deploy:
|
|
||||||
provider: npm
|
|
||||||
email: npm@lossless.digital
|
|
||||||
api_key:
|
|
||||||
secure: wIOQHE7Jbck2j5lcv1Rc8T9/1wbHNGLxqJ6pttNZ+hG1+w77TYnjNYuGtM2xQCXitXSFDoogU8MpiYieOQHYypFgJ6Ns8MTeKIzNJSnlOWdCSN/lVptscT8pyC6qD4IBAyi8m5F2HoGQR+IzcdDBPjXLaPbH7jn8hc9rNY+LNktmYOXfOr37P40pxYrf16GLwrkjQIK8pbkdIbNA0D0k3apTGqw+HsneN2D/O/zAYaB3ojm40ttgPAGYF5PO5t6uqIbPFgIPkMWsO1HbV6I+vOAuIf0KYUqnR/YZd5yFcxFt3c+bfyc8/LP4vy5FyKMLXHe4IXIjXPYetOSiVHgMMYaxawU51OqwIKO+87FJ1TdaVmacMFO0wagl2QS0ceQBn8KBUhljHu/fDInK82uy15Iddk44EhnTx1MIxxgH5WMM6aQB2vuqnViPghs4nA0Y/Dz2U69267fhvmZvEWWUndz058EksHdZsIt5WCqQErI/dWLXMGom94CuZv6nkoVHCw8CO5dqVvfqUFL7Qyw59kRbiUPItFVoiV8ptLUX9tnQ5xBukNRkFX34ViM9YvBRlGt5e//f+cWjUpXFvbrwkqusXArplpxIaUSsQKh7XaMB5DcZ5jDDdjKzIMDf6QWsMTU1rjfQS5ZS3eV5LPy0UlfpDGK28oK2/o8fM+yydVk=
|
|
||||||
on:
|
|
||||||
tags: true
|
|
||||||
repo: pushrocks/smartfile
|
|
||||||
notifications:
|
|
||||||
slack:
|
|
||||||
secure: f5Uss0z9RPl/QcA/DroB8loyE93aOYI6bqCkrsiUscmZtlv/TVQtT4dxqGA6uvcG6iTQDBi3Ul88dQxWkRm4IqbhY35/iMaV2dHW4FVYMAh8GQMbsfL2sALCcufxD9blw47awv3iFcwhV1EeyesscjgL0JIjduk96v/7G/6QIO2838M1lzlgtj+kRUkim8qkaEs1je3gRrhMUIjLuAdscMXyUKYFMjWo9ACSjVUl30R/ZNemb18itIja6i92GotreBgcfEMczvy58ovDC7xdJUsY8LjMI01DwY+WPRnI0tAhsuI8moBwwcdM4e3bAjKjucQRjO33O5bMWRZ6QCiYd0DnCEFyCPQLJ4GSy/tkD00n8ijLHAOSV3AH1zNbdK1EAdSPQXDvlI36KJn/2hyQLoitGHVUPr76ujJWP82ypO2tgIp3XQU0dJVCxDuHnwJO2+hjdI+gCPqxNTpjeujHx3UdkTGNRjuuf9dlZ/D08fApjYxy2fxItTqo3QjP/nrqvBXUOPP8yPHpjIT4H2t5Pr4SJjBGI6X4qhKyFj6s9rA/Xu1rL+45zu1C3uC3z+u3T9UwrbzJ/cZM6r6UQvQmUvIfBNaMlg4I/diQCDIPL+Rhop2nylY3IcHmJnk2itn7kOqj1tohCpFEml5pRuSZy4udWywkdtyBAsHWFLF7oiQ=
|
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2015 Push.Rocks
|
Copyright (c) 2015 Lossless GmbH
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
36
README.md
36
README.md
@ -1,13 +1,43 @@
|
|||||||
# smartfile
|
# smartfile
|
||||||
|
|
||||||
make files easily accessible for processing in javascript.
|
make files easily accessible for processing in javascript.
|
||||||
|
|
||||||
## Status
|
## Availabililty
|
||||||
|
|
||||||
|
[](https://www.npmjs.com/package/smartfile)
|
||||||
|
[](https://gitlab.com/pushrocks/smartfile)
|
||||||
|
[](https://github.com/pushrocks/smartfile)
|
||||||
|
[](https://pushrocks.gitlab.io/smartfile/)
|
||||||
|
|
||||||
|
## Status for master
|
||||||
|
|
||||||
[](https://gitlab.com/pushrocks/smartfile/commits/master)
|
[](https://gitlab.com/pushrocks/smartfile/commits/master)
|
||||||
|
[](https://gitlab.com/pushrocks/smartfile/commits/master)
|
||||||
[](https://david-dm.org/pushrocks/smartfile)
|
[](https://david-dm.org/pushrocks/smartfile)
|
||||||
[](https://www.bithound.io/github/pushrocks/smartfile/master/dependencies/npm)
|
[](https://www.bithound.io/github/pushrocks/smartfile/master/dependencies/npm)
|
||||||
[](https://www.bithound.io/github/pushrocks/smartfile)
|
[](https://www.bithound.io/github/pushrocks/smartfile)
|
||||||
[](https://codecov.io/github/pushrocks/smartfile?branch=master)
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[](http://standardjs.com/)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
smartfile is an approach of being one tool to handle files in diverse environments.
|
smartfile is an approach of being one tool to handle files in diverse environments.
|
||||||
It can fetch files from remote locations, work with local disks and do pure memory operations.
|
|
||||||
|
### Smartfile Sections
|
||||||
|
|
||||||
|
smartfile thinks in sections:
|
||||||
|
|
||||||
|
| section | description |
|
||||||
|
| ----------- | ---------------------------------------------------------------------------- |
|
||||||
|
| fs | (object) gets data from fs to somewhere |
|
||||||
|
| memory | gets data from memory to somewhere |
|
||||||
|
| remote | gets data from remote locations to somewhere |
|
||||||
|
| interpreter | (object) handles yaml and json |
|
||||||
|
| smartfile | (class) a virtual representation of a file, alternative to vinyl file format |
|
||||||
|
|
||||||
|
For further information read the linked docs at the top of this README.
|
||||||
|
|
||||||
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
|
|
||||||
|
[](https://push.rocks)
|
||||||
|
10
appveyor.yml
10
appveyor.yml
@ -1,10 +0,0 @@
|
|||||||
environment:
|
|
||||||
nodejs_version: "4"
|
|
||||||
install:
|
|
||||||
- ps: Install-Product node $env:nodejs_version
|
|
||||||
- npm install
|
|
||||||
test_script:
|
|
||||||
- node --version
|
|
||||||
- npm --version
|
|
||||||
- npm test
|
|
||||||
build: off
|
|
11
dist/index.d.ts
vendored
11
dist/index.d.ts
vendored
@ -1,9 +1,8 @@
|
|||||||
import "typings-global";
|
import * as SmartfileFs from './smartfile.fs';
|
||||||
import * as SmartfileFs from "./smartfile.fs";
|
import * as SmartfileInterpreter from './smartfile.interpreter';
|
||||||
import * as SmartfileInterpreter from "./smartfile.interpreter";
|
import * as SmartfileMemory from './smartfile.memory';
|
||||||
import * as SmartfileMemory from "./smartfile.memory";
|
import * as SmartfileRemote from './smartfile.remote';
|
||||||
import * as SmartfileRemote from "./smartfile.remote";
|
export { Smartfile } from './smartfile.classes.smartfile';
|
||||||
export { Smartfile } from "./smartfile.classes.smartfile";
|
|
||||||
export declare let fs: typeof SmartfileFs;
|
export declare let fs: typeof SmartfileFs;
|
||||||
export declare let interpreter: typeof SmartfileInterpreter;
|
export declare let interpreter: typeof SmartfileInterpreter;
|
||||||
export declare let memory: typeof SmartfileMemory;
|
export declare let memory: typeof SmartfileMemory;
|
||||||
|
13
dist/index.js
vendored
13
dist/index.js
vendored
@ -1,9 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require("typings-global");
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
var SmartfileFs = require("./smartfile.fs");
|
const SmartfileFs = require("./smartfile.fs");
|
||||||
var SmartfileInterpreter = require("./smartfile.interpreter");
|
const SmartfileInterpreter = require("./smartfile.interpreter");
|
||||||
var SmartfileMemory = require("./smartfile.memory");
|
const SmartfileMemory = require("./smartfile.memory");
|
||||||
var SmartfileRemote = require("./smartfile.remote");
|
const SmartfileRemote = require("./smartfile.remote");
|
||||||
var smartfile_classes_smartfile_1 = require("./smartfile.classes.smartfile");
|
var smartfile_classes_smartfile_1 = require("./smartfile.classes.smartfile");
|
||||||
exports.Smartfile = smartfile_classes_smartfile_1.Smartfile;
|
exports.Smartfile = smartfile_classes_smartfile_1.Smartfile;
|
||||||
exports.fs = SmartfileFs;
|
exports.fs = SmartfileFs;
|
||||||
@ -11,5 +11,4 @@ exports.interpreter = SmartfileInterpreter;
|
|||||||
exports.memory = SmartfileMemory;
|
exports.memory = SmartfileMemory;
|
||||||
exports.remote = SmartfileRemote;
|
exports.remote = SmartfileRemote;
|
||||||
exports.requireReload = SmartfileFs.requireReload;
|
exports.requireReload = SmartfileFs.requireReload;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUNBLDhDQUE2QztBQUM3QyxnRUFBK0Q7QUFDL0Qsc0RBQXFEO0FBQ3JELHNEQUFxRDtBQUVyRCw2RUFBdUQ7QUFBL0Msa0RBQUEsU0FBUyxDQUFBO0FBRU4sUUFBQSxFQUFFLEdBQUcsV0FBVyxDQUFBO0FBQ2hCLFFBQUEsV0FBVyxHQUFHLG9CQUFvQixDQUFBO0FBQ2xDLFFBQUEsTUFBTSxHQUFHLGVBQWUsQ0FBQTtBQUN4QixRQUFBLE1BQU0sR0FBRyxlQUFlLENBQUE7QUFDeEIsUUFBQSxhQUFhLEdBQUcsV0FBVyxDQUFDLGFBQWEsQ0FBQSJ9
|
||||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFHeEIsSUFBWSxXQUFXLFdBQU0sZ0JBQWdCLENBQUMsQ0FBQTtBQUM5QyxJQUFZLG9CQUFvQixXQUFNLHlCQUN0QyxDQUFDLENBRDhEO0FBQy9ELElBQVksZUFBZSxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFDdEQsSUFBWSxlQUFlLFdBQU0sb0JBQW9CLENBQUMsQ0FBQTtBQUV0RCw0Q0FBd0IsK0JBQStCLENBQUM7QUFBaEQsNERBQWdEO0FBRTdDLFVBQUUsR0FBRyxXQUFXLENBQUM7QUFDakIsbUJBQVcsR0FBRyxvQkFBb0IsQ0FBQztBQUNuQyxjQUFNLEdBQUcsZUFBZSxDQUFDO0FBQ3pCLGNBQU0sR0FBRyxlQUFlLENBQUM7QUFDekIscUJBQWEsR0FBRyxXQUFXLENBQUMsYUFBYSxDQUFDIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy1nbG9iYWxcIjtcblxuaW1wb3J0ICogYXMgcGx1Z2lucyBmcm9tIFwiLi9zbWFydGZpbGUucGx1Z2luc1wiO1xuaW1wb3J0ICogYXMgU21hcnRmaWxlRnMgZnJvbSBcIi4vc21hcnRmaWxlLmZzXCI7XG5pbXBvcnQgKiBhcyBTbWFydGZpbGVJbnRlcnByZXRlciBmcm9tIFwiLi9zbWFydGZpbGUuaW50ZXJwcmV0ZXJcIiBcbmltcG9ydCAqIGFzIFNtYXJ0ZmlsZU1lbW9yeSBmcm9tIFwiLi9zbWFydGZpbGUubWVtb3J5XCI7XG5pbXBvcnQgKiBhcyBTbWFydGZpbGVSZW1vdGUgZnJvbSBcIi4vc21hcnRmaWxlLnJlbW90ZVwiO1xuXG5leHBvcnQge1NtYXJ0ZmlsZX0gZnJvbSBcIi4vc21hcnRmaWxlLmNsYXNzZXMuc21hcnRmaWxlXCI7XG5cbmV4cG9ydCBsZXQgZnMgPSBTbWFydGZpbGVGcztcbmV4cG9ydCBsZXQgaW50ZXJwcmV0ZXIgPSBTbWFydGZpbGVJbnRlcnByZXRlcjtcbmV4cG9ydCBsZXQgbWVtb3J5ID0gU21hcnRmaWxlTWVtb3J5O1xuZXhwb3J0IGxldCByZW1vdGUgPSBTbWFydGZpbGVSZW1vdGU7XG5leHBvcnQgbGV0IHJlcXVpcmVSZWxvYWQgPSBTbWFydGZpbGVGcy5yZXF1aXJlUmVsb2FkO1xuIl19
|
|
80
dist/smartfile.classes.smartfile.d.ts
vendored
80
dist/smartfile.classes.smartfile.d.ts
vendored
@ -1,3 +1,79 @@
|
|||||||
export declare class Smartfile {
|
/// <reference types="node" />
|
||||||
constructor();
|
import * as plugins from './smartfile.plugins';
|
||||||
|
export interface ISmartfileConstructorOptions {
|
||||||
|
path?: string;
|
||||||
|
contentString?: string;
|
||||||
|
contentBuffer?: Buffer;
|
||||||
|
base?: string;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* class Smartfile
|
||||||
|
* -> is vinyl file compatible
|
||||||
|
*/
|
||||||
|
export declare class Smartfile {
|
||||||
|
/**
|
||||||
|
* the full path of the file on disk
|
||||||
|
*/
|
||||||
|
path: string;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
parsedPath: plugins.path.ParsedPath;
|
||||||
|
/**
|
||||||
|
* the content of the file as Buffer
|
||||||
|
*/
|
||||||
|
contentBuffer: Buffer;
|
||||||
|
/**
|
||||||
|
* The current working directory of the file
|
||||||
|
* Note:this is similar to gulp and different from native node path base
|
||||||
|
*/
|
||||||
|
base: string;
|
||||||
|
/**
|
||||||
|
* sync the file with disk
|
||||||
|
*/
|
||||||
|
sync: boolean;
|
||||||
|
/**
|
||||||
|
* the constructor of Smartfile
|
||||||
|
* @param optionsArg
|
||||||
|
*/
|
||||||
|
constructor(optionsArg: ISmartfileConstructorOptions);
|
||||||
|
/**
|
||||||
|
* set contents from string
|
||||||
|
* @param contentString
|
||||||
|
*/
|
||||||
|
setContentsFromString(contentString: string): void;
|
||||||
|
/**
|
||||||
|
* write file to disk
|
||||||
|
* Behaviours:
|
||||||
|
* - no argument write to exactly where the file was picked up
|
||||||
|
*/
|
||||||
|
write(pathArg?: string): Promise<void>;
|
||||||
|
/**
|
||||||
|
* read file from disk
|
||||||
|
*/
|
||||||
|
read(): Promise<void>;
|
||||||
|
/**
|
||||||
|
* vinyl-compatibility: alias of this.contentBuffer
|
||||||
|
*/
|
||||||
|
contents: Buffer;
|
||||||
|
/**
|
||||||
|
* vinyl-compatibility
|
||||||
|
*/
|
||||||
|
readonly cwd: string;
|
||||||
|
/**
|
||||||
|
* return relative path of file
|
||||||
|
*/
|
||||||
|
readonly relative: string;
|
||||||
|
/**
|
||||||
|
* return truw when the file has content
|
||||||
|
*/
|
||||||
|
isNull(): boolean;
|
||||||
|
/**
|
||||||
|
* return true if contents are Buffer
|
||||||
|
*/
|
||||||
|
isBuffer(): boolean;
|
||||||
|
isDirectory(): boolean;
|
||||||
|
isStream(): boolean;
|
||||||
|
isSymbolic(): boolean;
|
||||||
|
updateFileName(fileNameArg: string): void;
|
||||||
}
|
}
|
||||||
|
123
dist/smartfile.classes.smartfile.js
vendored
123
dist/smartfile.classes.smartfile.js
vendored
@ -1,10 +1,119 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var Smartfile = (function () {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function Smartfile() {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const plugins = require("./smartfile.plugins");
|
||||||
|
const memory = require("./smartfile.memory");
|
||||||
|
/**
|
||||||
|
* class Smartfile
|
||||||
|
* -> is vinyl file compatible
|
||||||
|
*/
|
||||||
|
class Smartfile {
|
||||||
|
/**
|
||||||
|
* the constructor of Smartfile
|
||||||
|
* @param optionsArg
|
||||||
|
*/
|
||||||
|
constructor(optionsArg) {
|
||||||
|
if (optionsArg.contentBuffer) {
|
||||||
|
this.contentBuffer = optionsArg.contentBuffer;
|
||||||
|
}
|
||||||
|
else if (optionsArg.contentString) {
|
||||||
|
this.setContentsFromString(optionsArg.contentString);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log('created empty Smartfile?');
|
||||||
|
}
|
||||||
|
this.path = optionsArg.path;
|
||||||
|
this.parsedPath = plugins.path.parse(this.path);
|
||||||
|
this.base = optionsArg.base;
|
||||||
}
|
}
|
||||||
;
|
/**
|
||||||
return Smartfile;
|
* set contents from string
|
||||||
}());
|
* @param contentString
|
||||||
|
*/
|
||||||
|
setContentsFromString(contentString) {
|
||||||
|
this.contents = new Buffer(contentString);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* write file to disk
|
||||||
|
* Behaviours:
|
||||||
|
* - no argument write to exactly where the file was picked up
|
||||||
|
*/
|
||||||
|
write(pathArg) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const stringToWrite = this.contentBuffer.toString();
|
||||||
|
yield memory.toFs(stringToWrite, this.path);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* read file from disk
|
||||||
|
*/
|
||||||
|
read() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// -----------------------------------------------
|
||||||
|
// vinyl compatibility
|
||||||
|
// -----------------------------------------------
|
||||||
|
/**
|
||||||
|
* vinyl-compatibility: alias of this.contentBuffer
|
||||||
|
*/
|
||||||
|
get contents() {
|
||||||
|
return this.contentBuffer;
|
||||||
|
}
|
||||||
|
set contents(contentsArg) {
|
||||||
|
this.contentBuffer = contentsArg;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* vinyl-compatibility
|
||||||
|
*/
|
||||||
|
get cwd() {
|
||||||
|
return process.cwd();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* return relative path of file
|
||||||
|
*/
|
||||||
|
get relative() {
|
||||||
|
return plugins.path.relative(this.base, this.path);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* return truw when the file has content
|
||||||
|
*/
|
||||||
|
isNull() {
|
||||||
|
if (!this.contentBuffer) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* return true if contents are Buffer
|
||||||
|
*/
|
||||||
|
isBuffer() {
|
||||||
|
if (this.contents instanceof Buffer) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
isDirectory() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
isStream() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
isSymbolic() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// update things
|
||||||
|
updateFileName(fileNameArg) {
|
||||||
|
let oldFileName = this.parsedPath.base;
|
||||||
|
this.path = this.path.replace(new RegExp(oldFileName + '$'), fileNameArg);
|
||||||
|
}
|
||||||
|
}
|
||||||
exports.Smartfile = Smartfile;
|
exports.Smartfile = Smartfile;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRmaWxlLmNsYXNzZXMuc21hcnRmaWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRmaWxlLmNsYXNzZXMuc21hcnRmaWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSwrQ0FBOEM7QUFFOUMsNkNBQTRDO0FBUzVDOzs7R0FHRztBQUNIO0lBMkJFOzs7T0FHRztJQUdILFlBQWEsVUFBd0M7UUFDbkQsSUFBSSxVQUFVLENBQUMsYUFBYSxFQUFFO1lBQzVCLElBQUksQ0FBQyxhQUFhLEdBQUcsVUFBVSxDQUFDLGFBQWEsQ0FBQTtTQUM5QzthQUFNLElBQUksVUFBVSxDQUFDLGFBQWEsRUFBRTtZQUNuQyxJQUFJLENBQUMscUJBQXFCLENBQUMsVUFBVSxDQUFDLGFBQWEsQ0FBQyxDQUFBO1NBQ3JEO2FBQU07WUFDTCxPQUFPLENBQUMsR0FBRyxDQUFDLDBCQUEwQixDQUFDLENBQUE7U0FDeEM7UUFDRCxJQUFJLENBQUMsSUFBSSxHQUFHLFVBQVUsQ0FBQyxJQUFJLENBQUE7UUFDM0IsSUFBSSxDQUFDLFVBQVUsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUE7UUFDL0MsSUFBSSxDQUFDLElBQUksR0FBRyxVQUFVLENBQUMsSUFBSSxDQUFBO0lBQzdCLENBQUM7SUFHRDs7O09BR0c7SUFDSCxxQkFBcUIsQ0FBQyxhQUFxQjtRQUN6QyxJQUFJLENBQUMsUUFBUSxHQUFHLElBQUksTUFBTSxDQUFDLGFBQWEsQ0FBQyxDQUFBO0lBQzNDLENBQUM7SUFFRDs7OztPQUlHO0lBQ0csS0FBSyxDQUFFLE9BQWdCOztZQUMzQixNQUFNLGFBQWEsR0FBRyxJQUFJLENBQUMsYUFBYSxDQUFDLFFBQVEsRUFBRSxDQUFBO1lBQ25ELE1BQU0sTUFBTSxDQUFDLElBQUksQ0FBQyxhQUFhLEVBQUUsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFBO1FBQzdDLENBQUM7S0FBQTtJQUVEOztPQUVHO0lBQ0csSUFBSTs7UUFDVixDQUFDO0tBQUE7SUFFRCxrREFBa0Q7SUFDbEQsc0JBQXNCO0lBQ3RCLGtEQUFrRDtJQUNsRDs7T0FFRztJQUNILElBQUksUUFBUTtRQUNWLE9BQU8sSUFBSSxDQUFDLGFBQWEsQ0FBQTtJQUMzQixDQUFDO0lBQ0QsSUFBSSxRQUFRLENBQUUsV0FBVztRQUN2QixJQUFJLENBQUMsYUFBYSxHQUFHLFdBQVcsQ0FBQTtJQUNsQyxDQUFDO0lBRUQ7O09BRUc7SUFDSCxJQUFJLEdBQUc7UUFDTCxPQUFPLE9BQU8sQ0FBQyxHQUFHLEVBQUUsQ0FBQTtJQUN0QixDQUFDO0lBRUQ7O09BRUc7SUFDSCxJQUFJLFFBQVE7UUFDVixPQUFPLE9BQU8sQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQyxJQUFJLEVBQUUsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFBO0lBQ3BELENBQUM7SUFFRDs7T0FFRztJQUNILE1BQU07UUFDSixJQUFJLENBQUMsSUFBSSxDQUFDLGFBQWEsRUFBRTtZQUN2QixPQUFPLElBQUksQ0FBQTtTQUNaO1FBQ0QsT0FBTyxLQUFLLENBQUE7SUFDZCxDQUFDO0lBRUQ7O09BRUc7SUFDSCxRQUFRO1FBQ04sSUFBSSxJQUFJLENBQUMsUUFBUSxZQUFZLE1BQU0sRUFBRTtZQUNuQyxPQUFPLElBQUksQ0FBQTtTQUNaO1FBQ0QsT0FBTyxLQUFLLENBQUE7SUFDZCxDQUFDO0lBRUQsV0FBVztRQUNULE9BQU8sS0FBSyxDQUFBO0lBQ2QsQ0FBQztJQUVELFFBQVE7UUFDTixPQUFPLEtBQUssQ0FBQTtJQUNkLENBQUM7SUFFRCxVQUFVO1FBQ1IsT0FBTyxLQUFLLENBQUE7SUFDZCxDQUFDO0lBRUQsZ0JBQWdCO0lBQ2hCLGNBQWMsQ0FBRSxXQUFtQjtRQUNqQyxJQUFJLFdBQVcsR0FBRyxJQUFJLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQTtRQUN0QyxJQUFJLENBQUMsSUFBSSxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLElBQUksTUFBTSxDQUFDLFdBQVcsR0FBRyxHQUFHLENBQUMsRUFBQyxXQUFXLENBQUMsQ0FBQTtJQUMxRSxDQUFDO0NBQ0Y7QUF2SUQsOEJBdUlDIn0=
|
||||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0ZmlsZS5jbGFzc2VzLnNtYXJ0ZmlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7SUFDSTtJQUVBLENBQUM7O0lBQ0wsZ0JBQUM7QUFBRCxDQUpBLEFBSUMsSUFBQTtBQUpZLGlCQUFTLFlBSXJCLENBQUEiLCJmaWxlIjoic21hcnRmaWxlLmNsYXNzZXMuc21hcnRmaWxlLmpzIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNsYXNzIFNtYXJ0ZmlsZSB7XG4gICAgY29uc3RydWN0b3IoKXtcbiAgICAgICAgXG4gICAgfTtcbn0iXX0=
|
|
95
dist/smartfile.fs.d.ts
vendored
95
dist/smartfile.fs.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
import "typings-global";
|
import { Smartfile } from './smartfile.classes.smartfile';
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param filePath
|
* @param filePath
|
||||||
@ -10,7 +10,7 @@ export declare let fileExistsSync: (filePath: any) => boolean;
|
|||||||
* @param filePath
|
* @param filePath
|
||||||
* @returns {any}
|
* @returns {any}
|
||||||
*/
|
*/
|
||||||
export declare let fileExists: (filePath: any) => any;
|
export declare let fileExists: (filePath: any) => Promise<{}>;
|
||||||
/**
|
/**
|
||||||
* Checks if given path points to an existing directory
|
* Checks if given path points to an existing directory
|
||||||
*/
|
*/
|
||||||
@ -19,37 +19,64 @@ export declare let isDirectory: (pathArg: any) => boolean;
|
|||||||
* Checks if a given path points to an existing file
|
* Checks if a given path points to an existing file
|
||||||
*/
|
*/
|
||||||
export declare let isFile: (pathArg: any) => boolean;
|
export declare let isFile: (pathArg: any) => boolean;
|
||||||
/**
|
|
||||||
* ensures that a directory is in place
|
|
||||||
*/
|
|
||||||
export declare let ensureDir: (dirPathArg: string) => any;
|
|
||||||
/**
|
|
||||||
* ensures that a directory is in place
|
|
||||||
*/
|
|
||||||
export declare let ensureDirSync: (dirPathArg: string) => void;
|
|
||||||
/**
|
/**
|
||||||
* copies a file from A to B on the local disk
|
* copies a file from A to B on the local disk
|
||||||
*/
|
*/
|
||||||
export declare let copy: (fromArg: string, toArg: string) => any;
|
export declare let copy: (fromArg: string, toArg: string) => Promise<{}>;
|
||||||
/**
|
/**
|
||||||
* copies a file SYNCHRONOUSLY from A to B on the local disk
|
* copies a file SYNCHRONOUSLY from A to B on the local disk
|
||||||
*/
|
*/
|
||||||
export declare let copySync: (fromArg: string, toArg: string) => boolean;
|
export declare let copySync: (fromArg: string, toArg: string) => boolean;
|
||||||
|
/**
|
||||||
|
* ensures that a directory is in place
|
||||||
|
*/
|
||||||
|
export declare let ensureDir: (dirPathArg: string) => Promise<{}>;
|
||||||
|
/**
|
||||||
|
* ensures that a directory is in place
|
||||||
|
*/
|
||||||
|
export declare let ensureDirSync: (dirPathArg: string) => void;
|
||||||
|
/**
|
||||||
|
* ensure an empty directory
|
||||||
|
* @executes ASYNC
|
||||||
|
*/
|
||||||
|
export declare let ensureEmptyDir: (dirPathArg: string) => Promise<{}>;
|
||||||
|
/**
|
||||||
|
* ensure an empty directory
|
||||||
|
* @executes SYNC
|
||||||
|
*/
|
||||||
|
export declare let ensureEmptyDirSync: (dirPathArg: string) => void;
|
||||||
|
/**
|
||||||
|
* ensures that a file is on disk
|
||||||
|
* @param filePath the filePath to ensureDir
|
||||||
|
* @param the fileContent to place into a new file in case it doesn't exist yet
|
||||||
|
* @returns Promise<void>
|
||||||
|
* @exec ASYNC
|
||||||
|
*/
|
||||||
|
export declare let ensureFile: (filePathArg: any, initFileStringArg: any) => Promise<void>;
|
||||||
|
/**
|
||||||
|
* ensures that a file is on disk
|
||||||
|
* @param filePath the filePath to ensureDir
|
||||||
|
* @param the fileContent to place into a new file in case it doesn't exist yet
|
||||||
|
* @returns Promise<void>
|
||||||
|
* @exec SYNC
|
||||||
|
*/
|
||||||
|
export declare let ensureFileSync: (filePathArg: string, initFileStringArg: string) => void;
|
||||||
/**
|
/**
|
||||||
* removes a file or folder from local disk
|
* removes a file or folder from local disk
|
||||||
*/
|
*/
|
||||||
export declare let remove: (pathArg: string) => any;
|
export declare let remove: (pathArg: string) => Promise<void>;
|
||||||
/**
|
/**
|
||||||
* removes a file SYNCHRONOUSLY from local disk
|
* removes a file SYNCHRONOUSLY from local disk
|
||||||
*/
|
*/
|
||||||
export declare let removeSync: (pathArg: string) => boolean;
|
export declare let removeSync: (pathArg: string) => boolean;
|
||||||
/**
|
/**
|
||||||
*
|
* removes an array of filePaths from disk
|
||||||
* @param filePathArg
|
|
||||||
* @returns {*}
|
|
||||||
*/
|
*/
|
||||||
export declare let toGulpStreamSync: (filePathArg: string) => any;
|
export declare let removeMany: (filePathArrayArg: string[]) => Promise<void[]>;
|
||||||
export declare let toGulpDestSync: (folderPathArg: string) => any;
|
/**
|
||||||
|
* like removeFilePathArray but SYNCHRONOUSLY
|
||||||
|
*/
|
||||||
|
export declare let removeManySync: (filePathArrayArg: string[]) => void;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param filePathArg
|
* @param filePathArg
|
||||||
@ -62,7 +89,8 @@ export declare let toObjectSync: (filePathArg: any, fileTypeArg?: any) => any;
|
|||||||
* @param filePath
|
* @param filePath
|
||||||
* @returns {string|Buffer|any}
|
* @returns {string|Buffer|any}
|
||||||
*/
|
*/
|
||||||
export declare let toStringSync: (filePath: any) => any;
|
export declare let toStringSync: (filePath: string) => string;
|
||||||
|
export declare let fileTreeToObject: (dirPathArg: string, miniMatchFilter: string) => Promise<Smartfile[]>;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param filePathArg
|
* @param filePathArg
|
||||||
@ -80,9 +108,36 @@ export declare let requireReload: (path: string) => any;
|
|||||||
* lists Folders in a directory on local disk
|
* lists Folders in a directory on local disk
|
||||||
* @returns Promise
|
* @returns Promise
|
||||||
*/
|
*/
|
||||||
export declare let listFolders: (pathArg: string) => any;
|
export declare let listFolders: (pathArg: string, regexFilter?: RegExp) => Promise<{}>;
|
||||||
/**
|
/**
|
||||||
* lists Folders SYNCHRONOUSLY in a directory on local disk
|
* lists Folders SYNCHRONOUSLY in a directory on local disk
|
||||||
* @returns an array with the folder names as strings
|
* @returns an array with the folder names as strings
|
||||||
*/
|
*/
|
||||||
export declare let listFoldersSync: (pathArg: any) => string[];
|
export declare let listFoldersSync: (pathArg: string, regexFilter?: RegExp) => string[];
|
||||||
|
/**
|
||||||
|
* lists Files in a directory on local disk
|
||||||
|
* @returns Promise
|
||||||
|
*/
|
||||||
|
export declare let listFiles: (pathArg: string, regexFilter?: RegExp) => Promise<{}>;
|
||||||
|
/**
|
||||||
|
* lists Files SYNCHRONOUSLY in a directory on local disk
|
||||||
|
* @returns an array with the folder names as strings
|
||||||
|
*/
|
||||||
|
export declare let listFilesSync: (pathArg: string, regexFilter?: RegExp) => string[];
|
||||||
|
/**
|
||||||
|
* lists all items (folders AND files) in a directory on local disk
|
||||||
|
* @returns Promise<string[]>
|
||||||
|
*/
|
||||||
|
export declare let listAllItems: (pathArg: string, regexFilter?: RegExp) => Promise<string[]>;
|
||||||
|
/**
|
||||||
|
* lists all items (folders AND files) in a directory on local disk
|
||||||
|
* @returns an array with the folder names as strings
|
||||||
|
* @executes SYNC
|
||||||
|
*/
|
||||||
|
export declare let listAllItemsSync: (pathArg: string, regexFilter?: RegExp) => string[];
|
||||||
|
/**
|
||||||
|
* lists a file tree using a miniMatch filter
|
||||||
|
* note: if the miniMatch Filter is an absolute path, the cwdArg will be omitted
|
||||||
|
* @returns Promise<string[]> string array with the absolute paths of all matching files
|
||||||
|
*/
|
||||||
|
export declare let listFileTree: (dirPathArg: string, miniMatchFilter: string) => Promise<string[]>;
|
||||||
|
312
dist/smartfile.fs.js
vendored
312
dist/smartfile.fs.js
vendored
File diff suppressed because one or more lines are too long
1
dist/smartfile.interpreter.d.ts
vendored
1
dist/smartfile.interpreter.d.ts
vendored
@ -1,3 +1,2 @@
|
|||||||
import "typings-global";
|
|
||||||
export declare let filetype: (pathArg: string) => string;
|
export declare let filetype: (pathArg: string) => string;
|
||||||
export declare let objectFile: (fileStringArg: string, fileTypeArg: any) => any;
|
export declare let objectFile: (fileStringArg: string, fileTypeArg: any) => any;
|
||||||
|
23
dist/smartfile.interpreter.js
vendored
23
dist/smartfile.interpreter.js
vendored
@ -1,22 +1,21 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require("typings-global");
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
var plugins = require("./smartfile.plugins");
|
const plugins = require("./smartfile.plugins");
|
||||||
exports.filetype = function (pathArg) {
|
exports.filetype = (pathArg) => {
|
||||||
var extName = plugins.path.extname(pathArg);
|
let extName = plugins.path.extname(pathArg);
|
||||||
var fileType = extName.replace(/\.([a-z]*)/, "$1"); //remove . form fileType
|
let fileType = extName.replace(/\.([a-z]*)/, '$1'); // remove . form fileType
|
||||||
return fileType;
|
return fileType;
|
||||||
};
|
};
|
||||||
exports.objectFile = function (fileStringArg, fileTypeArg) {
|
exports.objectFile = (fileStringArg, fileTypeArg) => {
|
||||||
switch (fileTypeArg) {
|
switch (fileTypeArg) {
|
||||||
case "yml":
|
case 'yml':
|
||||||
case "yaml":
|
case 'yaml':
|
||||||
return plugins.yaml.safeLoad(fileStringArg);
|
return plugins.yaml.safeLoad(fileStringArg);
|
||||||
case "json":
|
case 'json':
|
||||||
return JSON.parse(fileStringArg);
|
return JSON.parse(fileStringArg);
|
||||||
default:
|
default:
|
||||||
plugins.beautylog.error("file type " + fileTypeArg.blue + " not supported");
|
console.error('file type ' + fileTypeArg.blue + ' not supported');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRmaWxlLmludGVycHJldGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRmaWxlLmludGVycHJldGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsK0NBQStDO0FBRXBDLFFBQUEsUUFBUSxHQUFHLENBQUMsT0FBZSxFQUFVLEVBQUU7SUFDOUMsSUFBSSxPQUFPLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUE7SUFDM0MsSUFBSSxRQUFRLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxZQUFZLEVBQUMsSUFBSSxDQUFDLENBQUEsQ0FBQyx5QkFBeUI7SUFDM0UsT0FBTyxRQUFRLENBQUE7QUFDbkIsQ0FBQyxDQUFBO0FBRVUsUUFBQSxVQUFVLEdBQUcsQ0FBQyxhQUFxQixFQUFFLFdBQVcsRUFBRSxFQUFFO0lBQzNELFFBQVEsV0FBVyxFQUFFO1FBQ2pCLEtBQUssS0FBSyxDQUFFO1FBQ1osS0FBSyxNQUFNO1lBQ1AsT0FBTyxPQUFPLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxhQUFhLENBQUMsQ0FBQTtRQUMvQyxLQUFLLE1BQU07WUFDUCxPQUFPLElBQUksQ0FBQyxLQUFLLENBQUMsYUFBYSxDQUFDLENBQUE7UUFDcEM7WUFDSSxPQUFPLENBQUMsS0FBSyxDQUFDLFlBQVksR0FBRyxXQUFXLENBQUMsSUFBSSxHQUFHLGdCQUFnQixDQUFDLENBQUE7WUFDakUsTUFBSztLQUNaO0FBQ0wsQ0FBQyxDQUFBIn0=
|
||||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0ZmlsZS5pbnRlcnByZXRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBRXhCLElBQU8sT0FBTyxXQUFXLHFCQUFxQixDQUFDLENBQUM7QUFFckMsZ0JBQVEsR0FBRyxVQUFDLE9BQWM7SUFDakMsSUFBSSxPQUFPLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUM7SUFDNUMsSUFBSSxRQUFRLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxZQUFZLEVBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyx3QkFBd0I7SUFDM0UsTUFBTSxDQUFDLFFBQVEsQ0FBQztBQUNwQixDQUFDLENBQUM7QUFFUyxrQkFBVSxHQUFHLFVBQUMsYUFBb0IsRUFBRSxXQUFXO0lBQ3RELE1BQU0sQ0FBQyxDQUFDLFdBQVcsQ0FBQyxDQUFDLENBQUM7UUFDbEIsS0FBSyxLQUFLLENBQUU7UUFDWixLQUFLLE1BQU07WUFDUCxNQUFNLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsYUFBYSxDQUFDLENBQUM7UUFDaEQsS0FBSyxNQUFNO1lBQ1AsTUFBTSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsYUFBYSxDQUFDLENBQUM7UUFDckM7WUFDSSxPQUFPLENBQUMsU0FBUyxDQUFDLEtBQUssQ0FBQyxZQUFZLEdBQUcsV0FBVyxDQUFDLElBQUksR0FBRyxnQkFBZ0IsQ0FBQyxDQUFDO1lBQzVFLEtBQUssQ0FBQztJQUNkLENBQUM7QUFDTCxDQUFDLENBQUEiLCJmaWxlIjoic21hcnRmaWxlLmludGVycHJldGVyLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy1nbG9iYWxcIjtcblxuaW1wb3J0IHBsdWdpbnMgPSByZXF1aXJlKFwiLi9zbWFydGZpbGUucGx1Z2luc1wiKTtcblxuZXhwb3J0IGxldCBmaWxldHlwZSA9IChwYXRoQXJnOnN0cmluZyk6c3RyaW5nID0+IHtcbiAgICBsZXQgZXh0TmFtZSA9IHBsdWdpbnMucGF0aC5leHRuYW1lKHBhdGhBcmcpO1xuICAgIGxldCBmaWxlVHlwZSA9IGV4dE5hbWUucmVwbGFjZSgvXFwuKFthLXpdKikvLFwiJDFcIik7IC8vcmVtb3ZlIC4gZm9ybSBmaWxlVHlwZVxuICAgIHJldHVybiBmaWxlVHlwZTtcbn07XG5cbmV4cG9ydCBsZXQgb2JqZWN0RmlsZSA9IChmaWxlU3RyaW5nQXJnOnN0cmluZywgZmlsZVR5cGVBcmcpID0+IHtcbiAgICBzd2l0Y2ggKGZpbGVUeXBlQXJnKSB7XG4gICAgICAgIGNhc2UgXCJ5bWxcIiA6XG4gICAgICAgIGNhc2UgXCJ5YW1sXCI6XG4gICAgICAgICAgICByZXR1cm4gcGx1Z2lucy55YW1sLnNhZmVMb2FkKGZpbGVTdHJpbmdBcmcpO1xuICAgICAgICBjYXNlIFwianNvblwiOlxuICAgICAgICAgICAgcmV0dXJuIEpTT04ucGFyc2UoZmlsZVN0cmluZ0FyZyk7XG4gICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICBwbHVnaW5zLmJlYXV0eWxvZy5lcnJvcihcImZpbGUgdHlwZSBcIiArIGZpbGVUeXBlQXJnLmJsdWUgKyBcIiBub3Qgc3VwcG9ydGVkXCIpO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgfVxufSJdfQ==
|
|
50
dist/smartfile.memory.d.ts
vendored
50
dist/smartfile.memory.d.ts
vendored
@ -1,13 +1,4 @@
|
|||||||
import "typings-global";
|
import { Smartfile } from './smartfile.classes.smartfile';
|
||||||
import plugins = require("./smartfile.plugins");
|
|
||||||
/**
|
|
||||||
* allows you to create a gulp stream
|
|
||||||
* from String, from an Array of Strings, from Vinyl File, from an Array of VinylFiles
|
|
||||||
* @param fileArg
|
|
||||||
* @returns stream.Readable
|
|
||||||
* @TODO: make it async;
|
|
||||||
*/
|
|
||||||
export declare let toGulpStream: (fileArg: string | string[] | plugins.vinyl | plugins.vinyl[], baseArg?: string) => any;
|
|
||||||
/**
|
/**
|
||||||
* converts file to Object
|
* converts file to Object
|
||||||
* @param fileStringArg
|
* @param fileStringArg
|
||||||
@ -15,35 +6,20 @@ export declare let toGulpStream: (fileArg: string | string[] | plugins.vinyl | p
|
|||||||
* @returns {any|any}
|
* @returns {any|any}
|
||||||
*/
|
*/
|
||||||
export declare let toObject: (fileStringArg: string, fileTypeArg: string) => any;
|
export declare let toObject: (fileStringArg: string, fileTypeArg: string) => any;
|
||||||
|
export interface IToFsOptions {
|
||||||
|
respectRelative?: boolean;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* takes a string and converts it to vinyl file
|
* writes string or Smartfile to disk.
|
||||||
* @param fileArg
|
|
||||||
* @param optionsArg
|
|
||||||
*/
|
|
||||||
export declare let toVinylFileSync: (fileArg: string, optionsArg?: {
|
|
||||||
filename?: string;
|
|
||||||
base?: string;
|
|
||||||
relPath?: string;
|
|
||||||
}) => plugins.vinyl;
|
|
||||||
/**
|
|
||||||
* takes a string array and some options and returns a vinylfile array
|
|
||||||
* @param arrayArg
|
|
||||||
* @param optionsArg
|
|
||||||
*/
|
|
||||||
export declare let toVinylArraySync: (arrayArg: string[], optionsArg?: {
|
|
||||||
filename?: string;
|
|
||||||
base?: string;
|
|
||||||
relPath?: string;
|
|
||||||
}) => any[];
|
|
||||||
/**
|
|
||||||
* takes a vinylFile object and converts it to String
|
|
||||||
*/
|
|
||||||
export declare let toStringSync: (fileArg: plugins.vinyl) => string;
|
|
||||||
/**
|
|
||||||
* writes string or vinyl file to disk.
|
|
||||||
* @param fileArg
|
* @param fileArg
|
||||||
* @param fileNameArg
|
* @param fileNameArg
|
||||||
* @param fileBaseArg
|
* @param fileBaseArg
|
||||||
*/
|
*/
|
||||||
export declare let toFs: (fileContentArg: string | plugins.vinyl, filePathArg: any) => any;
|
export declare let toFs: (fileContentArg: string | Smartfile, filePathArg: any, optionsArg?: IToFsOptions) => Promise<{}>;
|
||||||
export declare let toFsSync: (fileArg: any, filePathArg: string) => void;
|
/**
|
||||||
|
* writes a string or a Smartfile to disk synchronously, only supports string
|
||||||
|
* @param fileArg
|
||||||
|
* @param filePathArg
|
||||||
|
*/
|
||||||
|
export declare let toFsSync: (fileArg: string, filePathArg: string) => void;
|
||||||
|
export declare let smartfileArrayToFs: (smartfileArrayArg: Smartfile[], dirArg: string) => Promise<void>;
|
||||||
|
167
dist/smartfile.memory.js
vendored
167
dist/smartfile.memory.js
vendored
File diff suppressed because one or more lines are too long
20
dist/smartfile.plugins.d.ts
vendored
20
dist/smartfile.plugins.d.ts
vendored
@ -1,14 +1,10 @@
|
|||||||
import "typings-global";
|
export import fs = require('fs');
|
||||||
export declare let beautylog: any;
|
export import fsExtra = require('fs-extra');
|
||||||
export declare let fs: any;
|
export declare let glob: any;
|
||||||
export declare let gulp: any;
|
export import path = require('path');
|
||||||
export declare let g: {
|
export import smartpromise = require('@pushrocks/smartpromise');
|
||||||
remoteSrc: any;
|
export import smartrequest = require('smartrequest');
|
||||||
};
|
export declare let requireReload: any;
|
||||||
export import path = require("path");
|
export import smartpath = require('smartpath');
|
||||||
export declare let q: any;
|
|
||||||
export import vinyl = require("vinyl");
|
|
||||||
export declare let vinylFile: any;
|
export declare let vinylFile: any;
|
||||||
export declare let yaml: any;
|
export declare let yaml: any;
|
||||||
export declare let request: any;
|
|
||||||
export declare let requireReload: any;
|
|
||||||
|
26
dist/smartfile.plugins.js
vendored
26
dist/smartfile.plugins.js
vendored
@ -1,17 +1,13 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require("typings-global");
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.beautylog = require("beautylog");
|
exports.fs = require("fs");
|
||||||
exports.fs = require("fs-extra");
|
exports.fsExtra = require("fs-extra");
|
||||||
exports.gulp = require("gulp");
|
exports.glob = require('glob');
|
||||||
exports.g = {
|
|
||||||
remoteSrc: require("gulp-remote-src")
|
|
||||||
};
|
|
||||||
exports.path = require("path");
|
exports.path = require("path");
|
||||||
exports.q = require("q");
|
exports.smartpromise = require("@pushrocks/smartpromise");
|
||||||
exports.vinyl = require("vinyl");
|
exports.smartrequest = require("smartrequest");
|
||||||
exports.vinylFile = require("vinyl-file");
|
exports.requireReload = require('require-reload');
|
||||||
exports.yaml = require("js-yaml");
|
exports.smartpath = require("smartpath");
|
||||||
exports.request = require("request");
|
exports.vinylFile = require('vinyl-file');
|
||||||
exports.requireReload = require("require-reload");
|
exports.yaml = require('js-yaml');
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRmaWxlLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGZpbGUucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJCQUFnQztBQUNoQyxzQ0FBMkM7QUFDaEMsUUFBQSxJQUFJLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFBO0FBQ2pDLCtCQUFvQztBQUNwQywwREFBK0Q7QUFDL0QsK0NBQW9EO0FBQ3pDLFFBQUEsYUFBYSxHQUFHLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ3BELHlDQUE4QztBQUNuQyxRQUFBLFNBQVMsR0FBRyxPQUFPLENBQUMsWUFBWSxDQUFDLENBQUE7QUFDakMsUUFBQSxJQUFJLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFBIn0=
|
||||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0ZmlsZS5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDYixpQkFBUyxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQztBQUNqQyxVQUFFLEdBQUcsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFDO0FBQ3pCLFlBQUksR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUM7QUFDdkIsU0FBQyxHQUFHO0lBQ1gsU0FBUyxFQUFFLE9BQU8sQ0FBQyxpQkFBaUIsQ0FBQztDQUN4QyxDQUFDO0FBQ1ksWUFBSSxXQUFXLE1BQU0sQ0FBQyxDQUFDO0FBQzFCLFNBQUMsR0FBRyxPQUFPLENBQUMsR0FBRyxDQUFDLENBQUM7QUFDZCxhQUFLLFdBQVcsT0FBTyxDQUFDLENBQUM7QUFDNUIsaUJBQVMsR0FBRyxPQUFPLENBQUMsWUFBWSxDQUFDLENBQUM7QUFDbEMsWUFBSSxHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUMsQ0FBQztBQUMxQixlQUFPLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0FBQzdCLHFCQUFhLEdBQUcsT0FBTyxDQUFDLGdCQUFnQixDQUFDLENBQUMiLCJmaWxlIjoic21hcnRmaWxlLnBsdWdpbnMuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgXCJ0eXBpbmdzLWdsb2JhbFwiO1xuZXhwb3J0IGxldCBiZWF1dHlsb2cgPSByZXF1aXJlKFwiYmVhdXR5bG9nXCIpO1xuZXhwb3J0IGxldCBmcyA9IHJlcXVpcmUoXCJmcy1leHRyYVwiKTtcbmV4cG9ydCBsZXQgZ3VscCA9IHJlcXVpcmUoXCJndWxwXCIpO1xuZXhwb3J0IGxldCBnID0ge1xuICAgIHJlbW90ZVNyYzogcmVxdWlyZShcImd1bHAtcmVtb3RlLXNyY1wiKVxufTtcbmV4cG9ydCBpbXBvcnQgcGF0aCA9IHJlcXVpcmUoXCJwYXRoXCIpO1xuZXhwb3J0IGxldCBxID0gcmVxdWlyZShcInFcIik7XG5leHBvcnQgaW1wb3J0IHZpbnlsID0gcmVxdWlyZShcInZpbnlsXCIpO1xuZXhwb3J0IGxldCB2aW55bEZpbGUgPSByZXF1aXJlKFwidmlueWwtZmlsZVwiKTtcbmV4cG9ydCBsZXQgeWFtbCA9IHJlcXVpcmUoXCJqcy15YW1sXCIpO1xuZXhwb3J0IGxldCByZXF1ZXN0ID0gcmVxdWlyZShcInJlcXVlc3RcIik7XG5leHBvcnQgbGV0IHJlcXVpcmVSZWxvYWQgPSByZXF1aXJlKFwicmVxdWlyZS1yZWxvYWRcIik7XG4iXX0=
|
|
12
dist/smartfile.remote.d.ts
vendored
12
dist/smartfile.remote.d.ts
vendored
@ -1,20 +1,12 @@
|
|||||||
import "typings-global";
|
|
||||||
export declare let toFs: (from: string, toPath: string) => any;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param filePathArg
|
|
||||||
* @returns {*}
|
|
||||||
*/
|
|
||||||
export declare let toGulpStreamSync: (filePathArg: string, baseArg: string) => any;
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param fromArg
|
* @param fromArg
|
||||||
* @returns {any}
|
* @returns {any}
|
||||||
*/
|
*/
|
||||||
export declare let toObject: (fromArg: string) => any;
|
export declare let toObject: (fromArg: string) => Promise<{}>;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param fromArg
|
* @param fromArg
|
||||||
* @returns {any}
|
* @returns {any}
|
||||||
*/
|
*/
|
||||||
export declare let toString: (fromArg: string) => any;
|
export declare let toString: (fromArg: string) => Promise<{}>;
|
||||||
|
66
dist/smartfile.remote.js
vendored
66
dist/smartfile.remote.js
vendored
File diff suppressed because one or more lines are too long
43
docs/index.md
Normal file
43
docs/index.md
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# smartfile
|
||||||
|
|
||||||
|
make files easily accessible for processing in javascript.
|
||||||
|
|
||||||
|
## Availabililty
|
||||||
|
|
||||||
|
[](https://www.npmjs.com/package/smartfile)
|
||||||
|
[](https://gitlab.com/pushrocks/smartfile)
|
||||||
|
[](https://github.com/pushrocks/smartfile)
|
||||||
|
[](https://pushrocks.gitlab.io/smartfile/)
|
||||||
|
|
||||||
|
## Status for master
|
||||||
|
|
||||||
|
[](https://gitlab.com/pushrocks/smartfile/commits/master)
|
||||||
|
[](https://gitlab.com/pushrocks/smartfile/commits/master)
|
||||||
|
[](https://david-dm.org/pushrocks/smartfile)
|
||||||
|
[](https://www.bithound.io/github/pushrocks/smartfile/master/dependencies/npm)
|
||||||
|
[](https://www.bithound.io/github/pushrocks/smartfile)
|
||||||
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[](http://standardjs.com/)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
smartfile is an approach of being one tool to handle files in diverse environments.
|
||||||
|
|
||||||
|
### Smartfile Sections
|
||||||
|
|
||||||
|
smartfile thinks in sections:
|
||||||
|
|
||||||
|
| section | description |
|
||||||
|
| ----------- | ---------------------------------------------------------------------------- |
|
||||||
|
| fs | (object) gets data from fs to somewhere |
|
||||||
|
| memory | gets data from memory to somewhere |
|
||||||
|
| remote | gets data from remote locations to somewhere |
|
||||||
|
| interpreter | (object) handles yaml and json |
|
||||||
|
| smartfile | (class) a virtual representation of a file, alternative to vinyl file format |
|
||||||
|
|
||||||
|
For further information read the linked docs at the top of this README.
|
||||||
|
|
||||||
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
|
|
||||||
|
[](https://push.rocks)
|
15
npmextra.json
Normal file
15
npmextra.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"npmts":{
|
||||||
|
"mode":"default",
|
||||||
|
"coverageTreshold":70
|
||||||
|
},
|
||||||
|
"npmdocker":{
|
||||||
|
|
||||||
|
},
|
||||||
|
"npmci": {
|
||||||
|
"npmGlobalTools": [
|
||||||
|
"npmts"
|
||||||
|
],
|
||||||
|
"npmAccessLevel": "public"
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"mode":"default",
|
|
||||||
"codecov":true,
|
|
||||||
"coverageTreshold":80
|
|
||||||
}
|
|
766
package-lock.json
generated
Normal file
766
package-lock.json
generated
Normal file
@ -0,0 +1,766 @@
|
|||||||
|
{
|
||||||
|
"name": "@pushrocks/smartfile",
|
||||||
|
"version": "6.0.1",
|
||||||
|
"lockfileVersion": 1,
|
||||||
|
"requires": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@airbnb/node-memwatch": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@airbnb/node-memwatch/-/node-memwatch-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-2R+MEEMSTUdKwQ6NFWkyA/UNoSjL1tMldZqJbZpgXSwNMBzlNlkUWEXKu9RqTTMkDqJRfGJ2VDs8gPlPK2APDQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"bindings": "^1.3.0",
|
||||||
|
"nan": "^2.9.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@pushrocks/smartpromise": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@pushrocks/smartpromise/-/smartpromise-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-Rr4aLO2spAQ58TB9l3UwVs+keQu7gPXcYSO/5zLYNimEP7H237tFApX/qk80nwvHh2ATTBTgu0IcWKhHb5uVow==",
|
||||||
|
"requires": {
|
||||||
|
"util.promisify": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@types/chai": {
|
||||||
|
"version": "4.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.1.4.tgz",
|
||||||
|
"integrity": "sha512-h6+VEw2Vr3ORiFCyyJmcho2zALnUq9cvdB/IO8Xs9itrJVCenC7o26A6+m7D0ihTTr65eS259H5/Ghl/VjYs6g==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"@types/chai-as-promised": {
|
||||||
|
"version": "7.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/chai-as-promised/-/chai-as-promised-7.1.0.tgz",
|
||||||
|
"integrity": "sha512-MFiW54UOSt+f2bRw8J7LgQeIvE/9b4oGvwU7XW30S9QGAiHGnU/fmiOprsyMkdmH2rl8xSPc0/yrQw8juXU6bQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/chai": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@types/chai-string": {
|
||||||
|
"version": "1.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/chai-string/-/chai-string-1.4.1.tgz",
|
||||||
|
"integrity": "sha512-aRNMs6TKgjgPlCHwDfq/YNy5VtRR2hJ4AUWByddrT0TRVVD8eX4MiHW6/iHvmQHRlVuuPZcwnTUE7b4yFt7bEA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/chai": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@types/fs-extra": {
|
||||||
|
"version": "5.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.0.3.tgz",
|
||||||
|
"integrity": "sha512-m2QKoRrJnei1s10e1ZfMIa7QcABBVLdQhVUv5+bMRaHhPzxO/IWMmREiags59AqFbI+piWPq/PupTahNS/0kyA==",
|
||||||
|
"requires": {
|
||||||
|
"@types/node": "*"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@types/node": {
|
||||||
|
"version": "10.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.5.1.tgz",
|
||||||
|
"integrity": "sha512-AFLl1IALIuyt6oK4AYZsgWVJ/5rnyzQWud7IebaZWWV3YmgtPZkQmYio9R5Ze/2pdd7XfqF5bP+hWS11mAKoOQ=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@types/node": {
|
||||||
|
"version": "10.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.5.1.tgz",
|
||||||
|
"integrity": "sha512-AFLl1IALIuyt6oK4AYZsgWVJ/5rnyzQWud7IebaZWWV3YmgtPZkQmYio9R5Ze/2pdd7XfqF5bP+hWS11mAKoOQ=="
|
||||||
|
},
|
||||||
|
"@types/through2": {
|
||||||
|
"version": "2.0.33",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/through2/-/through2-2.0.33.tgz",
|
||||||
|
"integrity": "sha1-H/LoihAN+1sUDnu5h5HxGUQA0TE=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@types/vinyl": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/vinyl/-/vinyl-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-2iYpNuOl98SrLPBZfEN9Mh2JCJ2EI9HU35SfgBEb51DcmaHkhp8cKMblYeBqMQiwXMgAD3W60DbQ4i/UdLiXhw==",
|
||||||
|
"requires": {
|
||||||
|
"@types/node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ansi-256-colors": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz",
|
||||||
|
"integrity": "sha1-kQ3lDvzHwJ49gvL4er1rcAwYgYo=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"argparse": {
|
||||||
|
"version": "1.0.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||||
|
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
|
||||||
|
"requires": {
|
||||||
|
"sprintf-js": "~1.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"assertion-error": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"balanced-match": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
|
||||||
|
},
|
||||||
|
"beautycolor": {
|
||||||
|
"version": "1.0.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/beautycolor/-/beautycolor-1.0.11.tgz",
|
||||||
|
"integrity": "sha512-Uxl/39+2uqixPzsrV+0NOHf0sJlWmsKnRTV0oz8+bfwnHPA/E+SZuh3Upn3OXobv0W7LZg5BVoLj1nkMj7m5jA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"ansi-256-colors": "^1.1.0",
|
||||||
|
"typings-global": "^1.0.14"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bindings": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"brace-expansion": {
|
||||||
|
"version": "1.1.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||||
|
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||||
|
"requires": {
|
||||||
|
"balanced-match": "^1.0.0",
|
||||||
|
"concat-map": "0.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"chai": {
|
||||||
|
"version": "4.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz",
|
||||||
|
"integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"assertion-error": "^1.0.1",
|
||||||
|
"check-error": "^1.0.1",
|
||||||
|
"deep-eql": "^3.0.0",
|
||||||
|
"get-func-name": "^2.0.0",
|
||||||
|
"pathval": "^1.0.0",
|
||||||
|
"type-detect": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"chai-as-promised": {
|
||||||
|
"version": "7.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz",
|
||||||
|
"integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"check-error": "^1.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"chai-string": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/chai-string/-/chai-string-1.4.0.tgz",
|
||||||
|
"integrity": "sha1-NZFAwFHTak5LGl/GuRAVL0OKjUk=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"check-error": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
|
||||||
|
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"clone": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/clone/-/clone-2.1.1.tgz",
|
||||||
|
"integrity": "sha1-0hfR6WERjjrJpLi7oyhVU79kfNs="
|
||||||
|
},
|
||||||
|
"clone-buffer": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg="
|
||||||
|
},
|
||||||
|
"clone-stats": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA="
|
||||||
|
},
|
||||||
|
"cloneable-readable": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/cloneable-readable/-/cloneable-readable-1.1.2.tgz",
|
||||||
|
"integrity": "sha512-Bq6+4t+lbM8vhTs/Bef5c5AdEMtapp/iFb6+s4/Hh9MVTt8OLKH7ZOOZSCT+Ys7hsHvqv0GuMPJ1lnQJVHvxpg==",
|
||||||
|
"requires": {
|
||||||
|
"inherits": "^2.0.1",
|
||||||
|
"process-nextick-args": "^2.0.0",
|
||||||
|
"readable-stream": "^2.3.5"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"concat-map": {
|
||||||
|
"version": "0.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
|
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
||||||
|
},
|
||||||
|
"core-util-is": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||||
|
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
|
||||||
|
},
|
||||||
|
"deep-eql": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"type-detect": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"define-properties": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz",
|
||||||
|
"integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=",
|
||||||
|
"requires": {
|
||||||
|
"foreach": "^2.0.5",
|
||||||
|
"object-keys": "^1.0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"early": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/early/-/early-2.1.1.tgz",
|
||||||
|
"integrity": "sha1-hB4jJU6l3FTYr67ugvWrZcAO4jw=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"beautycolor": "^1.0.7",
|
||||||
|
"smartq": "^1.1.1",
|
||||||
|
"typings-global": "^1.0.16"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"smartq": {
|
||||||
|
"version": "1.1.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/smartq/-/smartq-1.1.8.tgz",
|
||||||
|
"integrity": "sha512-FURlYW/C3bLeZjJcBVyw7bxCyQoCXiXbLCZcDUKznhXHaLu35c8m33/a2H8CA0rtb82lvzN8dRLnBZAcNMzNHQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"util.promisify": "^1.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"es-abstract": {
|
||||||
|
"version": "1.12.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz",
|
||||||
|
"integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==",
|
||||||
|
"requires": {
|
||||||
|
"es-to-primitive": "^1.1.1",
|
||||||
|
"function-bind": "^1.1.1",
|
||||||
|
"has": "^1.0.1",
|
||||||
|
"is-callable": "^1.1.3",
|
||||||
|
"is-regex": "^1.0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"es-to-primitive": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.1.1.tgz",
|
||||||
|
"integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=",
|
||||||
|
"requires": {
|
||||||
|
"is-callable": "^1.1.1",
|
||||||
|
"is-date-object": "^1.0.1",
|
||||||
|
"is-symbol": "^1.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"es6-error": {
|
||||||
|
"version": "4.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz",
|
||||||
|
"integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"esprima": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw=="
|
||||||
|
},
|
||||||
|
"first-chunk-stream": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-G97NuOCDwGZLkZRVgVd6Q6nzHXA=",
|
||||||
|
"requires": {
|
||||||
|
"readable-stream": "^2.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"foreach": {
|
||||||
|
"version": "2.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz",
|
||||||
|
"integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k="
|
||||||
|
},
|
||||||
|
"fs-extra": {
|
||||||
|
"version": "6.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-6.0.1.tgz",
|
||||||
|
"integrity": "sha512-GnyIkKhhzXZUWFCaJzvyDLEEgDkPfb4/TPvJCJVuS8MWZgoSsErf++QpiAlDnKFcqhRlm+tIOcencCjyJE6ZCA==",
|
||||||
|
"requires": {
|
||||||
|
"graceful-fs": "^4.1.2",
|
||||||
|
"jsonfile": "^4.0.0",
|
||||||
|
"universalify": "^0.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"fs.realpath": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
||||||
|
},
|
||||||
|
"function-bind": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
|
||||||
|
},
|
||||||
|
"get-func-name": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"glob": {
|
||||||
|
"version": "7.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
|
||||||
|
"integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
|
||||||
|
"requires": {
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"graceful-fs": {
|
||||||
|
"version": "4.1.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz",
|
||||||
|
"integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg="
|
||||||
|
},
|
||||||
|
"gulp-function": {
|
||||||
|
"version": "2.2.14",
|
||||||
|
"resolved": "https://registry.npmjs.org/gulp-function/-/gulp-function-2.2.14.tgz",
|
||||||
|
"integrity": "sha512-tNNqKklcSia6AbOyPfvSUSXc3dOq7ZSuCN/o3YE0IcJVZdzftqgSFeeqTgyzvWMpPldo2lZ7D4jeW+kr52fUxw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/through2": "^2.0.32",
|
||||||
|
"smartq": "^1.1.6",
|
||||||
|
"through2": "^2.0.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"smartq": {
|
||||||
|
"version": "1.1.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/smartq/-/smartq-1.1.8.tgz",
|
||||||
|
"integrity": "sha512-FURlYW/C3bLeZjJcBVyw7bxCyQoCXiXbLCZcDUKznhXHaLu35c8m33/a2H8CA0rtb82lvzN8dRLnBZAcNMzNHQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"util.promisify": "^1.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"has": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
|
||||||
|
"requires": {
|
||||||
|
"function-bind": "^1.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"home": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/home/-/home-1.0.1.tgz",
|
||||||
|
"integrity": "sha1-lqQjzrSbmDeP9e886uBZpVf53TU=",
|
||||||
|
"requires": {
|
||||||
|
"os-homedir": "^1.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"inflight": {
|
||||||
|
"version": "1.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||||
|
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||||
|
"requires": {
|
||||||
|
"once": "^1.3.0",
|
||||||
|
"wrappy": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"inherits": {
|
||||||
|
"version": "2.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||||
|
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
|
||||||
|
},
|
||||||
|
"is-callable": {
|
||||||
|
"version": "1.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.3.tgz",
|
||||||
|
"integrity": "sha1-hut1OSgF3cM69xySoO7fdO52BLI="
|
||||||
|
},
|
||||||
|
"is-date-object": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz",
|
||||||
|
"integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY="
|
||||||
|
},
|
||||||
|
"is-regex": {
|
||||||
|
"version": "1.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz",
|
||||||
|
"integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=",
|
||||||
|
"requires": {
|
||||||
|
"has": "^1.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"is-symbol": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz",
|
||||||
|
"integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI="
|
||||||
|
},
|
||||||
|
"is-utf8": {
|
||||||
|
"version": "0.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
|
||||||
|
"integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI="
|
||||||
|
},
|
||||||
|
"isarray": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
|
||||||
|
},
|
||||||
|
"js-yaml": {
|
||||||
|
"version": "3.12.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz",
|
||||||
|
"integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==",
|
||||||
|
"requires": {
|
||||||
|
"argparse": "^1.0.7",
|
||||||
|
"esprima": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"jsonfile": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
|
||||||
|
"integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
|
||||||
|
"requires": {
|
||||||
|
"graceful-fs": "^4.1.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"leakage": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/leakage/-/leakage-0.4.0.tgz",
|
||||||
|
"integrity": "sha512-x7gYK5n5dPkHDZWJ2Kh8Ag1hZNzUh+HtXn8Bv1aDdN6o6ONPCJ8sOfFq+kxcULJFp3lXaCjXb3iXOLmQRbBLwA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@airbnb/node-memwatch": "^1.0.2",
|
||||||
|
"es6-error": "^4.0.2",
|
||||||
|
"left-pad": "^1.1.3",
|
||||||
|
"minimist": "^1.2.0",
|
||||||
|
"pretty-bytes": "^4.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"left-pad": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"minimatch": {
|
||||||
|
"version": "3.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||||
|
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||||
|
"requires": {
|
||||||
|
"brace-expansion": "^1.1.7"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"minimist": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||||
|
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"nan": {
|
||||||
|
"version": "2.10.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz",
|
||||||
|
"integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"object-keys": {
|
||||||
|
"version": "1.0.12",
|
||||||
|
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz",
|
||||||
|
"integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag=="
|
||||||
|
},
|
||||||
|
"object.getownpropertydescriptors": {
|
||||||
|
"version": "2.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz",
|
||||||
|
"integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=",
|
||||||
|
"requires": {
|
||||||
|
"define-properties": "^1.1.2",
|
||||||
|
"es-abstract": "^1.5.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"once": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||||
|
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||||
|
"requires": {
|
||||||
|
"wrappy": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"os-homedir": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
|
||||||
|
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M="
|
||||||
|
},
|
||||||
|
"path-is-absolute": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||||
|
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
|
||||||
|
},
|
||||||
|
"pathval": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz",
|
||||||
|
"integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"pify": {
|
||||||
|
"version": "2.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
|
||||||
|
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
|
||||||
|
},
|
||||||
|
"pretty-bytes": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-4.0.2.tgz",
|
||||||
|
"integrity": "sha1-sr+C5zUNZcbDOqlaqlpPYyf2HNk=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"process-nextick-args": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw=="
|
||||||
|
},
|
||||||
|
"readable-stream": {
|
||||||
|
"version": "2.3.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
|
||||||
|
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
|
||||||
|
"requires": {
|
||||||
|
"core-util-is": "~1.0.0",
|
||||||
|
"inherits": "~2.0.3",
|
||||||
|
"isarray": "~1.0.0",
|
||||||
|
"process-nextick-args": "~2.0.0",
|
||||||
|
"safe-buffer": "~5.1.1",
|
||||||
|
"string_decoder": "~1.1.1",
|
||||||
|
"util-deprecate": "~1.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"remove-trailing-separator": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz",
|
||||||
|
"integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8="
|
||||||
|
},
|
||||||
|
"replace-ext": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs="
|
||||||
|
},
|
||||||
|
"require-reload": {
|
||||||
|
"version": "0.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/require-reload/-/require-reload-0.2.2.tgz",
|
||||||
|
"integrity": "sha1-KadZGEbK+RtuijzamRaD+V+NfUI="
|
||||||
|
},
|
||||||
|
"safe-buffer": {
|
||||||
|
"version": "5.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||||
|
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||||
|
},
|
||||||
|
"smartchai": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/smartchai/-/smartchai-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-9M+R56OhAHXScxgr2vzQqxGx0XMS0QXriNZuP7hjlbVbo2FUT+l60iEzbwPt9Ga+5u2cEEjSSoZEQVqlROaddA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/chai": "^4.1.2",
|
||||||
|
"@types/chai-as-promised": "^7.1.0",
|
||||||
|
"@types/chai-string": "^1.4.0",
|
||||||
|
"chai": "^4.1.2",
|
||||||
|
"chai-as-promised": "^7.1.1",
|
||||||
|
"chai-string": "^1.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"smartdelay": {
|
||||||
|
"version": "1.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/smartdelay/-/smartdelay-1.0.4.tgz",
|
||||||
|
"integrity": "sha512-ab+d8ADiMMPKwrQNhoJYjmOR20VIIIxjknoEF9/PfMryic7tmvTmFrDMdcnMRohGNw/pN+4/I5dSUBdsDya7uw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"smartq": "^1.1.1",
|
||||||
|
"typings-global": "^1.0.16"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"smartq": {
|
||||||
|
"version": "1.1.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/smartq/-/smartq-1.1.8.tgz",
|
||||||
|
"integrity": "sha512-FURlYW/C3bLeZjJcBVyw7bxCyQoCXiXbLCZcDUKznhXHaLu35c8m33/a2H8CA0rtb82lvzN8dRLnBZAcNMzNHQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"util.promisify": "^1.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"smartpath": {
|
||||||
|
"version": "3.2.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/smartpath/-/smartpath-3.2.8.tgz",
|
||||||
|
"integrity": "sha1-SDS9OouuIpW6rK26I8h6UBlS+UA=",
|
||||||
|
"requires": {
|
||||||
|
"home": "^1.0.1",
|
||||||
|
"typings-global": "^1.0.14"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"smartrequest": {
|
||||||
|
"version": "1.0.13",
|
||||||
|
"resolved": "https://registry.npmjs.org/smartrequest/-/smartrequest-1.0.13.tgz",
|
||||||
|
"integrity": "sha512-OHrvzaxaA8Z8bJr33yxnyJF35nrWyaumsajqXm2Zkv0/2hfWO1NQAj02VVV51rLQfmtU0Hex7Nk19SoC8nOmYg==",
|
||||||
|
"requires": {
|
||||||
|
"smartq": "^1.1.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"smartq": {
|
||||||
|
"version": "1.1.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/smartq/-/smartq-1.1.8.tgz",
|
||||||
|
"integrity": "sha512-FURlYW/C3bLeZjJcBVyw7bxCyQoCXiXbLCZcDUKznhXHaLu35c8m33/a2H8CA0rtb82lvzN8dRLnBZAcNMzNHQ==",
|
||||||
|
"requires": {
|
||||||
|
"util.promisify": "^1.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sprintf-js": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||||
|
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
|
||||||
|
},
|
||||||
|
"string_decoder": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||||
|
"requires": {
|
||||||
|
"safe-buffer": "~5.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"strip-bom": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=",
|
||||||
|
"requires": {
|
||||||
|
"is-utf8": "^0.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"strip-bom-buf": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/strip-bom-buf/-/strip-bom-buf-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-HLRar1dTD0yvhsf3UXnSyaUd1XI=",
|
||||||
|
"requires": {
|
||||||
|
"is-utf8": "^0.2.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"strip-bom-stream": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/strip-bom-stream/-/strip-bom-stream-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-+H217yYT9paKpUWr/h7HKLaoKco=",
|
||||||
|
"requires": {
|
||||||
|
"first-chunk-stream": "^2.0.0",
|
||||||
|
"strip-bom": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tapbundle": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/tapbundle/-/tapbundle-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-y3ulfK4GKoVkuqF2QsrwVMWLXHqXeoDEzsw/Q9ZTJumNINbx4bcWPAdg2IcTHYgJHeSdF03HiB9EbHoUTRjD9Q==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"early": "^2.1.1",
|
||||||
|
"leakage": "^0.4.0",
|
||||||
|
"smartchai": "^2.0.1",
|
||||||
|
"smartdelay": "^1.0.4",
|
||||||
|
"smartq": "^1.1.8"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"smartq": {
|
||||||
|
"version": "1.1.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/smartq/-/smartq-1.1.8.tgz",
|
||||||
|
"integrity": "sha512-FURlYW/C3bLeZjJcBVyw7bxCyQoCXiXbLCZcDUKznhXHaLu35c8m33/a2H8CA0rtb82lvzN8dRLnBZAcNMzNHQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"util.promisify": "^1.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"through2": {
|
||||||
|
"version": "2.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz",
|
||||||
|
"integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"readable-stream": "^2.1.5",
|
||||||
|
"xtend": "~4.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"type-detect": {
|
||||||
|
"version": "4.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
|
||||||
|
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"typings-global": {
|
||||||
|
"version": "1.0.28",
|
||||||
|
"resolved": "https://registry.npmjs.org/typings-global/-/typings-global-1.0.28.tgz",
|
||||||
|
"integrity": "sha512-6VOwJWEY2971HOMHu/7sURzUXiD4/LiMJPsMAOqkHHAtS3MVpLFE5gzTiHilsH9KY5VE1mBQirWIgWFsDuo90A=="
|
||||||
|
},
|
||||||
|
"universalify": {
|
||||||
|
"version": "0.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
|
||||||
|
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="
|
||||||
|
},
|
||||||
|
"util-deprecate": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||||
|
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||||
|
},
|
||||||
|
"util.promisify": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==",
|
||||||
|
"requires": {
|
||||||
|
"define-properties": "^1.1.2",
|
||||||
|
"object.getownpropertydescriptors": "^2.0.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"vinyl": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==",
|
||||||
|
"requires": {
|
||||||
|
"clone": "^2.1.1",
|
||||||
|
"clone-buffer": "^1.0.0",
|
||||||
|
"clone-stats": "^1.0.0",
|
||||||
|
"cloneable-readable": "^1.0.0",
|
||||||
|
"remove-trailing-separator": "^1.0.1",
|
||||||
|
"replace-ext": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"vinyl-file": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/vinyl-file/-/vinyl-file-3.0.0.tgz",
|
||||||
|
"integrity": "sha1-sQTZ5ECf+jJfqt1SBkLQo7SIs2U=",
|
||||||
|
"requires": {
|
||||||
|
"graceful-fs": "^4.1.2",
|
||||||
|
"pify": "^2.3.0",
|
||||||
|
"strip-bom-buf": "^1.0.0",
|
||||||
|
"strip-bom-stream": "^2.0.0",
|
||||||
|
"vinyl": "^2.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"wrappy": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||||
|
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||||
|
},
|
||||||
|
"xtend": {
|
||||||
|
"version": "4.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
|
||||||
|
"integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
34
package.json
34
package.json
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "smartfile",
|
"name": "@pushrocks/smartfile",
|
||||||
"version": "4.0.6",
|
"private": false,
|
||||||
|
"version": "6.0.1",
|
||||||
"description": "offers smart ways to work with files in nodejs",
|
"description": "offers smart ways to work with files in nodejs",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
@ -9,7 +10,8 @@
|
|||||||
"reinstall": "(rm -r node_modules && npm install)",
|
"reinstall": "(rm -r node_modules && npm install)",
|
||||||
"release": "(git pull origin master && npm version patch && git push origin master && git checkout release && git merge master && git push origin release && git checkout master)",
|
"release": "(git pull origin master && npm version patch && git push origin master && git checkout release && git merge master && git push origin release && git checkout master)",
|
||||||
"update": "(git checkout master && git pull origin master && npm install)",
|
"update": "(git checkout master && git pull origin master && npm install)",
|
||||||
"upgrade": "(npm run update) && (ncu upgradeAll && npm install)"
|
"upgrade": "(npm run update) && (ncu upgradeAll && npm install)",
|
||||||
|
"build": "echo \"Not needed for now\""
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -26,22 +28,20 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/smartfile",
|
"homepage": "https://gitlab.com/pushrocks/smartfile",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"beautylog": "^5.0.12",
|
"@pushrocks/smartpromise": "^2.0.2",
|
||||||
"fs-extra": "^0.30.0",
|
"@types/fs-extra": "^5.0.3",
|
||||||
"gulp": "^3.9.1",
|
"@types/vinyl": "^2.0.2",
|
||||||
"gulp-remote-src": "^0.4.1",
|
"fs-extra": "^6.0.1",
|
||||||
"js-yaml": "^3.6.1",
|
"glob": "^7.1.2",
|
||||||
"q": "^1.4.1",
|
"js-yaml": "^3.10.0",
|
||||||
"request": "^2.72.0",
|
|
||||||
"require-reload": "0.2.2",
|
"require-reload": "0.2.2",
|
||||||
"typings-global": "^1.0.3",
|
"smartpath": "^3.2.8",
|
||||||
"vinyl": "^1.1.1",
|
"smartrequest": "^1.0.13",
|
||||||
"vinyl-file": "^2.0.0"
|
"vinyl-file": "^3.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"gulp-function": "^1.3.6",
|
"@types/node": "^10.5.1",
|
||||||
"npmts-g": "^5.2.6",
|
"gulp-function": "^2.2.14",
|
||||||
"should": "^9.0.2",
|
"tapbundle": "^2.0.2"
|
||||||
"typings-test": "^1.0.1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1
test/test.d.ts
vendored
1
test/test.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
import "typings-test";
|
|
181
test/test.js
181
test/test.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
386
test/test.ts
386
test/test.ts
@ -1,200 +1,194 @@
|
|||||||
import "typings-test";
|
import * as smartfile from '../ts/index';
|
||||||
import * as smartfile from "../dist/index";
|
import path = require('path');
|
||||||
let beautylog = require("beautylog");
|
|
||||||
let gulp = require("gulp");
|
|
||||||
let gFunction = require("gulp-function");
|
|
||||||
import path = require("path");
|
|
||||||
import should = require("should");
|
|
||||||
let vinyl = require("vinyl");
|
|
||||||
|
|
||||||
describe("smartfile".yellow,function(){
|
import { expect, tap } from 'tapbundle';
|
||||||
|
|
||||||
|
// ---------------------------
|
||||||
|
// smartfile.fs
|
||||||
|
// ---------------------------
|
||||||
|
|
||||||
describe(".fs".yellow,function(){
|
tap.test('.fs.fileExistsSync -> should return an accurate boolean', async () => {
|
||||||
describe(".fileExistsSync".yellow,function(){
|
expect(smartfile.fs.fileExistsSync('./test/mytest.json')).to.be.true;
|
||||||
it("should return an accurate boolean",function(){
|
expect(smartfile.fs.fileExistsSync('./test/notthere.json')).be.false;
|
||||||
(smartfile.fs.fileExistsSync("./test/mytest.json")).should.be.true();
|
|
||||||
(smartfile.fs.fileExistsSync("./test/notthere.json")).should.be.false();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe(".fileExists".yellow,function(){
|
|
||||||
it("should return a working promise",function(){
|
|
||||||
(smartfile.fs.fileExists("./test/mytest.json")).should.be.Promise();
|
|
||||||
(smartfile.fs.fileExists("./test/mytest.json")).should.be.fulfilled();
|
|
||||||
(smartfile.fs.fileExists("./test/notthere.json")).should.not.be.fulfilled();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe(".listFoldersSync()",function(){
|
|
||||||
it("should get the file type from a string",function(){
|
|
||||||
smartfile.fs.listFoldersSync("./test/").should.containDeep([ "testfolder"]);
|
|
||||||
smartfile.fs.listFoldersSync("./test/").should.not.containDeep([ "notExistentFolder"]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe(".listFolders()",function(){
|
|
||||||
it("should get the file type from a string",function(done){
|
|
||||||
smartfile.fs.listFolders("./test/")
|
|
||||||
.then(function(folderArrayArg){
|
|
||||||
folderArrayArg.should.containDeep([ "testfolder"]);
|
|
||||||
folderArrayArg.should.not.containDeep([ "notExistentFolder"]);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe(".copy()".yellow,function(){
|
|
||||||
it("should copy a directory",function(){
|
|
||||||
smartfile.fs.copy("./test/testfolder/","./test/temp/")
|
|
||||||
});
|
|
||||||
it("should copy a file",function(){
|
|
||||||
smartfile.fs.copy("./test/mytest.yaml","./test/temp/")
|
|
||||||
});
|
|
||||||
it("should copy a file and rename it",function(){
|
|
||||||
smartfile.fs.copy("./test/mytest.yaml","./test/temp/mytestRenamed.yaml")
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe(".remove()",function(){
|
|
||||||
it("should remove an entire directory",function(){
|
|
||||||
|
|
||||||
});
|
|
||||||
it("should remove single files",function(){
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe(".interpreter",function(){
|
|
||||||
describe(".filetype()",function(){
|
|
||||||
it("should get the file type from a string",function(){
|
|
||||||
smartfile.interpreter.filetype("./somefolder/data.json").should.equal("json");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
describe(".fs".yellow,function(){
|
|
||||||
describe("toGulpStreamSync() and toGulpDestSync",function(){
|
|
||||||
it("should produce a gulp stream",function(done){
|
|
||||||
smartfile.fs.toGulpStreamSync("./test/my*")
|
|
||||||
.pipe(smartfile.fs.toGulpDestSync("./test/temp/"))
|
|
||||||
.pipe(gFunction(done,"atEnd"));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe(".toObjectSync()".yellow,function(){
|
|
||||||
it("should read an " + ".yaml".blue + " file to an object",function(){
|
|
||||||
let testData = smartfile.fs.toObjectSync("./test/mytest.yaml");
|
|
||||||
testData.should.have.property("key1","this works");
|
|
||||||
testData.should.have.property("key2","this works too");
|
|
||||||
|
|
||||||
});
|
|
||||||
it("should state unknown file type for unknown file types",function(){
|
|
||||||
let testData = smartfile.fs.toObjectSync("./test/mytest.txt");
|
|
||||||
});
|
|
||||||
it("should read an " + ".json".blue + " file to an object",function(){
|
|
||||||
let testData = smartfile.fs.toObjectSync("./test/mytest.json");
|
|
||||||
testData.should.have.property("key1","this works");
|
|
||||||
testData.should.have.property("key2","this works too");
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe(".toStringSync()".yellow,function(){
|
|
||||||
it("should read a file to a string",function(){
|
|
||||||
should.equal(
|
|
||||||
smartfile.fs.toStringSync("./test/mytest.txt"),
|
|
||||||
"Some TestString &&%$"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe(".toVinylSync".yellow,function(){
|
|
||||||
it("should read an " + ".json OR .yaml".blue + " file to an " + "vinyl file object".cyan,function(){
|
|
||||||
let testData = smartfile.fs.toVinylSync("./test/mytest.json");
|
|
||||||
(vinyl.isVinyl(testData)).should.be.true();
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe(".memory",function(){
|
|
||||||
describe(".toGulpStream()",function(){
|
|
||||||
it("should produce a valid gulp stream",function(){
|
|
||||||
let localArray = ["test1","test2","test3"];
|
|
||||||
smartfile.memory.toGulpStream(localArray)
|
|
||||||
.pipe(gulp.dest("./test/temp/"));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe("toVinylFileSync()",function(){
|
|
||||||
it("should produce a vinylFile",function(){
|
|
||||||
let localString = "myString";
|
|
||||||
let localOptions = {filename:"vinylfile2",base:"/someDir"};
|
|
||||||
(smartfile.memory.toVinylFileSync(localString,localOptions) instanceof vinyl).should.be.true();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe("toVinylArraySync()",function(){
|
|
||||||
it("should produce a an array of vinylfiles",function(){
|
|
||||||
let localStringArray = ["string1","string2","string3"];
|
|
||||||
let localOptions = {filename:"vinylfile2",base:"/someDir"};
|
|
||||||
let testResult = smartfile.memory.toVinylArraySync(localStringArray,localOptions);
|
|
||||||
testResult.should.be.Array();
|
|
||||||
(testResult.length === 3).should.be.true();
|
|
||||||
for (let myKey in testResult){
|
|
||||||
(testResult[myKey] instanceof vinyl).should.be.true();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe("toStringSync()",function(){
|
|
||||||
it("should produce a String from vinyl file",function(){
|
|
||||||
let localString = smartfile.memory.toStringSync(new vinyl({
|
|
||||||
base:"/",
|
|
||||||
path:"/test.txt",
|
|
||||||
contents: new Buffer("myString")
|
|
||||||
}));
|
|
||||||
localString.should.equal("myString");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe("toFs()",function(){
|
|
||||||
it("should write a file to disk and return a promise",function(done){
|
|
||||||
let localString = "myString";
|
|
||||||
smartfile.memory.toFs(
|
|
||||||
localString,
|
|
||||||
path.join(process.cwd(),"./test/temp/testMemToFs.txt")
|
|
||||||
).then(done);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe("toFsSync()",function(){
|
|
||||||
it("should write a file to disk and return true if successfull",function(){
|
|
||||||
let localString = "myString";
|
|
||||||
smartfile.memory.toFsSync(
|
|
||||||
localString,
|
|
||||||
path.join(process.cwd(),"./test/temp/testMemToFsSync.txt")
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe(".remote",function(){
|
|
||||||
describe("toGulpStreamSync()",function(){
|
|
||||||
it("should produce a gulp stream",function(done){
|
|
||||||
smartfile.remote.toGulpStreamSync("mytest.txt","https://raw.githubusercontent.com/pushrocks/smartfile/master/test/")
|
|
||||||
.pipe(smartfile.fs.toGulpDestSync("./test/temp/"))
|
|
||||||
.pipe(gFunction(done,"atEnd"));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe(".toString()",function(){
|
|
||||||
it("should load a remote file to a variable",function(done){
|
|
||||||
this.timeout(5000);
|
|
||||||
smartfile.remote.toString("https://raw.githubusercontent.com/pushrocks/smartfile/master/test/mytest.txt")
|
|
||||||
.then(function(responseString){
|
|
||||||
should.equal(responseString,"Some TestString &&%$");
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
it("should reject a Promise when the link is false",function(done){
|
|
||||||
this.timeout(10000);
|
|
||||||
smartfile.remote.toString("https://push.rocks/doesnotexist.txt")
|
|
||||||
.then(function(){
|
|
||||||
throw new Error("this test should not be resolved");
|
|
||||||
},function(){
|
|
||||||
done();
|
|
||||||
})
|
|
||||||
});
|
|
||||||
});
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tap.test('.fs.fileExists -> should resolve or reject a promise', async () => {
|
||||||
|
expect(smartfile.fs.fileExists('./test/mytest.json')).to.be.instanceof(Promise);
|
||||||
|
await smartfile.fs.fileExists('./test/mytest.json');
|
||||||
|
await smartfile.fs.fileExists('./test/notthere.json').catch(err => {
|
||||||
|
return expect(err.message).to.equal(
|
||||||
|
"ENOENT: no such file or directory, access './test/notthere.json'"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('.fs.listFoldersSync() -> should get the file type from a string', async () => {
|
||||||
|
expect(smartfile.fs.listFoldersSync('./test/')).to.include('testfolder');
|
||||||
|
expect(smartfile.fs.listFoldersSync('./test/')).to.not.include('notExistentFolder');
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('.fs.listFolders() -> should get the file type from a string', async () => {
|
||||||
|
let folderArrayArg = await smartfile.fs.listFolders('./test/');
|
||||||
|
expect(folderArrayArg).to.include('testfolder');
|
||||||
|
expect(folderArrayArg).to.not.include('notExistentFolder');
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('.fs.listFilesSync() -> should get the file type from a string', async () => {
|
||||||
|
expect(smartfile.fs.listFilesSync('./test/')).to.include('mytest.json');
|
||||||
|
expect(smartfile.fs.listFilesSync('./test/')).to.not.include('notExistentFile');
|
||||||
|
expect(smartfile.fs.listFilesSync('./test/', /mytest\.json/)).to.include('mytest.json');
|
||||||
|
expect(smartfile.fs.listFilesSync('./test/', /mytests.json/)).to.not.include('mytest.json');
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('.fs.listFiles() -> should get the file type from a string', async () => {
|
||||||
|
let folderArrayArg = await smartfile.fs.listFiles('./test/');
|
||||||
|
expect(folderArrayArg).to.include('mytest.json');
|
||||||
|
expect(folderArrayArg).to.not.include('notExistentFile');
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('.fs.listFileTree() -> should get a file tree', async () => {
|
||||||
|
let folderArrayArg = await smartfile.fs.listFileTree(path.resolve('./test/'), '**/*.txt');
|
||||||
|
expect(folderArrayArg).to.include('testfolder/testfile1.txt');
|
||||||
|
expect(folderArrayArg).to.not.include('mytest.json');
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('.fs.fileTreeToObject -> should read a file tree into an Object', async () => {
|
||||||
|
let fileArrayArg = await smartfile.fs.fileTreeToObject(path.resolve('./test/'), '**/*.txt');
|
||||||
|
expect(fileArrayArg[0]).to.be.instanceof(smartfile.Smartfile);
|
||||||
|
expect(fileArrayArg[0].contents.toString()).to.equal(fileArrayArg[0].contentBuffer.toString());
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('.fs.copy() -> should copy a directory', async () => {
|
||||||
|
smartfile.fs.copy('./test/testfolder/', './test/temp/');
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('.fs.copy() -> should copy a file', async () => {
|
||||||
|
smartfile.fs.copy('./test/mytest.yaml', './test/temp/');
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('.fs.copy() -> should copy a file and rename it', async () => {
|
||||||
|
smartfile.fs.copy('./test/mytest.yaml', './test/temp/mytestRenamed.yaml');
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('.fs.remove() -> should remove an entire directory', async () => {});
|
||||||
|
|
||||||
|
tap.test('.fs.remove -> should remove single files', async () => {
|
||||||
|
await smartfile.fs.remove('./test/temp/mytestRenamed.yaml');
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('.fs.removeSync -> should remove single files synchronouly', async () => {
|
||||||
|
smartfile.fs.removeSync('./test/temp/testfile1.txt');
|
||||||
|
expect(smartfile.fs.fileExistsSync('./test/temp/testfile1.txt')).to.be.false;
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('.fs.removeMany -> should remove and array of files', async () => {
|
||||||
|
smartfile.fs.removeMany(['./test/temp/testfile1.txt', './test/temp/testfile2.txt']).then(() => {
|
||||||
|
expect(smartfile.fs.fileExistsSync('./test/temp/testfile1.txt')).to.be.false;
|
||||||
|
expect(smartfile.fs.fileExistsSync('./test/temp/testfile2.txt')).to.be.false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('.fs.removeManySync -> should remove and array of single files synchronouly', async () => {
|
||||||
|
smartfile.fs.removeManySync(['./test/temp/testfile1.txt', './test/temp/testfile2.txt']);
|
||||||
|
expect(smartfile.fs.fileExistsSync('./test/temp/testfile1.txt')).to.be.false;
|
||||||
|
expect(smartfile.fs.fileExistsSync('./test/temp/testfile2.txt')).to.be.false;
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('.fs.toObjectSync() -> should read an ' + '.yaml' + ' file to an object', async () => {
|
||||||
|
let testData = smartfile.fs.toObjectSync('./test/mytest.yaml');
|
||||||
|
expect(testData).to.include({ key1: 'this works' });
|
||||||
|
expect(testData).to.include({ key2: 'this works too' });
|
||||||
|
});
|
||||||
|
tap.test(
|
||||||
|
'.fs.toObjectSync() -> should state unknown file type for unknown file types',
|
||||||
|
async () => {
|
||||||
|
let testData = smartfile.fs.toObjectSync('./test/mytest.txt');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
tap.test('.fs.toObjectSync() -> should read an ' + '.json' + ' file to an object', async () => {
|
||||||
|
let testData = smartfile.fs.toObjectSync('./test/mytest.json');
|
||||||
|
expect(testData).to.include({ key1: 'this works' });
|
||||||
|
expect(testData).to.include({ key2: 'this works too' });
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('.fs.toStringSync() -> should read a file to a string', async () => {
|
||||||
|
expect(smartfile.fs.toStringSync('./test/mytest.txt')).to.equal('Some TestString &&%$');
|
||||||
|
});
|
||||||
|
|
||||||
|
// ---------------------------
|
||||||
|
// smartfile.interpreter
|
||||||
|
// ---------------------------
|
||||||
|
|
||||||
|
tap.test('.interpreter.filetype() -> should get the file type from a string', async () => {
|
||||||
|
expect(smartfile.interpreter.filetype('./somefolder/data.json')).equal('json');
|
||||||
|
});
|
||||||
|
|
||||||
|
// ---------------------------
|
||||||
|
// smartfile.memory
|
||||||
|
// ---------------------------
|
||||||
|
|
||||||
|
tap.test('.memory.toFs() -> should write a file to disk and return a promise', async () => {
|
||||||
|
let localString = 'myString';
|
||||||
|
await smartfile.memory.toFs(localString, path.join(process.cwd(), './test/temp/testMemToFs.txt'));
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test(
|
||||||
|
'.memory.toFsSync() -> should write a file to disk and return true if successfull',
|
||||||
|
async () => {
|
||||||
|
let localString = 'myString';
|
||||||
|
smartfile.memory.toFsSync(
|
||||||
|
localString,
|
||||||
|
path.join(process.cwd(), './test/temp/testMemToFsSync.txt')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
tap.test('.remote.toString() -> should load a remote file to a variable', async () => {
|
||||||
|
let responseString = await smartfile.remote.toString(
|
||||||
|
'https://raw.githubusercontent.com/pushrocks/smartfile/master/test/mytest.txt'
|
||||||
|
);
|
||||||
|
expect(responseString).to.equal('Some TestString &&%$');
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('.remote.toString() -> should reject a Promise when the link is false', async tools => {
|
||||||
|
tools.returnError;
|
||||||
|
await smartfile.remote.toString('https://push.rocks/doesnotexist.txt').catch(err => {
|
||||||
|
return expect(err.message).to.equal(
|
||||||
|
'could not get remote file from https://push.rocks/doesnotexist.txt'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// ---------------------------
|
||||||
|
// smartfile.Smartfile
|
||||||
|
// ---------------------------
|
||||||
|
|
||||||
|
tap.test('.Smartfile -> should produce vinyl compatible files', async () => {
|
||||||
|
let smartfileArray = await smartfile.fs.fileTreeToObject(process.cwd(), './test/testfolder/**/*');
|
||||||
|
let localSmartfile = smartfileArray[0];
|
||||||
|
expect(localSmartfile).to.be.instanceof(smartfile.Smartfile);
|
||||||
|
expect(localSmartfile.contents).to.be.instanceof(Buffer);
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(localSmartfile.isBuffer()).to.be.true;
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(localSmartfile.isDirectory()).to.be.false;
|
||||||
|
// tslint:disable-next-line:no-unused-expression
|
||||||
|
expect(localSmartfile.isNull()).to.be.false;
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('should output a smartfile array to disk', async () => {
|
||||||
|
let smartfileArray = await smartfile.fs.fileTreeToObject('./test/testfolder/', '*');
|
||||||
|
for (let smartfile of smartfileArray) {
|
||||||
|
console.log(smartfile.relative);
|
||||||
|
console.log(smartfile.path);
|
||||||
|
console.log(smartfile.base);
|
||||||
|
console.log(smartfile.parsedPath);
|
||||||
|
}
|
||||||
|
await smartfile.memory.smartfileArrayToFs(
|
||||||
|
smartfileArray,
|
||||||
|
path.resolve('./test/temp/testoutput/')
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.start();
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
okidoks
|
1
test/testfolder/subfolder/subtestfile.txt
Normal file
1
test/testfolder/subfolder/subtestfile.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
hi
|
14
ts/index.ts
14
ts/index.ts
@ -1,12 +1,10 @@
|
|||||||
import "typings-global";
|
import * as plugins from './smartfile.plugins';
|
||||||
|
import * as SmartfileFs from './smartfile.fs';
|
||||||
|
import * as SmartfileInterpreter from './smartfile.interpreter';
|
||||||
|
import * as SmartfileMemory from './smartfile.memory';
|
||||||
|
import * as SmartfileRemote from './smartfile.remote';
|
||||||
|
|
||||||
import * as plugins from "./smartfile.plugins";
|
export { Smartfile } from './smartfile.classes.smartfile';
|
||||||
import * as SmartfileFs from "./smartfile.fs";
|
|
||||||
import * as SmartfileInterpreter from "./smartfile.interpreter"
|
|
||||||
import * as SmartfileMemory from "./smartfile.memory";
|
|
||||||
import * as SmartfileRemote from "./smartfile.remote";
|
|
||||||
|
|
||||||
export {Smartfile} from "./smartfile.classes.smartfile";
|
|
||||||
|
|
||||||
export let fs = SmartfileFs;
|
export let fs = SmartfileFs;
|
||||||
export let interpreter = SmartfileInterpreter;
|
export let interpreter = SmartfileInterpreter;
|
||||||
|
@ -1,5 +1,148 @@
|
|||||||
|
import * as plugins from './smartfile.plugins';
|
||||||
|
import * as fs from './smartfile.fs';
|
||||||
|
import * as memory from './smartfile.memory';
|
||||||
|
|
||||||
|
export interface ISmartfileConstructorOptions {
|
||||||
|
path?: string;
|
||||||
|
contentString?: string;
|
||||||
|
contentBuffer?: Buffer;
|
||||||
|
base?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* class Smartfile
|
||||||
|
* -> is vinyl file compatible
|
||||||
|
*/
|
||||||
export class Smartfile {
|
export class Smartfile {
|
||||||
constructor(){
|
/**
|
||||||
|
* the full path of the file on disk
|
||||||
};
|
*/
|
||||||
}
|
path: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
parsedPath: plugins.path.ParsedPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the content of the file as Buffer
|
||||||
|
*/
|
||||||
|
contentBuffer: Buffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current working directory of the file
|
||||||
|
* Note:this is similar to gulp and different from native node path base
|
||||||
|
*/
|
||||||
|
base: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sync the file with disk
|
||||||
|
*/
|
||||||
|
sync: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the constructor of Smartfile
|
||||||
|
* @param optionsArg
|
||||||
|
*/
|
||||||
|
|
||||||
|
constructor(optionsArg: ISmartfileConstructorOptions) {
|
||||||
|
if (optionsArg.contentBuffer) {
|
||||||
|
this.contentBuffer = optionsArg.contentBuffer;
|
||||||
|
} else if (optionsArg.contentString) {
|
||||||
|
this.setContentsFromString(optionsArg.contentString);
|
||||||
|
} else {
|
||||||
|
console.log('created empty Smartfile?');
|
||||||
|
}
|
||||||
|
this.path = optionsArg.path;
|
||||||
|
this.parsedPath = plugins.path.parse(this.path);
|
||||||
|
this.base = optionsArg.base;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set contents from string
|
||||||
|
* @param contentString
|
||||||
|
*/
|
||||||
|
setContentsFromString(contentString: string) {
|
||||||
|
this.contents = new Buffer(contentString);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* write file to disk
|
||||||
|
* Behaviours:
|
||||||
|
* - no argument write to exactly where the file was picked up
|
||||||
|
*/
|
||||||
|
async write(pathArg?: string) {
|
||||||
|
const stringToWrite = this.contentBuffer.toString();
|
||||||
|
await memory.toFs(stringToWrite, this.path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* read file from disk
|
||||||
|
*/
|
||||||
|
async read() {}
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
// vinyl compatibility
|
||||||
|
// -----------------------------------------------
|
||||||
|
/**
|
||||||
|
* vinyl-compatibility: alias of this.contentBuffer
|
||||||
|
*/
|
||||||
|
get contents(): Buffer {
|
||||||
|
return this.contentBuffer;
|
||||||
|
}
|
||||||
|
set contents(contentsArg) {
|
||||||
|
this.contentBuffer = contentsArg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* vinyl-compatibility
|
||||||
|
*/
|
||||||
|
get cwd() {
|
||||||
|
return process.cwd();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return relative path of file
|
||||||
|
*/
|
||||||
|
get relative(): string {
|
||||||
|
return plugins.path.relative(this.base, this.path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return truw when the file has content
|
||||||
|
*/
|
||||||
|
isNull(): boolean {
|
||||||
|
if (!this.contentBuffer) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return true if contents are Buffer
|
||||||
|
*/
|
||||||
|
isBuffer(): boolean {
|
||||||
|
if (this.contents instanceof Buffer) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
isDirectory() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
isStream() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
isSymbolic() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// update things
|
||||||
|
updateFileName(fileNameArg: string) {
|
||||||
|
let oldFileName = this.parsedPath.base;
|
||||||
|
this.path = this.path.replace(new RegExp(oldFileName + '$'), fileNameArg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import "typings-global";
|
import plugins = require('./smartfile.plugins');
|
||||||
|
import SmartfileInterpreter = require('./smartfile.interpreter');
|
||||||
|
|
||||||
import plugins = require("./smartfile.plugins");
|
import { Smartfile } from './smartfile.classes.smartfile';
|
||||||
import SmartfileInterpreter = require("./smartfile.interpreter");
|
|
||||||
|
|
||||||
|
import * as memory from './smartfile.memory';
|
||||||
/*===============================================================
|
/*===============================================================
|
||||||
============================ Checks =============================
|
============================ Checks =============================
|
||||||
===============================================================*/
|
===============================================================*/
|
||||||
@ -12,16 +13,15 @@ import SmartfileInterpreter = require("./smartfile.interpreter");
|
|||||||
* @param filePath
|
* @param filePath
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
export let fileExistsSync = function(filePath):boolean {
|
export let fileExistsSync = function(filePath): boolean {
|
||||||
let fileExistsBool:boolean = false;
|
let fileExistsBool: boolean = false;
|
||||||
try {
|
try {
|
||||||
plugins.fs.readFileSync(filePath);
|
plugins.fsExtra.readFileSync(filePath);
|
||||||
fileExistsBool = true
|
fileExistsBool = true;
|
||||||
}
|
} catch (err) {
|
||||||
catch(err){
|
fileExistsBool = false;
|
||||||
fileExistsBool = false;
|
}
|
||||||
}
|
return fileExistsBool;
|
||||||
return fileExistsBool;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,116 +29,175 @@ export let fileExistsSync = function(filePath):boolean {
|
|||||||
* @param filePath
|
* @param filePath
|
||||||
* @returns {any}
|
* @returns {any}
|
||||||
*/
|
*/
|
||||||
export let fileExists = function(filePath){
|
export let fileExists = function(filePath) {
|
||||||
let done = plugins.q.defer();
|
let done = plugins.smartpromise.defer();
|
||||||
plugins.fs.access(filePath, plugins.fs.R_OK, function (err) {
|
plugins.fs.access(filePath, 4, function(err) {
|
||||||
err ? done.reject() : done.resolve();
|
err ? done.reject(err) : done.resolve();
|
||||||
});
|
});
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if given path points to an existing directory
|
* Checks if given path points to an existing directory
|
||||||
*/
|
*/
|
||||||
export let isDirectory = function(pathArg):boolean{
|
export let isDirectory = function(pathArg): boolean {
|
||||||
return plugins.fs.statSync(pathArg).isDirectory();
|
try {
|
||||||
|
return plugins.fsExtra.statSync(pathArg).isDirectory();
|
||||||
|
} catch (err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a given path points to an existing file
|
* Checks if a given path points to an existing file
|
||||||
*/
|
*/
|
||||||
export let isFile = function(pathArg):boolean{
|
export let isFile = function(pathArg): boolean {
|
||||||
return plugins.fs.statSync(pathArg).isFile();
|
return plugins.fsExtra.statSync(pathArg).isFile();
|
||||||
};
|
};
|
||||||
|
|
||||||
/*===============================================================
|
/*===============================================================
|
||||||
============================ FS ACTIONS =========================
|
============================ FS ACTIONS =========================
|
||||||
===============================================================*/
|
===============================================================*/
|
||||||
|
|
||||||
/**
|
|
||||||
* ensures that a directory is in place
|
|
||||||
*/
|
|
||||||
export let ensureDir = (dirPathArg:string) => {
|
|
||||||
let done = plugins.q.defer();
|
|
||||||
plugins.fs.ensureDir(dirPathArg,done.resolve);
|
|
||||||
return done.promise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ensures that a directory is in place
|
|
||||||
*/
|
|
||||||
export let ensureDirSync = (dirPathArg:string) => {
|
|
||||||
plugins.fs.ensureDirSync(dirPathArg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* copies a file from A to B on the local disk
|
* copies a file from A to B on the local disk
|
||||||
*/
|
*/
|
||||||
export let copy = function(fromArg:string, toArg:string){
|
export let copy = function(fromArg: string, toArg: string) {
|
||||||
var done = plugins.q.defer();
|
let done = plugins.smartpromise.defer();
|
||||||
plugins.fs.copy(fromArg,toArg,{},function(){
|
plugins.fsExtra.copy(fromArg, toArg, {}, function() {
|
||||||
done.resolve();
|
done.resolve();
|
||||||
});
|
});
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* copies a file SYNCHRONOUSLY from A to B on the local disk
|
* copies a file SYNCHRONOUSLY from A to B on the local disk
|
||||||
*/
|
*/
|
||||||
export let copySync = function(fromArg:string,toArg:string):boolean{
|
export let copySync = function(fromArg: string, toArg: string): boolean {
|
||||||
plugins.fs.copySync(fromArg,toArg);
|
plugins.fsExtra.copySync(fromArg, toArg);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* removes a file or folder from local disk
|
* ensures that a directory is in place
|
||||||
*/
|
*/
|
||||||
export let remove = function(pathArg:string){
|
export let ensureDir = (dirPathArg: string) => {
|
||||||
var done = plugins.q.defer();
|
let done = plugins.smartpromise.defer();
|
||||||
plugins.fs.remove(pathArg,function(){
|
plugins.fsExtra.ensureDir(dirPathArg, done.resolve);
|
||||||
done.resolve();
|
return done.promise;
|
||||||
});
|
};
|
||||||
return done.promise;
|
|
||||||
|
/**
|
||||||
|
* ensures that a directory is in place
|
||||||
|
*/
|
||||||
|
export let ensureDirSync = (dirPathArg: string) => {
|
||||||
|
plugins.fsExtra.ensureDirSync(dirPathArg);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ensure an empty directory
|
||||||
|
* @executes ASYNC
|
||||||
|
*/
|
||||||
|
export let ensureEmptyDir = (dirPathArg: string) => {
|
||||||
|
let done = plugins.smartpromise.defer();
|
||||||
|
plugins.fsExtra.ensureDir(dirPathArg, () => {
|
||||||
|
plugins.fsExtra.emptyDir(dirPathArg, done.resolve);
|
||||||
|
});
|
||||||
|
return done.promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ensure an empty directory
|
||||||
|
* @executes SYNC
|
||||||
|
*/
|
||||||
|
export let ensureEmptyDirSync = (dirPathArg: string) => {
|
||||||
|
plugins.fsExtra.ensureDirSync(dirPathArg);
|
||||||
|
plugins.fsExtra.emptyDirSync(dirPathArg);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ensures that a file is on disk
|
||||||
|
* @param filePath the filePath to ensureDir
|
||||||
|
* @param the fileContent to place into a new file in case it doesn't exist yet
|
||||||
|
* @returns Promise<void>
|
||||||
|
* @exec ASYNC
|
||||||
|
*/
|
||||||
|
export let ensureFile = (filePathArg, initFileStringArg): Promise<void> => {
|
||||||
|
let done = plugins.smartpromise.defer<void>();
|
||||||
|
ensureFileSync(filePathArg, initFileStringArg);
|
||||||
|
done.resolve();
|
||||||
|
return done.promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ensures that a file is on disk
|
||||||
|
* @param filePath the filePath to ensureDir
|
||||||
|
* @param the fileContent to place into a new file in case it doesn't exist yet
|
||||||
|
* @returns Promise<void>
|
||||||
|
* @exec SYNC
|
||||||
|
*/
|
||||||
|
export let ensureFileSync = (filePathArg: string, initFileStringArg: string): void => {
|
||||||
|
if (fileExistsSync(filePathArg)) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
memory.toFsSync(initFileStringArg, filePathArg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* removes a file or folder from local disk
|
||||||
|
*/
|
||||||
|
export let remove = function(pathArg: string): Promise<void> {
|
||||||
|
let done = plugins.smartpromise.defer<void>();
|
||||||
|
plugins.fsExtra.remove(pathArg, function() {
|
||||||
|
done.resolve();
|
||||||
|
});
|
||||||
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* removes a file SYNCHRONOUSLY from local disk
|
* removes a file SYNCHRONOUSLY from local disk
|
||||||
*/
|
*/
|
||||||
export let removeSync = function(pathArg:string):boolean{
|
export let removeSync = function(pathArg: string): boolean {
|
||||||
plugins.fs.removeSync(pathArg);
|
plugins.fsExtra.removeSync(pathArg);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* removes an array of filePaths from disk
|
||||||
|
*/
|
||||||
|
export let removeMany = function(filePathArrayArg: string[]) {
|
||||||
|
let promiseArray: Promise<void>[] = [];
|
||||||
|
for (let filePath of filePathArrayArg) {
|
||||||
|
promiseArray.push(remove(filePath));
|
||||||
|
}
|
||||||
|
return Promise.all(promiseArray);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* like removeFilePathArray but SYNCHRONOUSLY
|
||||||
|
*/
|
||||||
|
export let removeManySync = function(filePathArrayArg: string[]): void {
|
||||||
|
for (let filePath of filePathArrayArg) {
|
||||||
|
removeSync(filePath);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/*===============================================================
|
/*===============================================================
|
||||||
============================ Write/Read =========================
|
============================ Write/Read =========================
|
||||||
===============================================================*/
|
===============================================================*/
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param filePathArg
|
|
||||||
* @returns {*}
|
|
||||||
*/
|
|
||||||
export let toGulpStreamSync = function(filePathArg:string){
|
|
||||||
let stream = plugins.gulp.src(filePathArg);
|
|
||||||
return stream;
|
|
||||||
};
|
|
||||||
|
|
||||||
export let toGulpDestSync = function(folderPathArg:string){
|
|
||||||
return plugins.gulp.dest(folderPathArg);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param filePathArg
|
* @param filePathArg
|
||||||
* @param fileTypeArg
|
* @param fileTypeArg
|
||||||
* @returns {any}
|
* @returns {any}
|
||||||
*/
|
*/
|
||||||
export let toObjectSync = function(filePathArg,fileTypeArg?) {
|
export let toObjectSync = function(filePathArg, fileTypeArg?) {
|
||||||
let fileString = plugins.fs.readFileSync(filePathArg, 'utf8');
|
let fileString = plugins.fsExtra.readFileSync(filePathArg, 'utf8');
|
||||||
let fileType;
|
let fileType;
|
||||||
fileTypeArg ? fileType = fileTypeArg : fileType = SmartfileInterpreter.filetype(filePathArg);
|
fileTypeArg ? (fileType = fileTypeArg) : (fileType = SmartfileInterpreter.filetype(filePathArg));
|
||||||
return SmartfileInterpreter.objectFile(fileString,fileType);
|
return SmartfileInterpreter.objectFile(fileString, fileType);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -146,10 +205,42 @@ export let toObjectSync = function(filePathArg,fileTypeArg?) {
|
|||||||
* @param filePath
|
* @param filePath
|
||||||
* @returns {string|Buffer|any}
|
* @returns {string|Buffer|any}
|
||||||
*/
|
*/
|
||||||
export let toStringSync = function(filePath) {
|
export let toStringSync = function(filePath: string): string {
|
||||||
let fileString;
|
let fileString: any = plugins.fsExtra.readFileSync(filePath, 'utf8');
|
||||||
fileString = plugins.fs.readFileSync(filePath, "utf8");
|
return fileString;
|
||||||
return fileString;
|
};
|
||||||
|
|
||||||
|
export let fileTreeToObject = async (dirPathArg: string, miniMatchFilter: string) => {
|
||||||
|
// handle absolute miniMatchFilter
|
||||||
|
let dirPath: string;
|
||||||
|
if (plugins.path.isAbsolute(miniMatchFilter)) {
|
||||||
|
dirPath = '/';
|
||||||
|
} else {
|
||||||
|
dirPath = dirPathArg;
|
||||||
|
}
|
||||||
|
|
||||||
|
let fileTree = await listFileTree(dirPath, miniMatchFilter);
|
||||||
|
let smartfileArray: Smartfile[] = [];
|
||||||
|
for (let filePath of fileTree) {
|
||||||
|
let readPath = ((): string => {
|
||||||
|
if (!plugins.path.isAbsolute(filePath)) {
|
||||||
|
return plugins.path.join(dirPath, filePath);
|
||||||
|
} else {
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
let fileContentString = toStringSync(readPath);
|
||||||
|
|
||||||
|
// push a read file as Smartfile
|
||||||
|
smartfileArray.push(
|
||||||
|
new Smartfile({
|
||||||
|
contentBuffer: new Buffer(fileContentString),
|
||||||
|
base: dirPath,
|
||||||
|
path: filePath
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return smartfileArray;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -158,8 +249,8 @@ export let toStringSync = function(filePath) {
|
|||||||
* @param options
|
* @param options
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
export let toVinylSync = function(filePathArg,options = {}) {
|
export let toVinylSync = function(filePathArg, options = {}) {
|
||||||
return plugins.vinylFile.readSync(filePathArg,options);
|
return plugins.vinylFile.readSync(filePathArg, options);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -167,29 +258,138 @@ export let toVinylSync = function(filePathArg,options = {}) {
|
|||||||
* @param path
|
* @param path
|
||||||
* @returns {any}
|
* @returns {any}
|
||||||
*/
|
*/
|
||||||
export let requireReload = function(path:string){
|
export let requireReload = function(path: string) {
|
||||||
return plugins.requireReload(path);
|
return plugins.requireReload(path);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* lists Folders in a directory on local disk
|
* lists Folders in a directory on local disk
|
||||||
* @returns Promise
|
* @returns Promise
|
||||||
*/
|
*/
|
||||||
export let listFolders = function(pathArg:string){
|
export let listFolders = function(pathArg: string, regexFilter?: RegExp) {
|
||||||
let done = plugins.q.defer();
|
let done = plugins.smartpromise.defer();
|
||||||
let folderArray = plugins.fs.readdirSync(pathArg).filter(function(file) {
|
let folderArray = plugins.fsExtra.readdirSync(pathArg).filter(function(file) {
|
||||||
return plugins.fs.statSync(plugins.path.join(pathArg, file)).isDirectory();
|
return plugins.fsExtra.statSync(plugins.path.join(pathArg, file)).isDirectory();
|
||||||
|
});
|
||||||
|
if (regexFilter) {
|
||||||
|
folderArray = folderArray.filter(fileItem => {
|
||||||
|
return regexFilter.test(fileItem);
|
||||||
});
|
});
|
||||||
done.resolve(folderArray);
|
}
|
||||||
return done.promise;
|
done.resolve(folderArray);
|
||||||
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* lists Folders SYNCHRONOUSLY in a directory on local disk
|
* lists Folders SYNCHRONOUSLY in a directory on local disk
|
||||||
* @returns an array with the folder names as strings
|
* @returns an array with the folder names as strings
|
||||||
*/
|
*/
|
||||||
export let listFoldersSync = function(pathArg):string[]{
|
export let listFoldersSync = function(pathArg: string, regexFilter?: RegExp): string[] {
|
||||||
return plugins.fs.readdirSync(pathArg).filter(function(file) {
|
let folderArray = plugins.fsExtra.readdirSync(pathArg).filter(function(file) {
|
||||||
return plugins.fs.statSync(plugins.path.join(pathArg, file)).isDirectory();
|
return plugins.fsExtra.statSync(plugins.path.join(pathArg, file)).isDirectory();
|
||||||
|
});
|
||||||
|
if (regexFilter) {
|
||||||
|
folderArray = folderArray.filter(fileItem => {
|
||||||
|
return regexFilter.test(fileItem);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
return folderArray;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* lists Files in a directory on local disk
|
||||||
|
* @returns Promise
|
||||||
|
*/
|
||||||
|
export let listFiles = function(pathArg: string, regexFilter?: RegExp) {
|
||||||
|
let done = plugins.smartpromise.defer();
|
||||||
|
let fileArray = plugins.fsExtra.readdirSync(pathArg).filter(function(file) {
|
||||||
|
return plugins.fsExtra.statSync(plugins.path.join(pathArg, file)).isFile();
|
||||||
|
});
|
||||||
|
if (regexFilter) {
|
||||||
|
fileArray = fileArray.filter(fileItem => {
|
||||||
|
return regexFilter.test(fileItem);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
done.resolve(fileArray);
|
||||||
|
return done.promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* lists Files SYNCHRONOUSLY in a directory on local disk
|
||||||
|
* @returns an array with the folder names as strings
|
||||||
|
*/
|
||||||
|
export let listFilesSync = function(pathArg: string, regexFilter?: RegExp): string[] {
|
||||||
|
let fileArray = plugins.fsExtra.readdirSync(pathArg).filter(function(file) {
|
||||||
|
return plugins.fsExtra.statSync(plugins.path.join(pathArg, file)).isFile();
|
||||||
|
});
|
||||||
|
if (regexFilter) {
|
||||||
|
fileArray = fileArray.filter(fileItem => {
|
||||||
|
return regexFilter.test(fileItem);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return fileArray;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* lists all items (folders AND files) in a directory on local disk
|
||||||
|
* @returns Promise<string[]>
|
||||||
|
*/
|
||||||
|
export let listAllItems = function(pathArg: string, regexFilter?: RegExp): Promise<string[]> {
|
||||||
|
let done = plugins.smartpromise.defer<string[]>();
|
||||||
|
let allItmesArray = plugins.fsExtra.readdirSync(pathArg);
|
||||||
|
if (regexFilter) {
|
||||||
|
allItmesArray = allItmesArray.filter(fileItem => {
|
||||||
|
return regexFilter.test(fileItem);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
done.resolve(allItmesArray);
|
||||||
|
return done.promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* lists all items (folders AND files) in a directory on local disk
|
||||||
|
* @returns an array with the folder names as strings
|
||||||
|
* @executes SYNC
|
||||||
|
*/
|
||||||
|
export let listAllItemsSync = function(pathArg: string, regexFilter?: RegExp): string[] {
|
||||||
|
let allItmesArray = plugins.fsExtra.readdirSync(pathArg).filter(function(file) {
|
||||||
|
return plugins.fsExtra.statSync(plugins.path.join(pathArg, file)).isFile();
|
||||||
|
});
|
||||||
|
if (regexFilter) {
|
||||||
|
allItmesArray = allItmesArray.filter(fileItem => {
|
||||||
|
return regexFilter.test(fileItem);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return allItmesArray;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* lists a file tree using a miniMatch filter
|
||||||
|
* note: if the miniMatch Filter is an absolute path, the cwdArg will be omitted
|
||||||
|
* @returns Promise<string[]> string array with the absolute paths of all matching files
|
||||||
|
*/
|
||||||
|
export let listFileTree = (dirPathArg: string, miniMatchFilter: string): Promise<string[]> => {
|
||||||
|
let done = plugins.smartpromise.defer<string[]>();
|
||||||
|
|
||||||
|
// handle absolute miniMatchFilter
|
||||||
|
let dirPath: string;
|
||||||
|
if (plugins.path.isAbsolute(miniMatchFilter)) {
|
||||||
|
dirPath = '/';
|
||||||
|
} else {
|
||||||
|
dirPath = dirPathArg;
|
||||||
|
}
|
||||||
|
|
||||||
|
let options = {
|
||||||
|
cwd: dirPath,
|
||||||
|
nodir: true,
|
||||||
|
dot: true
|
||||||
|
};
|
||||||
|
plugins.glob(miniMatchFilter, options, (err, files: string[]) => {
|
||||||
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
|
done.reject(err);
|
||||||
|
}
|
||||||
|
done.resolve(files);
|
||||||
|
});
|
||||||
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
@ -1,22 +1,20 @@
|
|||||||
import "typings-global";
|
import plugins = require('./smartfile.plugins');
|
||||||
|
|
||||||
import plugins = require("./smartfile.plugins");
|
export let filetype = (pathArg: string): string => {
|
||||||
|
let extName = plugins.path.extname(pathArg);
|
||||||
export let filetype = (pathArg:string):string => {
|
let fileType = extName.replace(/\.([a-z]*)/, '$1'); // remove . form fileType
|
||||||
let extName = plugins.path.extname(pathArg);
|
return fileType;
|
||||||
let fileType = extName.replace(/\.([a-z]*)/,"$1"); //remove . form fileType
|
|
||||||
return fileType;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export let objectFile = (fileStringArg:string, fileTypeArg) => {
|
export let objectFile = (fileStringArg: string, fileTypeArg) => {
|
||||||
switch (fileTypeArg) {
|
switch (fileTypeArg) {
|
||||||
case "yml" :
|
case 'yml':
|
||||||
case "yaml":
|
case 'yaml':
|
||||||
return plugins.yaml.safeLoad(fileStringArg);
|
return plugins.yaml.safeLoad(fileStringArg);
|
||||||
case "json":
|
case 'json':
|
||||||
return JSON.parse(fileStringArg);
|
return JSON.parse(fileStringArg);
|
||||||
default:
|
default:
|
||||||
plugins.beautylog.error("file type " + fileTypeArg.blue + " not supported");
|
console.error('file type ' + fileTypeArg.blue + ' not supported');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
@ -1,44 +1,8 @@
|
|||||||
import "typings-global";
|
import plugins = require('./smartfile.plugins');
|
||||||
|
import { Smartfile } from './smartfile.classes.smartfile';
|
||||||
|
import * as smartfileFs from './smartfile.fs';
|
||||||
|
|
||||||
import plugins = require("./smartfile.plugins");
|
import SmartfileInterpreter = require('./smartfile.interpreter');
|
||||||
import SmartfileInterpreter = require("./smartfile.interpreter");
|
|
||||||
import vinyl = require("vinyl");
|
|
||||||
let Readable = require("stream").Readable;
|
|
||||||
/**
|
|
||||||
* allows you to create a gulp stream
|
|
||||||
* from String, from an Array of Strings, from Vinyl File, from an Array of VinylFiles
|
|
||||||
* @param fileArg
|
|
||||||
* @returns stream.Readable
|
|
||||||
* @TODO: make it async;
|
|
||||||
*/
|
|
||||||
export let toGulpStream = function(fileArg:string|string[]|plugins.vinyl|plugins.vinyl[],baseArg:string = "/"){
|
|
||||||
let fileArray = [];
|
|
||||||
|
|
||||||
if(typeof fileArg === "string" || fileArg instanceof plugins.vinyl){ // make sure we work with an array later on
|
|
||||||
fileArray.push(fileArg);
|
|
||||||
} else if (Array.isArray(fileArg)){
|
|
||||||
fileArray = fileArg;
|
|
||||||
} else {
|
|
||||||
throw new Error("fileArg has unknown format");
|
|
||||||
}
|
|
||||||
|
|
||||||
let vinylFileArray:plugins.vinyl[] = []; //we want to have an array of vinylFiles
|
|
||||||
|
|
||||||
for (let fileIndexArg in fileArray){ //convert fileArray in vinylArray
|
|
||||||
let file = fileArray[fileIndexArg];
|
|
||||||
file instanceof plugins.vinyl ?
|
|
||||||
vinylFileArray.push(file) :
|
|
||||||
vinylFileArray.push(toVinylFileSync(file,{filename:fileIndexArg,base:baseArg}));
|
|
||||||
};
|
|
||||||
|
|
||||||
let stream = new Readable({ objectMode: true });
|
|
||||||
for(let vinylFileIndexArg in vinylFileArray){
|
|
||||||
let vinylFile = vinylFileArray[vinylFileIndexArg];
|
|
||||||
stream.push(vinylFile);
|
|
||||||
};
|
|
||||||
stream.push(null); //signal end of stream;
|
|
||||||
return stream;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* converts file to Object
|
* converts file to Object
|
||||||
@ -46,88 +10,82 @@ export let toGulpStream = function(fileArg:string|string[]|plugins.vinyl|plugins
|
|||||||
* @param fileTypeArg
|
* @param fileTypeArg
|
||||||
* @returns {any|any}
|
* @returns {any|any}
|
||||||
*/
|
*/
|
||||||
export let toObject = function(fileStringArg:string,fileTypeArg:string){
|
export let toObject = function(fileStringArg: string, fileTypeArg: string) {
|
||||||
return SmartfileInterpreter.objectFile(fileStringArg,fileTypeArg);
|
return SmartfileInterpreter.objectFile(fileStringArg, fileTypeArg);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
export interface IToFsOptions {
|
||||||
* takes a string and converts it to vinyl file
|
respectRelative?: boolean;
|
||||||
* @param fileArg
|
}
|
||||||
* @param optionsArg
|
|
||||||
*/
|
|
||||||
export let toVinylFileSync = function(fileArg:string,optionsArg?:{filename?:string,base?:string,relPath?:string}){
|
|
||||||
optionsArg? void(0) : optionsArg = {filename: "vinylfile", base: "/"};
|
|
||||||
optionsArg.filename ? void(0) : optionsArg.filename = "vinylfile";
|
|
||||||
optionsArg.base ? void(0) : optionsArg.base = "/";
|
|
||||||
optionsArg.relPath ? void("0") : optionsArg.relPath = "";
|
|
||||||
let vinylFile = new plugins.vinyl({
|
|
||||||
base: optionsArg.base,
|
|
||||||
path: plugins.path.join(optionsArg.base,optionsArg.relPath,optionsArg.filename),
|
|
||||||
contents: new Buffer(fileArg)
|
|
||||||
});
|
|
||||||
return vinylFile;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* takes a string array and some options and returns a vinylfile array
|
* writes string or Smartfile to disk.
|
||||||
* @param arrayArg
|
|
||||||
* @param optionsArg
|
|
||||||
*/
|
|
||||||
export let toVinylArraySync = function(arrayArg:string[],optionsArg?:{filename?:string,base?:string,relPath?:string}){
|
|
||||||
let vinylArray = [];
|
|
||||||
for(let stringIndexArg in arrayArg){
|
|
||||||
let myString = arrayArg[stringIndexArg];
|
|
||||||
vinylArray.push(toVinylFileSync(myString,optionsArg));
|
|
||||||
}
|
|
||||||
return vinylArray;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* takes a vinylFile object and converts it to String
|
|
||||||
*/
|
|
||||||
export let toStringSync = function(fileArg:plugins.vinyl){
|
|
||||||
return fileArg.contents.toString("utf8");
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* writes string or vinyl file to disk.
|
|
||||||
* @param fileArg
|
* @param fileArg
|
||||||
* @param fileNameArg
|
* @param fileNameArg
|
||||||
* @param fileBaseArg
|
* @param fileBaseArg
|
||||||
*/
|
*/
|
||||||
export let toFs = function(fileContentArg:string|vinyl,filePathArg){
|
export let toFs = async (
|
||||||
let done = plugins.q.defer();
|
fileContentArg: string | Smartfile,
|
||||||
|
filePathArg,
|
||||||
|
optionsArg: IToFsOptions = {}
|
||||||
|
) => {
|
||||||
|
let done = plugins.smartpromise.defer();
|
||||||
|
|
||||||
//function checks to abort if needed
|
// check args
|
||||||
if (!fileContentArg || !filePathArg) throw new Error("expected valid arguments");
|
if (!fileContentArg || !filePathArg) {
|
||||||
|
throw new Error('expected valid arguments');
|
||||||
|
}
|
||||||
|
|
||||||
// prepare actual write action
|
// prepare actual write action
|
||||||
let fileString:string;
|
let fileString: string;
|
||||||
let filePath:string = filePathArg;
|
let filePath: string = filePathArg;
|
||||||
if (fileContentArg instanceof plugins.vinyl){
|
|
||||||
fileString = toStringSync(fileContentArg);
|
// handle Smartfile
|
||||||
} else if (typeof fileContentArg === "string") {
|
if (fileContentArg instanceof Smartfile) {
|
||||||
fileString = fileContentArg;
|
let fileContentArg2: any = fileContentArg;
|
||||||
|
fileString = fileContentArg.contentBuffer.toString();
|
||||||
|
// handle options
|
||||||
|
if (optionsArg.respectRelative) {
|
||||||
|
filePath = plugins.path.join(filePath, fileContentArg.path);
|
||||||
}
|
}
|
||||||
plugins.fs.writeFile(filePath,fileString,"utf8",done.resolve);
|
} else if (typeof fileContentArg === 'string') {
|
||||||
return done.promise;
|
fileString = fileContentArg;
|
||||||
|
} else {
|
||||||
|
throw new Error('fileContent is neither string nor Smartfile');
|
||||||
|
}
|
||||||
|
await smartfileFs.ensureDir(plugins.path.parse(filePath).dir);
|
||||||
|
plugins.fsExtra.writeFile(filePath, fileString, { encoding: 'utf8' }, done.resolve);
|
||||||
|
return await done.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
export let toFsSync = function(fileArg,filePathArg:string){
|
/**
|
||||||
//function checks to abort if needed
|
* writes a string or a Smartfile to disk synchronously, only supports string
|
||||||
if (!fileArg || !filePathArg) throw new Error("expected a valid arguments");
|
* @param fileArg
|
||||||
|
* @param filePathArg
|
||||||
|
*/
|
||||||
|
export let toFsSync = function(fileArg: string, filePathArg: string) {
|
||||||
|
// function checks to abort if needed
|
||||||
|
if (!fileArg || !filePathArg) {
|
||||||
|
throw new Error('expected a valid arguments');
|
||||||
|
}
|
||||||
|
|
||||||
// prepare actual write action
|
// prepare actual write action
|
||||||
let fileString:string;
|
let fileString: string;
|
||||||
let filePath:string = filePathArg;
|
let filePath: string = filePathArg;
|
||||||
|
|
||||||
if (fileArg instanceof plugins.vinyl){
|
if (typeof fileArg !== 'string') {
|
||||||
fileString = toStringSync(fileArg);
|
throw new Error('fileArg is not of type String.');
|
||||||
} else if (typeof fileArg === "string") {
|
} else if (typeof fileArg === 'string') {
|
||||||
fileString = fileArg;
|
fileString = fileArg;
|
||||||
}
|
}
|
||||||
plugins.fs.writeFileSync(filePath,fileString,"utf8");
|
plugins.fsExtra.writeFileSync(filePath, fileString, { encoding: 'utf8' });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export let smartfileArrayToFs = async (smartfileArrayArg: Smartfile[], dirArg: string) => {
|
||||||
|
await smartfileFs.ensureDir(dirArg);
|
||||||
|
for (let smartfile of smartfileArrayArg) {
|
||||||
|
await toFs(smartfile, dirArg, {
|
||||||
|
respectRelative: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
import "typings-global";
|
export import fs = require('fs');
|
||||||
export let beautylog = require("beautylog");
|
export import fsExtra = require('fs-extra');
|
||||||
export let fs = require("fs-extra");
|
export let glob = require('glob');
|
||||||
export let gulp = require("gulp");
|
export import path = require('path');
|
||||||
export let g = {
|
export import smartpromise = require('@pushrocks/smartpromise');
|
||||||
remoteSrc: require("gulp-remote-src")
|
export import smartrequest = require('smartrequest');
|
||||||
};
|
export let requireReload = require('require-reload');
|
||||||
export import path = require("path");
|
export import smartpath = require('smartpath');
|
||||||
export let q = require("q");
|
export let vinylFile = require('vinyl-file');
|
||||||
export import vinyl = require("vinyl");
|
export let yaml = require('js-yaml');
|
||||||
export let vinylFile = require("vinyl-file");
|
|
||||||
export let yaml = require("js-yaml");
|
|
||||||
export let request = require("request");
|
|
||||||
export let requireReload = require("require-reload");
|
|
||||||
|
@ -1,26 +1,35 @@
|
|||||||
import "typings-global";
|
import plugins = require('./smartfile.plugins');
|
||||||
import plugins = require("./smartfile.plugins");
|
import SmartfileInterpreter = require('./smartfile.interpreter');
|
||||||
import SmartfileInterpreter = require("./smartfile.interpreter");
|
|
||||||
|
|
||||||
export let toFs = function(from:string,toPath:string) {
|
/* export let toFs = function (from: string, toPath: string) {
|
||||||
var done = plugins.q.defer();
|
let done = plugins.q.defer()
|
||||||
var stream = plugins.request(from).pipe(plugins.fs.createWriteStream(toPath));
|
let stream = plugins.smartrequest(from).pipe(plugins.fsExtra.createWriteStream(toPath))
|
||||||
stream.on('finish',function(){
|
stream.on('finish', function () {
|
||||||
done.resolve(toPath);
|
done.resolve(toPath)
|
||||||
});
|
})
|
||||||
return done.promise;
|
return done.promise
|
||||||
};
|
} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param filePathArg
|
* @param fromArg
|
||||||
* @returns {*}
|
* @returns {any}
|
||||||
*/
|
*/
|
||||||
export let toGulpStreamSync = function(filePathArg:string,baseArg:string){
|
export let toObject = function(fromArg: string) {
|
||||||
let stream = plugins.g.remoteSrc(filePathArg, {
|
let done = plugins.smartpromise.defer();
|
||||||
base: baseArg
|
plugins.smartrequest
|
||||||
|
.request(fromArg, {
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
.then((res: any) => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
done.resolve(res.body);
|
||||||
|
} else {
|
||||||
|
console.log('could not get remote file from ' + fromArg);
|
||||||
|
done.reject(new Error('could not get remote file from ' + fromArg));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return stream;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,38 +37,14 @@ export let toGulpStreamSync = function(filePathArg:string,baseArg:string){
|
|||||||
* @param fromArg
|
* @param fromArg
|
||||||
* @returns {any}
|
* @returns {any}
|
||||||
*/
|
*/
|
||||||
export let toObject = function(fromArg:string){
|
export let toString = (fromArg: string) => {
|
||||||
let done = plugins.q.defer();
|
let done = plugins.smartpromise.defer();
|
||||||
plugins.request.get(fromArg, function (error, response, bodyString) {
|
plugins.smartrequest.get(fromArg).then((res: any) => {
|
||||||
let returnObject;
|
if (res.statusCode === 200) {
|
||||||
if (!error && response.statusCode == 200) {
|
done.resolve(res.body);
|
||||||
returnObject = SmartfileInterpreter.objectFile(bodyString,SmartfileInterpreter.filetype(fromArg));
|
} else {
|
||||||
done.resolve(returnObject);
|
done.reject(new Error('could not get remote file from ' + fromArg));
|
||||||
} else {
|
}
|
||||||
console.log('could not get remote file from ' + fromArg);
|
});
|
||||||
returnObject = undefined;
|
return done.promise;
|
||||||
done.reject(returnObject);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
return done.promise;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param fromArg
|
|
||||||
* @returns {any}
|
|
||||||
*/
|
|
||||||
export let toString = (fromArg:string) => {
|
|
||||||
let done = plugins.q.defer();
|
|
||||||
plugins.request.get(fromArg, function (error, response, bodyString) {
|
|
||||||
if (!error && response.statusCode == 200) {
|
|
||||||
done.resolve(bodyString);
|
|
||||||
} else {
|
|
||||||
plugins.beautylog.error('could not get remote file from ' + fromArg);
|
|
||||||
bodyString = undefined;
|
|
||||||
done.reject(bodyString);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
return done.promise;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"globalDependencies": {
|
|
||||||
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts",
|
|
||||||
"mocha": "github:Bartvds/tsd-deftools/typings/DefinitelyTyped/mocha/mocha.d.ts",
|
|
||||||
"node": "registry:dt/node",
|
|
||||||
"should": "registry:dt/should"
|
|
||||||
}
|
|
||||||
}
|
|
3
tslint.json
Normal file
3
tslint.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "tslint-config-standard"
|
||||||
|
}
|
Reference in New Issue
Block a user