Skip to content

Commit 6497464

Browse files
authored
Merge pull request #1125 from appwrite/fix-warnings
fix: deprecated warnings in cli leading to error
2 parents 06fd586 + c9dd9e2 commit 6497464

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

templates/cli/lib/client.js.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class Client {
139139

140140
const warnings = response.headers.get('x-{{ spec.title | lower }}-warning');
141141
if (warnings) {
142-
warnings.split(';').forEach((warning) => console.warn(warning));
142+
warnings.split(';').forEach((warning) => console.log(`${chalk.yellow.bold("ℹ Warning:")} ${chalk.yellow(warning)}`));
143143
}
144144
} catch (error) {
145145
throw new {{spec.title | caseUcfirst}}Exception(error.message);

templates/cli/lib/commands/command.js.twig

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const libClient = require('../client.js');
77
const { getAllFiles, showConsoleLink } = require('../utils.js');
88
const { Command } = require('commander');
99
const { sdkForProject, sdkForConsole } = require('../sdks')
10-
const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
10+
const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log, warn } = require('../parser')
1111
const { localConfig, globalConfig } = require("../config");
1212
const { File } = require('undici');
1313
const { ReadableStream } = require('stream/web');
@@ -72,13 +72,6 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({
7272
{%- if method.type == 'location' -%}, destination{%- endif -%}
7373
{% if hasConsolePreview(method.name,service.name) %}, console{%- endif -%}
7474
}) => {
75-
{% if method.deprecated %}
76-
{% if method.since and method.replaceWith %}
77-
console.warn('Warning: This command is deprecated since {{ method.since }}.{% if method.replaceWith %} Please use "{{ method.replaceWith | replace({'.': ' '}) | caseKebab }}" instead.{% endif %}');
78-
{% else %}
79-
console.warn('Warning: This command is deprecated.');
80-
{% endif %}
81-
{% endif %}
8275
let client = !sdk ? await {% if service.name == "projects" %}sdkForConsole(){% else %}sdkForProject(){% endif %} :
8376
sdk;
8477
let apiPath = '{{ method.path }}'{% for parameter in method.parameters.path %}.replace('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | escapeKeyword }}){% endfor %};

0 commit comments

Comments
 (0)