Skip to content

Commit 31f9011

Browse files
authored
[beta] Feat/shaharsh/support customize path for import and export manifest (#134)
* Revert "[beta] Add new validate task to export manifest command (#119)" This reverts commit 2f7b151. * [beta] add allow missing variables * [beta] add allow missing variables * Support specific path for exporting manifest * bump version * fix merge issues
1 parent 7a0fa34 commit 31f9011

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mondaycom/apps-cli",
3-
"version": "4.4.0-beta.9",
3+
"version": "4.4.0-beta.10",
44
"description": "A cli tool to manage apps (and monday-code projects) in monday.com",
55
"author": "monday.com Apps Team",
66
"type": "module",

src/commands/manifest/export.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,23 @@ import logger from 'utils/logger';
1010
const MESSAGES = {
1111
appId: 'App id (will export the live version)',
1212
appVersionId: 'App version id',
13+
path: 'Path to export your app manifest files to',
1314
};
1415

1516
export default class ManifestExport extends AuthenticatedCommand {
1617
static description = 'export app manifest.';
1718
static withPrintCommand = false;
18-
static examples = ['<%= config.bin %> <%= command.id %>'];
19+
static examples = [
20+
'<%= config.bin %> <%= command.id %>',
21+
'<%= config.bin %> <%= command.id %> -p ./exports',
22+
'<%= config.bin %> <%= command.id %> --manifestPath ./my-manifests',
23+
];
24+
1925
static flags = ManifestExport.serializeFlags({
26+
manifestPath: Flags.string({
27+
char: 'p',
28+
description: MESSAGES.path,
29+
}),
2030
appId: Flags.string({
2131
char: 'a',
2232
description: MESSAGES.appId,
@@ -44,7 +54,7 @@ export default class ManifestExport extends AuthenticatedCommand {
4454
public async run(): Promise<void> {
4555
try {
4656
const { flags } = await this.parse(ManifestExport);
47-
const { appId: appIdAsString, appVersionId: appVersionIdAsString } = flags;
57+
const { manifestPath, appId: appIdAsString, appVersionId: appVersionIdAsString } = flags;
4858

4959
let appId = appIdAsString ? Number(appIdAsString) : undefined;
5060
let appVersionId = appVersionIdAsString ? Number(appVersionIdAsString) : undefined;
@@ -66,7 +76,7 @@ export default class ManifestExport extends AuthenticatedCommand {
6676
{ title: 'Validate app before exporting manifest', task: exportService.validateManifestTask },
6777
{ title: 'Export app manifest', task: exportService.downloadManifestTask },
6878
],
69-
{ ctx: { appVersionId, appId: appId! } },
79+
{ ctx: { appVersionId, appId: appId!, manifestPath } },
7080
);
7181

7282
await tasks.run();

src/services/export-manifest-service.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ export const downloadManifestTask = async (
1515
) => {
1616
task.output = `downloading manifest for app ${ctx.appId}`;
1717
const appManifest = await downloadManifest(ctx.appId, ctx.appVersionId);
18-
await decompressZipBufferToFiles(Buffer.from(appManifest, 'base64'), `${ctx.appId}`);
18+
const outputPath = ctx.manifestPath || `${ctx.appId}`;
19+
await decompressZipBufferToFiles(Buffer.from(appManifest, 'base64'), outputPath);
20+
1921
const currentWorkingDirectory = process.cwd();
20-
task.title = `your manifest files are downloaded at ${currentWorkingDirectory}/${ctx.appId}`;
22+
const absolutePath = outputPath.startsWith('/') ? outputPath : `${currentWorkingDirectory}/${outputPath}`;
23+
task.title = `your manifest files are downloaded at ${absolutePath}`;
2124
};
2225

2326
export const downloadManifest = async (appId: AppId, appVersionId?: AppVersionId) => {

src/types/commands/manifest-export.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ import type { AppId, AppVersionId } from 'types/general';
33
export type ExportCommandTasksContext = {
44
appId: AppId;
55
appVersionId?: AppVersionId;
6+
manifestPath?: string;
67
};

0 commit comments

Comments
 (0)