capacitor-standard-version 1.0.1 → 1.0.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.
@@ -0,0 +1,11 @@
1
+ export const readVersion = (contents) => {
2
+ const version = contents.split('versionName "')[1].split('"')[0]
3
+ return version
4
+ }
5
+
6
+ export const writeVersion = (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
+ }
@@ -0,0 +1,49 @@
1
+ import standardVersion from 'standard-version';
2
+ import command from 'standard-version/command';
3
+ import merge from 'merge-deep';
4
+ import * as ios from './ios';
5
+ import * as android from './android';
6
+
7
+ const baseConfig = {
8
+ noVerify: true,
9
+ tagPrefix: '',
10
+ releaseCommitMessageFormat: "chore(release): {{currentTag}} [skip ci]",
11
+ packageFiles: [
12
+ {
13
+ filename: "./package.json",
14
+ type: "json"
15
+ },
16
+ ],
17
+ bumpFiles: [
18
+ {
19
+ filename: "./android/app/build.gradle",
20
+ updater: android
21
+ },
22
+ {
23
+ filename: "./package.json",
24
+ type: "json"
25
+ },
26
+ {
27
+ filename: "./package-lock.json",
28
+ type: "json"
29
+ },
30
+ {
31
+ filename: "./ios/App/App.xcodeproj/project.pbxproj",
32
+ updater: ios
33
+ }
34
+ ]
35
+ }
36
+
37
+ async function run() {
38
+ try {
39
+ console.log('command', command)
40
+ // merge base config with user config
41
+ const finalConfig = merge(baseConfig, command.argv);
42
+ await standardVersion(finalConfig);
43
+ } catch (error) {
44
+ console.error(error);
45
+ throw error;
46
+ }
47
+ }
48
+
49
+ run();
package/src/bin/ios.ts ADDED
@@ -0,0 +1,11 @@
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
+
7
+ export const writeVersion = (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/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "esModuleInterop": true,
5
+ "target": "es6",
6
+ "moduleResolution": "node",
7
+ "sourceMap": true,
8
+ "outDir": "dist",
9
+ "baseUrl": "src",
10
+ "lib": ["es2016", "dom"]
11
+ },
12
+ "include": ["src/**/*"],
13
+ "exclude": ["node_modules", "__tests__", "**/*.spec.ts"]
14
+ }
@@ -0,0 +1,30 @@
1
+ const path = require('path');
2
+ const webpack = require('webpack');
3
+ const nodeExternals = require('webpack-node-externals');
4
+ const { CheckerPlugin } = require('awesome-typescript-loader');
5
+ console.log(process.env.NODE_ENV || 'production');
6
+ module.exports = {
7
+ mode: process.env.NODE_ENV || 'production',
8
+ target: 'node',
9
+ externals: [nodeExternals()],
10
+ entry: './src/bin/index.ts',
11
+ module: {
12
+ rules: [
13
+ {
14
+ test: /\.ts$/,
15
+ use: 'awesome-typescript-loader',
16
+ exclude: /node_modules/,
17
+ },
18
+ ],
19
+ },
20
+ devtool: process.env.NODE_ENV === 'development' ? 'eval-source-map' : undefined,
21
+ watch: process.env.NODE_ENV === 'development',
22
+ plugins: [new CheckerPlugin(), new webpack.BannerPlugin({ banner: '#!/usr/bin/env node', raw: true })],
23
+ resolve: {
24
+ extensions: ['.ts', '.js'],
25
+ },
26
+ output: {
27
+ filename: 'index.js',
28
+ path: path.resolve(__dirname, 'dist'),
29
+ },
30
+ };
@@ -1,11 +0,0 @@
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 DELETED
@@ -1,47 +0,0 @@
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();
@@ -1,11 +0,0 @@
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
- }