diff --git a/packages/wb/src/project.ts b/packages/wb/src/project.ts index 81ae7542..5a5dbf38 100644 --- a/packages/wb/src/project.ts +++ b/packages/wb/src/project.ts @@ -3,7 +3,6 @@ import path from 'node:path'; import type { EnvReaderOptions } from '@willbooster/shared-lib-node/src'; import { readEnvironmentVariables } from '@willbooster/shared-lib-node/src'; -import { memoizeOne } from 'at-decorators'; import type { PackageJson } from 'type-fest'; import type { ScriptArgv } from './scripts/builder.js'; @@ -20,7 +19,6 @@ export class Project { this.loadEnv = loadEnv; } - @memoizeOne getBuildCommand(argv?: ScriptArgv): string { return this.packageJson.scripts?.build?.includes('buildIfNeeded') ? 'yarn build' @@ -35,19 +33,16 @@ export class Project { this._dirPath = path.resolve(newDirPath); } - @memoizeOne get rootDirPath(): string { return fs.existsSync(path.join(this.dirPath, '..', '..', 'package.json')) ? path.resolve(this.dirPath, '..', '..') : this.dirPath; } - @memoizeOne get dockerfile(): string { return fs.readFileSync(this.findFile('Dockerfile'), 'utf8'); } - @memoizeOne get hasDockerfile(): boolean { try { return !!this.findFile('Dockerfile'); @@ -56,35 +51,29 @@ export class Project { } } - @memoizeOne get name(): string { return this.packageJson.name || 'unknown'; } - @memoizeOne get dockerImageName(): string { const name = this.packageJson.name || 'unknown'; return name.replaceAll('@', '').replaceAll('/', '-'); } - @memoizeOne get env(): Record { return this.loadEnv ? { ...readEnvironmentVariables(this.argv, this.dirPath), ...process.env } : process.env; } - @memoizeOne get packageJson(): PackageJson { return JSON.parse(fs.readFileSync(path.join(this.dirPath, 'package.json'), 'utf8')); } - @memoizeOne get rootPackageJson(): PackageJson { return this.rootDirPath === this.dirPath ? this.packageJson : JSON.parse(fs.readFileSync(path.join(this.rootDirPath, 'package.json'), 'utf8')); } - @memoizeOne get dockerPackageJson(): PackageJson { return path.dirname(this.findFile('Dockerfile')) === this.dirPath ? this.packageJson