@getik-public/cli 1.5.4 → 1.5.5
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/CHANGELOG.md +4 -0
- package/README.md +2 -1
- package/package.json +1 -1
- package/src/upload-to-getik-cloud.js +10 -4
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -46,8 +46,9 @@ Example: `getik-cli web-build -e getik`
|
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
## <a name="upload-to-getik-cloud" href="#upload-to-getik-cloud">`upload-to-getik-cloud`</a>
|
|
49
|
-
### Usage: `getik-cli upload-to-getik-cloud ./path/to/my-file.apk --host awesome.host.net`
|
|
49
|
+
### Usage: `getik-cli upload-to-getik-cloud ./path/to/my-file.apk --host awesome.host.net --useCommitHash`
|
|
50
50
|
Use this command to upload apk files to getik cloud. If successful, in command line you will find a direct link to fresh uploaded file alongside a link to the full list.
|
|
51
51
|
Run this command from the root of the project, as it tries to look for project name in `package.json` file. Project name will be used as file name.
|
|
52
|
+
Use `--useCommitHash` option if git hash needs to be added to the file name. This parameter is optional.
|
|
52
53
|
|
|
53
54
|
|
package/package.json
CHANGED
|
@@ -5,8 +5,9 @@ import fs from 'fs';
|
|
|
5
5
|
import path from 'path';
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
const upload = (pathToFile,
|
|
8
|
+
const upload = (pathToFile, options) => {
|
|
9
9
|
let projectName = '';
|
|
10
|
+
const host = options.host;
|
|
10
11
|
try {
|
|
11
12
|
const packageJsonBuffer = fs.readFileSync(path.join(process.cwd(), 'package.json'));
|
|
12
13
|
const packageJson = JSON.parse(packageJsonBuffer);
|
|
@@ -19,7 +20,6 @@ const upload = (pathToFile, host) => {
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
const normalizedPathToFile = path.join(process.cwd(), pathToFile);
|
|
22
|
-
const commit = execSync('git rev-parse HEAD').toString().trim();
|
|
23
23
|
let branch, splitBranchByFolder, splitBranchByName, issue;
|
|
24
24
|
try {
|
|
25
25
|
branch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
|
|
@@ -38,7 +38,12 @@ const upload = (pathToFile, host) => {
|
|
|
38
38
|
const fileNameSplit = fileNameWithExtension.split('.');
|
|
39
39
|
const fileNameOnly = fileNameSplit[0];
|
|
40
40
|
const fileExtension = fileNameSplit[fileNameSplit.length - 1];
|
|
41
|
-
|
|
41
|
+
let command = `curl -Ss -F "file=@${normalizedPathToFile}" "https://${host}/upload-apk/?name=${projectName}-${fileNameOnly}&appVersion=${issue}&type=${fileExtension}`;
|
|
42
|
+
if (options.useCommitHash) {
|
|
43
|
+
const commit = execSync('git rev-parse HEAD').toString().trim();
|
|
44
|
+
command += `&commit=${commit}`;
|
|
45
|
+
}
|
|
46
|
+
command += '"';
|
|
42
47
|
|
|
43
48
|
console.log('COMMAND: ', '\x1b[96m', command, '\x1b[0m');
|
|
44
49
|
const ls = spawn(command, [], {shell: true, env: { ...process.env, FORCE_COLOR: true }, cwd: ''});
|
|
@@ -74,8 +79,9 @@ export const uploadToGetikCloud = () => {
|
|
|
74
79
|
program
|
|
75
80
|
.command('upload-to-getik-cloud <source>')
|
|
76
81
|
.requiredOption('--host <type>', 'Provide host, ex: my.host.net')
|
|
82
|
+
.option('--useCommitHash', 'Read last commit hash and add it upload command')
|
|
77
83
|
.action((pathToBuild, options) => {
|
|
78
84
|
console.log('INPUT OPTIONS: ', pathToBuild, options);
|
|
79
|
-
upload(pathToBuild, options
|
|
85
|
+
upload(pathToBuild, options);
|
|
80
86
|
});
|
|
81
87
|
};
|