@getik-public/cli 1.5.3 → 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 +8 -0
- package/README.md +2 -1
- package/package.json +1 -1
- package/src/upload-to-getik-cloud.js +13 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
### v1.5.5
|
|
2
|
+
- Added option `--useCommitHash` to make upload `commit` parameter optional
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### v1.5.4
|
|
6
|
+
- Remove option to add entire folder(`--folder`), read file extension to be sent in request as `&type=extension`, make script more dynamic
|
|
7
|
+
|
|
8
|
+
|
|
1
9
|
### v1.5.3
|
|
2
10
|
- Added option to upload a folder to cloud, script will zip entire folder then upload it
|
|
3
11
|
- Remove actual host and added it as a required input parameter as path to upload
|
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`
|
|
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
|
@@ -4,11 +4,10 @@ import chalk from 'chalk';
|
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
|
|
7
|
-
import { runCliCommand } from './lib.js';
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
const upload = (pathToFile, host, extraUploadParams) => {
|
|
8
|
+
const upload = (pathToFile, options) => {
|
|
11
9
|
let projectName = '';
|
|
10
|
+
const host = options.host;
|
|
12
11
|
try {
|
|
13
12
|
const packageJsonBuffer = fs.readFileSync(path.join(process.cwd(), 'package.json'));
|
|
14
13
|
const packageJson = JSON.parse(packageJsonBuffer);
|
|
@@ -21,7 +20,6 @@ const upload = (pathToFile, host, extraUploadParams) => {
|
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
const normalizedPathToFile = path.join(process.cwd(), pathToFile);
|
|
24
|
-
const commit = execSync('git rev-parse HEAD').toString().trim();
|
|
25
23
|
let branch, splitBranchByFolder, splitBranchByName, issue;
|
|
26
24
|
try {
|
|
27
25
|
branch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
|
|
@@ -37,8 +35,15 @@ const upload = (pathToFile, host, extraUploadParams) => {
|
|
|
37
35
|
}
|
|
38
36
|
const splitFileName = normalizedPathToFile.split(path.sep);
|
|
39
37
|
const fileNameWithExtension = splitFileName[splitFileName.length - 1];
|
|
40
|
-
const
|
|
41
|
-
const
|
|
38
|
+
const fileNameSplit = fileNameWithExtension.split('.');
|
|
39
|
+
const fileNameOnly = fileNameSplit[0];
|
|
40
|
+
const fileExtension = fileNameSplit[fileNameSplit.length - 1];
|
|
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,20 +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')
|
|
77
|
-
.option('--
|
|
82
|
+
.option('--useCommitHash', 'Read last commit hash and add it upload command')
|
|
78
83
|
.action((pathToBuild, options) => {
|
|
79
84
|
console.log('INPUT OPTIONS: ', pathToBuild, options);
|
|
80
|
-
|
|
81
|
-
const finalZipName = 'grouped.zip';
|
|
82
|
-
const pathToZip = path.join(pathToBuild, finalZipName);
|
|
83
|
-
if (fs.existsSync(pathToZip)) {
|
|
84
|
-
fs.rmSync(pathToZip);
|
|
85
|
-
}
|
|
86
|
-
runCliCommand(`zip -q -r ./${finalZipName} .`, function() {
|
|
87
|
-
upload(`${pathToBuild}/${finalZipName}`, options.host, '&type=zip');
|
|
88
|
-
}, pathToBuild);
|
|
89
|
-
} else {
|
|
90
|
-
upload(pathToBuild, options.host);
|
|
91
|
-
}
|
|
85
|
+
upload(pathToBuild, options);
|
|
92
86
|
});
|
|
93
87
|
};
|