UNPKG

2.09 kBJavaScriptView Raw
1"use strict";
2/*
3 * Copyright (c) 2016, salesforce.com, inc.
4 * All rights reserved.
5 * Licensed under the BSD 3-Clause license.
6 * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7 */
8const _ = require("lodash");
9const projectDir = require("./core/projectDir");
10const logger = require("./core/logApi");
11module.exports = {
12 validateProjectDir(command) {
13 if (command.requiresProject) {
14 projectDir.getPath();
15 }
16 },
17 showDeprecationWarnings(command, context) {
18 context.warnings = context.warnings || [];
19 if (_.toUpper(process.env.SFDX_PRECOMPILE_DISABLE) === 'TRUE') {
20 const msg = logger.formatDeprecationWarning('SFDX_PRECOMPILE_DISABLE', {
21 version: 41,
22 to: 'SFDX_PRECOMPILE_ENABLE=true to enable Apex pre-compilation.'
23 }, 'environment variable');
24 logger.warnUser(context, msg);
25 }
26 if (_.toUpper(process.env.SFDX_DISABLE_ENCRYPTION) === 'TRUE') {
27 const msg = logger.formatDeprecationWarning('SFDX_DISABLE_ENCRYPTION', {
28 version: 41,
29 to: 'sfdx force:auth to re-authorize your orgs'
30 // I wanted to create an enum for DeprecationTypes but string mappings are only supported in TS 2.4 and above.
31 }, 'environment variable');
32 logger.warnUser(context, msg);
33 }
34 if (command.deprecated) {
35 const msg = logger.formatDeprecationWarning(command.command ? `${command.topic}:${command.command}` : command.topic, command.deprecated, 'command');
36 logger.warnUser(context, msg);
37 }
38 else if (context.flags) {
39 _.each(command.flags, flag => {
40 if (flag.deprecated && !_.isNil(context.flags[flag.name])) {
41 const msg = logger.formatDeprecationWarning(flag.name, flag.deprecated, 'flag');
42 logger.warnUser(context, msg);
43 }
44 });
45 }
46 }
47};
48
49//# sourceMappingURL=indexPreFilters.js.map