Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix if-check to log file relative path #889

Merged
merged 4 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 13 additions & 5 deletions src/if-check/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
/* eslint-disable no-process-exit */
import * as path from 'path';

import {parseIfCheckArgs} from './util/args';
import {logStdoutFailMessage} from './util/helpers';
import {getYamlFiles, removeFileIfExists} from '../common/util/fs';
import {debugLogger} from '../common/util/debug-logger';
import {logger} from '../common/util/logger';

import {STRINGS} from './config';
import {logStdoutFailMessage} from './util/helpers';
import {parseIfCheckArgs} from './util/args';
import {executeCommands} from './util/npm';

import {STRINGS} from './config';

const {
CHECKING,
DIRECTORY_YAML_FILES_NOT_FOUND,
Expand All @@ -19,6 +21,9 @@ const {
} = STRINGS;

const IfCheck = async () => {
// Call this function with false parameter to prevent log debug messages.
debugLogger.overrideConsoleMethods(false);

const commandArgs = await parseIfCheckArgs();

console.log(`${CHECKING}\n`);
Expand Down Expand Up @@ -51,8 +56,11 @@ const IfCheck = async () => {
}

for await (const file of files) {
const fileName = path.basename(file);
console.log(IF_CHECK_EXECUTING(fileName));
const fileRelativePath = path.relative(
process.env.CURRENT_DIR || process.cwd(),
file
);
console.log(IF_CHECK_EXECUTING(fileRelativePath));

try {
await executeCommands(file, true);
Expand Down
10 changes: 6 additions & 4 deletions src/if-env/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
#!/usr/bin/env node
/* eslint-disable no-process-exit */
import {parseIfEnvArgs} from './util/args';

import {debugLogger} from '../common/util/debug-logger';
import {logger} from '../common/util/logger';
import {STRINGS} from '../common/config';

import {
addTemplateManifest,
getOptionsFromArgs,
initializeAndInstallLibs,
} from './util/helpers';
import {logger} from '../common/util/logger';

import {EnvironmentOptions} from './types/if-env';
import {parseIfEnvArgs} from './util/args';

const {SUCCESS_MESSAGE} = STRINGS;

const IfEnv = async () => {
// Call this function with false parameter to prevent log debug messages.
debugLogger.overrideConsoleMethods(false);

const commandArgs = await parseIfEnvArgs();
const options: EnvironmentOptions = {
folderPath: process.env.CURRENT_DIR || process.cwd(),
Expand Down