capacitor-standard-version 1.0.11 → 1.0.14
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/.eslintrc.js +113 -0
- package/.prettierrc +13 -0
- package/.vscode/settings.json +1 -1
- package/README.md +49 -0
- package/dist/index.js +1 -1
- package/package.json +16 -10
- package/src/bin/android.ts +29 -9
- package/src/bin/ios.ts +30 -9
- package/tsconfig.eslint.json +3 -0
- package/webpack.config.js +2 -3
- package/.eslintrc +0 -53
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
overrides: [
|
|
4
|
+
{
|
|
5
|
+
files: ['*.ts'],
|
|
6
|
+
parser: '@typescript-eslint/parser',
|
|
7
|
+
parserOptions: {
|
|
8
|
+
project: ['tsconfig.eslint.json'],
|
|
9
|
+
createDefaultProgram: true,
|
|
10
|
+
},
|
|
11
|
+
plugins: ['prettier', 'simple-import-sort'],
|
|
12
|
+
extends: [
|
|
13
|
+
'plugin:import/recommended',
|
|
14
|
+
'plugin:import/typescript',
|
|
15
|
+
'airbnb-typescript/base',
|
|
16
|
+
'prettier',
|
|
17
|
+
'plugin:prettier/recommended',
|
|
18
|
+
],
|
|
19
|
+
rules: {
|
|
20
|
+
'prettier/prettier': 'error',
|
|
21
|
+
'simple-import-sort/imports': [
|
|
22
|
+
'error',
|
|
23
|
+
{
|
|
24
|
+
groups: [
|
|
25
|
+
// Side effect imports.
|
|
26
|
+
['^\\u0000'],
|
|
27
|
+
// Parent imports. Put `..` last.
|
|
28
|
+
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
|
|
29
|
+
// Other relative imports. Put same-folder imports and `.` last.
|
|
30
|
+
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
|
|
31
|
+
// Style imports.
|
|
32
|
+
['^.+\\.s?css$'],
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
'simple-import-sort/exports': 'error',
|
|
37
|
+
'import/first': 'error',
|
|
38
|
+
'import/newline-after-import': 'error',
|
|
39
|
+
'import/no-duplicates': 'error',
|
|
40
|
+
'max-len': [
|
|
41
|
+
'error',
|
|
42
|
+
{
|
|
43
|
+
code: 100,
|
|
44
|
+
ignorePattern: '^import .*',
|
|
45
|
+
ignoreComments: true,
|
|
46
|
+
ignoreUrls: true,
|
|
47
|
+
ignoreStrings: true,
|
|
48
|
+
ignoreTemplateLiterals: true,
|
|
49
|
+
ignoreRegExpLiterals: true,
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
'@typescript-eslint/lines-between-class-members': [
|
|
53
|
+
'error',
|
|
54
|
+
'always',
|
|
55
|
+
{ exceptAfterSingleLine: true },
|
|
56
|
+
],
|
|
57
|
+
'@typescript-eslint/naming-convention': [
|
|
58
|
+
'error',
|
|
59
|
+
{
|
|
60
|
+
selector: 'interface',
|
|
61
|
+
format: ['PascalCase'],
|
|
62
|
+
custom: {
|
|
63
|
+
regex: '^I[A-Z]',
|
|
64
|
+
match: true,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
selector: 'typeAlias',
|
|
69
|
+
format: ['PascalCase'],
|
|
70
|
+
custom: {
|
|
71
|
+
regex: '^T[A-Z]',
|
|
72
|
+
match: true,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
selector: 'enum',
|
|
77
|
+
format: ['PascalCase'],
|
|
78
|
+
custom: {
|
|
79
|
+
regex: '^E[A-Z]',
|
|
80
|
+
match: true,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
reportUnusedDisableDirectives: true,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
files: ['*.interface.ts', '*.enum.ts', '*.model.ts'],
|
|
89
|
+
parser: '@typescript-eslint/parser',
|
|
90
|
+
parserOptions: {
|
|
91
|
+
extraFileExtensions: ['*.ts'],
|
|
92
|
+
project: ['tsconfig.eslint.json'],
|
|
93
|
+
createDefaultProgram: true,
|
|
94
|
+
},
|
|
95
|
+
plugins: ['prettier'],
|
|
96
|
+
extends: ['plugin:typescript-sort-keys/recommended'],
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
files: ['src/**/*.spec.ts', 'src/**/*.d.ts', 'src/**/*.mock.ts'],
|
|
100
|
+
parserOptions: {
|
|
101
|
+
project: ['tsconfig.eslint.json'],
|
|
102
|
+
createDefaultProgram: true,
|
|
103
|
+
},
|
|
104
|
+
plugins: ['prettier', 'jasmine'],
|
|
105
|
+
extends: ['plugin:jasmine/recommended'],
|
|
106
|
+
env: { jasmine: true },
|
|
107
|
+
rules: {
|
|
108
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
109
|
+
'jasmine/no-disabled-tests': 'off',
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
};
|
package/.prettierrc
ADDED
package/.vscode/settings.json
CHANGED
package/README.md
CHANGED
|
@@ -5,3 +5,52 @@ Default config for standard-version for capacitor app
|
|
|
5
5
|
use it at builtin replacement of https://www.npmjs.com/package/standard-version
|
|
6
6
|
|
|
7
7
|
All config from .versionrc, .versionrc.json or .versionrc.js are supported
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
`npm i capacitor-standard-version`
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
Run `npx capacitor-standard-version` for update main version or `npx capacitor-standard-version --prerelease alpha` for alpha release for dev branch.
|
|
18
|
+
|
|
19
|
+
Exemple of Github action to do it on every commit in `main` and `development`
|
|
20
|
+
|
|
21
|
+
```yml
|
|
22
|
+
on:
|
|
23
|
+
push:
|
|
24
|
+
branches:
|
|
25
|
+
- main
|
|
26
|
+
- development
|
|
27
|
+
|
|
28
|
+
jobs:
|
|
29
|
+
bump-version:
|
|
30
|
+
if: "!startsWith(github.event.head_commit.message, 'chore(release):')"
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
name: "Bump version and create changelog with standard version"
|
|
33
|
+
steps:
|
|
34
|
+
- name: Check out
|
|
35
|
+
uses: actions/checkout@v3
|
|
36
|
+
with:
|
|
37
|
+
fetch-depth: 0
|
|
38
|
+
token: '${{ secrets.PERSONAL_ACCESS_TOKEN }}'
|
|
39
|
+
- name: Git config
|
|
40
|
+
run: |
|
|
41
|
+
git config --local user.name "github-actions[bot]"
|
|
42
|
+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
|
43
|
+
- name: Create bump and changelog
|
|
44
|
+
if: github.ref == 'refs/heads/main'
|
|
45
|
+
run: npx capacitor-standard-version
|
|
46
|
+
- name: Create bump and changelog
|
|
47
|
+
if: github.ref != 'refs/heads/main'
|
|
48
|
+
run: npx capacitor-standard-version --prerelease alpha
|
|
49
|
+
- name: Push to origin
|
|
50
|
+
run: |
|
|
51
|
+
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
52
|
+
remote_repo="https://${GITHUB_ACTOR}:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
|
|
53
|
+
git pull $remote_repo $CURRENT_BRANCH
|
|
54
|
+
git push $remote_repo HEAD:$CURRENT_BRANCH --follow-tags --tags
|
|
55
|
+
```
|
|
56
|
+
For this action to work you have to add as env var `PERSONAL_ACCESS_TOKEN` you can create it by following this doc https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
(()=>{"use strict";var e={
|
|
2
|
+
(()=>{"use strict";var e={572:(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,n]=t.split("-"),i=e.replace(/(.*(?:versionName[ \t]+).*)/g,`\t\tversionName "${r}"`);let o=Number(r.split(".").map((e=>1===e.length?`0${e}`:e)).join(""));if(n){const e=Number(n.split(".")[1]);e<100?o=100*o+e:o+=e}return i.replace(/(.*(?:versionCode[ \t]+).*)/g,`\t\tversionCode ${o}`)}},91: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)),l=s(r(731)),c=s(r(389)),p=o(r(489)),d={noVerify:!0,tagPrefix:"",packageFiles:[{filename:"./package.json",type:"json"}],bumpFiles:[{filename:"./android/app/build.gradle",updater:o(r(572))},{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)(l.default.argv,d);yield(0,u.default)(e)}catch(e){throw console.error(e),e}}))}()},489:(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,n]=t.split("-"),i=e.replace(/(.*(?:MARKETING_VERSION[ \t]+).*)/g,`\t\t\t\tMARKETING_VERSION = "${r}";`);let o=Number(r.split(".").map((e=>1===e.length?`0${e}`:e)).join(""));if(n){const e=Number(n.split(".")[1]);e<100?o=100*o+e:o+=e}return i.replace(/(.*(?:CURRENT_PROJECT_VERSION[ \t]+).*)/g,`\t\t\t\tCURRENT_PROJECT_VERSION = "${o}";`)}},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}(91)})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "capacitor-standard-version",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"description": "Default standard-version config for capacitor app",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -36,20 +36,26 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/adm-zip": "^0.4.34",
|
|
38
38
|
"@types/fs-extra": "^9.0.13",
|
|
39
|
-
"@
|
|
40
|
-
"@typescript-eslint/
|
|
41
|
-
"
|
|
42
|
-
"eslint": "^8.
|
|
43
|
-
"eslint-config-airbnb-
|
|
39
|
+
"@types/node": "^18.7.15",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^5.36.1",
|
|
41
|
+
"@typescript-eslint/parser": "^5.36.1",
|
|
42
|
+
"eslint": "^8.23.0",
|
|
43
|
+
"eslint-config-airbnb-typescript": "^17.0.0",
|
|
44
44
|
"eslint-config-prettier": "^8.5.0",
|
|
45
|
-
"eslint-import
|
|
46
|
-
"eslint-plugin-
|
|
47
|
-
"eslint-plugin-prettier": "^4.
|
|
45
|
+
"eslint-plugin-import": "^2.26.0",
|
|
46
|
+
"eslint-plugin-jasmine": "^4.1.3",
|
|
47
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
48
|
+
"eslint-plugin-simple-import-sort": "^7.0.0",
|
|
49
|
+
"eslint-plugin-typescript-sort-keys": "^2.1.0",
|
|
48
50
|
"git-format-staged": "^2.1.3",
|
|
49
51
|
"husky": "^7.0.4",
|
|
50
52
|
"nodemon": "^2.0.15",
|
|
51
53
|
"pkg": "^5.5.2",
|
|
52
|
-
"prettier": "^2.
|
|
54
|
+
"prettier": "^2.7.1",
|
|
55
|
+
"prettier-eslint": "^15.0.1",
|
|
56
|
+
"prettier-eslint-cli": "^7.1.0",
|
|
57
|
+
"prettier-plugin-organize-attributes": "^0.0.5",
|
|
58
|
+
"ts-loader": "^9.3.1",
|
|
53
59
|
"ts-node": "^10.7.0",
|
|
54
60
|
"tsconfig-paths": "^3.14.0",
|
|
55
61
|
"typescript": "^4.6.2",
|
package/src/bin/android.ts
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
1
|
-
export const readVersion =
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
1
|
+
export const readVersion = contents => {
|
|
2
|
+
const version = contents.split('versionName "')[1].split('"')[0];
|
|
3
|
+
return version;
|
|
4
|
+
};
|
|
5
5
|
|
|
6
6
|
export const writeVersion = (contents, version) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
const [versionPure, versionBata] = version.split('-');
|
|
8
|
+
const newContent = contents.replace(
|
|
9
|
+
/(.*(?:versionName[ \t]+).*)/g,
|
|
10
|
+
`\t\tversionName "${versionPure}"`
|
|
11
|
+
);
|
|
12
|
+
let versionCode = Number(
|
|
13
|
+
versionPure
|
|
14
|
+
.split('.')
|
|
15
|
+
.map(v => (v.length === 1 ? `0${v}` : v))
|
|
16
|
+
.join('')
|
|
17
|
+
);
|
|
18
|
+
if (versionBata) {
|
|
19
|
+
const versionCodeBeta = Number(versionBata.split('.')[1]);
|
|
20
|
+
if (versionCodeBeta < 100) {
|
|
21
|
+
versionCode = versionCode * 100 + versionCodeBeta;
|
|
22
|
+
} else {
|
|
23
|
+
versionCode += versionCodeBeta;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const finalContent = newContent.replace(
|
|
27
|
+
/(.*(?:versionCode[ \t]+).*)/g,
|
|
28
|
+
`\t\tversionCode ${versionCode}`
|
|
29
|
+
);
|
|
30
|
+
return finalContent;
|
|
31
|
+
};
|
package/src/bin/ios.ts
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
|
-
export const readVersion =
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
1
|
+
export const readVersion = 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
6
|
|
|
7
7
|
export const writeVersion = (contents, version) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
8
|
+
const [versionPure, versionBata] = version.split('-');
|
|
9
|
+
const newContent = contents.replace(
|
|
10
|
+
/(.*(?:MARKETING_VERSION[ \t]+).*)/g,
|
|
11
|
+
`\t\t\t\tMARKETING_VERSION = "${versionPure}";`
|
|
12
|
+
);
|
|
13
|
+
let versionCode = Number(
|
|
14
|
+
versionPure
|
|
15
|
+
.split('.')
|
|
16
|
+
.map(v => (v.length === 1 ? `0${v}` : v))
|
|
17
|
+
.join('')
|
|
18
|
+
);
|
|
19
|
+
if (versionBata) {
|
|
20
|
+
const versionCodeBeta = Number(versionBata.split('.')[1]);
|
|
21
|
+
if (versionCodeBeta < 100) {
|
|
22
|
+
versionCode = versionCode * 100 + versionCodeBeta;
|
|
23
|
+
} else {
|
|
24
|
+
versionCode += versionCodeBeta;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const finalContent = newContent.replace(
|
|
28
|
+
/(.*(?:CURRENT_PROJECT_VERSION[ \t]+).*)/g,
|
|
29
|
+
`\t\t\t\tCURRENT_PROJECT_VERSION = "${versionCode}";`
|
|
30
|
+
);
|
|
31
|
+
return finalContent;
|
|
32
|
+
};
|
package/webpack.config.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const webpack = require('webpack');
|
|
3
3
|
const nodeExternals = require('webpack-node-externals');
|
|
4
|
-
const { CheckerPlugin } = require('awesome-typescript-loader');
|
|
5
4
|
console.log(process.env.NODE_ENV || 'production');
|
|
6
5
|
module.exports = {
|
|
7
6
|
mode: process.env.NODE_ENV || 'production',
|
|
@@ -12,14 +11,14 @@ module.exports = {
|
|
|
12
11
|
rules: [
|
|
13
12
|
{
|
|
14
13
|
test: /\.ts$/,
|
|
15
|
-
use: '
|
|
14
|
+
use: 'ts-loader',
|
|
16
15
|
exclude: /node_modules/,
|
|
17
16
|
},
|
|
18
17
|
],
|
|
19
18
|
},
|
|
20
19
|
devtool: process.env.NODE_ENV === 'development' ? 'eval-source-map' : undefined,
|
|
21
20
|
watch: process.env.NODE_ENV === 'development',
|
|
22
|
-
plugins: [new
|
|
21
|
+
plugins: [new webpack.BannerPlugin({ banner: '#!/usr/bin/env node', raw: true })],
|
|
23
22
|
resolve: {
|
|
24
23
|
extensions: ['.ts', '.js'],
|
|
25
24
|
},
|
package/.eslintrc
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["airbnb-base", "plugin:@typescript-eslint/recommended", "eslint-config-prettier"],
|
|
3
|
-
"parser": "@typescript-eslint/parser",
|
|
4
|
-
"plugins": ["@typescript-eslint", "prettier"],
|
|
5
|
-
"settings": {
|
|
6
|
-
"import/parsers": {
|
|
7
|
-
"@typescript-eslint/parser": [".ts", ".tsx"]
|
|
8
|
-
},
|
|
9
|
-
"import/resolver": {
|
|
10
|
-
"typescript": {}
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
"rules": {
|
|
14
|
-
"import/prefer-default-export": 0,
|
|
15
|
-
"no-param-reassign": 0,
|
|
16
|
-
"import/no-extraneous-dependencies": [
|
|
17
|
-
2,
|
|
18
|
-
{
|
|
19
|
-
"devDependencies": ["**/spec.tsx", "**/spec.ts", "__tests__/**/*"]
|
|
20
|
-
}
|
|
21
|
-
],
|
|
22
|
-
"import/extensions": 0,
|
|
23
|
-
"indent": "off",
|
|
24
|
-
"@typescript-eslint/indent": ["error", 2],
|
|
25
|
-
"eofline": 0,
|
|
26
|
-
"arrow-parens": 0,
|
|
27
|
-
"ordered-imports": 0,
|
|
28
|
-
"object-literal-sort-keys": 0,
|
|
29
|
-
"no-empty": 2,
|
|
30
|
-
"no-unused-expression": 0,
|
|
31
|
-
"linebreak-style": 0,
|
|
32
|
-
"@typescript-eslint/explicit-function-return-type": 0,
|
|
33
|
-
"max-len": [
|
|
34
|
-
"error",
|
|
35
|
-
{
|
|
36
|
-
"code": 140
|
|
37
|
-
}
|
|
38
|
-
],
|
|
39
|
-
"@typescript-eslint/no-use-before-define": 0,
|
|
40
|
-
"@typescript-eslint/no-empty-function": 0,
|
|
41
|
-
"no-unused-expressions": 0,
|
|
42
|
-
"operator-linebreak": 0,
|
|
43
|
-
"implicit-arrow-linebreak": 0,
|
|
44
|
-
"no-implicit-dependencies": 0,
|
|
45
|
-
"no-use-before-define": 0,
|
|
46
|
-
"class-methods-use-this": 0,
|
|
47
|
-
"no-restricted-syntax": 0,
|
|
48
|
-
"no-await-in-loop": 0,
|
|
49
|
-
"no-continue": 0,
|
|
50
|
-
"no-underscore-dangle": 0,
|
|
51
|
-
"no-console": 0
|
|
52
|
-
}
|
|
53
|
-
}
|