Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
116 changes: 92 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
monday-apps-cli
=================
# monday-apps-cli

monday.com cli tool for monday apps management.

<!-- toc -->
* [Usage](#usage)
* [Commands](#commands)

- [Usage](#usage)
- [Commands](#commands)
<!-- tocstop -->

# Usage

<!-- usage -->

```sh-session
$ npm install -g @mondaycom/apps-cli
$ mapps COMMAND
Expand All @@ -22,39 +23,53 @@ USAGE
$ mapps COMMAND
...
```

<!-- usagestop -->

# Commands

<!-- commands -->
* [`mapps api:generate`](#mapps-apigenerate)
* [`mapps app-features:build`](#mapps-app-featuresbuild)
* [`mapps app-features:create`](#mapps-app-featurescreate)
* [`mapps app-features:list`](#mapps-app-featureslist)
* [`mapps app-version:builds`](#mapps-app-versionbuilds)
* [`mapps app-version:list`](#mapps-app-versionlist)
* [`mapps app:create`](#mapps-appcreate)
* [`mapps app:deploy`](#mapps-appdeploy)
* [`mapps app:list`](#mapps-applist)

- [`mapps api:generate`](#mapps-apigenerate)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go through all and check for duplications

- [`mapps app-features:build`](#mapps-app-featuresbuild)
- [`mapps app-features:create`](#mapps-app-featurescreate)
- [`mapps app-features:list`](#mapps-app-featureslist)
- [`mapps app-version:builds`](#mapps-app-versionbuilds)
- [`mapps app-version:list`](#mapps-app-versionlist)
- [`mapps app:create`](#mapps-appcreate)
- [`mapps app:deploy`](#mapps-appdeploy)
- [`mapps app:list`](#mapps-applist)

* [`mapps app:promote`](#mapps-apppromote)
* [`mapps autocomplete [SHELL]`](#mapps-autocomplete-shell)
* [`mapps code:env`](#mapps-codeenv)
* [`mapps code:logs`](#mapps-codelogs)
* [`mapps code:push`](#mapps-codepush)

- [`mapps autocomplete [SHELL]`](#mapps-autocomplete-shell)
- [`mapps code:env`](#mapps-codeenv)
- [`mapps code:logs`](#mapps-codelogs)
- [`mapps code:push`](#mapps-codepush)

* [`mapps code:secret`](#mapps-codesecret)
* [`mapps code:status`](#mapps-codestatus)

- [`mapps code:status`](#mapps-codestatus)

* [`mapps database:connection-string`](#mapps-databaseconnection-string)
* [`mapps help [COMMANDS]`](#mapps-help-commands)
* [`mapps init`](#mapps-init)

- [`mapps help [COMMANDS]`](#mapps-help-commands)
- [`mapps init`](#mapps-init)

* [`mapps scheduler:create`](#mapps-schedulercreate)
* [`mapps scheduler:delete`](#mapps-schedulerdelete)
* [`mapps scheduler:list`](#mapps-schedulerlist)
* [`mapps scheduler:run`](#mapps-schedulerrun)
* [`mapps scheduler:update`](#mapps-schedulerupdate)
* [`mapps storage:export`](#mapps-storageexport)

- [`mapps manifest:export`](#mapps-manifestexport)
- [`mapps manifest:import`](#mapps-manifestimport)
- [`mapps storage:export`](#mapps-storageexport)

* [`mapps storage:remove-data`](#mapps-storageremove-data)
* [`mapps storage:search`](#mapps-storagesearch)
* [`mapps tunnel:create`](#mapps-tunnelcreate)

- [`mapps storage:search`](#mapps-storagesearch)
- [`mapps tunnel:create`](#mapps-tunnelcreate)

## `mapps api:generate`

Expand Down Expand Up @@ -202,7 +217,7 @@ EXAMPLES
$ mapps app-version:list
```

_See code: [src/commands/app-version/list.ts](https://github.com/mondaycom/monday-apps-cli/blob/v4.7.2/src/commands/app-version/list.ts)_
_See code: [src/commands/app-version/list.ts](https://github.com/mondaycom/monday-apps-cli/blob/v4.3.2/src/commands/app-version/list.ts)_
Comment thread
oricho123 marked this conversation as resolved.
Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link doesn't even work
should be https://github.com/mondaycom/monday-apps-cli/blob/master/src/commands/app-version/list.ts


## `mapps app:create`

Expand Down Expand Up @@ -567,6 +582,58 @@ EXAMPLES

_See code: [src/commands/init/index.ts](https://github.com/mondaycom/monday-apps-cli/blob/v4.7.2/src/commands/init/index.ts)_

## `mapps manifest:export`

export manifest.

```
USAGE
$ mapps manifest:export [--verbose] [--print-command] [-a <value>] [-v <value>]

FLAGS
-a, --appId=<value> App id (will export the live version)
-v, --appVersionId=<value> App version id

GLOBAL FLAGS
--print-command Print the command that was executed (optional).
--verbose Print advanced logs (optional).

DESCRIPTION
export manifest.

EXAMPLES
$ mapps manifest:export
```

_See code: [src/commands/manifest/export.ts](https://github.com/mondaycom/monday-apps-cli/blob/v4.3.2/src/commands/manifest/export.ts)_

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, replace the version with master


## `mapps manifest:import`

Import manifest.

```
USAGE
$ mapps manifest:import [--verbose] [--print-command] [-p <value>] [-a <value>] [-v <value>] [-n]

FLAGS
-a, --appId=<value> App id (will create new draft version)
-n, --newApp Create new app
-p, --manifestPath=<value> Path of you manifest file in your machine
-v, --appVersionId=<value> App version id to override

GLOBAL FLAGS
--print-command Print the command that was executed (optional).
--verbose Print advanced logs (optional).

DESCRIPTION
Import manifest.

EXAMPLES
$ mapps manifest:import
```

_See code: [src/commands/manifest/import.ts](https://github.com/mondaycom/monday-apps-cli/blob/v4.3.2/src/commands/manifest/import.ts)_

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here


## `mapps scheduler:create`

Create a new scheduler job for an app
Expand Down Expand Up @@ -830,4 +897,5 @@ EXAMPLES
```

_See code: [src/commands/tunnel/create.ts](https://github.com/mondaycom/monday-apps-cli/blob/v4.7.2/src/commands/tunnel/create.ts)_

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here


<!-- commandsstop -->
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mondaycom/apps-cli",
"version": "4.7.5",
"version": "4.8.0",
"description": "A cli tool to manage apps (and monday-code projects) in monday.com",
"author": "monday.com Apps Team",
"type": "module",
Expand Down Expand Up @@ -53,6 +53,7 @@
"@oclif/core": "^3.18.1",
"@oclif/plugin-autocomplete": "^3.0.5",
"@oclif/plugin-help": "^6.0.12",
"adm-zip": "^0.5.16",
"archiver": "^5.3.1",
"args-parser": "^1.3.0",
"axios": "^1.6.5",
Expand All @@ -65,6 +66,7 @@
"fs-extra": "^11.2.0",
"fuzzy": "^0.1.3",
"glob": "^8.1.0",
"handlebars": "^4.7.8",
"http-status-codes": "^2.2.0",
"inquirer": "^8.2.6",
"inquirer-autocomplete-prompt": "^2.0.0",
Expand All @@ -83,10 +85,12 @@
"zod": "^3.20.2"
},
"devDependencies": {
"@types/adm-zip": "^0.5.7",
"@types/archiver": "^5.3.1",
"@types/figlet": "^1.5.5",
"@types/fs-extra": "^11.0.4",
"@types/glob": "^8.0.0",
"@types/handlebars": "^4.1.0",
"@types/inquirer": "^8.2.10",
"@types/inquirer-autocomplete-prompt": "^2.0.2",
"@types/jest": "^29.5.6",
Expand Down
88 changes: 88 additions & 0 deletions src/commands/manifest/export.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { Flags } from '@oclif/core';
import { Listr } from 'listr2';

import { AuthenticatedCommand } from 'commands-base/authenticated-command';
import { DynamicChoicesService } from 'services/dynamic-choices-service';
import * as exportService from 'services/export-manifest-service';
import { ExportCommandTasksContext } from 'types/commands/manifest-export';
import logger from 'utils/logger';

const MESSAGES = {
appId: 'App id (will export the live version)',
appVersionId: 'App version id',
path: 'Path to export your app manifest files to',
};

export default class ManifestExport extends AuthenticatedCommand {
static description = 'export app manifest.';
static withPrintCommand = false;
static examples = [
'<%= config.bin %> <%= command.id %>',
'<%= config.bin %> <%= command.id %> -p ./exports',
'<%= config.bin %> <%= command.id %> --manifestPath ./my-manifests',
];

static flags = ManifestExport.serializeFlags({
manifestPath: Flags.string({
char: 'p',
description: MESSAGES.path,
}),
appId: Flags.string({
char: 'a',
description: MESSAGES.appId,
}),
appVersionId: Flags.integer({
char: 'i',
aliases: ['v'],
description: MESSAGES.appVersionId,
}),
});

DEBUG_TAG = 'manifest_export';

async getAppVersionId(appVersionId: number | undefined, appId: number | undefined): Promise<number> {
if (appVersionId) return appVersionId;

const latestDraftVersion = await DynamicChoicesService.chooseAppAndAppVersion(false, true, {
appId: Number(appId),
autoSelectVersion: false,
});

return latestDraftVersion.appVersionId;
}

public async run(): Promise<void> {
try {
const { flags } = await this.parse(ManifestExport);
const { manifestPath, appId: appIdAsString, appVersionId: appVersionIdAsString } = flags;

let appId = appIdAsString ? Number(appIdAsString) : undefined;
let appVersionId = appVersionIdAsString ? Number(appVersionIdAsString) : undefined;

if (appVersionId && !appId) {
logger.error('App id is required when app version id is provided');
process.exit(1);
}

if (!appId && !appVersionId) {
appId = Number(await DynamicChoicesService.chooseApp());
appVersionId = await this.getAppVersionId(undefined, appId);
}

this.preparePrintCommand(this, flags);

const tasks = new Listr<ExportCommandTasksContext>(
[
{ title: 'Validate app before exporting manifest', task: exportService.validateManifestTask },
{ title: 'Export app manifest', task: exportService.downloadManifestTask },
],
{ ctx: { appVersionId, appId: appId!, manifestPath } },
);

await tasks.run();
} catch (error) {
logger.debug(error, this.DEBUG_TAG);
process.exit(1);
}
}
}
Loading
Loading