New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@modyo/cli

Package Overview
Dependencies
Maintainers
4
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@modyo/cli - npm Package Compare versions

Comparing version
3.5.4
to
3.5.5
+12
-0
lib/commands/get.d.ts

@@ -19,2 +19,14 @@ import { Command } from '@oclif/core';

run(): Promise<void>;
/**
* Handles errors thrown during command execution.
*
* This method is invoked when the `run` method (or other lifecycle hooks)
* throw an error. It normalizes non-zero exit {@link Errors.CLIError}
* instances by re-emitting them through {@link this.error}, which controls
* the process exit code and message formatting, and then delegates all
* other errors to the base implementation.
*
* @param error The error thrown during command execution.
*/
catch(error: any): Promise<any>;
}
+44
-29

@@ -15,34 +15,49 @@ "use strict";

async run() {
try {
this.debug('getting details from arguments');
const { args, flags } = await this.parse(Get);
core_1.ux.action.start('Getting identifier information', 'initializing', { stdout: true });
const [templateName, templateVersion] = (0, get_template_name_and_version_1.default)(args.name);
this.debug({ templateName, templateVersion });
core_1.ux.action.stop(`name: ${templateName} and version: ${templateVersion}`);
if (!args.directory) {
this.debug(`setting directory to initialize in ${templateName}`);
// eslint-disable-next-line functional/immutable-data
args.directory = templateName;
}
const finalPath = path.resolve(args.directory);
this.debug(`template Path is ${finalPath} checking if needs overrides`);
const override = await (0, check_to_overrides_1.default)(finalPath, flags.force);
const tempDirectory = await (0, create_tmp_directory_1.default)();
const zipPath = await (0, getting_template_1.default)({
organization: flags.organization,
templateName,
templateVersion,
tempDirectory,
});
await (0, extracting_template_files_1.default)({ zipPath, finalPath, override });
await (0, remove_tmp_zip_file_1.default)(tempDirectory);
await (0, moving_files_to_final_destination_1.default)(finalPath);
core_1.ux.action.stop();
this.debug('getting details from arguments');
const { args, flags } = await this.parse(Get);
core_1.ux.action.start('Getting identifier information', 'initializing', { stdout: true });
const [templateName, templateVersion] = (0, get_template_name_and_version_1.default)(args.name);
this.debug({ templateName, templateVersion });
core_1.ux.action.stop(`name: ${templateName} and version: ${templateVersion}`);
if (!args.directory) {
this.debug(`setting directory to initialize in ${templateName}`);
// eslint-disable-next-line functional/immutable-data
args.directory = templateName;
}
catch (error) {
if (error instanceof Error) {
this.error(error.message || error);
const finalPath = path.resolve(args.directory);
this.debug(`template Path is ${finalPath} checking if needs overrides`);
const override = await (0, check_to_overrides_1.default)(finalPath, flags.force);
const tempDirectory = await (0, create_tmp_directory_1.default)();
const zipPath = await (0, getting_template_1.default)({
organization: flags.organization,
templateName,
templateVersion,
tempDirectory,
});
await (0, extracting_template_files_1.default)({ zipPath, finalPath, override });
await (0, remove_tmp_zip_file_1.default)(tempDirectory);
await (0, moving_files_to_final_destination_1.default)(finalPath);
core_1.ux.action.stop();
}
/**
* Handles errors thrown during command execution.
*
* This method is invoked when the `run` method (or other lifecycle hooks)
* throw an error. It normalizes non-zero exit {@link Errors.CLIError}
* instances by re-emitting them through {@link this.error}, which controls
* the process exit code and message formatting, and then delegates all
* other errors to the base implementation.
*
* @param error The error thrown during command execution.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async catch(error) {
var _a;
if (error instanceof core_1.Errors.CLIError) {
const exit = (_a = error.oclif) === null || _a === void 0 ? void 0 : _a.exit;
if (typeof exit === 'number' && exit !== 0) {
return this.error(error.message, { exit });
}
}
return super.catch(error);
}

@@ -49,0 +64,0 @@ }

@@ -18,2 +18,17 @@ import { Command } from '@oclif/core';

run(): Promise<void>;
/**
* Handles errors thrown during command execution.
*
* This method is invoked by oclif when {@link run} (or other command
* lifecycle methods) throws an exception or returns a rejected promise.
* It explicitly handles {@link Errors.CLIError} instances that have a
* non-zero `oclif.exit` code by delegating to {@link this.error} so that
* the process exits with the appropriate status code and message.
* All other errors are forwarded to the base {@link Command.catch}
* implementation for default handling.
*
* @param error - The error thrown during command execution; may be any value,
* but is typically an instance of {@link Errors.CLIError} or `Error`.
*/
catch(error: any): Promise<any>;
}

@@ -11,13 +11,31 @@ "use strict";

async run() {
try {
await (0, merge_env_variables_1.default)();
const input = await this.parse(Preview);
const { accountUrl, domId, entryJs, port, siteHost, } = await (0, prepare_and_validate_preview_1.default)(input);
await (0, open_preview_1.default)(accountUrl, siteHost, port, domId, entryJs);
}
catch (error) {
if (error instanceof Error) {
this.error(error.message || error);
await (0, merge_env_variables_1.default)();
const input = await this.parse(Preview);
const { accountUrl, domId, entryJs, port, siteHost, } = await (0, prepare_and_validate_preview_1.default)(input);
await (0, open_preview_1.default)(accountUrl, siteHost, port, domId, entryJs);
}
/**
* Handles errors thrown during command execution.
*
* This method is invoked by oclif when {@link run} (or other command
* lifecycle methods) throws an exception or returns a rejected promise.
* It explicitly handles {@link Errors.CLIError} instances that have a
* non-zero `oclif.exit` code by delegating to {@link this.error} so that
* the process exits with the appropriate status code and message.
* All other errors are forwarded to the base {@link Command.catch}
* implementation for default handling.
*
* @param error - The error thrown during command execution; may be any value,
* but is typically an instance of {@link Errors.CLIError} or `Error`.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async catch(error) {
var _b;
if (error instanceof core_1.Errors.CLIError) {
const exit = (_b = error.oclif) === null || _b === void 0 ? void 0 : _b.exit;
if (typeof exit === 'number' && exit !== 0) {
return this.error(error.message, { exit });
}
}
return super.catch(error);
}

@@ -24,0 +42,0 @@ }

@@ -28,2 +28,20 @@ import { Command } from '@oclif/core';

run(): Promise<void>;
/**
* Handles errors thrown during execution of this command.
*
* This method is invoked by oclif when {@link run} (or other command lifecycle
* methods) throws an error or returns a rejected promise. It provides
* specialized handling for:
*
* - Axios errors: formats and reports the Modyo API error response (if
* available) before exiting the process.
* - {@link Errors.CLIError} instances with a non-zero exit code: rethrows the
* error via {@link this.error} while preserving the intended exit code.
*
* All other errors are delegated to {@link Command.catch} via
* {@link super.catch}.
*
* @param error The error encountered while running the push command.
*/
catch(error: any): Promise<any>;
}

@@ -14,26 +14,49 @@ "use strict";

async run() {
var _b;
try {
await (0, merge_env_variables_1.default)();
const input = await this.parse(PUSH);
const params = await (0, prepare_and_validate_params_1.default)(input);
await (0, check_widget_1.default)(params.buildDirectory, params.buildCommand);
const resources = await (0, process_widget_1.default)(params);
this.debug('pushing widget');
await (0, upload_widget_1.default)(params.name, resources, {
version: params.version,
accountUrl: params.accountUrl,
siteId: params.siteId,
token: params.token,
}, { publish: params.publish });
this.log('widget pushed');
await (0, merge_env_variables_1.default)();
const input = await this.parse(PUSH);
const params = await (0, prepare_and_validate_params_1.default)(input);
await (0, check_widget_1.default)(params.buildDirectory, params.buildCommand);
const resources = await (0, process_widget_1.default)(params);
this.debug('pushing widget');
await (0, upload_widget_1.default)(params.name, resources, {
version: params.version,
accountUrl: params.accountUrl,
siteId: params.siteId,
token: params.token,
}, { publish: params.publish });
this.log('widget pushed');
}
/**
* Handles errors thrown during execution of this command.
*
* This method is invoked by oclif when {@link run} (or other command lifecycle
* methods) throws an error or returns a rejected promise. It provides
* specialized handling for:
*
* - Axios errors: formats and reports the Modyo API error response (if
* available) before exiting the process.
* - {@link Errors.CLIError} instances with a non-zero exit code: rethrows the
* error via {@link this.error} while preserving the intended exit code.
*
* All other errors are delegated to {@link Command.catch} via
* {@link super.catch}.
*
* @param error The error encountered while running the push command.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async catch(error) {
var _b, _c;
if ((0, axios_1.isAxiosError)(error)) {
const errorMessage = ((_b = error.response) === null || _b === void 0 ? void 0 : _b.data)
? JSON.stringify(error.response.data, null, 2)
: error.message;
return this.error(`Modyo API Error: ${errorMessage}`);
}
catch (error) {
if ((0, axios_1.isAxiosError)(error)) {
this.error(JSON.stringify(((_b = error.response) === null || _b === void 0 ? void 0 : _b.data) || error.message));
if (error instanceof core_1.Errors.CLIError) {
const exit = (_c = error.oclif) === null || _c === void 0 ? void 0 : _c.exit;
if (typeof exit === 'number' && exit !== 0) {
return this.error(error.message, { exit });
}
if (error instanceof Error) {
this.error(error.message || error);
}
}
return super.catch(error);
}

@@ -170,3 +193,4 @@ }

required: false,
env: 'MODYO_WIDGET_NAME',
}),
};

@@ -14,3 +14,3 @@ type WidgetFileResources = {

export type WidgetResources = WidgetFileResources | WidgetZipResources;
export declare function updateWidgetFromResources(widgetId: string, url: string, token: string, resources: WidgetResources): Promise<import("axios").AxiosResponse<any, any>>;
export declare function updateWidgetFromResources(widgetId: string, url: string, token: string, resources: WidgetResources): Promise<import("axios").AxiosResponse<any, any, {}>>;
export {};

@@ -384,3 +384,3 @@ {

},
"version": "3.5.4"
"version": "3.5.5"
}
{
"name": "@modyo/cli",
"version": "3.5.4",
"version": "3.5.5",
"description": "Modyo CLI Command line to expose local development tools",

@@ -78,3 +78,2 @@ "keywords": [

"test": "mocha --config .mocharc.js",
"posttest": "eslint . --ext .ts",
"version": "oclif readme",

@@ -88,3 +87,2 @@ "readme": "oclif readme"

"@oclif/plugin-help": "^6.2.29",
"@oclif/plugin-plugins": "^5.4.43",
"@oclif/plugin-version": "^2.2.30",

@@ -91,0 +89,0 @@ "@types/fs-extra": "^11.0.1",

+62
-58

@@ -45,3 +45,3 @@ <!-- toc -->

* [`modyo-cli get NAME [DIRECTORY]`](#modyo-cli-get-name-directory)
* [`modyo-cli help [COMMANDS]`](#modyo-cli-help-commands)
* [`modyo-cli help [COMMAND]`](#modyo-cli-help-command)
* [`modyo-cli preview`](#modyo-cli-preview)

@@ -53,3 +53,3 @@ * [`modyo-cli push [NAME]`](#modyo-cli-push-name)

display autocomplete installation instructions
Display autocomplete installation instructions.

@@ -61,3 +61,3 @@ ```

ARGUMENTS
SHELL shell type
[SHELL] (zsh|bash|powershell) Shell type

@@ -68,3 +68,3 @@ FLAGS

DESCRIPTION
display autocomplete installation instructions
Display autocomplete installation instructions.

@@ -78,6 +78,8 @@ EXAMPLES

$ modyo-cli autocomplete powershell
$ modyo-cli autocomplete --refresh-cache
```
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v0.3.0/src/commands/autocomplete/index.ts)_
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.2.40/src/commands/autocomplete/index.ts)_

@@ -93,4 +95,4 @@ ## `modyo-cli get NAME [DIRECTORY]`

ARGUMENTS
NAME The name of the widget
DIRECTORY Name of directory to init
NAME The name of the widget
[DIRECTORY] Name of directory to init

@@ -121,5 +123,5 @@ FLAGS

_See code: [src/commands/get.ts](https://github.com/modyo/modyo-cli/blob/3.5.4/src/commands/get.ts)_
_See code: [src/commands/get.ts](https://github.com/modyo/modyo-cli/blob/3.5.5/src/commands/get.ts)_
## `modyo-cli help [COMMANDS]`
## `modyo-cli help [COMMAND]`

@@ -130,6 +132,6 @@ Display help for modyo-cli.

USAGE
$ modyo-cli help [COMMANDS] [-n]
$ modyo-cli help [COMMAND...] [-n]
ARGUMENTS
COMMANDS Command to show help for.
[COMMAND...] Command to show help for.

@@ -143,3 +145,3 @@ FLAGS

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.8/src/commands/help.ts)_
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.37/src/commands/help.ts)_

@@ -157,10 +159,11 @@ ## `modyo-cli preview`

-h, --help Output usage information
-i, --site-id=<value> Id of the site where the widget will be previewed
-j, --entry-js=<value> [default: main.js] Entry JS file of the widget
-n, --site-host=<value> Host of the site where the widget will be previewed
-p, --port=<value> [default: 8080] Deploy port local widget running
-s, --dom-id=<value> [default: widgetName] Container id of the widget
-t, --token=<value> (required) Modyo Api token
-u, --account-url=<value> (required) URL of your ®Modyo account ex("https://account.modyo.com")
-v, --version=<option> [default: 9] Version of Modyo platform
-i, --site-id=<value> [env: MODYO_SITE_ID] Id of the site where the widget will be previewed
-j, --entry-js=<value> [default: main.js, env: MODYO_LOCAL_ENTRY_JS] Entry JS file of the widget
-n, --site-host=<value> [env: MODYO_SITE_HOST] Host of the site where the widget will be previewed
-p, --port=<value> [default: 8080, env: MODYO_LOCAL_PORT] Deploy port local widget running
-s, --dom-id=<value> [default: widgetName, env: MODYO_LOCAL_DOM_ID] Container id of the widget
-t, --token=<value> (required) [env: MODYO_TOKEN] Modyo Api token
-u, --account-url=<value> (required) [env: MODYO_ACCOUNT_URL] URL of your ®Modyo account
ex("https://account.modyo.com")
-v, --version=<option> [default: 9, env: MODYO_VERSION] Version of Modyo platform
<options: 8|9|10>

@@ -188,3 +191,3 @@

_See code: [src/commands/preview.ts](https://github.com/modyo/modyo-cli/blob/3.5.4/src/commands/preview.ts)_
_See code: [src/commands/preview.ts](https://github.com/modyo/modyo-cli/blob/3.5.5/src/commands/preview.ts)_

@@ -201,21 +204,22 @@ ## `modyo-cli push [NAME]`

ARGUMENTS
NAME The name of the widget
[NAME] The name of the widget
FLAGS
-b, --build-command=<value> [default: build] Build command in package.json
-c, --zip-entry-css=<value> [default: main.css] Entry css file when use --zip flag
-d, --build-directory=<value> [default: dist] Build directory path
-b, --build-command=<value> [default: build, env: MODYO_BUILD_COMMAND] Build command in package.json
-c, --zip-entry-css=<value> [default: main.css, env: MODYO_ZIP_ENTRY_CSS] Entry css file when use --zip flag
-d, --build-directory=<value> [default: dist, env: MODYO_BUILD_DIRECTORY] Build directory path
-e, --[no-]remove-emojis Remove emojis from the widget that will be push
-f, --disable-liquid-regex=<value> Disable liquid on files that match a regex
-f, --disable-liquid-regex=<value> [env: MODYO_DISABLE_LIQUID_REGEX] Disable liquid on files that match a regex
-h, --help Output usage information
-i, --site-id=<value> Id of the site where the widget will be push
-j, --zip-entry-js=<value> [default: main.js] Entry js file when use --zip flag
-i, --site-id=<value> [env: MODYO_SITE_ID] Id of the site where the widget will be push
-j, --zip-entry-js=<value> [default: main.js, env: MODYO_ZIP_ENTRY_JS] Entry js file when use --zip flag
-l, --disable-liquid Disable liquid on all files
-n, --site-host=<value> Host of the site where the widget will be push
-n, --site-host=<value> [env: MODYO_SITE_HOST] Host of the site where the widget will be push
-p, --publish Force widget publication
-t, --token=<value> (required) Modyo Api token
-u, --account-url=<value> (required) URL of your ®Modyo account ex("https://account.modyo.com")
-v, --version=<option> [default: 9] Version of Modyo platform
-t, --token=<value> (required) [env: MODYO_TOKEN] Modyo Api token
-u, --account-url=<value> (required) [env: MODYO_ACCOUNT_URL] URL of your ®Modyo account
ex("https://account.modyo.com")
-v, --version=<option> [default: 9, env: MODYO_VERSION] Version of Modyo platform
<options: 8|9|10>
-z, --zip Zip bundle to publish
-z, --zip [env: MODYO_ZIP] Zip bundle to publish

@@ -252,2 +256,26 @@ DESCRIPTION

```
_See code: [src/commands/push.ts](https://github.com/modyo/modyo-cli/blob/3.5.5/src/commands/push.ts)_
## `modyo-cli version`
```
USAGE
$ modyo-cli version [--json] [--verbose]
FLAGS
--verbose Show additional information about the CLI.
GLOBAL FLAGS
--json Format output as json.
FLAG DESCRIPTIONS
--verbose Show additional information about the CLI.
Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.
```
_See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v2.2.36/src/commands/version.ts)_
<!-- commandsstop -->
## **Using the `--zip` Flag and Code Splitting Support**

@@ -279,26 +307,2 @@

_See code: [src/commands/push.ts](https://github.com/modyo/modyo-cli/blob/3.5.4/src/commands/push.ts)_
## `modyo-cli version`
```
USAGE
$ modyo-cli version [--json] [--verbose]
FLAGS
--verbose Show additional information about the CLI.
GLOBAL FLAGS
--json Format output as json.
FLAG DESCRIPTIONS
--verbose Show additional information about the CLI.
Additionally shows the architecture, node version, operating system, and versions of plugins that the CLI is using.
```
_See code: [@oclif/plugin-version](https://github.com/oclif/plugin-version/blob/v1.1.3/src/commands/version.ts)_
<!-- commandsstop -->
## Enable Debug Mode

@@ -314,2 +318,2 @@ Use the debug for debugging. The CLI uses this module for all of its debugging. If you set the environment variable ```DEBUG=*``` it will print all the debug output to the screen.

Modyo CLI is licensed under the ![Modyo Software License ](https://github.com/modyo/modyo-cli/blob/master/LICENSE).
Modyo CLI is licensed under the [Modyo Software License ](https://github.com/modyo/modyo-cli/blob/master/LICENSE).

Sorry, the diff of this file is not supported yet