diff --git a/.gitignore b/.gitignore
index 9d4ae5d..91c0db0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,22 @@
-node_modules/
+.nogit/
+
+# artifacts
coverage/
-pages/
public/
+pages/
-test/temp/
+# installs
+node_modules/
+# caches
+.yarn/
+.cache/
+.rpt2_cache
+
+# builds
+dist/
+dist_web/
+dist_serve/
+dist_ts_web/
+
+# custom
\ No newline at end of file
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8321aed..8d4acf4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,5 @@
-# gitzone standard
-image: hosttoday/ht-docker-node:npmci
+# gitzone ci_default
+image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache:
paths:
@@ -49,23 +49,11 @@ testLTS:
tags:
- docker
- notpriv
-
-testSTABLE:
- stage: test
- script:
- - npmci npm prepare
- - npmci node install stable
- - npmci npm install
- - npmci npm test
- coverage: /\d+.?\d+?\%\s*coverage/
- tags:
- - docker
- - notpriv
release:
stage: release
script:
- - npmci node install stable
+ - npmci node install lts
- npmci npm publish
only:
- tags
@@ -78,19 +66,11 @@ release:
# ====================
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]
+ - npmci command npm install -g tslint typescript
+ - npmci npm install
+ - npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags:
- docker
- priv
@@ -109,10 +89,10 @@ pages:
image: hosttoday/ht-docker-node:npmci
stage: metadata
script:
- - npmci command npm install -g typedoc typescript
+ - npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install
- - npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
+ - npmci command tsdoc
tags:
- docker
- notpriv
diff --git a/dist/index.d.ts b/dist/index.d.ts
deleted file mode 100644
index d5c1940..0000000
--- a/dist/index.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-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 declare let fs: typeof SmartfileFs;
-export declare let interpreter: typeof SmartfileInterpreter;
-export declare let memory: typeof SmartfileMemory;
-export declare let remote: typeof SmartfileRemote;
-export declare let requireReload: (path: string) => any;
diff --git a/dist/index.js b/dist/index.js
deleted file mode 100644
index ff6138b..0000000
--- a/dist/index.js
+++ /dev/null
@@ -1,14 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const SmartfileFs = require("./smartfile.fs");
-const SmartfileInterpreter = require("./smartfile.interpreter");
-const SmartfileMemory = require("./smartfile.memory");
-const SmartfileRemote = require("./smartfile.remote");
-var smartfile_classes_smartfile_1 = require("./smartfile.classes.smartfile");
-exports.Smartfile = smartfile_classes_smartfile_1.Smartfile;
-exports.fs = SmartfileFs;
-exports.interpreter = SmartfileInterpreter;
-exports.memory = SmartfileMemory;
-exports.remote = SmartfileRemote;
-exports.requireReload = SmartfileFs.requireReload;
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUNBLDhDQUE4QztBQUM5QyxnRUFBZ0U7QUFDaEUsc0RBQXNEO0FBQ3RELHNEQUFzRDtBQUV0RCw2RUFBMEQ7QUFBakQsa0RBQUEsU0FBUyxDQUFBO0FBRVAsUUFBQSxFQUFFLEdBQUcsV0FBVyxDQUFDO0FBQ2pCLFFBQUEsV0FBVyxHQUFHLG9CQUFvQixDQUFDO0FBQ25DLFFBQUEsTUFBTSxHQUFHLGVBQWUsQ0FBQztBQUN6QixRQUFBLE1BQU0sR0FBRyxlQUFlLENBQUM7QUFDekIsUUFBQSxhQUFhLEdBQUcsV0FBVyxDQUFDLGFBQWEsQ0FBQyJ9
\ No newline at end of file
diff --git a/dist/smartfile.classes.smartfile.d.ts b/dist/smartfile.classes.smartfile.d.ts
deleted file mode 100644
index ed30ae7..0000000
--- a/dist/smartfile.classes.smartfile.d.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-///
-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;
- /**
- * read file from disk
- */
- read(): Promise;
- /**
- * 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;
-}
diff --git a/dist/smartfile.classes.smartfile.js b/dist/smartfile.classes.smartfile.js
deleted file mode 100644
index b178581..0000000
--- a/dist/smartfile.classes.smartfile.js
+++ /dev/null
@@ -1,118 +0,0 @@
-"use strict";
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- 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;
- }
- /**
- * 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;
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRmaWxlLmNsYXNzZXMuc21hcnRmaWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRmaWxlLmNsYXNzZXMuc21hcnRmaWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSwrQ0FBK0M7QUFFL0MsNkNBQTZDO0FBUzdDOzs7R0FHRztBQUNIO0lBMkJFOzs7T0FHRztJQUVILFlBQVksVUFBd0M7UUFDbEQsSUFBSSxVQUFVLENBQUMsYUFBYSxFQUFFO1lBQzVCLElBQUksQ0FBQyxhQUFhLEdBQUcsVUFBVSxDQUFDLGFBQWEsQ0FBQztTQUMvQzthQUFNLElBQUksVUFBVSxDQUFDLGFBQWEsRUFBRTtZQUNuQyxJQUFJLENBQUMscUJBQXFCLENBQUMsVUFBVSxDQUFDLGFBQWEsQ0FBQyxDQUFDO1NBQ3REO2FBQU07WUFDTCxPQUFPLENBQUMsR0FBRyxDQUFDLDBCQUEwQixDQUFDLENBQUM7U0FDekM7UUFDRCxJQUFJLENBQUMsSUFBSSxHQUFHLFVBQVUsQ0FBQyxJQUFJLENBQUM7UUFDNUIsSUFBSSxDQUFDLFVBQVUsR0FBRyxPQUF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M7SUFFRDs7T0FFRztJQUNILE1BQU07UUFDSixJQUFJLENBQUMsSUFBSSxDQUFDLGFBQWEsRUFBRTtZQUN2QixPQUFPLElBQUksQ0FBQztTQUNiO1FBQ0QsT0FBTyxLQUFLLENBQUM7SUFDZixDQUFDO0lBRUQ7O09BRUc7SUFDSCxRQUFRO1FBQ04sSUFBSSxJQUFJLENBQUMsUUFBUSxZQUFZLE1BQU0sRUFBRTtZQUNuQyxPQUFPLElBQUksQ0FBQztTQUNiO1FBQ0QsT0FBTyxLQUFLLENBQUM7SUFDZixDQUFDO0lBRUQsV0FBVztRQUNULE9BQU8sS0FBSyxDQUFDO0lBQ2YsQ0FBQztJQUVELFFBQVE7UUFDTixPQUFPLEtBQUssQ0FBQztJQUNmLENBQUM7SUFFRCxVQUFVO1FBQ1IsT0FBTyxLQUFLLENBQUM7SUFDZixDQUFDO0lBRUQsZ0JBQWdCO0lBQ2hCLGNBQWMsQ0FBQyxXQUFtQjtRQUNoQyxJQUFJLFdBQVcsR0FBRyxJQUFJLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQztRQUN2QyxJQUFJLENBQUMsSUFBSSxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLElBQUksTUFBTSxDQUFDLFdBQVcsR0FBRyxHQUFHLENBQUMsRUFBRSxXQUFXLENBQUMsQ0FBQztJQUM1RSxDQUFDO0NBQ0Y7QUFwSUQsOEJBb0lDIn0=
\ No newline at end of file
diff --git a/dist/smartfile.fs.d.ts b/dist/smartfile.fs.d.ts
deleted file mode 100644
index e3d8f6a..0000000
--- a/dist/smartfile.fs.d.ts
+++ /dev/null
@@ -1,143 +0,0 @@
-import { Smartfile } from './smartfile.classes.smartfile';
-/**
- *
- * @param filePath
- * @returns {boolean}
- */
-export declare let fileExistsSync: (filePath: any) => boolean;
-/**
- *
- * @param filePath
- * @returns {any}
- */
-export declare let fileExists: (filePath: any) => Promise<{}>;
-/**
- * Checks if given path points to an existing directory
- */
-export declare let isDirectory: (pathArg: any) => boolean;
-/**
- * Checks if a given path points to an existing file
- */
-export declare let isFile: (pathArg: any) => boolean;
-/**
- * copies a file from A to B on the local disk
- */
-export declare let copy: (fromArg: string, toArg: string) => Promise<{}>;
-/**
- * copies a file SYNCHRONOUSLY from A to B on the local disk
- */
-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
- * @exec ASYNC
- */
-export declare let ensureFile: (filePathArg: any, initFileStringArg: any) => 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
- * @exec SYNC
- */
-export declare let ensureFileSync: (filePathArg: string, initFileStringArg: string) => void;
-/**
- * removes a file or folder from local disk
- */
-export declare let remove: (pathArg: string) => Promise;
-/**
- * removes a file SYNCHRONOUSLY from local disk
- */
-export declare let removeSync: (pathArg: string) => boolean;
-/**
- * removes an array of filePaths from disk
- */
-export declare let removeMany: (filePathArrayArg: string[]) => Promise;
-/**
- * like removeFilePathArray but SYNCHRONOUSLY
- */
-export declare let removeManySync: (filePathArrayArg: string[]) => void;
-/**
- *
- * @param filePathArg
- * @param fileTypeArg
- * @returns {any}
- */
-export declare let toObjectSync: (filePathArg: any, fileTypeArg?: any) => any;
-/**
- * reads a file content to a String
- * @param filePath
- * @returns {string|Buffer|any}
- */
-export declare let toStringSync: (filePath: string) => string;
-export declare let fileTreeToObject: (dirPathArg: string, miniMatchFilter: string) => Promise;
-/**
- *
- * @param filePathArg
- * @param options
- * @returns {number}
- */
-export declare let toVinylSync: (filePathArg: any, options?: {}) => any;
-/**
- * lets you reload files hot.
- * @param path
- * @returns {any}
- */
-export declare let requireReload: (path: string) => any;
-/**
- * lists Folders in a directory on local disk
- * @returns Promise
- */
-export declare let listFolders: (pathArg: string, regexFilter?: RegExp) => Promise<{}>;
-/**
- * lists Folders SYNCHRONOUSLY in a directory on local disk
- * @returns an array with the folder names as strings
- */
-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
- */
-export declare let listAllItems: (pathArg: string, regexFilter?: RegExp) => 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 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 array with the absolute paths of all matching files
- */
-export declare let listFileTree: (dirPathArg: string, miniMatchFilter: string) => Promise;
diff --git a/dist/smartfile.fs.js b/dist/smartfile.fs.js
deleted file mode 100644
index 78d5f7e..0000000
--- a/dist/smartfile.fs.js
+++ /dev/null
@@ -1,374 +0,0 @@
-"use strict";
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- 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 SmartfileInterpreter = require("./smartfile.interpreter");
-const smartfile_classes_smartfile_1 = require("./smartfile.classes.smartfile");
-const memory = require("./smartfile.memory");
-/*===============================================================
-============================ Checks =============================
-===============================================================*/
-/**
- *
- * @param filePath
- * @returns {boolean}
- */
-exports.fileExistsSync = function (filePath) {
- let fileExistsBool = false;
- try {
- plugins.fsExtra.readFileSync(filePath);
- fileExistsBool = true;
- }
- catch (err) {
- fileExistsBool = false;
- }
- return fileExistsBool;
-};
-/**
- *
- * @param filePath
- * @returns {any}
- */
-exports.fileExists = function (filePath) {
- let done = plugins.smartpromise.defer();
- plugins.fs.access(filePath, 4, function (err) {
- err ? done.reject(err) : done.resolve();
- });
- return done.promise;
-};
-/**
- * Checks if given path points to an existing directory
- */
-exports.isDirectory = function (pathArg) {
- try {
- return plugins.fsExtra.statSync(pathArg).isDirectory();
- }
- catch (err) {
- return false;
- }
-};
-/**
- * Checks if a given path points to an existing file
- */
-exports.isFile = function (pathArg) {
- return plugins.fsExtra.statSync(pathArg).isFile();
-};
-/*===============================================================
-============================ FS ACTIONS =========================
-===============================================================*/
-/**
- * copies a file from A to B on the local disk
- */
-exports.copy = function (fromArg, toArg) {
- let done = plugins.smartpromise.defer();
- plugins.fsExtra.copy(fromArg, toArg, {}, function () {
- done.resolve();
- });
- return done.promise;
-};
-/**
- * copies a file SYNCHRONOUSLY from A to B on the local disk
- */
-exports.copySync = function (fromArg, toArg) {
- plugins.fsExtra.copySync(fromArg, toArg);
- return true;
-};
-/**
- * ensures that a directory is in place
- */
-exports.ensureDir = (dirPathArg) => {
- let done = plugins.smartpromise.defer();
- plugins.fsExtra.ensureDir(dirPathArg, done.resolve);
- return done.promise;
-};
-/**
- * ensures that a directory is in place
- */
-exports.ensureDirSync = (dirPathArg) => {
- plugins.fsExtra.ensureDirSync(dirPathArg);
-};
-/**
- * ensure an empty directory
- * @executes ASYNC
- */
-exports.ensureEmptyDir = (dirPathArg) => {
- let done = plugins.smartpromise.defer();
- plugins.fsExtra.ensureDir(dirPathArg, () => {
- plugins.fsExtra.emptyDir(dirPathArg, done.resolve);
- });
- return done.promise;
-};
-/**
- * ensure an empty directory
- * @executes SYNC
- */
-exports.ensureEmptyDirSync = (dirPathArg) => {
- 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
- * @exec ASYNC
- */
-exports.ensureFile = (filePathArg, initFileStringArg) => {
- let done = plugins.smartpromise.defer();
- exports.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
- * @exec SYNC
- */
-exports.ensureFileSync = (filePathArg, initFileStringArg) => {
- if (exports.fileExistsSync(filePathArg)) {
- return null;
- }
- else {
- memory.toFsSync(initFileStringArg, filePathArg);
- }
-};
-/**
- * removes a file or folder from local disk
- */
-exports.remove = function (pathArg) {
- let done = plugins.smartpromise.defer();
- plugins.fsExtra.remove(pathArg, function () {
- done.resolve();
- });
- return done.promise;
-};
-/**
- * removes a file SYNCHRONOUSLY from local disk
- */
-exports.removeSync = function (pathArg) {
- plugins.fsExtra.removeSync(pathArg);
- return true;
-};
-/**
- * removes an array of filePaths from disk
- */
-exports.removeMany = function (filePathArrayArg) {
- let promiseArray = [];
- for (let filePath of filePathArrayArg) {
- promiseArray.push(exports.remove(filePath));
- }
- return Promise.all(promiseArray);
-};
-/**
- * like removeFilePathArray but SYNCHRONOUSLY
- */
-exports.removeManySync = function (filePathArrayArg) {
- for (let filePath of filePathArrayArg) {
- exports.removeSync(filePath);
- }
-};
-/*===============================================================
-============================ Write/Read =========================
-===============================================================*/
-/**
- *
- * @param filePathArg
- * @param fileTypeArg
- * @returns {any}
- */
-exports.toObjectSync = function (filePathArg, fileTypeArg) {
- let fileString = plugins.fsExtra.readFileSync(filePathArg, 'utf8');
- let fileType;
- fileTypeArg ? (fileType = fileTypeArg) : (fileType = SmartfileInterpreter.filetype(filePathArg));
- return SmartfileInterpreter.objectFile(fileString, fileType);
-};
-/**
- * reads a file content to a String
- * @param filePath
- * @returns {string|Buffer|any}
- */
-exports.toStringSync = function (filePath) {
- let fileString = plugins.fsExtra.readFileSync(filePath, 'utf8');
- return fileString;
-};
-exports.fileTreeToObject = (dirPathArg, miniMatchFilter) => __awaiter(this, void 0, void 0, function* () {
- // handle absolute miniMatchFilter
- let dirPath;
- if (plugins.path.isAbsolute(miniMatchFilter)) {
- dirPath = '/';
- }
- else {
- dirPath = dirPathArg;
- }
- let fileTree = yield exports.listFileTree(dirPath, miniMatchFilter);
- let smartfileArray = [];
- for (let filePath of fileTree) {
- let readPath = (() => {
- if (!plugins.path.isAbsolute(filePath)) {
- return plugins.path.join(dirPath, filePath);
- }
- else {
- return filePath;
- }
- })();
- let fileContentString = exports.toStringSync(readPath);
- // push a read file as Smartfile
- smartfileArray.push(new smartfile_classes_smartfile_1.Smartfile({
- contentBuffer: new Buffer(fileContentString),
- base: dirPath,
- path: filePath
- }));
- }
- return smartfileArray;
-});
-/**
- *
- * @param filePathArg
- * @param options
- * @returns {number}
- */
-exports.toVinylSync = function (filePathArg, options = {}) {
- return plugins.vinylFile.readSync(filePathArg, options);
-};
-/**
- * lets you reload files hot.
- * @param path
- * @returns {any}
- */
-exports.requireReload = function (path) {
- return plugins.requireReload(path);
-};
-/**
- * lists Folders in a directory on local disk
- * @returns Promise
- */
-exports.listFolders = function (pathArg, regexFilter) {
- let done = plugins.smartpromise.defer();
- let folderArray = plugins.fsExtra.readdirSync(pathArg).filter(function (file) {
- 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;
-};
-/**
- * lists Folders SYNCHRONOUSLY in a directory on local disk
- * @returns an array with the folder names as strings
- */
-exports.listFoldersSync = function (pathArg, regexFilter) {
- let folderArray = plugins.fsExtra.readdirSync(pathArg).filter(function (file) {
- 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
- */
-exports.listFiles = function (pathArg, regexFilter) {
- 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
- */
-exports.listFilesSync = function (pathArg, regexFilter) {
- 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
- */
-exports.listAllItems = function (pathArg, regexFilter) {
- let done = plugins.smartpromise.defer();
- 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
- */
-exports.listAllItemsSync = function (pathArg, regexFilter) {
- 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 array with the absolute paths of all matching files
- */
-exports.listFileTree = (dirPathArg, miniMatchFilter) => {
- let done = plugins.smartpromise.defer();
- // handle absolute miniMatchFilter
- let dirPath;
- if (plugins.path.isAbsolute(miniMatchFilter)) {
- dirPath = '/';
- }
- else {
- dirPath = dirPathArg;
- }
- let options = {
- cwd: dirPath,
- nodir: true,
- dot: true
- };
- plugins.glob(miniMatchFilter, options, (err, files) => {
- if (err) {
- console.log(err);
- done.reject(err);
- }
- done.resolve(files);
- });
- return done.promise;
-};
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRmaWxlLmZzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRmaWxlLmZzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSwrQ0FBZ0Q7QUFDaEQsZ0VBQWlFO0FBRWpFLCtFQUEwRDtBQUUxRCw2Q0FBNkM7QUFDN0M7O2lFQUVpRTtBQUVqRTs7OztHQUlHO0FBQ1EsUUFBQSxjQUFjLEdBQUcsVUFBUyxRQUFRO0lBQzNDLElBQUksY0FBYyxHQUFZLEtBQUssQ0FBQztJQUNwQyxJQUFJO1FBQ0YsT0FBTyxDQUFDLE9BQU8sQ0FBQyxZQUFZLENBQUMsUUFBUSxDQUFDLENBQUM7UUFDdkMsY0FBYyxHQUFHLElBQUksQ0FBQztLQUN2QjtJQUFDLE9BQU8sR0FBRyxFQUFFO1FBQ1osY0FBYyxHQUFHLEtBQUssQ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UFDcEIsSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLFVBQVUsQ0FBQyxlQUFlLENBQUMsRUFBRTtRQUM1QyxPQUFPLEdBQUcsR0FBRyxDQUFDO0tBQ2Y7U0FBTTtRQUNMLE9BQU8sR0FBRyxVQUFVLENBQUM7S0FDdEI7SUFFRCxJQUFJLE9BQU8sR0FBRztRQUNaLEdBQUcsRUFBRSxPQUFPO1FBQ1osS0FBSyxFQUFFLElBQUk7UUFDWCxHQUFHLEVBQUUsSUFBSTtLQUNWLENBQUM7SUFDRixPQUFPLENBQUMsSUFBSSxDQUFDLGVBQWUsRUFBRSxPQUFPLEVBQUUsQ0FBQyxHQUFHLEVBQUUsS0FBZSxFQUFFLEVBQUU7UUFDOUQsSUFBSSxHQUFHLEVBQUU7WUFDUCxPQUFPLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQUFDO1lBQ2pCLElBQUksQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLENBQUM7U0FDbEI7UUFDRCxJQUFJLENBQUMsT0FBTyxDQUFDLEtBQUssQ0FBQyxDQUFDO0lBQ3RCLENBQUMsQ0FBQyxDQUFDO0lBQ0gsT0FBTyxJQUFJLENBQUMsT0FBTyxDQUFDO0FBQ3RCLENBQUMsQ0FBQyJ9
\ No newline at end of file
diff --git a/dist/smartfile.interpreter.d.ts b/dist/smartfile.interpreter.d.ts
deleted file mode 100644
index de74b2a..0000000
--- a/dist/smartfile.interpreter.d.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export declare let filetype: (pathArg: string) => string;
-export declare let objectFile: (fileStringArg: string, fileTypeArg: any) => any;
diff --git a/dist/smartfile.interpreter.js b/dist/smartfile.interpreter.js
deleted file mode 100644
index 9836ed9..0000000
--- a/dist/smartfile.interpreter.js
+++ /dev/null
@@ -1,21 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const plugins = require("./smartfile.plugins");
-exports.filetype = (pathArg) => {
- let extName = plugins.path.extname(pathArg);
- let fileType = extName.replace(/\.([a-z]*)/, '$1'); // remove . form fileType
- return fileType;
-};
-exports.objectFile = (fileStringArg, fileTypeArg) => {
- switch (fileTypeArg) {
- case 'yml':
- case 'yaml':
- return plugins.yaml.safeLoad(fileStringArg);
- case 'json':
- return JSON.parse(fileStringArg);
- default:
- console.error('file type ' + fileTypeArg.blue + ' not supported');
- break;
- }
-};
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRmaWxlLmludGVycHJldGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRmaWxlLmludGVycHJldGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsK0NBQWdEO0FBRXJDLFFBQUEsUUFBUSxHQUFHLENBQUMsT0FBZSxFQUFVLEVBQUU7SUFDaEQsSUFBSSxPQUFPLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUM7SUFDNUMsSUFBSSxRQUFRLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxZQUFZLEVBQUUsSUFBSSxDQUFDLENBQUMsQ0FBQyx5QkFBeUI7SUFDN0UsT0FBTyxRQUFRLENBQUM7QUFDbEIsQ0FBQyxDQUFDO0FBRVMsUUFBQSxVQUFVLEdBQUcsQ0FBQyxhQUFxQixFQUFFLFdBQVcsRUFBRSxFQUFFO0lBQzdELFFBQVEsV0FBVyxFQUFFO1FBQ25CLEtBQUssS0FBSyxDQUFDO1FBQ1gsS0FBSyxNQUFNO1lBQ1QsT0FBTyxPQUFPLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxhQUFhLENBQUMsQ0FBQztRQUM5QyxLQUFLLE1BQU07WUFDVCxPQUFPLElBQUksQ0FBQyxLQUFLLENBQUMsYUFBYSxDQUFDLENBQUM7UUFDbkM7WUFDRSxPQUFPLENBQUMsS0FBSyxDQUFDLFlBQVksR0FBRyxXQUFXLENBQUMsSUFBSSxHQUFHLGdCQUFnQixDQUFDLENBQUM7WUFDbEUsTUFBTTtLQUNUO0FBQ0gsQ0FBQyxDQUFDIn0=
\ No newline at end of file
diff --git a/dist/smartfile.memory.d.ts b/dist/smartfile.memory.d.ts
deleted file mode 100644
index d02b87d..0000000
--- a/dist/smartfile.memory.d.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { Smartfile } from './smartfile.classes.smartfile';
-/**
- * converts file to Object
- * @param fileStringArg
- * @param fileTypeArg
- * @returns {any|any}
- */
-export declare let toObject: (fileStringArg: string, fileTypeArg: string) => any;
-export interface IToFsOptions {
- respectRelative?: boolean;
-}
-/**
- * writes string or Smartfile to disk.
- * @param fileArg
- * @param fileNameArg
- * @param fileBaseArg
- */
-export declare let toFs: (fileContentArg: string | Smartfile, filePathArg: any, optionsArg?: IToFsOptions) => Promise<{}>;
-/**
- * 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;
diff --git a/dist/smartfile.memory.js b/dist/smartfile.memory.js
deleted file mode 100644
index 171de91..0000000
--- a/dist/smartfile.memory.js
+++ /dev/null
@@ -1,87 +0,0 @@
-"use strict";
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- 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 smartfile_classes_smartfile_1 = require("./smartfile.classes.smartfile");
-const smartfileFs = require("./smartfile.fs");
-const SmartfileInterpreter = require("./smartfile.interpreter");
-/**
- * converts file to Object
- * @param fileStringArg
- * @param fileTypeArg
- * @returns {any|any}
- */
-exports.toObject = function (fileStringArg, fileTypeArg) {
- return SmartfileInterpreter.objectFile(fileStringArg, fileTypeArg);
-};
-/**
- * writes string or Smartfile to disk.
- * @param fileArg
- * @param fileNameArg
- * @param fileBaseArg
- */
-exports.toFs = (fileContentArg, filePathArg, optionsArg = {}) => __awaiter(this, void 0, void 0, function* () {
- let done = plugins.smartpromise.defer();
- // check args
- if (!fileContentArg || !filePathArg) {
- throw new Error('expected valid arguments');
- }
- // prepare actual write action
- let fileString;
- let filePath = filePathArg;
- // handle Smartfile
- if (fileContentArg instanceof smartfile_classes_smartfile_1.Smartfile) {
- let fileContentArg2 = fileContentArg;
- fileString = fileContentArg.contentBuffer.toString();
- // handle options
- if (optionsArg.respectRelative) {
- filePath = plugins.path.join(filePath, fileContentArg.path);
- }
- }
- else if (typeof fileContentArg === 'string') {
- fileString = fileContentArg;
- }
- else {
- throw new Error('fileContent is neither string nor Smartfile');
- }
- yield smartfileFs.ensureDir(plugins.path.parse(filePath).dir);
- plugins.fsExtra.writeFile(filePath, fileString, { encoding: 'utf8' }, done.resolve);
- return yield done.promise;
-});
-/**
- * writes a string or a Smartfile to disk synchronously, only supports string
- * @param fileArg
- * @param filePathArg
- */
-exports.toFsSync = function (fileArg, filePathArg) {
- // function checks to abort if needed
- if (!fileArg || !filePathArg) {
- throw new Error('expected a valid arguments');
- }
- // prepare actual write action
- let fileString;
- let filePath = filePathArg;
- if (typeof fileArg !== 'string') {
- throw new Error('fileArg is not of type String.');
- }
- else if (typeof fileArg === 'string') {
- fileString = fileArg;
- }
- plugins.fsExtra.writeFileSync(filePath, fileString, { encoding: 'utf8' });
-};
-exports.smartfileArrayToFs = (smartfileArrayArg, dirArg) => __awaiter(this, void 0, void 0, function* () {
- yield smartfileFs.ensureDir(dirArg);
- for (let smartfile of smartfileArrayArg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QUssUUFBUSxFQUFFO1FBQy9CLE1BQU0sSUFBSSxLQUFLLENBQUMsZ0NBQWdDLENBQUMsQ0FBQztLQUNuRDtTQUFNLElBQUksT0FBTyxPQUFPLEtBQUssUUFBUSxFQUFFO1FBQ3RDLFVBQVUsR0FBRyxPQUFPLENBQUM7S0FDdEI7SUFDRCxPQUFPLENBQUMsT0FBTyxDQUFDLGFBQWEsQ0FBQyxRQUFRLEVBQUUsVUFBVSxFQUFFLEVBQUUsUUFBUSxFQUFFLE1BQU0sRUFBRSxDQUFDLENBQUM7QUFDNUUsQ0FBQyxDQUFDO0FBRVMsUUFBQSxrQkFBa0IsR0FBRyxDQUFPLGlCQUE4QixFQUFFLE1BQWMsRUFBRSxFQUFFO0lBQ3ZGLE1BQU0sV0FBVyxDQUFDLFNBQVMsQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUNwQyxLQUFLLElBQUksU0FBUyxJQUFJLGlCQUFpQixFQUFFO1FBQ3ZDLE1BQU0sWUFBSSxDQUFDLFNBQVMsRUFBRSxNQUFNLEVBQUU7WUFDNUIsZUFBZSxFQUFFLElBQUk7U0FDdEIsQ0FBQyxDQUFDO0tBQ0o7QUFDSCxDQUFDLENBQUEsQ0FBQyJ9
\ No newline at end of file
diff --git a/dist/smartfile.plugins.d.ts b/dist/smartfile.plugins.d.ts
deleted file mode 100644
index 655662a..0000000
--- a/dist/smartfile.plugins.d.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-export import fs = require('fs');
-export import fsExtra = require('fs-extra');
-export declare let glob: any;
-export import path = require('path');
-export import smartpromise = require('@pushrocks/smartpromise');
-export import smartrequest = require('@pushrocks/smartrequest');
-export declare let requireReload: any;
-export import smartpath = require('smartpath');
-export declare let vinylFile: any;
-export declare let yaml: any;
diff --git a/dist/smartfile.plugins.js b/dist/smartfile.plugins.js
deleted file mode 100644
index 7d50327..0000000
--- a/dist/smartfile.plugins.js
+++ /dev/null
@@ -1,13 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.fs = require("fs");
-exports.fsExtra = require("fs-extra");
-exports.glob = require('glob');
-exports.path = require("path");
-exports.smartpromise = require("@pushrocks/smartpromise");
-exports.smartrequest = require("@pushrocks/smartrequest");
-exports.requireReload = require('require-reload');
-exports.smartpath = require("smartpath");
-exports.vinylFile = require('vinyl-file');
-exports.yaml = require('js-yaml');
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRmaWxlLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGZpbGUucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJCQUFpQztBQUNqQyxzQ0FBNEM7QUFDakMsUUFBQSxJQUFJLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0FBQ2xDLCtCQUFxQztBQUNyQywwREFBZ0U7QUFDaEUsMERBQWdFO0FBQ3JELFFBQUEsYUFBYSxHQUFHLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDO0FBQ3JELHlDQUErQztBQUNwQyxRQUFBLFNBQVMsR0FBRyxPQUFPLENBQUMsWUFBWSxDQUFDLENBQUM7QUFDbEMsUUFBQSxJQUFJLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDIn0=
\ No newline at end of file
diff --git a/dist/smartfile.remote.d.ts b/dist/smartfile.remote.d.ts
deleted file mode 100644
index 9124081..0000000
--- a/dist/smartfile.remote.d.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- *
- * @param fromArg
- * @returns {any}
- */
-export declare let toObject: (fromArg: string) => Promise<{}>;
-/**
- *
- * @param fromArg
- * @returns {any}
- */
-export declare let toString: (fromArg: string) => Promise<{}>;
diff --git a/dist/smartfile.remote.js b/dist/smartfile.remote.js
deleted file mode 100644
index f03c297..0000000
--- a/dist/smartfile.remote.js
+++ /dev/null
@@ -1,51 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const plugins = require("./smartfile.plugins");
-/* export let toFs = function (from: string, toPath: string) {
- let done = plugins.q.defer()
- let stream = plugins.smartrequest(from).pipe(plugins.fsExtra.createWriteStream(toPath))
- stream.on('finish', function () {
- done.resolve(toPath)
- })
- return done.promise
-} */
-/**
- *
- * @param fromArg
- * @returns {any}
- */
-exports.toObject = function (fromArg) {
- let done = plugins.smartpromise.defer();
- plugins.smartrequest
- .request(fromArg, {
- method: 'get'
- })
- .then((res) => {
- 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 done.promise;
-};
-/**
- *
- * @param fromArg
- * @returns {any}
- */
-exports.toString = (fromArg) => {
- let done = plugins.smartpromise.defer();
- plugins.smartrequest.get(fromArg).then((res) => {
- if (res.statusCode === 200) {
- done.resolve(res.body);
- }
- else {
- done.reject(new Error('could not get remote file from ' + fromArg));
- }
- });
- return done.promise;
-};
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRmaWxlLnJlbW90ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0ZmlsZS5yZW1vdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwrQ0FBZ0Q7QUFHaEQ7Ozs7Ozs7SUFPSTtBQUVKOzs7O0dBSUc7QUFDUSxRQUFBLFFBQVEsR0FBRyxVQUFTLE9BQWU7SUFDNUMsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLFlBQVksQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUN4QyxPQUFPLENBQUMsWUFBWTtTQUNqQixPQUFPLENBQUMsT0FBTyxFQUFFO1FBQ2hCLE1BQU0sRUFBRSxLQUFLO0tBQ2QsQ0FBQztTQUNELElBQUks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docs/index.md b/docs/index.md
deleted file mode 100644
index 24eb151..0000000
--- a/docs/index.md
+++ /dev/null
@@ -1,43 +0,0 @@
-# smartfile
-
-make files easily accessible for processing in javascript.
-
-## Availabililty
-
-[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartfile)
-[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://gitlab.com/pushrocks/smartfile)
-[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartfile)
-[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartfile/)
-
-## Status for master
-
-[![build status](https://gitlab.com/pushrocks/smartfile/badges/master/build.svg)](https://gitlab.com/pushrocks/smartfile/commits/master)
-[![coverage report](https://gitlab.com/pushrocks/smartfile/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartfile/commits/master)
-[![Dependency Status](https://david-dm.org/pushrocks/smartfile.svg)](https://david-dm.org/pushrocks/smartfile)
-[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/smartfile/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/smartfile/master/dependencies/npm)
-[![bitHound Code](https://www.bithound.io/github/pushrocks/smartfile/badges/code.svg)](https://www.bithound.io/github/pushrocks/smartfile)
-[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
-[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
-[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](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)
-
-[![npm](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)
diff --git a/package.json b/package.json
index 257c741..029abb4 100644
--- a/package.json
+++ b/package.json
@@ -47,5 +47,15 @@
"gulp-function": "^2.2.14",
"tslint": "^5.15.0",
"tslint-config-prettier": "^1.18.0"
- }
-}
+ },
+ "files": [
+ "ts/*",
+ "ts_web/*",
+ "dist/*",
+ "dist_web/*",
+ "assets/*",
+ "cli.js",
+ "npmextra.json",
+ "readme.md"
+ ]
+}
\ No newline at end of file
diff --git a/test/test.ts b/test/test.ts
index 1db6364..c10b948 100644
--- a/test/test.ts
+++ b/test/test.ts
@@ -8,112 +8,112 @@ import { expect, tap } from '@pushrocks/tapbundle';
// ---------------------------
tap.test('.fs.fileExistsSync -> should return an accurate boolean', async () => {
- expect(smartfile.fs.fileExistsSync('./test/mytest.json')).to.be.true;
- expect(smartfile.fs.fileExistsSync('./test/notthere.json')).be.false;
+ expect(smartfile.fs.fileExistsSync('./test/testassets/mytest.json')).to.be.true;
+ expect(smartfile.fs.fileExistsSync('./test/testassets/notthere.json')).be.false;
});
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 => {
+ expect(smartfile.fs.fileExists('./test/testassets/mytest.json')).to.be.instanceof(Promise);
+ await smartfile.fs.fileExists('./test/testassets/mytest.json');
+ await smartfile.fs.fileExists('./test/testassets/notthere.json').catch(err => {
return expect(err.message).to.equal(
- "ENOENT: no such file or directory, access './test/notthere.json'"
+ "ENOENT: no such file or directory, access './test/testassets/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');
+ expect(smartfile.fs.listFoldersSync('./test/testassets/')).to.include('testfolder');
+ expect(smartfile.fs.listFoldersSync('./test/testassets/')).to.not.include('notExistentFolder');
});
tap.test('.fs.listFolders() -> should get the file type from a string', async () => {
- let folderArrayArg = await smartfile.fs.listFolders('./test/');
+ let folderArrayArg = await smartfile.fs.listFolders('./test/testassets/');
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');
+ expect(smartfile.fs.listFilesSync('./test/testassets/')).to.include('mytest.json');
+ expect(smartfile.fs.listFilesSync('./test/testassets/')).to.not.include('notExistentFile');
+ expect(smartfile.fs.listFilesSync('./test/testassets/', /mytest\.json/)).to.include('mytest.json');
+ expect(smartfile.fs.listFilesSync('./test/testassets/', /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/');
+ let folderArrayArg = await smartfile.fs.listFiles('./test/testassets/');
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');
+ let folderArrayArg = await smartfile.fs.listFileTree(path.resolve('./test/testassets/'), '**/*.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');
+ let fileArrayArg = await smartfile.fs.fileTreeToObject(path.resolve('./test/testassets/'), '**/*.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/');
+ smartfile.fs.copy('./test/testassets/testfolder/', './test/testassets/temp/');
});
tap.test('.fs.copy() -> should copy a file', async () => {
- smartfile.fs.copy('./test/mytest.yaml', './test/temp/');
+ smartfile.fs.copy('./test/testassets/mytest.yaml', './test/testassets/temp/');
});
tap.test('.fs.copy() -> should copy a file and rename it', async () => {
- smartfile.fs.copy('./test/mytest.yaml', './test/temp/mytestRenamed.yaml');
+ smartfile.fs.copy('./test/testassets/mytest.yaml', './test/testassets/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');
+ await smartfile.fs.remove('./test/testassets/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;
+ smartfile.fs.removeSync('./test/testassets/temp/testfile1.txt');
+ expect(smartfile.fs.fileExistsSync('./test/testassets/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;
+ smartfile.fs.removeMany(['./test/testassets/temp/testfile1.txt', './test/testassets/temp/testfile2.txt']).then(() => {
+ expect(smartfile.fs.fileExistsSync('./test/testassets/temp/testfile1.txt')).to.be.false;
+ expect(smartfile.fs.fileExistsSync('./test/testassets/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;
+ smartfile.fs.removeManySync(['./test/testassets/temp/testfile1.txt', './test/testassets/temp/testfile2.txt']);
+ expect(smartfile.fs.fileExistsSync('./test/testassets/temp/testfile1.txt')).to.be.false;
+ expect(smartfile.fs.fileExistsSync('./test/testassets/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');
+ let testData = smartfile.fs.toObjectSync('./test/testassets/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');
+ let testData = smartfile.fs.toObjectSync('./test/testassets/mytest.txt');
}
);
tap.test('.fs.toObjectSync() -> should read an ' + '.json' + ' file to an object', async () => {
- let testData = smartfile.fs.toObjectSync('./test/mytest.json');
+ let testData = smartfile.fs.toObjectSync('./test/testassets/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 &&%$');
+ expect(smartfile.fs.toStringSync('./test/testassets/mytest.txt')).to.equal('Some TestString &&%$');
});
// ---------------------------
@@ -130,7 +130,7 @@ tap.test('.interpreter.filetype() -> should get the file type from a string', as
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'));
+ await smartfile.memory.toFs(localString, path.join(process.cwd(), './test/testassets/temp/testMemToFs.txt'));
});
tap.test(
@@ -139,7 +139,7 @@ tap.test(
let localString = 'myString';
smartfile.memory.toFsSync(
localString,
- path.join(process.cwd(), './test/temp/testMemToFsSync.txt')
+ path.join(process.cwd(), './test/testassets/temp/testMemToFsSync.txt')
);
}
);
@@ -165,7 +165,7 @@ tap.test('.remote.toString() -> should reject a Promise when the link is false',
// ---------------------------
tap.test('.Smartfile -> should produce vinyl compatible files', async () => {
- let smartfileArray = await smartfile.fs.fileTreeToObject(process.cwd(), './test/testfolder/**/*');
+ let smartfileArray = await smartfile.fs.fileTreeToObject(process.cwd(), './test/testassets/testfolder/**/*');
let localSmartfile = smartfileArray[0];
expect(localSmartfile).to.be.instanceof(smartfile.Smartfile);
expect(localSmartfile.contents).to.be.instanceof(Buffer);
@@ -178,7 +178,7 @@ tap.test('.Smartfile -> should produce vinyl compatible files', async () => {
});
tap.test('should output a smartfile array to disk', async () => {
- let smartfileArray = await smartfile.fs.fileTreeToObject('./test/testfolder/', '*');
+ let smartfileArray = await smartfile.fs.fileTreeToObject('./test/testassets/testfolder/', '*');
for (let smartfile of smartfileArray) {
console.log(smartfile.relative);
console.log(smartfile.path);
@@ -187,7 +187,7 @@ tap.test('should output a smartfile array to disk', async () => {
}
await smartfile.memory.smartfileArrayToFs(
smartfileArray,
- path.resolve('./test/temp/testoutput/')
+ path.resolve('./test/testassets/temp/testoutput/')
);
});
diff --git a/test/mytest.json b/test/testassets/mytest.json
similarity index 100%
rename from test/mytest.json
rename to test/testassets/mytest.json
diff --git a/test/mytest.txt b/test/testassets/mytest.txt
similarity index 100%
rename from test/mytest.txt
rename to test/testassets/mytest.txt
diff --git a/test/mytest.yaml b/test/testassets/mytest.yaml
similarity index 100%
rename from test/mytest.yaml
rename to test/testassets/mytest.yaml
diff --git a/test/testfolder/subfolder/deepsubfolder/deepsubtestfile.txt b/test/testassets/temp/subfolder/deepsubfolder/deepsubtestfile.txt
similarity index 100%
rename from test/testfolder/subfolder/deepsubfolder/deepsubtestfile.txt
rename to test/testassets/temp/subfolder/deepsubfolder/deepsubtestfile.txt
diff --git a/test/testfolder/subfolder/subtestfile.txt b/test/testassets/temp/subfolder/subtestfile.txt
similarity index 100%
rename from test/testfolder/subfolder/subtestfile.txt
rename to test/testassets/temp/subfolder/subtestfile.txt
diff --git a/test/testassets/temp/testMemToFs.txt b/test/testassets/temp/testMemToFs.txt
new file mode 100644
index 0000000..68ef103
--- /dev/null
+++ b/test/testassets/temp/testMemToFs.txt
@@ -0,0 +1 @@
+myString
\ No newline at end of file
diff --git a/test/testassets/temp/testMemToFsSync.txt b/test/testassets/temp/testMemToFsSync.txt
new file mode 100644
index 0000000..68ef103
--- /dev/null
+++ b/test/testassets/temp/testMemToFsSync.txt
@@ -0,0 +1 @@
+myString
\ No newline at end of file
diff --git a/test/testfolder/testfile1.txt b/test/testassets/temp/testfile1.txt
similarity index 100%
rename from test/testfolder/testfile1.txt
rename to test/testassets/temp/testfile1.txt
diff --git a/test/testfolder/testfile2.txt b/test/testassets/temp/testfile2.txt
similarity index 100%
rename from test/testfolder/testfile2.txt
rename to test/testassets/temp/testfile2.txt
diff --git a/test/testassets/temp/testoutput/testfile1.txt b/test/testassets/temp/testoutput/testfile1.txt
new file mode 100644
index 0000000..e69de29
diff --git a/test/testassets/temp/testoutput/testfile2.txt b/test/testassets/temp/testoutput/testfile2.txt
new file mode 100644
index 0000000..e69de29
diff --git a/test/testassets/testfolder/subfolder/deepsubfolder/deepsubtestfile.txt b/test/testassets/testfolder/subfolder/deepsubfolder/deepsubtestfile.txt
new file mode 100644
index 0000000..c7e5f92
--- /dev/null
+++ b/test/testassets/testfolder/subfolder/deepsubfolder/deepsubtestfile.txt
@@ -0,0 +1 @@
+okidoks
\ No newline at end of file
diff --git a/test/testassets/testfolder/subfolder/subtestfile.txt b/test/testassets/testfolder/subfolder/subtestfile.txt
new file mode 100644
index 0000000..32f95c0
--- /dev/null
+++ b/test/testassets/testfolder/subfolder/subtestfile.txt
@@ -0,0 +1 @@
+hi
\ No newline at end of file
diff --git a/test/testassets/testfolder/testfile1.txt b/test/testassets/testfolder/testfile1.txt
new file mode 100644
index 0000000..e69de29
diff --git a/test/testassets/testfolder/testfile2.txt b/test/testassets/testfolder/testfile2.txt
new file mode 100644
index 0000000..e69de29
diff --git a/ts/smartfile.fs.ts b/ts/smartfile.fs.ts
index 2bcd274..0624dc1 100644
--- a/ts/smartfile.fs.ts
+++ b/ts/smartfile.fs.ts
@@ -210,7 +210,7 @@ export let toStringSync = function(filePath: string): string {
return fileString;
};
-export let fileTreeToObject = async (dirPathArg: string, miniMatchFilter: string) => {
+export const fileTreeToObject = async (dirPathArg: string, miniMatchFilter: string) => {
// handle absolute miniMatchFilter
let dirPath: string;
if (plugins.path.isAbsolute(miniMatchFilter)) {
@@ -219,8 +219,8 @@ export let fileTreeToObject = async (dirPathArg: string, miniMatchFilter: string
dirPath = dirPathArg;
}
- let fileTree = await listFileTree(dirPath, miniMatchFilter);
- let smartfileArray: Smartfile[] = [];
+ const fileTree = await listFileTree(dirPath, miniMatchFilter);
+ const smartfileArray: Smartfile[] = [];
for (let filePath of fileTree) {
let readPath = ((): string => {
if (!plugins.path.isAbsolute(filePath)) {
@@ -234,7 +234,7 @@ export let fileTreeToObject = async (dirPathArg: string, miniMatchFilter: string
// push a read file as Smartfile
smartfileArray.push(
new Smartfile({
- contentBuffer: new Buffer(fileContentString),
+ contentBuffer: Buffer.from(fileContentString),
base: dirPath,
path: filePath
})
@@ -331,7 +331,7 @@ export let listAllItemsSync = (pathArg: string, regexFilter?: RegExp): string[]
* note: if the miniMatch Filter is an absolute path, the cwdArg will be omitted
* @returns Promise string array with the absolute paths of all matching files
*/
-export let listFileTree = (dirPathArg: string, miniMatchFilter: string): Promise => {
+export const listFileTree = async (dirPathArg: string, miniMatchFilter: string, absolutePathsBool: boolean = false): Promise => {
const done = plugins.smartpromise.defer();
// handle absolute miniMatchFilter
@@ -354,5 +354,13 @@ export let listFileTree = (dirPathArg: string, miniMatchFilter: string): Promise
}
done.resolve(files);
});
- return done.promise;
+
+ let fileList = await done.promise;
+ if (absolutePathsBool) {
+ fileList = fileList.map(filePath => {
+ return plugins.path.resolve(plugins.path.join(dirPath, filePath));
+ });
+ }
+
+ return fileList;
};