fix(classes.dockerfile): use a single top-level fs import instead of requiring fs inside methods

This commit is contained in:
2026-01-21 00:03:25 +00:00
parent 9805324746
commit b0f87deb4b
4 changed files with 9 additions and 3 deletions

View File

@@ -1,5 +1,12 @@
# Changelog
## 2026-01-21 - 1.4.2 - fix(classes.dockerfile)
use a single top-level fs import instead of requiring fs inside methods
- Added top-level import: import * as fs from 'fs' in ts/classes.dockerfile.ts
- Removed inline require('fs') calls and replaced with the imported fs in constructor and test() to keep imports consistent
- No behavioral change expected; this is a cleanup/refactor to standardize module usage
## 2026-01-20 - 1.4.1 - fix(docs)
update README: expand usage, installation, quick start, features, troubleshooting and migration notes

0
cli.js Normal file → Executable file
View File

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@git.zone/tsdocker',
version: '1.4.1',
version: '1.4.2',
description: 'develop npm modules cross platform with docker'
}

View File

@@ -4,6 +4,7 @@ import { logger } from './tsdocker.logging.js';
import { DockerRegistry } from './classes.dockerregistry.js';
import type { IDockerfileOptions, ITsDockerConfig } from './interfaces/index.js';
import type { TsDockerManager } from './classes.tsdockermanager.js';
import * as fs from 'fs';
const smartshellInstance = new plugins.smartshell.Smartshell({
executor: 'bash',
@@ -314,7 +315,6 @@ export class Dockerfile {
this.containerName = 'dockerfile-' + this.version;
if (options.filePath && options.read) {
const fs = require('fs');
this.content = fs.readFileSync(plugins.path.resolve(options.filePath), 'utf-8');
} else if (options.fileContents) {
this.content = options.fileContents;
@@ -419,7 +419,6 @@ export class Dockerfile {
const testDir = this.managerRef.config.testDir || plugins.path.join(paths.cwd, 'test');
const testFile = plugins.path.join(testDir, 'test_' + this.version + '.sh');
const fs = require('fs');
const testFileExists = fs.existsSync(testFile);
if (testFileExists) {