@tikkhun/version 2024.7.3 → 2024.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,17 +4,17 @@
4
4
  var C = require('dayjs');
5
5
  var logger = require('@tikkhun/logger');
6
6
  var fsExtra = require('fs-extra');
7
- var q = require('path');
7
+ var z = require('path');
8
8
  var commander = require('commander');
9
9
 
10
10
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
11
 
12
12
  var C__default = /*#__PURE__*/_interopDefault(C);
13
- var q__default = /*#__PURE__*/_interopDefault(q);
13
+ var z__default = /*#__PURE__*/_interopDefault(z);
14
14
 
15
15
  /**
16
16
  @tikkhun/logger
17
17
  */
18
- var R=Object.defineProperty,M=Object.defineProperties;var L=Object.getOwnPropertyDescriptors;var E=Object.getOwnPropertySymbols;var U=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var y=(r,t,e)=>t in r?R(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,_=(r,t)=>{for(var e in t||(t={}))U.call(t,e)&&y(r,e,t[e]);if(E)for(var e of E(t))F.call(t,e)&&y(r,e,t[e]);return r},d=(r,t)=>M(r,L(t));var o=(r,t)=>()=>(r&&(t=r(r=0)),t);var Y=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var i=(r,t,e)=>new Promise((g,a)=>{var I=s=>{try{h(e.next(s));}catch(O){a(O);}},v=s=>{try{h(e.throw(s));}catch(O){a(O);}},h=s=>s.done?g(s.value):Promise.resolve(s.value).then(I,v);h((e=e.apply(r,t)).next());});var f,n,w=o(()=>{f={pattern:"YYYY.MM.DD"},n=class r{constructor(t){this.log=new logger.Logger(this.constructor.name);this.options=Object.assign(f,t);}static get(t){return C__default.default().format(t)}get(){return r.get(this.options.pattern)}};});var N=o(()=>{});var c,m=o(()=>{c=process.cwd();});var j=o(()=>{m();});var G=o(()=>{});var u=o(()=>{w();N();j();G();});var S,p,b=o(()=>{m();S={file:"package.json",key:"version"},p=class{constructor(t){this.opts=Object.assign(S,t),this.filePath=q__default.default.join(c,this.opts.file);}update(t){return i(this,null,function*(){try{let e=yield fsExtra.readJson(this.filePath);return yield fsExtra.writeJson(this.filePath,d(_({},e),{[this.opts.key]:t}),{spaces:2}),!0}catch(e){return !1}})}};});var k=o(()=>{});var A=o(()=>{m();});var x=o(()=>{b();k();A();});var H,l,J=o(()=>{u();x();H={getter:new n,store:new p},l=class{constructor(t){this.opts=Object.assign(H,t);}get(){return this.opts.getter.get()}update(){return i(this,null,function*(){let t=yield this.get(),e=Array.isArray(this.opts.store)?this.opts.store:[this.opts.store];try{if((yield Promise.all(e.map(a=>a.update(t)))).filter(a=>!a).length)throw new Error("update error");return !0}catch(g){return !1}})}};});var V=o(()=>{J();m();x();u();});var K=Y(D=>{V();logger.Logger.log("[\u6B22\u8FCE] date-version");commander.program.command("update").description("\u66F4\u65B0JSON").option("-f --format <format>","\u65E5\u671F\u683C\u5F0F",f.pattern).option("-p --path <filePath>","json\u6587\u4EF6\u8DEF\u5F84",S.file).action(r=>i(D,null,function*(){(yield new l({getter:new n({pattern:r.format}),store:new p({file:r.path,key:"version"})}).update())&&logger.Logger.debug("package json \u7684\u7248\u672C\u66F4\u65B0\u6210\u529F");}));commander.program.command("get").description("\u83B7\u53D6\u7248\u672C").option("-f --format <format>","\u65E5\u671F\u683C\u5F0F",f.pattern).action(({format:r})=>{let t=new n({pattern:r});logger.Logger.log(t.get());});commander.program.parse(process.argv);});var dateVersion = K();
18
+ var R=Object.defineProperty,M=Object.defineProperties;var L=Object.getOwnPropertyDescriptors;var E=Object.getOwnPropertySymbols;var U=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var d=(r,t,e)=>t in r?R(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,y=(r,t)=>{for(var e in t||(t={}))U.call(t,e)&&d(r,e,t[e]);if(E)for(var e of E(t))F.call(t,e)&&d(r,e,t[e]);return r},P=(r,t)=>M(r,L(t));var o=(r,t)=>()=>(r&&(t=r(r=0)),t);var Y=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var i=(r,t,e)=>new Promise((g,p)=>{var D=s=>{try{h(e.next(s));}catch(u){p(u);}},I=s=>{try{h(e.throw(s));}catch(u){p(u);}},h=s=>s.done?g(s.value):Promise.resolve(s.value).then(D,I);h((e=e.apply(r,t)).next());});var f,n,_=o(()=>{f={pattern:"YYYY.MM.DD"},n=class r{constructor(t){this.log=new logger.Logger(this.constructor.name);this.options=Object.assign(f,t);}static get(t){return C__default.default().format(t)}get(){return r.get(this.options.pattern)}};});var N=o(()=>{});var c,m=o(()=>{c=process.cwd();});var b=o(()=>{m();});var j=o(()=>{});var O=o(()=>{_();N();b();j();});var S,a,v=o(()=>{m();S={file:"package.json",key:"version"},a=class{constructor(t){this.opts=Object.assign(S,t),this.filePath=z__default.default.join(c,this.opts.file);}update(t){return i(this,null,function*(){try{let e=yield fsExtra.readJson(this.filePath);return yield fsExtra.writeJson(this.filePath,P(y({},e),{[this.opts.key]:t}),{spaces:2}),!0}catch(e){return !1}})}};});var G=o(()=>{});var J=o(()=>{m();});var w=o(()=>{v();G();J();});var B,l,k=o(()=>{O();w();B={getter:new n,store:new a},l=class{constructor(t){this.opts=Object.assign(B,t);}get(){return this.opts.getter.get()}update(){return i(this,null,function*(){let t=yield this.get(),e=Array.isArray(this.opts.store)?this.opts.store:[this.opts.store];try{if((yield Promise.all(e.map(p=>p.update(t)))).filter(p=>!p).length)throw new Error("update, but error");return !0}catch(g){return !1}})}};});var A=o(()=>{k();m();w();O();});var H=Y(V=>{A();logger.Logger.log("[\u6B22\u8FCE] date-version");commander.program.command("update").description("\u66F4\u65B0JSON").option("-f --format <format>","\u65E5\u671F\u683C\u5F0F",f.pattern).option("-p --path <filePath>","json\u6587\u4EF6\u8DEF\u5F84",S.file).action(r=>i(V,null,function*(){(yield new l({getter:new n({pattern:r.format}),store:new a({file:r.path,key:"version"})}).update())&&logger.Logger.debug("package json \u7684\u7248\u672C\u66F4\u65B0\u6210\u529F");}));commander.program.command("get").description("\u83B7\u53D6\u7248\u672C").option("-f --format <format>","\u65E5\u671F\u683C\u5F0F",f.pattern).action(({format:r})=>{let t=new n({pattern:r});logger.Logger.log(t.get());});commander.program.parse(process.argv);});var dateVersion = H();
19
19
 
20
20
  module.exports = dateVersion;
@@ -2,12 +2,12 @@
2
2
  import C from 'dayjs';
3
3
  import { Logger } from '@tikkhun/logger';
4
4
  import { readJson, writeJson } from 'fs-extra';
5
- import q from 'path';
5
+ import z from 'path';
6
6
  import { program } from 'commander';
7
7
 
8
8
  /**
9
9
  @tikkhun/logger
10
10
  */
11
- var R=Object.defineProperty,M=Object.defineProperties;var L=Object.getOwnPropertyDescriptors;var E=Object.getOwnPropertySymbols;var U=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var y=(r,t,e)=>t in r?R(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,_=(r,t)=>{for(var e in t||(t={}))U.call(t,e)&&y(r,e,t[e]);if(E)for(var e of E(t))F.call(t,e)&&y(r,e,t[e]);return r},d=(r,t)=>M(r,L(t));var o=(r,t)=>()=>(r&&(t=r(r=0)),t);var Y=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var i=(r,t,e)=>new Promise((g,a)=>{var I=s=>{try{h(e.next(s));}catch(O){a(O);}},v=s=>{try{h(e.throw(s));}catch(O){a(O);}},h=s=>s.done?g(s.value):Promise.resolve(s.value).then(I,v);h((e=e.apply(r,t)).next());});var f,n,w=o(()=>{f={pattern:"YYYY.MM.DD"},n=class r{constructor(t){this.log=new Logger(this.constructor.name);this.options=Object.assign(f,t);}static get(t){return C().format(t)}get(){return r.get(this.options.pattern)}};});var N=o(()=>{});var c,m=o(()=>{c=process.cwd();});var j=o(()=>{m();});var G=o(()=>{});var u=o(()=>{w();N();j();G();});var S,p,b=o(()=>{m();S={file:"package.json",key:"version"},p=class{constructor(t){this.opts=Object.assign(S,t),this.filePath=q.join(c,this.opts.file);}update(t){return i(this,null,function*(){try{let e=yield readJson(this.filePath);return yield writeJson(this.filePath,d(_({},e),{[this.opts.key]:t}),{spaces:2}),!0}catch(e){return !1}})}};});var k=o(()=>{});var A=o(()=>{m();});var x=o(()=>{b();k();A();});var H,l,J=o(()=>{u();x();H={getter:new n,store:new p},l=class{constructor(t){this.opts=Object.assign(H,t);}get(){return this.opts.getter.get()}update(){return i(this,null,function*(){let t=yield this.get(),e=Array.isArray(this.opts.store)?this.opts.store:[this.opts.store];try{if((yield Promise.all(e.map(a=>a.update(t)))).filter(a=>!a).length)throw new Error("update error");return !0}catch(g){return !1}})}};});var V=o(()=>{J();m();x();u();});var K=Y(D=>{V();Logger.log("[\u6B22\u8FCE] date-version");program.command("update").description("\u66F4\u65B0JSON").option("-f --format <format>","\u65E5\u671F\u683C\u5F0F",f.pattern).option("-p --path <filePath>","json\u6587\u4EF6\u8DEF\u5F84",S.file).action(r=>i(D,null,function*(){(yield new l({getter:new n({pattern:r.format}),store:new p({file:r.path,key:"version"})}).update())&&Logger.debug("package json \u7684\u7248\u672C\u66F4\u65B0\u6210\u529F");}));program.command("get").description("\u83B7\u53D6\u7248\u672C").option("-f --format <format>","\u65E5\u671F\u683C\u5F0F",f.pattern).action(({format:r})=>{let t=new n({pattern:r});Logger.log(t.get());});program.parse(process.argv);});var dateVersion = K();
11
+ var R=Object.defineProperty,M=Object.defineProperties;var L=Object.getOwnPropertyDescriptors;var E=Object.getOwnPropertySymbols;var U=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var d=(r,t,e)=>t in r?R(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,y=(r,t)=>{for(var e in t||(t={}))U.call(t,e)&&d(r,e,t[e]);if(E)for(var e of E(t))F.call(t,e)&&d(r,e,t[e]);return r},P=(r,t)=>M(r,L(t));var o=(r,t)=>()=>(r&&(t=r(r=0)),t);var Y=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var i=(r,t,e)=>new Promise((g,p)=>{var D=s=>{try{h(e.next(s));}catch(u){p(u);}},I=s=>{try{h(e.throw(s));}catch(u){p(u);}},h=s=>s.done?g(s.value):Promise.resolve(s.value).then(D,I);h((e=e.apply(r,t)).next());});var f,n,_=o(()=>{f={pattern:"YYYY.MM.DD"},n=class r{constructor(t){this.log=new Logger(this.constructor.name);this.options=Object.assign(f,t);}static get(t){return C().format(t)}get(){return r.get(this.options.pattern)}};});var N=o(()=>{});var c,m=o(()=>{c=process.cwd();});var b=o(()=>{m();});var j=o(()=>{});var O=o(()=>{_();N();b();j();});var S,a,v=o(()=>{m();S={file:"package.json",key:"version"},a=class{constructor(t){this.opts=Object.assign(S,t),this.filePath=z.join(c,this.opts.file);}update(t){return i(this,null,function*(){try{let e=yield readJson(this.filePath);return yield writeJson(this.filePath,P(y({},e),{[this.opts.key]:t}),{spaces:2}),!0}catch(e){return !1}})}};});var G=o(()=>{});var J=o(()=>{m();});var w=o(()=>{v();G();J();});var B,l,k=o(()=>{O();w();B={getter:new n,store:new a},l=class{constructor(t){this.opts=Object.assign(B,t);}get(){return this.opts.getter.get()}update(){return i(this,null,function*(){let t=yield this.get(),e=Array.isArray(this.opts.store)?this.opts.store:[this.opts.store];try{if((yield Promise.all(e.map(p=>p.update(t)))).filter(p=>!p).length)throw new Error("update, but error");return !0}catch(g){return !1}})}};});var A=o(()=>{k();m();w();O();});var H=Y(V=>{A();Logger.log("[\u6B22\u8FCE] date-version");program.command("update").description("\u66F4\u65B0JSON").option("-f --format <format>","\u65E5\u671F\u683C\u5F0F",f.pattern).option("-p --path <filePath>","json\u6587\u4EF6\u8DEF\u5F84",S.file).action(r=>i(V,null,function*(){(yield new l({getter:new n({pattern:r.format}),store:new a({file:r.path,key:"version"})}).update())&&Logger.debug("package json \u7684\u7248\u672C\u66F4\u65B0\u6210\u529F");}));program.command("get").description("\u83B7\u53D6\u7248\u672C").option("-f --format <format>","\u65E5\u671F\u683C\u5F0F",f.pattern).action(({format:r})=>{let t=new n({pattern:r});Logger.log(t.get());});program.parse(process.argv);});var dateVersion = H();
12
12
 
13
13
  export { dateVersion as default };
@@ -4,19 +4,19 @@
4
4
  var C = require('dayjs');
5
5
  var logger = require('@tikkhun/logger');
6
6
  var fsExtra = require('fs-extra');
7
- var z = require('path');
8
- var Q = require('fs');
7
+ var B = require('path');
8
+ var K = require('fs');
9
9
  var commander = require('commander');
10
10
 
11
11
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
12
 
13
13
  var C__default = /*#__PURE__*/_interopDefault(C);
14
- var z__default = /*#__PURE__*/_interopDefault(z);
15
- var Q__default = /*#__PURE__*/_interopDefault(Q);
14
+ var B__default = /*#__PURE__*/_interopDefault(B);
15
+ var K__default = /*#__PURE__*/_interopDefault(K);
16
16
 
17
17
  /**
18
18
  @tikkhun/logger
19
19
  */
20
- var D=Object.defineProperty,R=Object.defineProperties;var L=Object.getOwnPropertyDescriptors;var P=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var T=(r,t,e)=>t in r?D(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,w=(r,t)=>{for(var e in t||(t={}))F.call(t,e)&&T(r,e,t[e]);if(P)for(var e of P(t))U.call(t,e)&&T(r,e,t[e]);return r},y=(r,t)=>R(r,L(t));var o=(r,t)=>()=>(r&&(t=r(r=0)),t);var Y=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var i=(r,t,e)=>new Promise((g,n)=>{var I=s=>{try{u(e.next(s));}catch(O){n(O);}},J=s=>{try{u(e.throw(s));}catch(O){n(O);}},u=s=>s.done?g(s.value):Promise.resolve(s.value).then(I,J);u((e=e.apply(r,t)).next());});var q,m,d=o(()=>{q={pattern:"YYYY.MM.DD"},m=class r{constructor(t){this.log=new logger.Logger(this.constructor.name);this.options=Object.assign(q,t);}static get(t){return C__default.default().format(t)}get(){return r.get(this.options.pattern)}};});var f,E=o(()=>{f=class{get(){return process.versions.node}};});var p,a=o(()=>{p=process.cwd();});var j=o(()=>{a();});var _=o(()=>{});var S=o(()=>{d();E();j();_();});var K,c,b=o(()=>{a();K={file:"package.json",key:"version"},c=class{constructor(t){this.opts=Object.assign(K,t),this.filePath=z__default.default.join(p,this.opts.file);}update(t){return i(this,null,function*(){try{let e=yield fsExtra.readJson(this.filePath);return yield fsExtra.writeJson(this.filePath,y(w({},e),{[this.opts.key]:t}),{spaces:2}),!0}catch(e){return !1}})}};});var G=o(()=>{});var l,N=o(()=>{a();l=class{constructor(t){this.opts=t,this.filePath=z__default.default.join(p,this.opts.file),console.log("this.filePath",this.filePath);}update(t){try{return typeof t!="string"&&(t=JSON.stringify(t)),console.log("this.filePath,text",this.filePath,t),Q__default.default.writeFileSync(this.filePath,t,"utf8"),!0}catch(e){return !1}}};});var x=o(()=>{b();G();N();});var Z,h,k=o(()=>{S();x();Z={getter:new m,store:new c},h=class{constructor(t){this.opts=Object.assign(Z,t);}get(){return this.opts.getter.get()}update(){return i(this,null,function*(){let t=yield this.get(),e=Array.isArray(this.opts.store)?this.opts.store:[this.opts.store];try{if((yield Promise.all(e.map(n=>n.update(t)))).filter(n=>!n).length)throw new Error("update error");return !0}catch(g){return !1}})}};});var v=o(()=>{k();a();x();S();});var $=Y(M=>{v();logger.Logger.log("[\u6B22\u8FCE] node-version");commander.program.command("save").description("\u4FDD\u5B58\u7248\u672C").action(()=>i(M,null,function*(){(yield new h({getter:new f,store:new l({file:".node-version"})}).update())&&logger.Logger.debug("node \u7248\u672C\u66F4\u65B0\u6210\u529F");}));commander.program.parse(process.argv);});var nodeVersion = $();
20
+ var D=Object.defineProperty,R=Object.defineProperties;var L=Object.getOwnPropertyDescriptors;var w=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var d=(r,t,e)=>t in r?D(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,T=(r,t)=>{for(var e in t||(t={}))F.call(t,e)&&d(r,e,t[e]);if(w)for(var e of w(t))U.call(t,e)&&d(r,e,t[e]);return r},y=(r,t)=>R(r,L(t));var o=(r,t)=>()=>(r&&(t=r(r=0)),t);var Y=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var i=(r,t,e)=>new Promise((h,n)=>{var M=s=>{try{u(e.next(s));}catch(O){n(O);}},I=s=>{try{u(e.throw(s));}catch(O){n(O);}},u=s=>s.done?h(s.value):Promise.resolve(s.value).then(M,I);u((e=e.apply(r,t)).next());});var $,m,E=o(()=>{$={pattern:"YYYY.MM.DD"},m=class r{constructor(t){this.log=new logger.Logger(this.constructor.name);this.options=Object.assign($,t);}static get(t){return C__default.default().format(t)}get(){return r.get(this.options.pattern)}};});var f,P=o(()=>{f=class{get(){return process.versions.node}};});var p,a=o(()=>{p=process.cwd();});var b=o(()=>{a();});var v=o(()=>{});var S=o(()=>{E();P();b();v();});var H,c,j=o(()=>{a();H={file:"package.json",key:"version"},c=class{constructor(t){this.opts=Object.assign(H,t),this.filePath=B__default.default.join(p,this.opts.file);}update(t){return i(this,null,function*(){try{let e=yield fsExtra.readJson(this.filePath);return yield fsExtra.writeJson(this.filePath,y(T({},e),{[this.opts.key]:t}),{spaces:2}),!0}catch(e){return !1}})}};});var N=o(()=>{});var l,_=o(()=>{a();l=class{constructor(t){this.opts=t,this.filePath=B__default.default.join(p,this.opts.file);}update(t){try{return typeof t!="string"&&(t=JSON.stringify(t)),K__default.default.writeFileSync(this.filePath,t,"utf8"),!0}catch(e){return !1}}};});var x=o(()=>{j();N();_();});var W,g,G=o(()=>{S();x();W={getter:new m,store:new c},g=class{constructor(t){this.opts=Object.assign(W,t);}get(){return this.opts.getter.get()}update(){return i(this,null,function*(){let t=yield this.get(),e=Array.isArray(this.opts.store)?this.opts.store:[this.opts.store];try{if((yield Promise.all(e.map(n=>n.update(t)))).filter(n=>!n).length)throw new Error("update, but error");return !0}catch(h){return !1}})}};});var k=o(()=>{G();a();x();S();});var Z=Y(J=>{k();logger.Logger.log("[\u6B22\u8FCE] node-version");commander.program.command("save").description("\u4FDD\u5B58\u7248\u672C").action(()=>i(J,null,function*(){(yield new g({getter:new f,store:new l({file:".node-version"})}).update())&&logger.Logger.debug("node \u7248\u672C\u66F4\u65B0\u6210\u529F");}));commander.program.parse(process.argv);});var nodeVersion = Z();
21
21
 
22
22
  module.exports = nodeVersion;
@@ -2,13 +2,13 @@
2
2
  import C from 'dayjs';
3
3
  import { Logger } from '@tikkhun/logger';
4
4
  import { readJson, writeJson } from 'fs-extra';
5
- import z from 'path';
6
- import Q from 'fs';
5
+ import B from 'path';
6
+ import K from 'fs';
7
7
  import { program } from 'commander';
8
8
 
9
9
  /**
10
10
  @tikkhun/logger
11
11
  */
12
- var D=Object.defineProperty,R=Object.defineProperties;var L=Object.getOwnPropertyDescriptors;var P=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var T=(r,t,e)=>t in r?D(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,w=(r,t)=>{for(var e in t||(t={}))F.call(t,e)&&T(r,e,t[e]);if(P)for(var e of P(t))U.call(t,e)&&T(r,e,t[e]);return r},y=(r,t)=>R(r,L(t));var o=(r,t)=>()=>(r&&(t=r(r=0)),t);var Y=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var i=(r,t,e)=>new Promise((g,n)=>{var I=s=>{try{u(e.next(s));}catch(O){n(O);}},J=s=>{try{u(e.throw(s));}catch(O){n(O);}},u=s=>s.done?g(s.value):Promise.resolve(s.value).then(I,J);u((e=e.apply(r,t)).next());});var q,m,d=o(()=>{q={pattern:"YYYY.MM.DD"},m=class r{constructor(t){this.log=new Logger(this.constructor.name);this.options=Object.assign(q,t);}static get(t){return C().format(t)}get(){return r.get(this.options.pattern)}};});var f,E=o(()=>{f=class{get(){return process.versions.node}};});var p,a=o(()=>{p=process.cwd();});var j=o(()=>{a();});var _=o(()=>{});var S=o(()=>{d();E();j();_();});var K,c,b=o(()=>{a();K={file:"package.json",key:"version"},c=class{constructor(t){this.opts=Object.assign(K,t),this.filePath=z.join(p,this.opts.file);}update(t){return i(this,null,function*(){try{let e=yield readJson(this.filePath);return yield writeJson(this.filePath,y(w({},e),{[this.opts.key]:t}),{spaces:2}),!0}catch(e){return !1}})}};});var G=o(()=>{});var l,N=o(()=>{a();l=class{constructor(t){this.opts=t,this.filePath=z.join(p,this.opts.file),console.log("this.filePath",this.filePath);}update(t){try{return typeof t!="string"&&(t=JSON.stringify(t)),console.log("this.filePath,text",this.filePath,t),Q.writeFileSync(this.filePath,t,"utf8"),!0}catch(e){return !1}}};});var x=o(()=>{b();G();N();});var Z,h,k=o(()=>{S();x();Z={getter:new m,store:new c},h=class{constructor(t){this.opts=Object.assign(Z,t);}get(){return this.opts.getter.get()}update(){return i(this,null,function*(){let t=yield this.get(),e=Array.isArray(this.opts.store)?this.opts.store:[this.opts.store];try{if((yield Promise.all(e.map(n=>n.update(t)))).filter(n=>!n).length)throw new Error("update error");return !0}catch(g){return !1}})}};});var v=o(()=>{k();a();x();S();});var $=Y(M=>{v();Logger.log("[\u6B22\u8FCE] node-version");program.command("save").description("\u4FDD\u5B58\u7248\u672C").action(()=>i(M,null,function*(){(yield new h({getter:new f,store:new l({file:".node-version"})}).update())&&Logger.debug("node \u7248\u672C\u66F4\u65B0\u6210\u529F");}));program.parse(process.argv);});var nodeVersion = $();
12
+ var D=Object.defineProperty,R=Object.defineProperties;var L=Object.getOwnPropertyDescriptors;var w=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var d=(r,t,e)=>t in r?D(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,T=(r,t)=>{for(var e in t||(t={}))F.call(t,e)&&d(r,e,t[e]);if(w)for(var e of w(t))U.call(t,e)&&d(r,e,t[e]);return r},y=(r,t)=>R(r,L(t));var o=(r,t)=>()=>(r&&(t=r(r=0)),t);var Y=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var i=(r,t,e)=>new Promise((h,n)=>{var M=s=>{try{u(e.next(s));}catch(O){n(O);}},I=s=>{try{u(e.throw(s));}catch(O){n(O);}},u=s=>s.done?h(s.value):Promise.resolve(s.value).then(M,I);u((e=e.apply(r,t)).next());});var $,m,E=o(()=>{$={pattern:"YYYY.MM.DD"},m=class r{constructor(t){this.log=new Logger(this.constructor.name);this.options=Object.assign($,t);}static get(t){return C().format(t)}get(){return r.get(this.options.pattern)}};});var f,P=o(()=>{f=class{get(){return process.versions.node}};});var p,a=o(()=>{p=process.cwd();});var b=o(()=>{a();});var v=o(()=>{});var S=o(()=>{E();P();b();v();});var H,c,j=o(()=>{a();H={file:"package.json",key:"version"},c=class{constructor(t){this.opts=Object.assign(H,t),this.filePath=B.join(p,this.opts.file);}update(t){return i(this,null,function*(){try{let e=yield readJson(this.filePath);return yield writeJson(this.filePath,y(T({},e),{[this.opts.key]:t}),{spaces:2}),!0}catch(e){return !1}})}};});var N=o(()=>{});var l,_=o(()=>{a();l=class{constructor(t){this.opts=t,this.filePath=B.join(p,this.opts.file);}update(t){try{return typeof t!="string"&&(t=JSON.stringify(t)),K.writeFileSync(this.filePath,t,"utf8"),!0}catch(e){return !1}}};});var x=o(()=>{j();N();_();});var W,g,G=o(()=>{S();x();W={getter:new m,store:new c},g=class{constructor(t){this.opts=Object.assign(W,t);}get(){return this.opts.getter.get()}update(){return i(this,null,function*(){let t=yield this.get(),e=Array.isArray(this.opts.store)?this.opts.store:[this.opts.store];try{if((yield Promise.all(e.map(n=>n.update(t)))).filter(n=>!n).length)throw new Error("update, but error");return !0}catch(h){return !1}})}};});var k=o(()=>{G();a();x();S();});var Z=Y(J=>{k();Logger.log("[\u6B22\u8FCE] node-version");program.command("save").description("\u4FDD\u5B58\u7248\u672C").action(()=>i(J,null,function*(){(yield new g({getter:new f,store:new l({file:".node-version"})}).update())&&Logger.debug("node \u7248\u672C\u66F4\u65B0\u6210\u529F");}));program.parse(process.argv);});var nodeVersion = Z();
13
13
 
14
14
  export { nodeVersion as default };
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- var q = require('dayjs');
4
+ var $ = require('dayjs');
5
5
  var logger = require('@tikkhun/logger');
6
6
  var fsExtra = require('fs-extra');
7
7
  var K = require('path');
@@ -9,12 +9,12 @@ var commander = require('commander');
9
9
 
10
10
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
11
 
12
- var q__default = /*#__PURE__*/_interopDefault(q);
12
+ var $__default = /*#__PURE__*/_interopDefault($);
13
13
  var K__default = /*#__PURE__*/_interopDefault(K);
14
14
 
15
15
  /**
16
16
  @tikkhun/logger
17
17
  */
18
- var L=Object.defineProperty,F=Object.defineProperties;var U=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var Y=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var d=(o,t,e)=>t in o?L(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,N=(o,t)=>{for(var e in t||(t={}))Y.call(t,e)&&d(o,e,t[e]);if(_)for(var e of _(t))C.call(t,e)&&d(o,e,t[e]);return o},j=(o,t)=>F(o,U(t));var i=(o,t)=>()=>(o&&(t=o(o=0)),t);var X=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports);var n=(o,t,e)=>new Promise((r,s)=>{var R=p=>{try{u(e.next(p));}catch(S){s(S);}},D=p=>{try{u(e.throw(p));}catch(S){s(S);}},u=p=>p.done?r(p.value):Promise.resolve(p.value).then(R,D);u((e=e.apply(o,t)).next());});var B,g,k=i(()=>{B={pattern:"YYYY.MM.DD"},g=class o{constructor(t){this.log=new logger.Logger(this.constructor.name);this.options=Object.assign(B,t);}static get(t){return q__default.default().format(t)}get(){return o.get(this.options.pattern)}};});var G=i(()=>{});var f,c=i(()=>{f=process.cwd();});var a,h,l,b=i(()=>{c();a=(r=>(r[r.major=0]="major",r[r.minor=1]="minor",r[r.patch=2]="patch",r))(a||{}),h={file:"package.json",position:2,key:"version"},l=class{constructor(t){this.opts=Object.assign(h,t),this.filePath=K__default.default.join(f,this.opts.file);}get(){return n(this,null,function*(){let{[this.opts.key]:t}=yield fsExtra.readJson(this.filePath),[e,r,s]=t.split(".");return this.opts.position===0?[Number(e)+1,r,s].join("."):this.opts.position===1?[e,Number(r)+1,s].join("."):[e,r,Number(s)+1].join(".")})}};});var A=i(()=>{});var P=i(()=>{k();G();b();A();});var T,m,I=i(()=>{c();T={file:"package.json",key:"version"},m=class{constructor(t){this.opts=Object.assign(T,t),this.filePath=K__default.default.join(f,this.opts.file);}update(t){return n(this,null,function*(){try{let e=yield fsExtra.readJson(this.filePath);return yield fsExtra.writeJson(this.filePath,j(N({},e),{[this.opts.key]:t}),{spaces:2}),!0}catch(e){return !1}})}};});var V=i(()=>{});var J=i(()=>{c();});var x=i(()=>{I();V();J();});var $,O,v=i(()=>{P();x();$={getter:new g,store:new m},O=class{constructor(t){this.opts=Object.assign($,t);}get(){return this.opts.getter.get()}update(){return n(this,null,function*(){let t=yield this.get(),e=Array.isArray(this.opts.store)?this.opts.store:[this.opts.store];try{if((yield Promise.all(e.map(s=>s.update(t)))).filter(s=>!s).length)throw new Error("update error");return !0}catch(r){return !1}})}};});var M=i(()=>{v();c();x();P();});var tt=X(w=>{M();logger.Logger.log("[\u6B22\u8FCE] date-version");commander.program.command("update").description("\u66F4\u65B0").option("-p --position <position>","\u66F4\u65B0\u4F4D\u7F6E",a[h.position]).option("-f --file <filePath>","json\u6587\u4EF6\u8DEF\u5F84",T.file).action(o=>n(w,null,function*(){let t=a[o.position];(yield new O({getter:new l({position:t,file:o.file}),store:new m({file:o.path,key:"version"})}).update())&&logger.Logger.debug("package json \u7684\u7248\u672C\u66F4\u65B0\u6210\u529F");}));commander.program.command("get").description("\u83B7\u53D6\u7248\u672C").option("-p --position <position>","\u66F4\u65B0\u4F4D\u7F6E",a[h.position]).action(o=>n(w,null,function*(){let t=a[o.position],e=new l({position:t});logger.Logger.log(yield e.get());}));commander.program.parse(process.argv);});var semanticVersion = tt();
18
+ var L=Object.defineProperty,F=Object.defineProperties;var U=Object.getOwnPropertyDescriptors;var d=Object.getOwnPropertySymbols;var Y=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var _=(o,t,r)=>t in o?L(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,N=(o,t)=>{for(var r in t||(t={}))Y.call(t,r)&&_(o,r,t[r]);if(d)for(var r of d(t))C.call(t,r)&&_(o,r,t[r]);return o},b=(o,t)=>F(o,U(t));var i=(o,t)=>()=>(o&&(t=o(o=0)),t);var X=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports);var n=(o,t,r)=>new Promise((e,s)=>{var R=p=>{try{O(r.next(p));}catch(S){s(S);}},D=p=>{try{O(r.throw(p));}catch(S){s(S);}},O=p=>p.done?e(p.value):Promise.resolve(p.value).then(R,D);O((r=r.apply(o,t)).next());});var z,g,j=i(()=>{z={pattern:"YYYY.MM.DD"},g=class o{constructor(t){this.log=new logger.Logger(this.constructor.name);this.options=Object.assign(z,t);}static get(t){return $__default.default().format(t)}get(){return o.get(this.options.pattern)}};});var v=i(()=>{});var m,c=i(()=>{m=process.cwd();});var a,h,l,k=i(()=>{c();a=(e=>(e[e.major=0]="major",e[e.minor=1]="minor",e[e.patch=2]="patch",e))(a||{}),h={file:"package.json",position:2,key:"version"},l=class{constructor(t){this.opts=Object.assign(h,t),this.filePath=K__default.default.join(m,this.opts.file);}get(){return n(this,null,function*(){if(!(yield fsExtra.pathExists(this.filePath)))throw new Error("get new version,but error: the file is not found");let{[this.opts.key]:t}=yield fsExtra.readJson(this.filePath);if(!t)throw new Error("get new version, but error: the old version is not found");if(typeof t!="string")throw new Error(`get new version, but error: the old version is not string,old version: ${JSON.stringify(t)}`);let[r,e,s]=t.split(".");return this.opts.position===0?[Number(r)+1,e,s].join("."):this.opts.position===1?[r,Number(e)+1,s].join("."):[r,e,Number(s)+1].join(".")})}};});var G=i(()=>{});var w=i(()=>{j();v();k();G();});var x,f,A=i(()=>{c();x={file:"package.json",key:"version"},f=class{constructor(t){this.opts=Object.assign(x,t),this.filePath=K__default.default.join(m,this.opts.file);}update(t){return n(this,null,function*(){try{let r=yield fsExtra.readJson(this.filePath);return yield fsExtra.writeJson(this.filePath,b(N({},r),{[this.opts.key]:t}),{spaces:2}),!0}catch(r){return !1}})}};});var I=i(()=>{});var J=i(()=>{c();});var T=i(()=>{A();I();J();});var tt,u,V=i(()=>{w();T();tt={getter:new g,store:new f},u=class{constructor(t){this.opts=Object.assign(tt,t);}get(){return this.opts.getter.get()}update(){return n(this,null,function*(){let t=yield this.get(),r=Array.isArray(this.opts.store)?this.opts.store:[this.opts.store];try{if((yield Promise.all(r.map(s=>s.update(t)))).filter(s=>!s).length)throw new Error("update, but error");return !0}catch(e){return !1}})}};});var M=i(()=>{V();c();T();w();});var ot=X(P=>{M();logger.Logger.log("[\u6B22\u8FCE] date-version");commander.program.command("update").description("\u66F4\u65B0").option("-p --position <position>","\u66F4\u65B0\u4F4D\u7F6E",a[h.position]).option("-f --file <filePath>","json\u6587\u4EF6\u8DEF\u5F84",x.file).action(o=>n(P,null,function*(){let t=a[o.position];(yield new u({getter:new l({position:t,file:o.file}),store:new f({file:o.path,key:"version"})}).update())&&logger.Logger.debug("package json \u7684\u7248\u672C\u66F4\u65B0\u6210\u529F");}));commander.program.command("get").description("\u83B7\u53D6\u7248\u672C").option("-p --position <position>","\u66F4\u65B0\u4F4D\u7F6E",a[h.position]).action(o=>n(P,null,function*(){let t=a[o.position],r=new l({position:t});logger.Logger.log(yield r.get());}));commander.program.parse(process.argv);});var semanticVersion = ot();
19
19
 
20
20
  module.exports = semanticVersion;
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
- import q from 'dayjs';
2
+ import $ from 'dayjs';
3
3
  import { Logger } from '@tikkhun/logger';
4
- import { readJson, writeJson } from 'fs-extra';
4
+ import { pathExists, readJson, writeJson } from 'fs-extra';
5
5
  import K from 'path';
6
6
  import { program } from 'commander';
7
7
 
8
8
  /**
9
9
  @tikkhun/logger
10
10
  */
11
- var L=Object.defineProperty,F=Object.defineProperties;var U=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var Y=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var d=(o,t,e)=>t in o?L(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,N=(o,t)=>{for(var e in t||(t={}))Y.call(t,e)&&d(o,e,t[e]);if(_)for(var e of _(t))C.call(t,e)&&d(o,e,t[e]);return o},j=(o,t)=>F(o,U(t));var i=(o,t)=>()=>(o&&(t=o(o=0)),t);var X=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports);var n=(o,t,e)=>new Promise((r,s)=>{var R=p=>{try{u(e.next(p));}catch(S){s(S);}},D=p=>{try{u(e.throw(p));}catch(S){s(S);}},u=p=>p.done?r(p.value):Promise.resolve(p.value).then(R,D);u((e=e.apply(o,t)).next());});var B,g,k=i(()=>{B={pattern:"YYYY.MM.DD"},g=class o{constructor(t){this.log=new Logger(this.constructor.name);this.options=Object.assign(B,t);}static get(t){return q().format(t)}get(){return o.get(this.options.pattern)}};});var G=i(()=>{});var f,c=i(()=>{f=process.cwd();});var a,h,l,b=i(()=>{c();a=(r=>(r[r.major=0]="major",r[r.minor=1]="minor",r[r.patch=2]="patch",r))(a||{}),h={file:"package.json",position:2,key:"version"},l=class{constructor(t){this.opts=Object.assign(h,t),this.filePath=K.join(f,this.opts.file);}get(){return n(this,null,function*(){let{[this.opts.key]:t}=yield readJson(this.filePath),[e,r,s]=t.split(".");return this.opts.position===0?[Number(e)+1,r,s].join("."):this.opts.position===1?[e,Number(r)+1,s].join("."):[e,r,Number(s)+1].join(".")})}};});var A=i(()=>{});var P=i(()=>{k();G();b();A();});var T,m,I=i(()=>{c();T={file:"package.json",key:"version"},m=class{constructor(t){this.opts=Object.assign(T,t),this.filePath=K.join(f,this.opts.file);}update(t){return n(this,null,function*(){try{let e=yield readJson(this.filePath);return yield writeJson(this.filePath,j(N({},e),{[this.opts.key]:t}),{spaces:2}),!0}catch(e){return !1}})}};});var V=i(()=>{});var J=i(()=>{c();});var x=i(()=>{I();V();J();});var $,O,v=i(()=>{P();x();$={getter:new g,store:new m},O=class{constructor(t){this.opts=Object.assign($,t);}get(){return this.opts.getter.get()}update(){return n(this,null,function*(){let t=yield this.get(),e=Array.isArray(this.opts.store)?this.opts.store:[this.opts.store];try{if((yield Promise.all(e.map(s=>s.update(t)))).filter(s=>!s).length)throw new Error("update error");return !0}catch(r){return !1}})}};});var M=i(()=>{v();c();x();P();});var tt=X(w=>{M();Logger.log("[\u6B22\u8FCE] date-version");program.command("update").description("\u66F4\u65B0").option("-p --position <position>","\u66F4\u65B0\u4F4D\u7F6E",a[h.position]).option("-f --file <filePath>","json\u6587\u4EF6\u8DEF\u5F84",T.file).action(o=>n(w,null,function*(){let t=a[o.position];(yield new O({getter:new l({position:t,file:o.file}),store:new m({file:o.path,key:"version"})}).update())&&Logger.debug("package json \u7684\u7248\u672C\u66F4\u65B0\u6210\u529F");}));program.command("get").description("\u83B7\u53D6\u7248\u672C").option("-p --position <position>","\u66F4\u65B0\u4F4D\u7F6E",a[h.position]).action(o=>n(w,null,function*(){let t=a[o.position],e=new l({position:t});Logger.log(yield e.get());}));program.parse(process.argv);});var semanticVersion = tt();
11
+ var L=Object.defineProperty,F=Object.defineProperties;var U=Object.getOwnPropertyDescriptors;var d=Object.getOwnPropertySymbols;var Y=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var _=(o,t,r)=>t in o?L(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,N=(o,t)=>{for(var r in t||(t={}))Y.call(t,r)&&_(o,r,t[r]);if(d)for(var r of d(t))C.call(t,r)&&_(o,r,t[r]);return o},b=(o,t)=>F(o,U(t));var i=(o,t)=>()=>(o&&(t=o(o=0)),t);var X=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports);var n=(o,t,r)=>new Promise((e,s)=>{var R=p=>{try{O(r.next(p));}catch(S){s(S);}},D=p=>{try{O(r.throw(p));}catch(S){s(S);}},O=p=>p.done?e(p.value):Promise.resolve(p.value).then(R,D);O((r=r.apply(o,t)).next());});var z,g,j=i(()=>{z={pattern:"YYYY.MM.DD"},g=class o{constructor(t){this.log=new Logger(this.constructor.name);this.options=Object.assign(z,t);}static get(t){return $().format(t)}get(){return o.get(this.options.pattern)}};});var v=i(()=>{});var m,c=i(()=>{m=process.cwd();});var a,h,l,k=i(()=>{c();a=(e=>(e[e.major=0]="major",e[e.minor=1]="minor",e[e.patch=2]="patch",e))(a||{}),h={file:"package.json",position:2,key:"version"},l=class{constructor(t){this.opts=Object.assign(h,t),this.filePath=K.join(m,this.opts.file);}get(){return n(this,null,function*(){if(!(yield pathExists(this.filePath)))throw new Error("get new version,but error: the file is not found");let{[this.opts.key]:t}=yield readJson(this.filePath);if(!t)throw new Error("get new version, but error: the old version is not found");if(typeof t!="string")throw new Error(`get new version, but error: the old version is not string,old version: ${JSON.stringify(t)}`);let[r,e,s]=t.split(".");return this.opts.position===0?[Number(r)+1,e,s].join("."):this.opts.position===1?[r,Number(e)+1,s].join("."):[r,e,Number(s)+1].join(".")})}};});var G=i(()=>{});var w=i(()=>{j();v();k();G();});var x,f,A=i(()=>{c();x={file:"package.json",key:"version"},f=class{constructor(t){this.opts=Object.assign(x,t),this.filePath=K.join(m,this.opts.file);}update(t){return n(this,null,function*(){try{let r=yield readJson(this.filePath);return yield writeJson(this.filePath,b(N({},r),{[this.opts.key]:t}),{spaces:2}),!0}catch(r){return !1}})}};});var I=i(()=>{});var J=i(()=>{c();});var T=i(()=>{A();I();J();});var tt,u,V=i(()=>{w();T();tt={getter:new g,store:new f},u=class{constructor(t){this.opts=Object.assign(tt,t);}get(){return this.opts.getter.get()}update(){return n(this,null,function*(){let t=yield this.get(),r=Array.isArray(this.opts.store)?this.opts.store:[this.opts.store];try{if((yield Promise.all(r.map(s=>s.update(t)))).filter(s=>!s).length)throw new Error("update, but error");return !0}catch(e){return !1}})}};});var M=i(()=>{V();c();T();w();});var ot=X(P=>{M();Logger.log("[\u6B22\u8FCE] date-version");program.command("update").description("\u66F4\u65B0").option("-p --position <position>","\u66F4\u65B0\u4F4D\u7F6E",a[h.position]).option("-f --file <filePath>","json\u6587\u4EF6\u8DEF\u5F84",x.file).action(o=>n(P,null,function*(){let t=a[o.position];(yield new u({getter:new l({position:t,file:o.file}),store:new f({file:o.path,key:"version"})}).update())&&Logger.debug("package json \u7684\u7248\u672C\u66F4\u65B0\u6210\u529F");}));program.command("get").description("\u83B7\u53D6\u7248\u672C").option("-p --position <position>","\u66F4\u65B0\u4F4D\u7F6E",a[h.position]).action(o=>n(P,null,function*(){let t=a[o.position],r=new l({position:t});Logger.log(yield r.get());}));program.parse(process.argv);});var semanticVersion = ot();
12
12
 
13
13
  export { semanticVersion as default };
@@ -3,17 +3,17 @@
3
3
  var j = require('dayjs');
4
4
  var logger = require('@tikkhun/logger');
5
5
  var fsExtra = require('fs-extra');
6
- var G = require('path');
6
+ var b = require('path');
7
7
 
8
8
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
9
 
10
10
  var j__default = /*#__PURE__*/_interopDefault(j);
11
- var G__default = /*#__PURE__*/_interopDefault(G);
11
+ var b__default = /*#__PURE__*/_interopDefault(b);
12
12
 
13
13
  /**
14
14
  @tikkhun/logger
15
15
  */
16
- var P=Object.defineProperty,T=Object.defineProperties;var y=Object.getOwnPropertyDescriptors;var l=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var h=(o,t,r)=>t in o?P(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,g=(o,t)=>{for(var r in t||(t={}))E.call(t,r)&&h(o,r,t[r]);if(l)for(var r of l(t))w.call(t,r)&&h(o,r,t[r]);return o},O=(o,t)=>T(o,y(t));var i=(o,t,r)=>new Promise((m,s)=>{var S=e=>{try{c(r.next(e));}catch(f){s(f);}},x=e=>{try{c(r.throw(e));}catch(f){s(f);}},c=e=>e.done?m(e.value):Promise.resolve(e.value).then(S,x);c((r=r.apply(o,t)).next());});var N={pattern:"YYYY.MM.DD"},n=class o{constructor(t){this.log=new logger.Logger(this.constructor.name);this.options=Object.assign(N,t);}static get(t){return j__default.default().format(t)}get(){return o.get(this.options.pattern)}};var p=process.cwd();var d={file:"package.json",key:"version"},a=class{constructor(t){this.opts=Object.assign(d,t),this.filePath=G__default.default.join(p,this.opts.file);}update(t){return i(this,null,function*(){try{let r=yield fsExtra.readJson(this.filePath);return yield fsExtra.writeJson(this.filePath,O(g({},r),{[this.opts.key]:t}),{spaces:2}),!0}catch(r){return !1}})}};var I={getter:new n,store:new a},u=class{constructor(t){this.opts=Object.assign(I,t);}get(){return this.opts.getter.get()}update(){return i(this,null,function*(){let t=yield this.get(),r=Array.isArray(this.opts.store)?this.opts.store:[this.opts.store];try{if((yield Promise.all(r.map(s=>s.update(t)))).filter(s=>!s).length)throw new Error("update error");return !0}catch(m){return !1}})}};
16
+ var x=Object.defineProperty,E=Object.defineProperties;var T=Object.getOwnPropertyDescriptors;var h=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var l=(o,t,r)=>t in o?x(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,g=(o,t)=>{for(var r in t||(t={}))y.call(t,r)&&l(o,r,t[r]);if(h)for(var r of h(t))P.call(t,r)&&l(o,r,t[r]);return o},u=(o,t)=>E(o,T(t));var i=(o,t,r)=>new Promise((f,s)=>{var S=e=>{try{m(r.next(e));}catch(c){s(c);}},w=e=>{try{m(r.throw(e));}catch(c){s(c);}},m=e=>e.done?f(e.value):Promise.resolve(e.value).then(S,w);m((r=r.apply(o,t)).next());});var d={pattern:"YYYY.MM.DD"},n=class o{constructor(t){this.log=new logger.Logger(this.constructor.name);this.options=Object.assign(d,t);}static get(t){return j__default.default().format(t)}get(){return o.get(this.options.pattern)}};var p=process.cwd();var k={file:"package.json",key:"version"},a=class{constructor(t){this.opts=Object.assign(k,t),this.filePath=b__default.default.join(p,this.opts.file);}update(t){return i(this,null,function*(){try{let r=yield fsExtra.readJson(this.filePath);return yield fsExtra.writeJson(this.filePath,u(g({},r),{[this.opts.key]:t}),{spaces:2}),!0}catch(r){return !1}})}};var A={getter:new n,store:new a},O=class{constructor(t){this.opts=Object.assign(A,t);}get(){return this.opts.getter.get()}update(){return i(this,null,function*(){let t=yield this.get(),r=Array.isArray(this.opts.store)?this.opts.store:[this.opts.store];try{if((yield Promise.all(r.map(s=>s.update(t)))).filter(s=>!s).length)throw new Error("update, but error");return !0}catch(f){return !1}})}};
17
17
 
18
- exports.DEFAULT_VERSION_MANAGER_OPTIONS = I;
19
- exports.VersionManager = u;
18
+ exports.DEFAULT_VERSION_MANAGER_OPTIONS = A;
19
+ exports.VersionManager = O;
@@ -1,11 +1,11 @@
1
1
  import j from 'dayjs';
2
2
  import { Logger } from '@tikkhun/logger';
3
3
  import { readJson, writeJson } from 'fs-extra';
4
- import G from 'path';
4
+ import b from 'path';
5
5
 
6
6
  /**
7
7
  @tikkhun/logger
8
8
  */
9
- var P=Object.defineProperty,T=Object.defineProperties;var y=Object.getOwnPropertyDescriptors;var l=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var h=(o,t,r)=>t in o?P(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,g=(o,t)=>{for(var r in t||(t={}))E.call(t,r)&&h(o,r,t[r]);if(l)for(var r of l(t))w.call(t,r)&&h(o,r,t[r]);return o},O=(o,t)=>T(o,y(t));var i=(o,t,r)=>new Promise((m,s)=>{var S=e=>{try{c(r.next(e));}catch(f){s(f);}},x=e=>{try{c(r.throw(e));}catch(f){s(f);}},c=e=>e.done?m(e.value):Promise.resolve(e.value).then(S,x);c((r=r.apply(o,t)).next());});var N={pattern:"YYYY.MM.DD"},n=class o{constructor(t){this.log=new Logger(this.constructor.name);this.options=Object.assign(N,t);}static get(t){return j().format(t)}get(){return o.get(this.options.pattern)}};var p=process.cwd();var d={file:"package.json",key:"version"},a=class{constructor(t){this.opts=Object.assign(d,t),this.filePath=G.join(p,this.opts.file);}update(t){return i(this,null,function*(){try{let r=yield readJson(this.filePath);return yield writeJson(this.filePath,O(g({},r),{[this.opts.key]:t}),{spaces:2}),!0}catch(r){return !1}})}};var I={getter:new n,store:new a},u=class{constructor(t){this.opts=Object.assign(I,t);}get(){return this.opts.getter.get()}update(){return i(this,null,function*(){let t=yield this.get(),r=Array.isArray(this.opts.store)?this.opts.store:[this.opts.store];try{if((yield Promise.all(r.map(s=>s.update(t)))).filter(s=>!s).length)throw new Error("update error");return !0}catch(m){return !1}})}};
9
+ var x=Object.defineProperty,E=Object.defineProperties;var T=Object.getOwnPropertyDescriptors;var h=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var l=(o,t,r)=>t in o?x(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,g=(o,t)=>{for(var r in t||(t={}))y.call(t,r)&&l(o,r,t[r]);if(h)for(var r of h(t))P.call(t,r)&&l(o,r,t[r]);return o},u=(o,t)=>E(o,T(t));var i=(o,t,r)=>new Promise((f,s)=>{var S=e=>{try{m(r.next(e));}catch(c){s(c);}},w=e=>{try{m(r.throw(e));}catch(c){s(c);}},m=e=>e.done?f(e.value):Promise.resolve(e.value).then(S,w);m((r=r.apply(o,t)).next());});var d={pattern:"YYYY.MM.DD"},n=class o{constructor(t){this.log=new Logger(this.constructor.name);this.options=Object.assign(d,t);}static get(t){return j().format(t)}get(){return o.get(this.options.pattern)}};var p=process.cwd();var k={file:"package.json",key:"version"},a=class{constructor(t){this.opts=Object.assign(k,t),this.filePath=b.join(p,this.opts.file);}update(t){return i(this,null,function*(){try{let r=yield readJson(this.filePath);return yield writeJson(this.filePath,u(g({},r),{[this.opts.key]:t}),{spaces:2}),!0}catch(r){return !1}})}};var A={getter:new n,store:new a},O=class{constructor(t){this.opts=Object.assign(A,t);}get(){return this.opts.getter.get()}update(){return i(this,null,function*(){let t=yield this.get(),r=Array.isArray(this.opts.store)?this.opts.store:[this.opts.store];try{if((yield Promise.all(r.map(s=>s.update(t)))).filter(s=>!s).length)throw new Error("update, but error");return !0}catch(f){return !1}})}};
10
10
 
11
- export { I as DEFAULT_VERSION_MANAGER_OPTIONS, u as VersionManager };
11
+ export { A as DEFAULT_VERSION_MANAGER_OPTIONS, O as VersionManager };
@@ -1,17 +1,17 @@
1
1
  'use strict';
2
2
 
3
3
  var fsExtra = require('fs-extra');
4
- var j = require('path');
4
+ var u = require('path');
5
5
 
6
6
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
7
 
8
- var j__default = /*#__PURE__*/_interopDefault(j);
8
+ var u__default = /*#__PURE__*/_interopDefault(u);
9
9
 
10
10
  /**
11
11
  @tikkhun/logger
12
12
  */
13
- var a=(p,r,o)=>new Promise((t,i)=>{var h=e=>{try{s(o.next(e));}catch(n){i(n);}},f=e=>{try{s(o.throw(e));}catch(n){i(n);}},s=e=>e.done?t(e.value):Promise.resolve(e.value).then(h,f);s((o=o.apply(p,r)).next());});var m=process.cwd();var u=(t=>(t[t.major=0]="major",t[t.minor=1]="minor",t[t.patch=2]="patch",t))(u||{}),O={file:"package.json",position:2,key:"version"},c=class{constructor(r){this.opts=Object.assign(O,r),this.filePath=j__default.default.join(m,this.opts.file);}get(){return a(this,null,function*(){let{[this.opts.key]:r}=yield fsExtra.readJson(this.filePath),[o,t,i]=r.split(".");return this.opts.position===0?[Number(o)+1,t,i].join("."):this.opts.position===1?[o,Number(t)+1,i].join("."):[o,t,Number(i)+1].join(".")})}};
13
+ var a=(p,r,o)=>new Promise((t,i)=>{var f=e=>{try{n(o.next(e));}catch(s){i(s);}},c=e=>{try{n(o.throw(e));}catch(s){i(s);}},n=e=>e.done?t(e.value):Promise.resolve(e.value).then(f,c);n((o=o.apply(p,r)).next());});var h=process.cwd();var g=(t=>(t[t.major=0]="major",t[t.minor=1]="minor",t[t.patch=2]="patch",t))(g||{}),j={file:"package.json",position:2,key:"version"},m=class{constructor(r){this.opts=Object.assign(j,r),this.filePath=u__default.default.join(h,this.opts.file);}get(){return a(this,null,function*(){if(!(yield fsExtra.pathExists(this.filePath)))throw new Error("get new version,but error: the file is not found");let{[this.opts.key]:r}=yield fsExtra.readJson(this.filePath);if(!r)throw new Error("get new version, but error: the old version is not found");if(typeof r!="string")throw new Error(`get new version, but error: the old version is not string,old version: ${JSON.stringify(r)}`);let[o,t,i]=r.split(".");return this.opts.position===0?[Number(o)+1,t,i].join("."):this.opts.position===1?[o,Number(t)+1,i].join("."):[o,t,Number(i)+1].join(".")})}};
14
14
 
15
- exports.DEFAULT_SEMANTIC_VERSION_GETTER_OPTIONS = O;
16
- exports.Positions = u;
17
- exports.SemanticVersionGetter = c;
15
+ exports.DEFAULT_SEMANTIC_VERSION_GETTER_OPTIONS = j;
16
+ exports.Positions = g;
17
+ exports.SemanticVersionGetter = m;
@@ -1,9 +1,9 @@
1
- import { readJson } from 'fs-extra';
2
- import j from 'path';
1
+ import { pathExists, readJson } from 'fs-extra';
2
+ import u from 'path';
3
3
 
4
4
  /**
5
5
  @tikkhun/logger
6
6
  */
7
- var a=(p,r,o)=>new Promise((t,i)=>{var h=e=>{try{s(o.next(e));}catch(n){i(n);}},f=e=>{try{s(o.throw(e));}catch(n){i(n);}},s=e=>e.done?t(e.value):Promise.resolve(e.value).then(h,f);s((o=o.apply(p,r)).next());});var m=process.cwd();var u=(t=>(t[t.major=0]="major",t[t.minor=1]="minor",t[t.patch=2]="patch",t))(u||{}),O={file:"package.json",position:2,key:"version"},c=class{constructor(r){this.opts=Object.assign(O,r),this.filePath=j.join(m,this.opts.file);}get(){return a(this,null,function*(){let{[this.opts.key]:r}=yield readJson(this.filePath),[o,t,i]=r.split(".");return this.opts.position===0?[Number(o)+1,t,i].join("."):this.opts.position===1?[o,Number(t)+1,i].join("."):[o,t,Number(i)+1].join(".")})}};
7
+ var a=(p,r,o)=>new Promise((t,i)=>{var f=e=>{try{n(o.next(e));}catch(s){i(s);}},c=e=>{try{n(o.throw(e));}catch(s){i(s);}},n=e=>e.done?t(e.value):Promise.resolve(e.value).then(f,c);n((o=o.apply(p,r)).next());});var h=process.cwd();var g=(t=>(t[t.major=0]="major",t[t.minor=1]="minor",t[t.patch=2]="patch",t))(g||{}),j={file:"package.json",position:2,key:"version"},m=class{constructor(r){this.opts=Object.assign(j,r),this.filePath=u.join(h,this.opts.file);}get(){return a(this,null,function*(){if(!(yield pathExists(this.filePath)))throw new Error("get new version,but error: the file is not found");let{[this.opts.key]:r}=yield readJson(this.filePath);if(!r)throw new Error("get new version, but error: the old version is not found");if(typeof r!="string")throw new Error(`get new version, but error: the old version is not string,old version: ${JSON.stringify(r)}`);let[o,t,i]=r.split(".");return this.opts.position===0?[Number(o)+1,t,i].join("."):this.opts.position===1?[o,Number(t)+1,i].join("."):[o,t,Number(i)+1].join(".")})}};
8
8
 
9
- export { O as DEFAULT_SEMANTIC_VERSION_GETTER_OPTIONS, u as Positions, c as SemanticVersionGetter };
9
+ export { j as DEFAULT_SEMANTIC_VERSION_GETTER_OPTIONS, g as Positions, m as SemanticVersionGetter };
@@ -1,23 +1,23 @@
1
1
  'use strict';
2
2
 
3
- var O = require('dayjs');
3
+ var u = require('dayjs');
4
4
  var logger = require('@tikkhun/logger');
5
5
  var fsExtra = require('fs-extra');
6
- var E = require('path');
6
+ var j = require('path');
7
7
 
8
8
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
9
 
10
- var O__default = /*#__PURE__*/_interopDefault(O);
11
- var E__default = /*#__PURE__*/_interopDefault(E);
10
+ var u__default = /*#__PURE__*/_interopDefault(u);
11
+ var j__default = /*#__PURE__*/_interopDefault(j);
12
12
 
13
13
  /**
14
14
  @tikkhun/logger
15
15
  */
16
- var m=(s,o,r)=>new Promise((t,i)=>{var h=e=>{try{n(r.next(e));}catch(p){i(p);}},g=e=>{try{n(r.throw(e));}catch(p){i(p);}},n=e=>e.done?t(e.value):Promise.resolve(e.value).then(h,g);n((r=r.apply(s,o)).next());});var x={pattern:"YYYY.MM.DD"},a=class s{constructor(o){this.log=new logger.Logger(this.constructor.name);this.options=Object.assign(x,o);}static get(o){return O__default.default().format(o)}get(){return s.get(this.options.pattern)}};var c=class{get(){return process.versions.node}};var f=process.cwd();var T=(t=>(t[t.major=0]="major",t[t.minor=1]="minor",t[t.patch=2]="patch",t))(T||{}),G={file:"package.json",position:2,key:"version"},l=class{constructor(o){this.opts=Object.assign(G,o),this.filePath=E__default.default.join(f,this.opts.file);}get(){return m(this,null,function*(){let{[this.opts.key]:o}=yield fsExtra.readJson(this.filePath),[r,t,i]=o.split(".");return this.opts.position===0?[Number(r)+1,t,i].join("."):this.opts.position===1?[r,Number(t)+1,i].join("."):[r,t,Number(i)+1].join(".")})}};
16
+ var a=(s,t,o)=>new Promise((r,i)=>{var l=e=>{try{n(o.next(e));}catch(p){i(p);}},g=e=>{try{n(o.throw(e));}catch(p){i(p);}},n=e=>e.done?r(e.value):Promise.resolve(e.value).then(l,g);n((o=o.apply(s,t)).next());});var w={pattern:"YYYY.MM.DD"},m=class s{constructor(t){this.log=new logger.Logger(this.constructor.name);this.options=Object.assign(w,t);}static get(t){return u__default.default().format(t)}get(){return s.get(this.options.pattern)}};var c=class{get(){return process.versions.node}};var f=process.cwd();var T=(r=>(r[r.major=0]="major",r[r.minor=1]="minor",r[r.patch=2]="patch",r))(T||{}),d={file:"package.json",position:2,key:"version"},h=class{constructor(t){this.opts=Object.assign(d,t),this.filePath=j__default.default.join(f,this.opts.file);}get(){return a(this,null,function*(){if(!(yield fsExtra.pathExists(this.filePath)))throw new Error("get new version,but error: the file is not found");let{[this.opts.key]:t}=yield fsExtra.readJson(this.filePath);if(!t)throw new Error("get new version, but error: the old version is not found");if(typeof t!="string")throw new Error(`get new version, but error: the old version is not string,old version: ${JSON.stringify(t)}`);let[o,r,i]=t.split(".");return this.opts.position===0?[Number(o)+1,r,i].join("."):this.opts.position===1?[o,Number(r)+1,i].join("."):[o,r,Number(i)+1].join(".")})}};
17
17
 
18
- exports.DEFAULT_DATE_VERSION_GETTER_OPTIONS = x;
19
- exports.DEFAULT_SEMANTIC_VERSION_GETTER_OPTIONS = G;
20
- exports.DateVersionGetter = a;
18
+ exports.DEFAULT_DATE_VERSION_GETTER_OPTIONS = w;
19
+ exports.DEFAULT_SEMANTIC_VERSION_GETTER_OPTIONS = d;
20
+ exports.DateVersionGetter = m;
21
21
  exports.NodeVersionGetter = c;
22
22
  exports.Positions = T;
23
- exports.SemanticVersionGetter = l;
23
+ exports.SemanticVersionGetter = h;
@@ -1,11 +1,11 @@
1
- import O from 'dayjs';
1
+ import u from 'dayjs';
2
2
  import { Logger } from '@tikkhun/logger';
3
- import { readJson } from 'fs-extra';
4
- import E from 'path';
3
+ import { pathExists, readJson } from 'fs-extra';
4
+ import j from 'path';
5
5
 
6
6
  /**
7
7
  @tikkhun/logger
8
8
  */
9
- var m=(s,o,r)=>new Promise((t,i)=>{var h=e=>{try{n(r.next(e));}catch(p){i(p);}},g=e=>{try{n(r.throw(e));}catch(p){i(p);}},n=e=>e.done?t(e.value):Promise.resolve(e.value).then(h,g);n((r=r.apply(s,o)).next());});var x={pattern:"YYYY.MM.DD"},a=class s{constructor(o){this.log=new Logger(this.constructor.name);this.options=Object.assign(x,o);}static get(o){return O().format(o)}get(){return s.get(this.options.pattern)}};var c=class{get(){return process.versions.node}};var f=process.cwd();var T=(t=>(t[t.major=0]="major",t[t.minor=1]="minor",t[t.patch=2]="patch",t))(T||{}),G={file:"package.json",position:2,key:"version"},l=class{constructor(o){this.opts=Object.assign(G,o),this.filePath=E.join(f,this.opts.file);}get(){return m(this,null,function*(){let{[this.opts.key]:o}=yield readJson(this.filePath),[r,t,i]=o.split(".");return this.opts.position===0?[Number(r)+1,t,i].join("."):this.opts.position===1?[r,Number(t)+1,i].join("."):[r,t,Number(i)+1].join(".")})}};
9
+ var a=(s,t,o)=>new Promise((r,i)=>{var l=e=>{try{n(o.next(e));}catch(p){i(p);}},g=e=>{try{n(o.throw(e));}catch(p){i(p);}},n=e=>e.done?r(e.value):Promise.resolve(e.value).then(l,g);n((o=o.apply(s,t)).next());});var w={pattern:"YYYY.MM.DD"},m=class s{constructor(t){this.log=new Logger(this.constructor.name);this.options=Object.assign(w,t);}static get(t){return u().format(t)}get(){return s.get(this.options.pattern)}};var c=class{get(){return process.versions.node}};var f=process.cwd();var T=(r=>(r[r.major=0]="major",r[r.minor=1]="minor",r[r.patch=2]="patch",r))(T||{}),d={file:"package.json",position:2,key:"version"},h=class{constructor(t){this.opts=Object.assign(d,t),this.filePath=j.join(f,this.opts.file);}get(){return a(this,null,function*(){if(!(yield pathExists(this.filePath)))throw new Error("get new version,but error: the file is not found");let{[this.opts.key]:t}=yield readJson(this.filePath);if(!t)throw new Error("get new version, but error: the old version is not found");if(typeof t!="string")throw new Error(`get new version, but error: the old version is not string,old version: ${JSON.stringify(t)}`);let[o,r,i]=t.split(".");return this.opts.position===0?[Number(o)+1,r,i].join("."):this.opts.position===1?[o,Number(r)+1,i].join("."):[o,r,Number(i)+1].join(".")})}};
10
10
 
11
- export { x as DEFAULT_DATE_VERSION_GETTER_OPTIONS, G as DEFAULT_SEMANTIC_VERSION_GETTER_OPTIONS, a as DateVersionGetter, c as NodeVersionGetter, T as Positions, l as SemanticVersionGetter };
11
+ export { w as DEFAULT_DATE_VERSION_GETTER_OPTIONS, d as DEFAULT_SEMANTIC_VERSION_GETTER_OPTIONS, m as DateVersionGetter, c as NodeVersionGetter, T as Positions, h as SemanticVersionGetter };
package/dist/lib/index.js CHANGED
@@ -1,32 +1,32 @@
1
1
  'use strict';
2
2
 
3
- var G = require('dayjs');
3
+ var N = require('dayjs');
4
4
  var logger = require('@tikkhun/logger');
5
5
  var fsExtra = require('fs-extra');
6
- var I = require('path');
6
+ var v = require('path');
7
7
  var F = require('fs');
8
8
 
9
9
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
10
 
11
- var G__default = /*#__PURE__*/_interopDefault(G);
12
- var I__default = /*#__PURE__*/_interopDefault(I);
11
+ var N__default = /*#__PURE__*/_interopDefault(N);
12
+ var v__default = /*#__PURE__*/_interopDefault(v);
13
13
  var F__default = /*#__PURE__*/_interopDefault(F);
14
14
 
15
15
  /**
16
16
  @tikkhun/logger
17
17
  */
18
- var E=Object.defineProperty,w=Object.defineProperties;var j=Object.getOwnPropertyDescriptors;var l=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var h=(o,t,r)=>t in o?E(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,g=(o,t)=>{for(var r in t||(t={}))_.call(t,r)&&h(o,r,t[r]);if(l)for(var r of l(t))N.call(t,r)&&h(o,r,t[r]);return o},O=(o,t)=>w(o,j(t));var n=(o,t,r)=>new Promise((e,s)=>{var T=i=>{try{f(r.next(i));}catch(c){s(c);}},y=i=>{try{f(r.throw(i));}catch(c){s(c);}},f=i=>i.done?e(i.value):Promise.resolve(i.value).then(T,y);f((r=r.apply(o,t)).next());});var A={pattern:"YYYY.MM.DD"},a=class o{constructor(t){this.log=new logger.Logger(this.constructor.name);this.options=Object.assign(A,t);}static get(t){return G__default.default().format(t)}get(){return o.get(this.options.pattern)}};var u=class{get(){return process.versions.node}};var p=process.cwd();var J=(e=>(e[e.major=0]="major",e[e.minor=1]="minor",e[e.patch=2]="patch",e))(J||{}),V={file:"package.json",position:2,key:"version"},S=class{constructor(t){this.opts=Object.assign(V,t),this.filePath=I__default.default.join(p,this.opts.file);}get(){return n(this,null,function*(){let{[this.opts.key]:t}=yield fsExtra.readJson(this.filePath),[r,e,s]=t.split(".");return this.opts.position===0?[Number(r)+1,e,s].join("."):this.opts.position===1?[r,Number(e)+1,s].join("."):[r,e,Number(s)+1].join(".")})}};var M={file:"package.json",key:"version"},m=class{constructor(t){this.opts=Object.assign(M,t),this.filePath=I__default.default.join(p,this.opts.file);}update(t){return n(this,null,function*(){try{let r=yield fsExtra.readJson(this.filePath);return yield fsExtra.writeJson(this.filePath,O(g({},r),{[this.opts.key]:t}),{spaces:2}),!0}catch(r){return !1}})}};var at={},x=class{constructor(t){this.opts=t,this.filePath=I__default.default.join(p,this.opts.file),console.log("this.filePath",this.filePath);}update(t){try{return typeof t!="string"&&(t=JSON.stringify(t)),console.log("this.filePath,text",this.filePath,t),F__default.default.writeFileSync(this.filePath,t,"utf8"),!0}catch(r){return !1}}};var U={getter:new a,store:new m},P=class{constructor(t){this.opts=Object.assign(U,t);}get(){return this.opts.getter.get()}update(){return n(this,null,function*(){let t=yield this.get(),r=Array.isArray(this.opts.store)?this.opts.store:[this.opts.store];try{if((yield Promise.all(r.map(s=>s.update(t)))).filter(s=>!s).length)throw new Error("update error");return !0}catch(e){return !1}})}};
18
+ var y=Object.defineProperty,P=Object.defineProperties;var j=Object.getOwnPropertyDescriptors;var h=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,d=Object.prototype.propertyIsEnumerable;var l=(o,t,r)=>t in o?y(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,g=(o,t)=>{for(var r in t||(t={}))_.call(t,r)&&l(o,r,t[r]);if(h)for(var r of h(t))d.call(t,r)&&l(o,r,t[r]);return o},u=(o,t)=>P(o,j(t));var n=(o,t,r)=>new Promise((e,s)=>{var E=i=>{try{m(r.next(i));}catch(c){s(c);}},T=i=>{try{m(r.throw(i));}catch(c){s(c);}},m=i=>i.done?e(i.value):Promise.resolve(i.value).then(E,T);m((r=r.apply(o,t)).next());});var b={pattern:"YYYY.MM.DD"},a=class o{constructor(t){this.log=new logger.Logger(this.constructor.name);this.options=Object.assign(b,t);}static get(t){return N__default.default().format(t)}get(){return o.get(this.options.pattern)}};var O=class{get(){return process.versions.node}};var p=process.cwd();var J=(e=>(e[e.major=0]="major",e[e.minor=1]="minor",e[e.patch=2]="patch",e))(J||{}),I={file:"package.json",position:2,key:"version"},S=class{constructor(t){this.opts=Object.assign(I,t),this.filePath=v__default.default.join(p,this.opts.file);}get(){return n(this,null,function*(){if(!(yield fsExtra.pathExists(this.filePath)))throw new Error("get new version,but error: the file is not found");let{[this.opts.key]:t}=yield fsExtra.readJson(this.filePath);if(!t)throw new Error("get new version, but error: the old version is not found");if(typeof t!="string")throw new Error(`get new version, but error: the old version is not string,old version: ${JSON.stringify(t)}`);let[r,e,s]=t.split(".");return this.opts.position===0?[Number(r)+1,e,s].join("."):this.opts.position===1?[r,Number(e)+1,s].join("."):[r,e,Number(s)+1].join(".")})}};var M={file:"package.json",key:"version"},f=class{constructor(t){this.opts=Object.assign(M,t),this.filePath=v__default.default.join(p,this.opts.file);}update(t){return n(this,null,function*(){try{let r=yield fsExtra.readJson(this.filePath);return yield fsExtra.writeJson(this.filePath,u(g({},r),{[this.opts.key]:t}),{spaces:2}),!0}catch(r){return !1}})}};var ht={file:""},x=class{constructor(t){this.opts=t,this.filePath=v__default.default.join(p,this.opts.file);}update(t){try{return typeof t!="string"&&(t=JSON.stringify(t)),F__default.default.writeFileSync(this.filePath,t,"utf8"),!0}catch(r){return !1}}};var U={getter:new a,store:new f},w=class{constructor(t){this.opts=Object.assign(U,t);}get(){return this.opts.getter.get()}update(){return n(this,null,function*(){let t=yield this.get(),r=Array.isArray(this.opts.store)?this.opts.store:[this.opts.store];try{if((yield Promise.all(r.map(s=>s.update(t)))).filter(s=>!s).length)throw new Error("update, but error");return !0}catch(e){return !1}})}};
19
19
 
20
- exports.DEFAULT_DATE_VERSION_GETTER_OPTIONS = A;
20
+ exports.DEFAULT_DATE_VERSION_GETTER_OPTIONS = b;
21
21
  exports.DEFAULT_JSON_STORE_OPTIONS = M;
22
- exports.DEFAULT_SEMANTIC_VERSION_GETTER_OPTIONS = V;
23
- exports.DEFAULT_TEXT_STORE_OPTIONS = at;
22
+ exports.DEFAULT_SEMANTIC_VERSION_GETTER_OPTIONS = I;
23
+ exports.DEFAULT_TEXT_STORE_OPTIONS = ht;
24
24
  exports.DEFAULT_VERSION_MANAGER_OPTIONS = U;
25
25
  exports.DateVersionGetter = a;
26
- exports.JsonStore = m;
27
- exports.NodeVersionGetter = u;
26
+ exports.JsonStore = f;
27
+ exports.NodeVersionGetter = O;
28
28
  exports.Positions = J;
29
29
  exports.SemanticVersionGetter = S;
30
30
  exports.TextStore = x;
31
- exports.VersionManager = P;
31
+ exports.VersionManager = w;
32
32
  exports.workspace = p;
@@ -1,12 +1,12 @@
1
- import G from 'dayjs';
1
+ import N from 'dayjs';
2
2
  import { Logger } from '@tikkhun/logger';
3
- import { readJson, writeJson } from 'fs-extra';
4
- import I from 'path';
3
+ import { pathExists, readJson, writeJson } from 'fs-extra';
4
+ import v from 'path';
5
5
  import F from 'fs';
6
6
 
7
7
  /**
8
8
  @tikkhun/logger
9
9
  */
10
- var E=Object.defineProperty,w=Object.defineProperties;var j=Object.getOwnPropertyDescriptors;var l=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var h=(o,t,r)=>t in o?E(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,g=(o,t)=>{for(var r in t||(t={}))_.call(t,r)&&h(o,r,t[r]);if(l)for(var r of l(t))N.call(t,r)&&h(o,r,t[r]);return o},O=(o,t)=>w(o,j(t));var n=(o,t,r)=>new Promise((e,s)=>{var T=i=>{try{f(r.next(i));}catch(c){s(c);}},y=i=>{try{f(r.throw(i));}catch(c){s(c);}},f=i=>i.done?e(i.value):Promise.resolve(i.value).then(T,y);f((r=r.apply(o,t)).next());});var A={pattern:"YYYY.MM.DD"},a=class o{constructor(t){this.log=new Logger(this.constructor.name);this.options=Object.assign(A,t);}static get(t){return G().format(t)}get(){return o.get(this.options.pattern)}};var u=class{get(){return process.versions.node}};var p=process.cwd();var J=(e=>(e[e.major=0]="major",e[e.minor=1]="minor",e[e.patch=2]="patch",e))(J||{}),V={file:"package.json",position:2,key:"version"},S=class{constructor(t){this.opts=Object.assign(V,t),this.filePath=I.join(p,this.opts.file);}get(){return n(this,null,function*(){let{[this.opts.key]:t}=yield readJson(this.filePath),[r,e,s]=t.split(".");return this.opts.position===0?[Number(r)+1,e,s].join("."):this.opts.position===1?[r,Number(e)+1,s].join("."):[r,e,Number(s)+1].join(".")})}};var M={file:"package.json",key:"version"},m=class{constructor(t){this.opts=Object.assign(M,t),this.filePath=I.join(p,this.opts.file);}update(t){return n(this,null,function*(){try{let r=yield readJson(this.filePath);return yield writeJson(this.filePath,O(g({},r),{[this.opts.key]:t}),{spaces:2}),!0}catch(r){return !1}})}};var at={},x=class{constructor(t){this.opts=t,this.filePath=I.join(p,this.opts.file),console.log("this.filePath",this.filePath);}update(t){try{return typeof t!="string"&&(t=JSON.stringify(t)),console.log("this.filePath,text",this.filePath,t),F.writeFileSync(this.filePath,t,"utf8"),!0}catch(r){return !1}}};var U={getter:new a,store:new m},P=class{constructor(t){this.opts=Object.assign(U,t);}get(){return this.opts.getter.get()}update(){return n(this,null,function*(){let t=yield this.get(),r=Array.isArray(this.opts.store)?this.opts.store:[this.opts.store];try{if((yield Promise.all(r.map(s=>s.update(t)))).filter(s=>!s).length)throw new Error("update error");return !0}catch(e){return !1}})}};
10
+ var y=Object.defineProperty,P=Object.defineProperties;var j=Object.getOwnPropertyDescriptors;var h=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,d=Object.prototype.propertyIsEnumerable;var l=(o,t,r)=>t in o?y(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,g=(o,t)=>{for(var r in t||(t={}))_.call(t,r)&&l(o,r,t[r]);if(h)for(var r of h(t))d.call(t,r)&&l(o,r,t[r]);return o},u=(o,t)=>P(o,j(t));var n=(o,t,r)=>new Promise((e,s)=>{var E=i=>{try{m(r.next(i));}catch(c){s(c);}},T=i=>{try{m(r.throw(i));}catch(c){s(c);}},m=i=>i.done?e(i.value):Promise.resolve(i.value).then(E,T);m((r=r.apply(o,t)).next());});var b={pattern:"YYYY.MM.DD"},a=class o{constructor(t){this.log=new Logger(this.constructor.name);this.options=Object.assign(b,t);}static get(t){return N().format(t)}get(){return o.get(this.options.pattern)}};var O=class{get(){return process.versions.node}};var p=process.cwd();var J=(e=>(e[e.major=0]="major",e[e.minor=1]="minor",e[e.patch=2]="patch",e))(J||{}),I={file:"package.json",position:2,key:"version"},S=class{constructor(t){this.opts=Object.assign(I,t),this.filePath=v.join(p,this.opts.file);}get(){return n(this,null,function*(){if(!(yield pathExists(this.filePath)))throw new Error("get new version,but error: the file is not found");let{[this.opts.key]:t}=yield readJson(this.filePath);if(!t)throw new Error("get new version, but error: the old version is not found");if(typeof t!="string")throw new Error(`get new version, but error: the old version is not string,old version: ${JSON.stringify(t)}`);let[r,e,s]=t.split(".");return this.opts.position===0?[Number(r)+1,e,s].join("."):this.opts.position===1?[r,Number(e)+1,s].join("."):[r,e,Number(s)+1].join(".")})}};var M={file:"package.json",key:"version"},f=class{constructor(t){this.opts=Object.assign(M,t),this.filePath=v.join(p,this.opts.file);}update(t){return n(this,null,function*(){try{let r=yield readJson(this.filePath);return yield writeJson(this.filePath,u(g({},r),{[this.opts.key]:t}),{spaces:2}),!0}catch(r){return !1}})}};var ht={file:""},x=class{constructor(t){this.opts=t,this.filePath=v.join(p,this.opts.file);}update(t){try{return typeof t!="string"&&(t=JSON.stringify(t)),F.writeFileSync(this.filePath,t,"utf8"),!0}catch(r){return !1}}};var U={getter:new a,store:new f},w=class{constructor(t){this.opts=Object.assign(U,t);}get(){return this.opts.getter.get()}update(){return n(this,null,function*(){let t=yield this.get(),r=Array.isArray(this.opts.store)?this.opts.store:[this.opts.store];try{if((yield Promise.all(r.map(s=>s.update(t)))).filter(s=>!s).length)throw new Error("update, but error");return !0}catch(e){return !1}})}};
11
11
 
12
- export { A as DEFAULT_DATE_VERSION_GETTER_OPTIONS, M as DEFAULT_JSON_STORE_OPTIONS, V as DEFAULT_SEMANTIC_VERSION_GETTER_OPTIONS, at as DEFAULT_TEXT_STORE_OPTIONS, U as DEFAULT_VERSION_MANAGER_OPTIONS, a as DateVersionGetter, m as JsonStore, u as NodeVersionGetter, J as Positions, S as SemanticVersionGetter, x as TextStore, P as VersionManager, p as workspace };
12
+ export { b as DEFAULT_DATE_VERSION_GETTER_OPTIONS, M as DEFAULT_JSON_STORE_OPTIONS, I as DEFAULT_SEMANTIC_VERSION_GETTER_OPTIONS, ht as DEFAULT_TEXT_STORE_OPTIONS, U as DEFAULT_VERSION_MANAGER_OPTIONS, a as DateVersionGetter, f as JsonStore, O as NodeVersionGetter, J as Positions, S as SemanticVersionGetter, x as TextStore, w as VersionManager, p as workspace };
@@ -1,18 +1,5 @@
1
1
  import { Store } from './Store.mjs';
2
2
 
3
- /**
4
- * @author
5
- * @file JsonStore.ts
6
- * @fileBase JsonStore
7
- * @path tools\date-version\lib\store\JsonStore.ts
8
- * @from
9
- * @desc
10
- * @todo
11
- *
12
- *
13
- * @done
14
- * @example
15
- */
16
3
  interface JsonStoreOptions {
17
4
  file: string;
18
5
  key: string;
@@ -1,18 +1,5 @@
1
1
  import { Store } from './Store.js';
2
2
 
3
- /**
4
- * @author
5
- * @file JsonStore.ts
6
- * @fileBase JsonStore
7
- * @path tools\date-version\lib\store\JsonStore.ts
8
- * @from
9
- * @desc
10
- * @todo
11
- *
12
- *
13
- * @done
14
- * @example
15
- */
16
3
  interface JsonStoreOptions {
17
4
  file: string;
18
5
  key: string;
@@ -1,16 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var u = require('path');
4
3
  var fsExtra = require('fs-extra');
4
+ var d = require('path');
5
5
 
6
6
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
7
 
8
- var u__default = /*#__PURE__*/_interopDefault(u);
8
+ var d__default = /*#__PURE__*/_interopDefault(d);
9
9
 
10
10
  /**
11
11
  @tikkhun/logger
12
12
  */
13
- var k=Object.defineProperty,w=Object.defineProperties;var y=Object.getOwnPropertyDescriptors;var a=Object.getOwnPropertySymbols;var J=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var p=(r,t,o)=>t in r?k(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o,c=(r,t)=>{for(var o in t||(t={}))J.call(t,o)&&p(r,o,t[o]);if(a)for(var o of a(t))P.call(t,o)&&p(r,o,t[o]);return r},f=(r,t)=>w(r,y(t));var h=(r,t,o)=>new Promise((O,n)=>{var S=s=>{try{e(o.next(s));}catch(i){n(i);}},g=s=>{try{e(o.throw(s));}catch(i){n(i);}},e=s=>s.done?O(s.value):Promise.resolve(s.value).then(S,g);e((o=o.apply(r,t)).next());});var m=process.cwd();var j={file:"package.json",key:"version"},l=class{constructor(t){this.opts=Object.assign(j,t),this.filePath=u__default.default.join(m,this.opts.file);}update(t){return h(this,null,function*(){try{let o=yield fsExtra.readJson(this.filePath);return yield fsExtra.writeJson(this.filePath,f(c({},o),{[this.opts.key]:t}),{spaces:2}),!0}catch(o){return !1}})}};
13
+ var k=Object.defineProperty,w=Object.defineProperties;var y=Object.getOwnPropertyDescriptors;var a=Object.getOwnPropertySymbols;var J=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var p=(s,t,o)=>t in s?k(s,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):s[t]=o,c=(s,t)=>{for(var o in t||(t={}))J.call(t,o)&&p(s,o,t[o]);if(a)for(var o of a(t))P.call(t,o)&&p(s,o,t[o]);return s},f=(s,t)=>w(s,y(t));var h=(s,t,o)=>new Promise((O,n)=>{var S=r=>{try{e(o.next(r));}catch(i){n(i);}},g=r=>{try{e(o.throw(r));}catch(i){n(i);}},e=r=>r.done?O(r.value):Promise.resolve(r.value).then(S,g);e((o=o.apply(s,t)).next());});var l=process.cwd();var j={file:"package.json",key:"version"},m=class{constructor(t){this.opts=Object.assign(j,t),this.filePath=d__default.default.join(l,this.opts.file);}update(t){return h(this,null,function*(){try{let o=yield fsExtra.readJson(this.filePath);return yield fsExtra.writeJson(this.filePath,f(c({},o),{[this.opts.key]:t}),{spaces:2}),!0}catch(o){return !1}})}};
14
14
 
15
15
  exports.DEFAULT_JSON_STORE_OPTIONS = j;
16
- exports.JsonStore = l;
16
+ exports.JsonStore = m;
@@ -1,9 +1,9 @@
1
- import u from 'path';
2
1
  import { readJson, writeJson } from 'fs-extra';
2
+ import d from 'path';
3
3
 
4
4
  /**
5
5
  @tikkhun/logger
6
6
  */
7
- var k=Object.defineProperty,w=Object.defineProperties;var y=Object.getOwnPropertyDescriptors;var a=Object.getOwnPropertySymbols;var J=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var p=(r,t,o)=>t in r?k(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o,c=(r,t)=>{for(var o in t||(t={}))J.call(t,o)&&p(r,o,t[o]);if(a)for(var o of a(t))P.call(t,o)&&p(r,o,t[o]);return r},f=(r,t)=>w(r,y(t));var h=(r,t,o)=>new Promise((O,n)=>{var S=s=>{try{e(o.next(s));}catch(i){n(i);}},g=s=>{try{e(o.throw(s));}catch(i){n(i);}},e=s=>s.done?O(s.value):Promise.resolve(s.value).then(S,g);e((o=o.apply(r,t)).next());});var m=process.cwd();var j={file:"package.json",key:"version"},l=class{constructor(t){this.opts=Object.assign(j,t),this.filePath=u.join(m,this.opts.file);}update(t){return h(this,null,function*(){try{let o=yield readJson(this.filePath);return yield writeJson(this.filePath,f(c({},o),{[this.opts.key]:t}),{spaces:2}),!0}catch(o){return !1}})}};
7
+ var k=Object.defineProperty,w=Object.defineProperties;var y=Object.getOwnPropertyDescriptors;var a=Object.getOwnPropertySymbols;var J=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var p=(s,t,o)=>t in s?k(s,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):s[t]=o,c=(s,t)=>{for(var o in t||(t={}))J.call(t,o)&&p(s,o,t[o]);if(a)for(var o of a(t))P.call(t,o)&&p(s,o,t[o]);return s},f=(s,t)=>w(s,y(t));var h=(s,t,o)=>new Promise((O,n)=>{var S=r=>{try{e(o.next(r));}catch(i){n(i);}},g=r=>{try{e(o.throw(r));}catch(i){n(i);}},e=r=>r.done?O(r.value):Promise.resolve(r.value).then(S,g);e((o=o.apply(s,t)).next());});var l=process.cwd();var j={file:"package.json",key:"version"},m=class{constructor(t){this.opts=Object.assign(j,t),this.filePath=d.join(l,this.opts.file);}update(t){return h(this,null,function*(){try{let o=yield readJson(this.filePath);return yield writeJson(this.filePath,f(c({},o),{[this.opts.key]:t}),{spaces:2}),!0}catch(o){return !1}})}};
8
8
 
9
- export { j as DEFAULT_JSON_STORE_OPTIONS, l as JsonStore };
9
+ export { j as DEFAULT_JSON_STORE_OPTIONS, m as JsonStore };
@@ -1,23 +1,9 @@
1
1
  import { Store } from './Store.mjs';
2
2
 
3
- /**
4
- * @author
5
- * @file TextStore.ts
6
- * @fileBase TextStore
7
- * @path tools\date-version\lib\store\TextStore.ts
8
- * @from
9
- * @desc
10
- * @todo
11
- *
12
- *
13
- * @done
14
- * @example
15
- */
16
3
  interface TextStoreOptions {
17
4
  file: string;
18
5
  }
19
- declare const DEFAULT_TEXT_STORE_OPTIONS: {};
20
-
6
+ declare const DEFAULT_TEXT_STORE_OPTIONS: TextStoreOptions;
21
7
  declare class TextStore implements Store {
22
8
  opts: TextStoreOptions;
23
9
  filePath: string;
@@ -1,23 +1,9 @@
1
1
  import { Store } from './Store.js';
2
2
 
3
- /**
4
- * @author
5
- * @file TextStore.ts
6
- * @fileBase TextStore
7
- * @path tools\date-version\lib\store\TextStore.ts
8
- * @from
9
- * @desc
10
- * @todo
11
- *
12
- *
13
- * @done
14
- * @example
15
- */
16
3
  interface TextStoreOptions {
17
4
  file: string;
18
5
  }
19
- declare const DEFAULT_TEXT_STORE_OPTIONS: {};
20
-
6
+ declare const DEFAULT_TEXT_STORE_OPTIONS: TextStoreOptions;
21
7
  declare class TextStore implements Store {
22
8
  opts: TextStoreOptions;
23
9
  filePath: string;
@@ -11,7 +11,7 @@ var i__default = /*#__PURE__*/_interopDefault(i);
11
11
  /**
12
12
  @tikkhun/logger
13
13
  */
14
- var o=process.cwd();var n={},r=class{constructor(t){this.opts=t,this.filePath=i__default.default.join(o,this.opts.file),console.log("this.filePath",this.filePath);}update(t){try{return typeof t!="string"&&(t=JSON.stringify(t)),console.log("this.filePath,text",this.filePath,t),e__default.default.writeFileSync(this.filePath,t,"utf8"),!0}catch(p){return !1}}};
14
+ var r=process.cwd();var l={file:""},o=class{constructor(t){this.opts=t,this.filePath=i__default.default.join(r,this.opts.file);}update(t){try{return typeof t!="string"&&(t=JSON.stringify(t)),e__default.default.writeFileSync(this.filePath,t,"utf8"),!0}catch(p){return !1}}};
15
15
 
16
- exports.DEFAULT_TEXT_STORE_OPTIONS = n;
17
- exports.TextStore = r;
16
+ exports.DEFAULT_TEXT_STORE_OPTIONS = l;
17
+ exports.TextStore = o;
@@ -4,6 +4,6 @@ import i from 'path';
4
4
  /**
5
5
  @tikkhun/logger
6
6
  */
7
- var o=process.cwd();var n={},r=class{constructor(t){this.opts=t,this.filePath=i.join(o,this.opts.file),console.log("this.filePath",this.filePath);}update(t){try{return typeof t!="string"&&(t=JSON.stringify(t)),console.log("this.filePath,text",this.filePath,t),e.writeFileSync(this.filePath,t,"utf8"),!0}catch(p){return !1}}};
7
+ var r=process.cwd();var l={file:""},o=class{constructor(t){this.opts=t,this.filePath=i.join(r,this.opts.file);}update(t){try{return typeof t!="string"&&(t=JSON.stringify(t)),e.writeFileSync(this.filePath,t,"utf8"),!0}catch(p){return !1}}};
8
8
 
9
- export { n as DEFAULT_TEXT_STORE_OPTIONS, r as TextStore };
9
+ export { l as DEFAULT_TEXT_STORE_OPTIONS, o as TextStore };
@@ -1,20 +1,20 @@
1
1
  'use strict';
2
2
 
3
- var k = require('path');
4
3
  var fsExtra = require('fs-extra');
4
+ var _ = require('path');
5
5
  var d = require('fs');
6
6
 
7
7
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
8
 
9
- var k__default = /*#__PURE__*/_interopDefault(k);
9
+ var ___default = /*#__PURE__*/_interopDefault(_);
10
10
  var d__default = /*#__PURE__*/_interopDefault(d);
11
11
 
12
12
  /**
13
13
  @tikkhun/logger
14
14
  */
15
- var u=Object.defineProperty,y=Object.defineProperties;var T=Object.getOwnPropertyDescriptors;var a=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var f=(r,t,o)=>t in r?u(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o,h=(r,t)=>{for(var o in t||(t={}))x.call(t,o)&&f(r,o,t[o]);if(a)for(var o of a(t))w.call(t,o)&&f(r,o,t[o]);return r},l=(r,t)=>y(r,T(t));var c=(r,t,o)=>new Promise((S,p)=>{var P=e=>{try{s(o.next(e));}catch(n){p(n);}},g=e=>{try{s(o.throw(e));}catch(n){p(n);}},s=e=>e.done?S(e.value):Promise.resolve(e.value).then(P,g);s((o=o.apply(r,t)).next());});var i=process.cwd();var E={file:"package.json",key:"version"},m=class{constructor(t){this.opts=Object.assign(E,t),this.filePath=k__default.default.join(i,this.opts.file);}update(t){return c(this,null,function*(){try{let o=yield fsExtra.readJson(this.filePath);return yield fsExtra.writeJson(this.filePath,l(h({},o),{[this.opts.key]:t}),{spaces:2}),!0}catch(o){return !1}})}};var R={},O=class{constructor(t){this.opts=t,this.filePath=k__default.default.join(i,this.opts.file),console.log("this.filePath",this.filePath);}update(t){try{return typeof t!="string"&&(t=JSON.stringify(t)),console.log("this.filePath,text",this.filePath,t),d__default.default.writeFileSync(this.filePath,t,"utf8"),!0}catch(o){return !1}}};
15
+ var T=Object.defineProperty,g=Object.defineProperties;var x=Object.getOwnPropertyDescriptors;var a=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var f=(r,t,o)=>t in r?T(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o,c=(r,t)=>{for(var o in t||(t={}))P.call(t,o)&&f(r,o,t[o]);if(a)for(var o of a(t))w.call(t,o)&&f(r,o,t[o]);return r},m=(r,t)=>g(r,x(t));var l=(r,t,o)=>new Promise((S,n)=>{var u=e=>{try{s(o.next(e));}catch(p){n(p);}},y=e=>{try{s(o.throw(e));}catch(p){n(p);}},s=e=>e.done?S(e.value):Promise.resolve(e.value).then(u,y);s((o=o.apply(r,t)).next());});var i=process.cwd();var E={file:"package.json",key:"version"},h=class{constructor(t){this.opts=Object.assign(E,t),this.filePath=___default.default.join(i,this.opts.file);}update(t){return l(this,null,function*(){try{let o=yield fsExtra.readJson(this.filePath);return yield fsExtra.writeJson(this.filePath,m(c({},o),{[this.opts.key]:t}),{spaces:2}),!0}catch(o){return !1}})}};var X={file:""},O=class{constructor(t){this.opts=t,this.filePath=___default.default.join(i,this.opts.file);}update(t){try{return typeof t!="string"&&(t=JSON.stringify(t)),d__default.default.writeFileSync(this.filePath,t,"utf8"),!0}catch(o){return !1}}};
16
16
 
17
17
  exports.DEFAULT_JSON_STORE_OPTIONS = E;
18
- exports.DEFAULT_TEXT_STORE_OPTIONS = R;
19
- exports.JsonStore = m;
18
+ exports.DEFAULT_TEXT_STORE_OPTIONS = X;
19
+ exports.JsonStore = h;
20
20
  exports.TextStore = O;
@@ -1,10 +1,10 @@
1
- import k from 'path';
2
1
  import { readJson, writeJson } from 'fs-extra';
2
+ import _ from 'path';
3
3
  import d from 'fs';
4
4
 
5
5
  /**
6
6
  @tikkhun/logger
7
7
  */
8
- var u=Object.defineProperty,y=Object.defineProperties;var T=Object.getOwnPropertyDescriptors;var a=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var f=(r,t,o)=>t in r?u(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o,h=(r,t)=>{for(var o in t||(t={}))x.call(t,o)&&f(r,o,t[o]);if(a)for(var o of a(t))w.call(t,o)&&f(r,o,t[o]);return r},l=(r,t)=>y(r,T(t));var c=(r,t,o)=>new Promise((S,p)=>{var P=e=>{try{s(o.next(e));}catch(n){p(n);}},g=e=>{try{s(o.throw(e));}catch(n){p(n);}},s=e=>e.done?S(e.value):Promise.resolve(e.value).then(P,g);s((o=o.apply(r,t)).next());});var i=process.cwd();var E={file:"package.json",key:"version"},m=class{constructor(t){this.opts=Object.assign(E,t),this.filePath=k.join(i,this.opts.file);}update(t){return c(this,null,function*(){try{let o=yield readJson(this.filePath);return yield writeJson(this.filePath,l(h({},o),{[this.opts.key]:t}),{spaces:2}),!0}catch(o){return !1}})}};var R={},O=class{constructor(t){this.opts=t,this.filePath=k.join(i,this.opts.file),console.log("this.filePath",this.filePath);}update(t){try{return typeof t!="string"&&(t=JSON.stringify(t)),console.log("this.filePath,text",this.filePath,t),d.writeFileSync(this.filePath,t,"utf8"),!0}catch(o){return !1}}};
8
+ var T=Object.defineProperty,g=Object.defineProperties;var x=Object.getOwnPropertyDescriptors;var a=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var f=(r,t,o)=>t in r?T(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o,c=(r,t)=>{for(var o in t||(t={}))P.call(t,o)&&f(r,o,t[o]);if(a)for(var o of a(t))w.call(t,o)&&f(r,o,t[o]);return r},m=(r,t)=>g(r,x(t));var l=(r,t,o)=>new Promise((S,n)=>{var u=e=>{try{s(o.next(e));}catch(p){n(p);}},y=e=>{try{s(o.throw(e));}catch(p){n(p);}},s=e=>e.done?S(e.value):Promise.resolve(e.value).then(u,y);s((o=o.apply(r,t)).next());});var i=process.cwd();var E={file:"package.json",key:"version"},h=class{constructor(t){this.opts=Object.assign(E,t),this.filePath=_.join(i,this.opts.file);}update(t){return l(this,null,function*(){try{let o=yield readJson(this.filePath);return yield writeJson(this.filePath,m(c({},o),{[this.opts.key]:t}),{spaces:2}),!0}catch(o){return !1}})}};var X={file:""},O=class{constructor(t){this.opts=t,this.filePath=_.join(i,this.opts.file);}update(t){try{return typeof t!="string"&&(t=JSON.stringify(t)),d.writeFileSync(this.filePath,t,"utf8"),!0}catch(o){return !1}}};
9
9
 
10
- export { E as DEFAULT_JSON_STORE_OPTIONS, R as DEFAULT_TEXT_STORE_OPTIONS, m as JsonStore, O as TextStore };
10
+ export { E as DEFAULT_JSON_STORE_OPTIONS, X as DEFAULT_TEXT_STORE_OPTIONS, h as JsonStore, O as TextStore };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tikkhun/version",
3
- "version": "2024.07.03",
3
+ "version": "2024.07.04",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "date-version": "./dist/cli/date-version.js",
@@ -45,7 +45,7 @@
45
45
  "scripts": {
46
46
  "build": "tsup",
47
47
  "dev": "ts-node ./src/index.ts",
48
- "update": "ts-node ./lib/cli.ts update",
48
+ "version:update": "ts-node ./cli/date-version.ts update",
49
49
  "test": "vitest"
50
50
  }
51
51
  }