Skip to content

Commit

Permalink
feat(wb): set 'development' or 'test' to WB_VERSION
Browse files Browse the repository at this point in the history
  • Loading branch information
exKAZUu committed Mar 14, 2024
1 parent 1ea6614 commit 61ab5af
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/wb/src/commands/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export async function test(
// Check playwright installation because --ci includes --e2e implicitly
if (argv.e2e !== 'none' && (await e2eTestsExistPromise)) {
if (project.hasDockerfile) {
await runWithSpawn(`${scripts.buildDocker(project)}`, project, argv);
await runWithSpawn(`${scripts.buildDocker(project, 'test')}`, project, argv);
}
const options = project.hasDockerfile
? {
Expand Down Expand Up @@ -192,7 +192,7 @@ async function testOnDocker(
scripts: BaseExecutionScripts,
prefix = ''
): Promise<void> {
await runWithSpawn(`${scripts.buildDocker(project)}`, project, argv);
await runWithSpawn(`${scripts.buildDocker(project, 'test')}`, project, argv);
process.exitCode = await runWithSpawn(
`${prefix}${scripts.testE2E(project, argv, {
startCommand: dockerScripts.stopAndStart(project, true),
Expand Down
4 changes: 2 additions & 2 deletions packages/wb/src/scripts/dockerScripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { Project } from '../project.js';
* Note that `YARN zzz` is replaced with `yarn zzz` or `node_modules/.bin/zzz`.
*/
class DockerScripts {
buildDevImage(project: Project): string {
buildDevImage(project: Project, version: string): string {
// e.g. coding-booster uses `"docker/build/prepare": "touch drill-users.csv",`
const prefix = project.dockerPackageJson.scripts?.['docker/build/prepare']
? 'yarn run docker/build/prepare && '
Expand All @@ -18,7 +18,7 @@ class DockerScripts {
&& YARN wb retry -- docker build -t ${project.dockerImageName}
--build-arg ARCH=$([ $(uname -m) = 'arm64' ] && echo arm64 || echo amd64)
--build-arg WB_ENV=${project.env.WB_ENV}
--build-arg WB_VERSION=dev .`;
--build-arg WB_VERSION=${version} .`;
}
stopAndStart(project: Project, unbuffer = false, additionalOptions = '', additionalArgs = ''): string {
return `${this.stop(project)} && ${unbuffer ? 'unbuffer ' : ''}${this.start(
Expand Down
4 changes: 2 additions & 2 deletions packages/wb/src/scripts/execution/baseExecutionScripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export interface TestE2EOptions extends TestE2EDevOptions {
export abstract class BaseExecutionScripts {
protected constructor(private readonly defaultPort = 3000) {}

buildDocker(project: Project): string {
return dockerScripts.buildDevImage(project);
buildDocker(project: Project, version = 'development'): string {
return dockerScripts.buildDevImage(project, version);
}

abstract start(project: Project, argv: ScriptArgv): string;
Expand Down

0 comments on commit 61ab5af

Please sign in to comment.