@waiting/shared-core
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -5,2 +5,7 @@ # Change Log | ||
<a name="1.2.1"></a> | ||
## [1.2.1](https://github.com/waitingsong/node-shared-core/compare/v1.2.0...v1.2.1) (2019-01-21) | ||
<a name="1.2.0"></a> | ||
@@ -7,0 +12,0 @@ # [1.2.0](https://github.com/waitingsong/node-shared-core/compare/v1.1.0...v1.2.0) (2019-01-21) |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* @version 1.2.0 | ||
* @version 1.2.1 | ||
* @author waiting | ||
@@ -282,3 +282,3 @@ * @license MIT | ||
const exitCode$ = rxjs.forkJoin(protectTest$, skipTest$).pipe(operators.map(([pro, skip]) => { | ||
console.info('pro:skip', pro, skip); | ||
// console.info('pro:skip', pro, skip) | ||
// tslint:disable-next-line:no-bitwise | ||
@@ -285,0 +285,0 @@ return pro & skip |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* @version 1.2.0 | ||
* @version 1.2.1 | ||
* @author waiting | ||
@@ -280,3 +280,3 @@ * @license MIT | ||
const exitCode$ = forkJoin(protectTest$, skipTest$).pipe(map(([pro, skip]) => { | ||
console.info('pro:skip', pro, skip); | ||
// console.info('pro:skip', pro, skip) | ||
// tslint:disable-next-line:no-bitwise | ||
@@ -283,0 +283,0 @@ return pro & skip |
@@ -5,3 +5,3 @@ /** | ||
* | ||
* @version 1.2.0 | ||
* @version 1.2.1 | ||
* @author waiting | ||
@@ -12,3 +12,3 @@ * @license MIT | ||
import{throwError as t,defer as e,of as n,from as r,combineLatest as i,forkJoin as o}from"rxjs";import{close as a,chmod as s,copyFile as c,mkdir as p,open as f,readFile as u,readdir as l,rmdir as w,stat as m,unlink as h,write as v,writeFile as d,access as x}from"fs";import{normalize as y,sep as g,resolve as M,dirname as E,join as I}from"path";export{basename,dirname,join,normalize,resolve as pathResolve}from"path";import{map as b,mergeMap as j,scan as D,concatMap as P,last as T,mapTo as N,defaultIfEmpty as O,tap as S,share as k,filter as B,take as C}from"rxjs/operators";import{promisify as G}from"util";export{promisify}from"util";export{tmpdir}from"os";function R(t){throw new Error("Assert Never Unexpected object: "+t)}function $(e){return t(new Error("Assert Never Unexpected object: "+e))}const _=G(a),A=G(s),F=G(c),U=G(p),z=G(f),J=G(u),L=G(l),q=G(w),H=G(m),K=G(h),Q=G(v),V=G(d);function W(t){return e(()=>X(t)).pipe(b(e=>e?y(t):""))}function X(t){return t?new Promise(e=>x(t,t=>e(!t))):Promise.resolve(!1)}function Y(t){if(!t)return n("");const r=y(t);return e(()=>Z(r)).pipe(b(t=>t?r:""))}function Z(t){return t?nt(t,"DIR"):Promise.resolve(!1)}function tt(t){const n=y(t);return e(()=>et(n)).pipe(b(t=>t?n:""))}function et(t){return t?nt(t,"FILE"):Promise.resolve(!1)}function nt(t,e){return t?X(t).then(n=>!!n&&H(t).then(t=>"DIR"===e?t.isDirectory():t.isFile())):Promise.resolve(!1)}function rt(t){if(!t)throw new Error("value of path param invalid");const e=n(y(t)),i=e.pipe(j(t=>r(t.split(g))),D((t,e)=>M(t,e),g)),o=i.pipe(P(it),T()),a=e.pipe(j(Y),j(t=>t?n(t):o));return a}function it(t,r){return W(t).pipe(j(r=>r?n(r):e(()=>U(t,493)).pipe(N(t))))}async function ot(t){if(t){const e=y(t);return await Z(e)||await e.split(g).reduce(async(t,e)=>{const n=M(await t,e);return await X(n)||await U(n,493),n},Promise.resolve(g)),e}throw new Error("value of path param invalid")}async function at(t,e,n){const r=E(t);if(!r)throw new Error("folder empty");await Z(r)||await ot(r);const i=y(t);if(!await et(i)){const t=n||{mode:416};Buffer.isBuffer(e)?await V(i,e,t):"object"==typeof e?await V(i,JSON.stringify(e)):await V(i,e,t)}return i}async function st(t){t&&(await ct(t),await Z(t)&&await q(t))}async function ct(t){if(t&&await X(t)){if(await et(t))return void await K(t);const e=await L(t);if(e.length)for(const n of e)await ct(I(t,n));else await q(t)}}async function pt(t,e){const n=[];for(const r of e){const e=I(t,r.replace(/\.{2,}/,"/"));if(!await X(e))continue;const i=await L(e);for(const t of i){if(!ft(t))continue;const i=I(e,t),o=ut(t),a=I(e,o);await X(a)||(await F(i,a),n.push(`${r}/${o}`))}}return n}function ft(t){if(!t)return!1;if(".example"===t)return!1;const e=t.split(".");return e.length>1&&"example"===e[e.length-1]}function ut(t){const e=t.split(".");return e.length>1&&"example"===e[e.length-1]?e.slice(0,e.length-1).join("."):t}function lt(t){const{baseDir:e,COMMIT_EDITMSG:a,branchName:s,protectBranch:c,skipMsg:p}=t,f=I(e,a);if(!a)return console.info("COMMIT_EDITMSG value blank"),n(1);const u=r(c).pipe(O()),l=r(p).pipe(O()),w=W(f).pipe(S(t=>{t||(console.info(`COMMIT_EDITMSG file not exists: "${f}"`),process.exit(1))}),j(t=>J(t,{encoding:"utf8"})),b(t=>{const e=t.split(/\n|\r\n/)[0];return{head:e,msg:t}}),k()),m=i(n(s),u).pipe(b(([t,e])=>!(!e||!e.test(t))),B(t=>t),N(0),O(1)),h=i(w,l).pipe(b(([{head:t},e])=>!(!e||!e.test(t))),B(t=>t),N(1),O(0)),v=o(m,h).pipe(b(([t,e])=>(console.info("pro:skip",t,e),t&e)),O(0),C(1));return v}export{R as assertNever,$ as assertNeverRx,_ as closeAsync,A as chmodAsync,F as copyFileAsync,U as mkdirAsync,z as openAsync,J as readFileAsync,L as readDirAsync,q as rmdirAsync,H as statAsync,K as unlinkAsync,Q as writeAsync,V as writeFileAsync,W as pathAccessible,X as isPathAccessible,Y as dirExists,Z as isDirExists,tt as fileExists,et as isFileExists,nt as isDirFileExists,rt as createDir,ot as createDirAsync,at as createFileAsync,st as rimraf,pt as genFileFromExample,lt as isSkipCommitlint}; | ||
import{throwError as t,defer as e,of as n,from as r,combineLatest as i,forkJoin as o}from"rxjs";import{close as a,chmod as s,copyFile as c,mkdir as p,open as f,readFile as u,readdir as l,rmdir as w,stat as m,unlink as h,write as v,writeFile as d,access as x}from"fs";import{normalize as y,sep as g,resolve as M,dirname as E,join as I}from"path";export{basename,dirname,join,normalize,resolve as pathResolve}from"path";import{map as b,mergeMap as j,scan as D,concatMap as P,last as T,mapTo as N,defaultIfEmpty as O,tap as S,share as B,filter as C,take as G}from"rxjs/operators";import{promisify as R}from"util";export{promisify}from"util";export{tmpdir}from"os";function $(t){throw new Error("Assert Never Unexpected object: "+t)}function _(e){return t(new Error("Assert Never Unexpected object: "+e))}const k=R(a),A=R(s),F=R(c),U=R(p),z=R(f),J=R(u),L=R(l),q=R(w),H=R(m),K=R(h),Q=R(v),V=R(d);function W(t){return e(()=>X(t)).pipe(b(e=>e?y(t):""))}function X(t){return t?new Promise(e=>x(t,t=>e(!t))):Promise.resolve(!1)}function Y(t){if(!t)return n("");const r=y(t);return e(()=>Z(r)).pipe(b(t=>t?r:""))}function Z(t){return t?nt(t,"DIR"):Promise.resolve(!1)}function tt(t){const n=y(t);return e(()=>et(n)).pipe(b(t=>t?n:""))}function et(t){return t?nt(t,"FILE"):Promise.resolve(!1)}function nt(t,e){return t?X(t).then(n=>!!n&&H(t).then(t=>"DIR"===e?t.isDirectory():t.isFile())):Promise.resolve(!1)}function rt(t){if(!t)throw new Error("value of path param invalid");const e=n(y(t)),i=e.pipe(j(t=>r(t.split(g))),D((t,e)=>M(t,e),g)),o=i.pipe(P(it),T()),a=e.pipe(j(Y),j(t=>t?n(t):o));return a}function it(t,r){return W(t).pipe(j(r=>r?n(r):e(()=>U(t,493)).pipe(N(t))))}async function ot(t){if(t){const e=y(t);return await Z(e)||await e.split(g).reduce(async(t,e)=>{const n=M(await t,e);return await X(n)||await U(n,493),n},Promise.resolve(g)),e}throw new Error("value of path param invalid")}async function at(t,e,n){const r=E(t);if(!r)throw new Error("folder empty");await Z(r)||await ot(r);const i=y(t);if(!await et(i)){const t=n||{mode:416};Buffer.isBuffer(e)?await V(i,e,t):"object"==typeof e?await V(i,JSON.stringify(e)):await V(i,e,t)}return i}async function st(t){t&&(await ct(t),await Z(t)&&await q(t))}async function ct(t){if(t&&await X(t)){if(await et(t))return void await K(t);const e=await L(t);if(e.length)for(const n of e)await ct(I(t,n));else await q(t)}}async function pt(t,e){const n=[];for(const r of e){const e=I(t,r.replace(/\.{2,}/,"/"));if(!await X(e))continue;const i=await L(e);for(const t of i){if(!ft(t))continue;const i=I(e,t),o=ut(t),a=I(e,o);await X(a)||(await F(i,a),n.push(`${r}/${o}`))}}return n}function ft(t){if(!t)return!1;if(".example"===t)return!1;const e=t.split(".");return e.length>1&&"example"===e[e.length-1]}function ut(t){const e=t.split(".");return e.length>1&&"example"===e[e.length-1]?e.slice(0,e.length-1).join("."):t}function lt(t){const{baseDir:e,COMMIT_EDITMSG:a,branchName:s,protectBranch:c,skipMsg:p}=t,f=I(e,a);if(!a)return console.info("COMMIT_EDITMSG value blank"),n(1);const u=r(c).pipe(O()),l=r(p).pipe(O()),w=W(f).pipe(S(t=>{t||(console.info(`COMMIT_EDITMSG file not exists: "${f}"`),process.exit(1))}),j(t=>J(t,{encoding:"utf8"})),b(t=>{const e=t.split(/\n|\r\n/)[0];return{head:e,msg:t}}),B()),m=i(n(s),u).pipe(b(([t,e])=>!(!e||!e.test(t))),C(t=>t),N(0),O(1)),h=i(w,l).pipe(b(([{head:t},e])=>!(!e||!e.test(t))),C(t=>t),N(1),O(0)),v=o(m,h).pipe(b(([t,e])=>t&e),O(0),G(1));return v}export{$ as assertNever,_ as assertNeverRx,k as closeAsync,A as chmodAsync,F as copyFileAsync,U as mkdirAsync,z as openAsync,J as readFileAsync,L as readDirAsync,q as rmdirAsync,H as statAsync,K as unlinkAsync,Q as writeAsync,V as writeFileAsync,W as pathAccessible,X as isPathAccessible,Y as dirExists,Z as isDirExists,tt as fileExists,et as isFileExists,nt as isDirFileExists,rt as createDir,ot as createDirAsync,at as createFileAsync,st as rimraf,pt as genFileFromExample,lt as isSkipCommitlint}; | ||
//# sourceMappingURL=index.esm.min.js.map |
@@ -30,3 +30,3 @@ import { combineLatest, forkJoin, from as ofrom, of } from 'rxjs' | ||
const exitCode$ = forkJoin(protectTest$, skipTest$).pipe(map(([pro, skip]) => { | ||
console.info('pro:skip', pro, skip) | ||
// console.info('pro:skip', pro, skip) | ||
// tslint:disable-next-line:no-bitwise | ||
@@ -33,0 +33,0 @@ return pro & skip |
{ | ||
"name": "@waiting/shared-core", | ||
"author": "waiting", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "node core function re export with Promise or Observable", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59447