Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
163eb5a70c | |||
fa5371a6bd | |||
5ff7f8c3ac | |||
0c49bbd4b2 | |||
f2e2a22a57 | |||
6ae30110f8 | |||
7b4626586c |
36
.gitlab-ci.yml
Normal file
36
.gitlab-ci.yml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
image: hosttoday/ht-docker-node:npmts
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- test
|
||||||
|
- release
|
||||||
|
|
||||||
|
testLEGACY:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- npmci test legacy
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
|
testLTS:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- npmci test lts
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
testSTABLE:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- npmci test stable
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
release:
|
||||||
|
stage: release
|
||||||
|
script:
|
||||||
|
- npmci publish
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
tags:
|
||||||
|
- docker
|
@ -2,13 +2,13 @@
|
|||||||
make files easily accessible for processing in javascript.
|
make files easily accessible for processing in javascript.
|
||||||
|
|
||||||
## Status
|
## Status
|
||||||
[](https://travis-ci.org/pushrocks/smartfile)
|
[](https://gitlab.com/pushrocks/smartfile/commits/master)
|
||||||
[](https://ci.appveyor.com/project/philkunz/smartfile/branch/master)
|
[](https://ci.appveyor.com/project/philkunz/smartfile/branch/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://codecov.io/github/pushrocks/smartfile?branch=master)
|
||||||
|
|
||||||
## Supported file types:
|
## Usage
|
||||||
* .yml .yaml
|
smartfile is an approach of being one tool to handle files in diverse environments.
|
||||||
* .json
|
It can fetch files from remote locations, work with local disks and do pure memory operations.
|
22
dist/smartfile.fs.d.ts
vendored
22
dist/smartfile.fs.d.ts
vendored
@ -1,7 +1,19 @@
|
|||||||
import "typings-global";
|
import "typings-global";
|
||||||
|
/**
|
||||||
|
* 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) => any;
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
/**
|
||||||
|
* removes a file or folder from local disk
|
||||||
|
*/
|
||||||
export declare let remove: (pathArg: string) => any;
|
export declare let remove: (pathArg: string) => any;
|
||||||
|
/**
|
||||||
|
* removes a file SYNCHRONOUSLY from local disk
|
||||||
|
*/
|
||||||
export declare let removeSync: (pathArg: string) => boolean;
|
export declare let removeSync: (pathArg: string) => boolean;
|
||||||
export declare let toFS: (options: {
|
export declare let toFS: (options: {
|
||||||
from: string;
|
from: string;
|
||||||
@ -40,8 +52,14 @@ export declare let toVinylSync: (filePathArg: any, options?: {}) => any;
|
|||||||
* @returns {any}
|
* @returns {any}
|
||||||
*/
|
*/
|
||||||
export declare let requireReload: (path: string) => any;
|
export declare let requireReload: (path: string) => any;
|
||||||
export declare let foldersSync: (pathArg: any) => any;
|
/**
|
||||||
export declare let folders: (pathArg: string) => any;
|
* lists Folders in a directory on local disk
|
||||||
|
*/
|
||||||
|
export declare let listFolders: (pathArg: string) => any;
|
||||||
|
/**
|
||||||
|
* lists Folders SYNCHRONOUSLY in a directory on local disk
|
||||||
|
*/
|
||||||
|
export declare let listFoldersSync: (pathArg: any) => any;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param filePath
|
* @param filePath
|
||||||
|
32
dist/smartfile.fs.js
vendored
32
dist/smartfile.fs.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "smartfile",
|
"name": "smartfile",
|
||||||
"version": "4.0.0",
|
"version": "4.0.4",
|
||||||
"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",
|
||||||
@ -13,7 +13,7 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/pushrocks/smartfile.git"
|
"url": "https://gitlab.com/pushrocks/smartfile.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"filesystem",
|
"filesystem",
|
||||||
@ -22,9 +22,9 @@
|
|||||||
"author": "Smart Coordination GmbH <office@push.rocks> (https://push.rocks)",
|
"author": "Smart Coordination GmbH <office@push.rocks> (https://push.rocks)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/pushrocks/smartfile/issues"
|
"url": "https://gitlab.com/pushrocks/smartfile/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/pushrocks/smartfile",
|
"homepage": "https://gitlab.com/pushrocks/smartfile",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"beautylog": "^5.0.12",
|
"beautylog": "^5.0.12",
|
||||||
"fs-extra": "^0.30.0",
|
"fs-extra": "^0.30.0",
|
||||||
|
12
test/test.js
12
test/test.js
File diff suppressed because one or more lines are too long
10
test/test.ts
10
test/test.ts
@ -23,15 +23,15 @@ describe("smartfile".yellow,function(){
|
|||||||
(smartfile.fs.fileExists("./test/notthere.json")).should.not.be.fulfilled();
|
(smartfile.fs.fileExists("./test/notthere.json")).should.not.be.fulfilled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe(".foldersSync()",function(){
|
describe(".listFoldersSync()",function(){
|
||||||
it("should get the file type from a string",function(){
|
it("should get the file type from a string",function(){
|
||||||
smartfile.fs.foldersSync("./test/").should.containDeep([ "testfolder"]);
|
smartfile.fs.listFoldersSync("./test/").should.containDeep([ "testfolder"]);
|
||||||
smartfile.fs.foldersSync("./test/").should.not.containDeep([ "notExistentFolder"]);
|
smartfile.fs.listFoldersSync("./test/").should.not.containDeep([ "notExistentFolder"]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe(".folders()",function(){
|
describe(".listFolders()",function(){
|
||||||
it("should get the file type from a string",function(done){
|
it("should get the file type from a string",function(done){
|
||||||
smartfile.fs.folders("./test/")
|
smartfile.fs.listFolders("./test/")
|
||||||
.then(function(folderArrayArg){
|
.then(function(folderArrayArg){
|
||||||
folderArrayArg.should.containDeep([ "testfolder"]);
|
folderArrayArg.should.containDeep([ "testfolder"]);
|
||||||
folderArrayArg.should.not.containDeep([ "notExistentFolder"]);
|
folderArrayArg.should.not.containDeep([ "notExistentFolder"]);
|
||||||
|
@ -7,6 +7,9 @@ import SmartfileInterpreter = require("./smartfile.interpreter");
|
|||||||
============================ FS ACTIONS =========================
|
============================ FS ACTIONS =========================
|
||||||
===============================================================*/
|
===============================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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();
|
var done = plugins.q.defer();
|
||||||
plugins.fs.copy(fromArg,toArg,{},function(){
|
plugins.fs.copy(fromArg,toArg,{},function(){
|
||||||
@ -15,11 +18,17 @@ export let copy = function(fromArg:string, toArg:string){
|
|||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.fs.copySync(fromArg,toArg);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* removes a file or folder from local disk
|
||||||
|
*/
|
||||||
export let remove = function(pathArg:string){
|
export let remove = function(pathArg:string){
|
||||||
var done = plugins.q.defer();
|
var done = plugins.q.defer();
|
||||||
plugins.fs.remove(pathArg,function(){
|
plugins.fs.remove(pathArg,function(){
|
||||||
@ -28,6 +37,9 @@ export let remove = function(pathArg:string){
|
|||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.fs.removeSync(pathArg);
|
||||||
return true;
|
return true;
|
||||||
@ -100,13 +112,10 @@ export let requireReload = function(path:string){
|
|||||||
return plugins.requireReload(path);
|
return plugins.requireReload(path);
|
||||||
};
|
};
|
||||||
|
|
||||||
export let foldersSync = function(pathArg){
|
/**
|
||||||
return plugins.fs.readdirSync(pathArg).filter(function(file) {
|
* lists Folders in a directory on local disk
|
||||||
return plugins.fs.statSync(plugins.path.join(pathArg, file)).isDirectory();
|
*/
|
||||||
});
|
export let listFolders = function(pathArg:string){
|
||||||
};
|
|
||||||
|
|
||||||
export let folders = function(pathArg:string){
|
|
||||||
let done = plugins.q.defer();
|
let done = plugins.q.defer();
|
||||||
let folderArray = plugins.fs.readdirSync(pathArg).filter(function(file) {
|
let folderArray = plugins.fs.readdirSync(pathArg).filter(function(file) {
|
||||||
return plugins.fs.statSync(plugins.path.join(pathArg, file)).isDirectory();
|
return plugins.fs.statSync(plugins.path.join(pathArg, file)).isDirectory();
|
||||||
@ -115,6 +124,14 @@ export let folders = function(pathArg:string){
|
|||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* lists Folders SYNCHRONOUSLY in a directory on local disk
|
||||||
|
*/
|
||||||
|
export let listFoldersSync = function(pathArg){
|
||||||
|
return plugins.fs.readdirSync(pathArg).filter(function(file) {
|
||||||
|
return plugins.fs.statSync(plugins.path.join(pathArg, file)).isDirectory();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user