@getik-public/cli 1.5.2 → 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 CHANGED
@@ -1,3 +1,8 @@
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
+
1
6
  ### v1.5.2
2
7
  - Added new parameters to include different types of build for the same environment: `--includeDemo` and `--includeFallback`
3
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getik-public/cli",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -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
- const upload = (pathToFile) => {
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://devs.getik.net/upload-apk/?name=${projectName}-${fileNameOnly}&appVersion=${issue}&commit=${commit}"`;
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://devs.getik.net/vbox/apk/${parsedResponse.fileName}`));
50
- console.log(chalk.green('Link to list: https://devs.getik.net/vbox/apk/?C=M;O=D'));
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
- .action((options) => {
75
- console.log('INPUT OPTIONS: ', options);
76
- upload(options);
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
@@ -38,7 +38,6 @@ function cleanBuildFolder(folder) {
38
38
 
39
39
 
40
40
  function buildApp(environmentName, versions, callback, extraConfig) {
41
- console.log(extraConfig);
42
41
  if (extraConfig?.falltrough) {
43
42
  callback();
44
43