@getik-public/cli 1.5.1 → 1.5.3
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 +9 -0
- package/README.md +6 -4
- package/package.json +1 -1
- package/src/upload-to-getik-cloud.js +22 -7
- package/src/web-build.js +18 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
### v1.5.3
|
|
2
|
+
- Added option to upload a folder to cloud, script will zip entire folder then upload it
|
|
3
|
+
- Remove actual host and added it as a required input parameter as path to upload
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### v1.5.2
|
|
7
|
+
- Added new parameters to include different types of build for the same environment: `--includeDemo` and `--includeFallback`
|
|
8
|
+
|
|
9
|
+
|
|
1
10
|
### v1.5.1
|
|
2
11
|
- Fixed typo: changed `sync` to `syncOnly`
|
|
3
12
|
|
package/README.md
CHANGED
|
@@ -37,10 +37,12 @@ Example: `getik-cli mobile-build --platform ios --environment getik --upload`
|
|
|
37
37
|
Example: `getik-cli web-build -e getik --syncOnly`
|
|
38
38
|
Example: `getik-cli web-build -e getik`
|
|
39
39
|
|
|
40
|
-
| Option
|
|
41
|
-
|
|
42
|
-
| `-e`, `--environment` | YES | `<string>` | While environment can be any name, be consistent and use these: `getik`, `vbox`, `qa`, `preprod`, `prod`.
|
|
43
|
-
| `--syncOnly`
|
|
40
|
+
| Option | Required | Values | Description |
|
|
41
|
+
|-----------------------|----------|-----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
42
|
+
| `-e`, `--environment` | YES | `<string>` | While environment can be any name, be consistent and use these: `getik`, `vbox`, `qa`, `preprod`, `prod`. |
|
|
43
|
+
| `--syncOnly` | NO | `-` | For development only, it will create a file named `version.ts` with version found in `package.json`. Use this version in all `environment.ts` files. This will not go further to trigger the actual build script. |
|
|
44
|
+
| `--includeDemo` | NO | `-` | Use this flag to also include the demo build variant for the selected environment. |
|
|
45
|
+
| `--includeFallback` | NO | `-` | Use this flag to also include the fallback build variant for the selected environment. |
|
|
44
46
|
|
|
45
47
|
|
|
46
48
|
## <a name="upload-to-getik-cloud" href="#upload-to-getik-cloud">`upload-to-getik-cloud`</a>
|
package/package.json
CHANGED
|
@@ -4,8 +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';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
const upload = (pathToFile, host, extraUploadParams) => {
|
|
9
11
|
let projectName = '';
|
|
10
12
|
try {
|
|
11
13
|
const packageJsonBuffer = fs.readFileSync(path.join(process.cwd(), 'package.json'));
|
|
@@ -36,7 +38,7 @@ const upload = (pathToFile) => {
|
|
|
36
38
|
const splitFileName = normalizedPathToFile.split(path.sep);
|
|
37
39
|
const fileNameWithExtension = splitFileName[splitFileName.length - 1];
|
|
38
40
|
const fileNameOnly = fileNameWithExtension.split('.')[0];
|
|
39
|
-
const command = `curl -Ss -F "file=@${normalizedPathToFile}" "https
|
|
41
|
+
const command = `curl -Ss -F "file=@${normalizedPathToFile}" "https://${host}/upload-apk/?name=${projectName}-${fileNameOnly}&appVersion=${issue}&commit=${commit}${extraUploadParams ? extraUploadParams : ''}"`;
|
|
40
42
|
|
|
41
43
|
console.log('COMMAND: ', '\x1b[96m', command, '\x1b[0m');
|
|
42
44
|
const ls = spawn(command, [], {shell: true, env: { ...process.env, FORCE_COLOR: true }, cwd: ''});
|
|
@@ -46,8 +48,8 @@ const upload = (pathToFile) => {
|
|
|
46
48
|
try {
|
|
47
49
|
const parsedResponse = JSON.parse(data.toString());
|
|
48
50
|
if (parsedResponse && parsedResponse.status === 'success' && parsedResponse.fileName) {
|
|
49
|
-
console.log(chalk.green(`Link to uploaded file: https
|
|
50
|
-
console.log(chalk.green(
|
|
51
|
+
console.log(chalk.green(`Link to uploaded file: https://${host}/vbox/apk/${parsedResponse.fileName}`));
|
|
52
|
+
console.log(chalk.green(`Link to list: https://${host}/vbox/apk/?C=M;O=D`));
|
|
51
53
|
}
|
|
52
54
|
} catch (e) {
|
|
53
55
|
// console.log(e);
|
|
@@ -71,8 +73,21 @@ const upload = (pathToFile) => {
|
|
|
71
73
|
export const uploadToGetikCloud = () => {
|
|
72
74
|
program
|
|
73
75
|
.command('upload-to-getik-cloud <source>')
|
|
74
|
-
.
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
.requiredOption('--host <type>', 'Provide host, ex: my.host.net')
|
|
77
|
+
.option('--folder', 'Destination is a folder, so will zip and upload entire folder')
|
|
78
|
+
.action((pathToBuild, options) => {
|
|
79
|
+
console.log('INPUT OPTIONS: ', pathToBuild, options);
|
|
80
|
+
if (options.folder) {
|
|
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
|
+
}
|
|
77
92
|
});
|
|
78
93
|
};
|
package/src/web-build.js
CHANGED
|
@@ -20,7 +20,7 @@ function applyVersion(versions) {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
fs.writeFileSync(pathToVersionsProperties, (
|
|
23
|
-
`export const version = {
|
|
23
|
+
`export const version = {
|
|
24
24
|
name: '${versions.versionName}',
|
|
25
25
|
code: ${versions.versionCode},
|
|
26
26
|
};
|
|
@@ -37,10 +37,15 @@ function cleanBuildFolder(folder) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
function buildApp(environmentName, callback) {
|
|
40
|
+
function buildApp(environmentName, versions, callback, extraConfig) {
|
|
41
|
+
if (extraConfig?.falltrough) {
|
|
42
|
+
callback();
|
|
43
|
+
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
41
46
|
cleanBuildFolder('dist');
|
|
42
47
|
runCliCommand(`ng build --configuration=${environmentName}`, function() {
|
|
43
|
-
runCliCommand(`zip -q -r ../../${buildFolder}/${environmentName}.zip .`, function() {
|
|
48
|
+
runCliCommand(`zip -q -r ../../${buildFolder}/${environmentName}-${versions.versionName}.zip .`, function() {
|
|
44
49
|
callback();
|
|
45
50
|
}, './dist/browser');
|
|
46
51
|
});
|
|
@@ -52,6 +57,8 @@ export const webBuild = () => {
|
|
|
52
57
|
.command('web-build')
|
|
53
58
|
.option('-e, --environment <type>', 'Environment: getik, vbox, qa, preprod, prod')
|
|
54
59
|
.option('--syncOnly', 'Generates the version.ts file only so no errors when running app locally')
|
|
60
|
+
.option('--includeDemo', 'Also builds and zips the Demo variant for the selected environment')
|
|
61
|
+
.option('--includeFallback', 'Also builds and zips the Fallback variant for the selected environment')
|
|
55
62
|
.option('--force', 'Skip all checks for builds of type release')
|
|
56
63
|
.action((options) => {
|
|
57
64
|
console.log('INPUT OPTIONS: ', options);
|
|
@@ -62,11 +69,14 @@ export const webBuild = () => {
|
|
|
62
69
|
return;
|
|
63
70
|
}
|
|
64
71
|
applyReleaseBuildChecks(versions, options, () => {
|
|
65
|
-
buildApp(options.environment, () => {
|
|
66
|
-
const
|
|
67
|
-
buildApp(
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
buildApp(options.environment, versions, () => {
|
|
73
|
+
const fallbackEnvName = `${options.environment}Fallback`;
|
|
74
|
+
buildApp(fallbackEnvName, versions, () => {
|
|
75
|
+
const demoEnvName = `${options.environment}Demo`;
|
|
76
|
+
buildApp(demoEnvName, versions, () => {
|
|
77
|
+
console.log('\x1b[32m SUCCESS! \x1b[0m');
|
|
78
|
+
}, {falltrough: !options.includeDemo});
|
|
79
|
+
}, {falltrough: !options.includeFallback});
|
|
70
80
|
});
|
|
71
81
|
});
|
|
72
82
|
});
|