capacitor-standard-version 1.0.0
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.
- package/android-version-updater.js +11 -0
- package/index.js +47 -0
- package/ios-version-updater.js +11 -0
- package/package.json +32 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module.exports.readVersion = function(contents) {
|
|
2
|
+
const version = contents.split('versionName "')[1].split('"')[0]
|
|
3
|
+
return version
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
module.exports.writeVersion = function(contents, version) {
|
|
7
|
+
const newContent = contents.replace(/(.*(?:versionName[ \t]+).*)/g, ` versionName "${version}"`)
|
|
8
|
+
const versionCode = Number(version.split('.').map(v => v.length === 1 ? `0${v}` : v).join(''))
|
|
9
|
+
const finalContent = newContent.replace(/(.*(?:versionCode[ \t]+).*)/g, ` versionCode "${versionCode}"`)
|
|
10
|
+
return finalContent
|
|
11
|
+
}
|
package/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const standardVersion = require('standard-version');
|
|
2
|
+
const { getConfiguration } = require('standard-version/lib/configuration');
|
|
3
|
+
const merge = require('merge-deep');
|
|
4
|
+
|
|
5
|
+
const baseConfig = {
|
|
6
|
+
noVerify: true,
|
|
7
|
+
tagPrefix: '',
|
|
8
|
+
releaseCommitMessageFormat: "chore(release): {{currentTag}} [skip ci]",
|
|
9
|
+
packageFiles: [
|
|
10
|
+
{
|
|
11
|
+
filename: "./package.json",
|
|
12
|
+
type: "json"
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
bumpFiles: [
|
|
16
|
+
{
|
|
17
|
+
filename: "./android/app/build.gradle",
|
|
18
|
+
updater: require('./android-version-updater.js')
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
filename: "./package.json",
|
|
22
|
+
type: "json"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
filename: "./package-lock.json",
|
|
26
|
+
type: "json"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
filename: "./ios/App/App.xcodeproj/project.pbxproj",
|
|
30
|
+
updater: require('./ios-version-updater.js')
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function run() {
|
|
36
|
+
try {
|
|
37
|
+
const config = getConfiguration();
|
|
38
|
+
// merge base config with user config
|
|
39
|
+
const finalConfig = merge(baseConfig, config);
|
|
40
|
+
await standardVersion(finalConfig);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.error(error);
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
run();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module.exports.readVersion = function(contents) {
|
|
2
|
+
const marketingVersionString = contents.match(/MARKETING_VERSION = [0-9]*.[0-9]*.[0-9]*/)
|
|
3
|
+
const version = marketingVersionString.toString().split('=')[1].trim()
|
|
4
|
+
return version
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
module.exports.writeVersion = function(contents, version) {
|
|
8
|
+
const newContent = contents.replace(/(.*(?:MARKETING_VERSION[ \t]+).*)/g, ` MARKETING_VERSION = "${version}"`)
|
|
9
|
+
const finalContent = newContent.replace(/(.*(?:CURRENT_PROJECT_VERSION[ \t]+).*)/g, ` CURRENT_PROJECT_VERSION "${version}"`)
|
|
10
|
+
return finalContent
|
|
11
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "capacitor-standard-version",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Default standard-version config for capacitor app",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"capacitor-standard-version": "index.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/Cap-go/capacitor-standard-version.git"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"capacitor",
|
|
18
|
+
"standard-version",
|
|
19
|
+
"bin",
|
|
20
|
+
"cli"
|
|
21
|
+
],
|
|
22
|
+
"author": "Martin Donadieu <martindonadieu@gmail.com>",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/Cap-go/capacitor-standard-version/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/Cap-go/capacitor-standard-version#readme",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"merge-deep": "^3.0.3",
|
|
30
|
+
"standard-version": "^9.3.2"
|
|
31
|
+
}
|
|
32
|
+
}
|