Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions templates/cli/lib/commands/command.js.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs');
const tar = require("tar");
const { promisify } = require('util');
const libClient = require('../client.js');
const childProcess = require('child_process');
const { Command } = require('commander');
const { sdkForProject, sdkForConsole } = require('../sdks')
const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
Expand Down Expand Up @@ -36,7 +36,14 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {
let folderPath = fs.realpathSync({{ parameter.name | caseCamel | escapeKeyword }});
if (!fs.lstatSync(folderPath).isDirectory())
throw new Error('The path is not a directory.');
childProcess.execSync(`tar --cd '${folderPath}' -zcvf code.tar.gz .`, { stdio: 'pipe' });

await tar
.create({
gzip: true,
sync: true,
cwd: folderPath,
file: 'code.tar.gz'
}, ['./'])
let archivePath = fs.realpathSync('code.tar.gz')
if (typeof archivePath !== 'undefined') {
payload['{{ parameter.name }}'] = archivePath;
Expand Down
3 changes: 2 additions & 1 deletion templates/cli/package.json.twig
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"cli-table3": "^0.6.1",
"commander": "^8.3.0",
"form-data": "^4.0.0",
"inquirer": "^8.2.0"
"inquirer": "^8.2.0",
"tar": "^6.1.11"
},
"devDependencies": {
"pkg": "5.5.1"
Expand Down