Skip to content
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
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"inversify": "6.1.4",
"js-string-escape": "1.0.1",
"md5": "2.3.0",
"mkdirp": "3.0.1",
"multimatch": "5.0.0",
"process": "0.11.10",
"reflect-metadata": "0.2.2",
Expand All @@ -58,7 +57,6 @@
"@types/js-beautify": "1.14.3",
"@types/js-string-escape": "1.0.3",
"@types/md5": "2.3.6",
"@types/mkdirp": "1.0.2",
"@types/mocha": "10.0.10",
"@types/multimatch": "4.0.0",
"@types/node": "22.10.2",
Expand Down
3 changes: 1 addition & 2 deletions src/cli/utils/ObfuscatedCodeFileUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as fs from 'fs';
import * as mkdirp from 'mkdirp';
import * as path from 'path';

import { TInputCLIOptions } from '../../types/options/TInputCLIOptions';
Expand Down Expand Up @@ -135,7 +134,7 @@ export class ObfuscatedCodeFileUtils {
* @param {string} data
*/
public writeFile(outputPath: string, data: string): void {
mkdirp.sync(path.dirname(outputPath));
fs.mkdirSync(path.dirname(outputPath), { recursive: true });

fs.writeFileSync(outputPath, data, {
encoding: JavaScriptObfuscatorCLI.encoding
Expand Down
3 changes: 1 addition & 2 deletions test/functional-tests/cli/JavaScriptObfuscatorCLI.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as fs from 'fs';
import * as mkdirp from 'mkdirp';
import * as path from 'path';
import * as rimraf from 'rimraf';
import * as sinon from 'sinon';
Expand Down Expand Up @@ -32,7 +31,7 @@ describe('JavaScriptObfuscatorCLI', function (): void {

describe('run', () => {
before(async () => {
mkdirp.sync(outputDirName);
fs.mkdirSync(outputDirName, { recursive: true });
});

describe('Variant #1: obfuscation of single file', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as fs from 'fs';
import * as mkdirp from 'mkdirp';
import * as path from 'path';
import * as rimraf from 'rimraf';

Expand All @@ -24,7 +23,7 @@ describe('IdentifierNamesCacheFileUtils', () => {
const tmpDirectoryPath: string = path.join('test', 'tmp');

before(() => {
mkdirp.sync(tmpDirectoryPath);
fs.mkdirSync(tmpDirectoryPath, { recursive: true });
});

describe('readFile', () => {
Expand Down
5 changes: 2 additions & 3 deletions test/unit-tests/cli/utils/ObfuscatedCodeFileUtils.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { assert } from 'chai';
import * as fs from 'fs';
import * as mkdirp from 'mkdirp';
import * as path from 'path';
import * as rimraf from 'rimraf';

Expand All @@ -11,7 +10,7 @@ describe('obfuscatedCodeFileUtils', () => {

describe('getOutputCodePath', () => {
before(() => {
mkdirp.sync(path.join(tmpDirectoryPath, 'input', 'nested'));
fs.mkdirSync(path.join(tmpDirectoryPath, 'input', 'nested'), { recursive: true });
fs.writeFileSync(path.join(tmpDirectoryPath, 'input', 'nested', 'test-input.js'), 'var foo = 1;');
});

Expand Down Expand Up @@ -206,7 +205,7 @@ describe('obfuscatedCodeFileUtils', () => {
const baseDirnamePath: string = __dirname;

before(() => {
mkdirp.sync(path.join(baseDirnamePath, tmpDirectoryPath, 'input', 'nested'));
fs.mkdirSync(path.join(baseDirnamePath, tmpDirectoryPath, 'input', 'nested'), { recursive: true });
fs.writeFileSync(
path.join(baseDirnamePath, tmpDirectoryPath, 'input', 'nested', 'test-input.js'),
'var foo = 1;'
Expand Down
9 changes: 4 additions & 5 deletions test/unit-tests/cli/utils/SourceCodeFileUtils.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as fs from 'fs';
import * as mkdirp from 'mkdirp';
import * as path from 'path';
import * as rimraf from 'rimraf';

Expand All @@ -15,7 +14,7 @@ describe('SourceCodeFileUtils', () => {
const tmpDirectoryPath: string = path.join('test', 'tmp');

before(() => {
mkdirp.sync(tmpDirectoryPath);
fs.mkdirSync(tmpDirectoryPath, { recursive: true });
});

describe('readSourceCode', () => {
Expand Down Expand Up @@ -277,8 +276,8 @@ describe('SourceCodeFileUtils', () => {
let result: IFileData[];

before(() => {
mkdirp.sync(parentDirectoryPath1);
mkdirp.sync(parentDirectoryPath2);
fs.mkdirSync(parentDirectoryPath1, { recursive: true });
fs.mkdirSync(parentDirectoryPath2, { recursive: true });
fs.writeFileSync(filePath1, fileContent);
fs.writeFileSync(filePath2, fileContent);
fs.writeFileSync(filePath3, fileContent);
Expand Down Expand Up @@ -534,7 +533,7 @@ describe('SourceCodeFileUtils', () => {
let result: IFileData[];

before(() => {
mkdirp.sync(tmpDirectoryWithDotPath);
fs.mkdirSync(tmpDirectoryWithDotPath, { recursive: true });
fs.writeFileSync(filePath, fileContent);
result = new SourceCodeFileUtils(tmpDirectoryWithDotPath, {}).readSourceCode();
});
Expand Down
12 changes: 0 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -693,13 +693,6 @@
resolved "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz"
integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==

"@types/mkdirp@1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@types/mkdirp/-/mkdirp-1.0.2.tgz#8d0bad7aa793abe551860be1f7ae7f3198c16666"
integrity sha512-o0K1tSO0Dx5X6xlU5F1D6625FawhC3dU3iqr25lluNv/+/QIVH8RLNEiVokgIZo+mz+87w/3Mkg/VvQS+J51fQ==
dependencies:
"@types/node" "*"

"@types/mocha@10.0.10":
version "10.0.10"
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-10.0.10.tgz#91f62905e8d23cbd66225312f239454a23bebfa0"
Expand Down Expand Up @@ -3919,11 +3912,6 @@ minimist@^1.2.6:
resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707"
integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==

mkdirp@3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-3.0.1.tgz#e44e4c5607fb279c168241713cc6e0fea9adcb50"
integrity sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==

mocha@11.7.4:
version "11.7.4"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-11.7.4.tgz#f161b17aeccb0762484b33bdb3f7ab9410ba5c82"
Expand Down
Loading