capacitor-standard-version
Advanced tools
Comparing version 1.0.11 to 1.0.12
#!/usr/bin/env node | ||
(()=>{"use strict";var e={805:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.writeVersion=t.readVersion=void 0,t.readVersion=e=>e.split('versionName "')[1].split('"')[0],t.writeVersion=(e,t)=>{const r=e.replace(/(.*(?:versionName[ \t]+).*)/g,` versionName "${t}"`),n=Number(t.split(".").map((e=>1===e.length?`0${e}`:e)).join("").replace(/\D/g,""));return r.replace(/(.*(?:versionCode[ \t]+).*)/g,` versionCode ${n}`)}},655:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},a=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const u=s(r(322)),c=s(r(731)),l=s(r(389)),p=o(r(861)),d={noVerify:!0,tagPrefix:"",packageFiles:[{filename:"./package.json",type:"json"}],bumpFiles:[{filename:"./android/app/build.gradle",updater:o(r(805))},{filename:"./package.json",type:"json"},{filename:"./package-lock.json",type:"json"},{filename:"./ios/App/App.xcodeproj/project.pbxproj",updater:p}]};!function(){a(this,void 0,void 0,(function*(){try{const e=(0,l.default)(c.default.argv,d);yield(0,u.default)(e)}catch(e){throw console.error(e),e}}))}()},861:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.writeVersion=t.readVersion=void 0,t.readVersion=e=>e.match(/MARKETING_VERSION = [0-9]*.[0-9]*.[0-9]*/).toString().split("=")[1].trim(),t.writeVersion=(e,t)=>e.replace(/(.*(?:MARKETING_VERSION[ \t]+).*)/g,` MARKETING_VERSION = "${t}";`).replace(/(.*(?:CURRENT_PROJECT_VERSION[ \t]+).*)/g,` CURRENT_PROJECT_VERSION = "${t}";`)},389:e=>{e.exports=require("merge-deep")},322:e=>{e.exports=require("standard-version")},731:e=>{e.exports=require("standard-version/command")}},t={};!function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}(655)})(); | ||
(()=>{"use strict";var e={805:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.writeVersion=t.readVersion=void 0,t.readVersion=e=>e.split('versionName "')[1].split('"')[0],t.writeVersion=(e,t)=>{const r=t.split("-")[0],n=e.replace(/(.*(?:versionName[ \t]+).*)/g,`\t\tversionName "${r}"`);let i=Number(t.replace(/-.*?\./g,"").split(".").map((e=>1===e.length?`0${e}`:e)).join(""));return i<1e6&&(i*=100),n.replace(/(.*(?:versionCode[ \t]+).*)/g,`\t\tversionCode ${i}`)}},655:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},a=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const l=s(r(322)),u=s(r(731)),c=s(r(389)),p=o(r(861)),d={noVerify:!0,tagPrefix:"",packageFiles:[{filename:"./package.json",type:"json"}],bumpFiles:[{filename:"./android/app/build.gradle",updater:o(r(805))},{filename:"./package.json",type:"json"},{filename:"./package-lock.json",type:"json"},{filename:"./ios/App/App.xcodeproj/project.pbxproj",updater:p}]};!function(){a(this,void 0,void 0,(function*(){try{const e=(0,c.default)(u.default.argv,d);yield(0,l.default)(e)}catch(e){throw console.error(e),e}}))}()},861:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.writeVersion=t.readVersion=void 0,t.readVersion=e=>e.match(/MARKETING_VERSION = [0-9]*.[0-9]*.[0-9]*/).toString().split("=")[1].trim(),t.writeVersion=(e,t)=>{const r=t.split("-")[0],n=e.replace(/(.*(?:MARKETING_VERSION[ \t]+).*)/g,`\t\t\t\tMARKETING_VERSION = "${r}";`);let i=Number(t.replace(/-.*?\./g,"").split(".").map((e=>1===e.length?`0${e}`:e)).join(""));return i<1e6&&(i*=100),n.replace(/(.*(?:CURRENT_PROJECT_VERSION[ \t]+).*)/g,`\t\t\t\tCURRENT_PROJECT_VERSION = "${r}";`)}},389:e=>{e.exports=require("merge-deep")},322:e=>{e.exports=require("standard-version")},731:e=>{e.exports=require("standard-version/command")}},t={};!function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}(655)})(); |
{ | ||
"name": "capacitor-standard-version", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"description": "Default standard-version config for capacitor app", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -7,6 +7,10 @@ export const readVersion = (contents) => { | ||
export const writeVersion = (contents, version) => { | ||
const newContent = contents.replace(/(.*(?:versionName[ \t]+).*)/g, ` versionName "${version}"`) | ||
const versionCode = Number(version.split('.').map(v => v.length === 1 ? `0${v}` : v).join('').replace(/\D/g, '')) | ||
const finalContent = newContent.replace(/(.*(?:versionCode[ \t]+).*)/g, ` versionCode ${versionCode}`) | ||
const versionPure = version.split('-')[0] | ||
const newContent = contents.replace(/(.*(?:versionName[ \t]+).*)/g, `\t\tversionName "${versionPure}"`) | ||
let versionCode = Number(version.replace(/-.*?\./g, '').split('.').map(v => v.length === 1 ? `0${v}` : v).join('')) | ||
if (versionCode < 1000000) { | ||
versionCode *= 100 | ||
} | ||
const finalContent = newContent.replace(/(.*(?:versionCode[ \t]+).*)/g, `\t\tversionCode ${versionCode}`) | ||
return finalContent | ||
} |
@@ -8,5 +8,11 @@ export const readVersion = (contents) => { | ||
export const writeVersion = (contents, version) => { | ||
const newContent = contents.replace(/(.*(?:MARKETING_VERSION[ \t]+).*)/g, ` MARKETING_VERSION = "${version}";`) | ||
const finalContent = newContent.replace(/(.*(?:CURRENT_PROJECT_VERSION[ \t]+).*)/g, ` CURRENT_PROJECT_VERSION = "${version}";`) | ||
const versionPure = version.split('-')[0] | ||
const newContent = contents.replace(/(.*(?:MARKETING_VERSION[ \t]+).*)/g, `\t\t\t\tMARKETING_VERSION = "${versionPure}";`) | ||
let versionCode = Number(version.replace(/-.*?\./g, '').split('.').map(v => v.length === 1 ? `0${v}` : v).join('')) | ||
if (versionCode < 1000000) { | ||
versionCode *= 100 | ||
} | ||
const finalContent = newContent | ||
.replace(/(.*(?:CURRENT_PROJECT_VERSION[ \t]+).*)/g, `\t\t\t\tCURRENT_PROJECT_VERSION = "${versionPure}";`) | ||
return finalContent | ||
} |
12531
186