@widergy/semantic-release-mobile-config 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/README.md +36 -0
- package/index.js +16 -0
- package/package.json +44 -0
- package/prepare.js +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# @widergy/semantic-release-app-config
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
[](https://github.com/semantic-release/semantic-release)
|
|
6
|
+
|
|
7
|
+
## Plugins
|
|
8
|
+
|
|
9
|
+
This shareable configuration use the following plugins:
|
|
10
|
+
|
|
11
|
+
- [`@semantic-release/commit-analyzer`](https://github.com/semantic-release/commit-analyzer)
|
|
12
|
+
- [`@semantic-release/release-notes-generator`](https://github.com/semantic-release/release-notes-generator)
|
|
13
|
+
- [`@semantic-release/changelog`](https://github.com/semantic-release/changelog)
|
|
14
|
+
- [`@semantic-release/git`](https://github.com/semantic-release/git)
|
|
15
|
+
- [`@semantic-release/github`](https://github.com/semantic-release/github)
|
|
16
|
+
- [`@semantic-release/npm`](https://github.com/semantic-release/npm)
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
$ yarn add dev @widergy/semantic-release-mobile-config
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
The shareable config can be configured in the [**semantic-release** configuration file](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration):
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"extends": "@widergy/semantic-release-mobile-config"
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Configuration
|
|
35
|
+
|
|
36
|
+
See each [plugin](#plugins) documentation for required installation and configuration steps.
|
package/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
plugins: [
|
|
3
|
+
"@semantic-release/commit-analyzer",
|
|
4
|
+
"@semantic-release/release-notes-generator",
|
|
5
|
+
["@semantic-release/changelog", { changelogFile: "./CHANGELOG.md" }],
|
|
6
|
+
["@semantic-release/npm", { npmPublish: false }],
|
|
7
|
+
"./prepare.js",
|
|
8
|
+
[
|
|
9
|
+
"@semantic-release/git",
|
|
10
|
+
{
|
|
11
|
+
assets: ["./CHANGELOG.md", "package.json", "android/app/build.gradle", "ios/Info.plist"],
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
"@semantic-release/github",
|
|
15
|
+
],
|
|
16
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@widergy/semantic-release-mobile-config",
|
|
3
|
+
"description": "semantic-release shareable config for React Native mobile apps using xcodegen",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"author": "Widergy (https://github.com/widergy)",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@semantic-release/changelog": "^3.0.6",
|
|
8
|
+
"@semantic-release/commit-analyzer": "^6.1.0",
|
|
9
|
+
"@semantic-release/git": "^7.0.18",
|
|
10
|
+
"@semantic-release/github": "^5.5.5",
|
|
11
|
+
"@semantic-release/npm": "^5.1.1",
|
|
12
|
+
"@semantic-release/release-notes-generator": "^7.1.4"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"semantic-release": "^15.10.0"
|
|
16
|
+
},
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=8.16"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"index.js",
|
|
22
|
+
"prepare.js"
|
|
23
|
+
],
|
|
24
|
+
"homepage": "https://github.com/widergy/semantic-release-mobile-config#readme",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"main": "index.js",
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"semantic-release": ">=15.10.0 <16.0.0"
|
|
29
|
+
},
|
|
30
|
+
"prettier": {
|
|
31
|
+
"printWidth": 120,
|
|
32
|
+
"trailingComma": "es5"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/widergy/semantic-release-mobile-config.git"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"semantic-release": "semantic-release"
|
|
43
|
+
}
|
|
44
|
+
}
|
package/prepare.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
async function prepare(_pluginConfig, { nextRelease: { version }, logger }) {
|
|
5
|
+
const gradlePath = path.resolve("android/app/build.gradle");
|
|
6
|
+
const gradle = fs.readFileSync(gradlePath, "utf8");
|
|
7
|
+
|
|
8
|
+
const versionNameRegex = /(versionName\s+")[^"]*(")/;
|
|
9
|
+
if (!versionNameRegex.test(gradle)) {
|
|
10
|
+
throw new Error("[semantic-release-mobile-config] versionName not found in android/app/build.gradle");
|
|
11
|
+
}
|
|
12
|
+
const versionCodeRegex = /(versionCode\s+)(\d+)/;
|
|
13
|
+
if (!versionCodeRegex.test(gradle)) {
|
|
14
|
+
throw new Error("[semantic-release-mobile-config] versionCode not found in android/app/build.gradle");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
fs.writeFileSync(
|
|
18
|
+
gradlePath,
|
|
19
|
+
gradle
|
|
20
|
+
.replace(versionNameRegex, `$1${version}$2`)
|
|
21
|
+
.replace(versionCodeRegex, (_, prefix, current) => `${prefix}${Number(current) + 1}`),
|
|
22
|
+
"utf8"
|
|
23
|
+
);
|
|
24
|
+
logger.log(`android/app/build.gradle: versionName → ${version}`);
|
|
25
|
+
logger.log(`android/app/build.gradle: versionCode → incremented`);
|
|
26
|
+
|
|
27
|
+
const plistPath = path.resolve("ios/Info.plist");
|
|
28
|
+
const plist = fs.readFileSync(plistPath, "utf8");
|
|
29
|
+
|
|
30
|
+
const shortVersionRegex = /(<key>CFBundleShortVersionString<\/key>\s*<string>)[^<]*(<\/string>)/;
|
|
31
|
+
if (!shortVersionRegex.test(plist)) {
|
|
32
|
+
throw new Error("[semantic-release-mobile-config] CFBundleShortVersionString not found in ios/Info.plist");
|
|
33
|
+
}
|
|
34
|
+
const bundleVersionRegex = /(<key>CFBundleVersion<\/key>\s*<string>)(\d+)(<\/string>)/;
|
|
35
|
+
if (!bundleVersionRegex.test(plist)) {
|
|
36
|
+
throw new Error("[semantic-release-mobile-config] CFBundleVersion not found in ios/Info.plist");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
fs.writeFileSync(
|
|
40
|
+
plistPath,
|
|
41
|
+
plist
|
|
42
|
+
.replace(shortVersionRegex, `$1${version}$2`)
|
|
43
|
+
.replace(bundleVersionRegex, (_, open, current, close) => `${open}${Number(current) + 1}${close}`),
|
|
44
|
+
"utf8"
|
|
45
|
+
);
|
|
46
|
+
logger.log(`ios/Info.plist: CFBundleShortVersionString → ${version}`);
|
|
47
|
+
logger.log(`ios/Info.plist: CFBundleVersion → incremented`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
module.exports = { prepare };
|