fix(classes.dockerfile): use a single top-level fs import instead of requiring fs inside methods
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user