Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions .qodo/testConfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[javascript]
testingFramework = "Jest"
mockingFramework = "Jest mocks"
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"cSpell.words": [
"postconditions"
]
],
"codium.codeCompletion.enable": true
}
16 changes: 10 additions & 6 deletions src/commands/transpile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const colors = require('ansi-colors');
const fs = require('fs');
const path = require('path');
const glob = require('glob');
const { log } = require('console');

/**
* Transpile files based on provided patterns and options.
Expand All @@ -22,10 +23,8 @@ function transpileCommand(patterns, options) {
logMessage('info', `Excluding patterns: ${excludePatterns.join(', ')}`, options.silent);
}

const outputDir = options.output || config.output || 'dist'; // Load from config or use default
if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir, { recursive: true }); // Ensure output directory exists
}
const path.dirname(destinationFile) = options.output || config.output || 'dist'; // Load from config or use default


const isSilent = options.silent ?? config.silent;
const isVerbose = options.verbose ?? config.verbose;
Expand All @@ -50,14 +49,19 @@ function transpileCommand(patterns, options) {
logMessage('info', `Transpiling: ${file}`, isSilent);

try {
const destinationFile = path.join(outputDir, path.basename(file));
logMessage('debug', `Source file dirname: ${path.dirname(file)}`, isSilent);
const destinationFile = path.join(path.dirname(destinationFile), path.dirname(file), path.basename(file));
logMessage('debug', `Destination file: ${destinationFile}`, isSilent);
logMessage('debug', `Destination file dirname: ${path.dirname(destinationFile)}`, isSilent);
if (!fs.existsSync(path.dirname(destinationFile))) {
fs.mkdirSync(path.dirname(destinationFile), { recursive: true }); // Ensure output directory exists
}
fs.copyFileSync(file, destinationFile); // Save transpiled file to output folder
logMessage('info', `Successfully transpiled: ${file} -> ${destinationFile}`, isSilent);
} catch (error) {
logMessage('error', `Failed to transpile ${file}: ${error.message}`, isSilent);
continue; // Skip to the next file on error
}

}

logMessage('info', 'Transpilation process completed!', isSilent);
Expand Down
Loading