Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node build command #12

Merged
merged 1 commit into from
Dec 21, 2023
Merged
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
36 changes: 22 additions & 14 deletions builder/rules/harness/rule_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func ConfigureNode(fsys fs.FS, pipeline *spec.Pipeline) error {

// add the npm install step
stage.Steps = append(stage.Steps, utils.CreateScriptStep(image,
"npm_install",
"install dependencies",
"npm install",
))

Expand All @@ -42,53 +42,61 @@ func ConfigureNode(fsys fs.FS, pipeline *spec.Pipeline) error {
// add test with junit for xml reports otherwise add well known test step
if _, ok := json.Scripts["test:junit"]; ok {
stage.Steps = append(stage.Steps, utils.CreateScriptStepWithReports(image,
"npm_test_reports",
"test_reports",
"npm run test:junit",
))
} else if _, ok := json.Scripts["test"]; ok {
stage.Steps = append(stage.Steps, utils.CreateScriptStep(image,
"npm_test",
"test",
"npm run test",
))
}

// add well-known jest coverage command
if _, ok := json.Scripts["coverage"]; ok {
stage.Steps = append(stage.Steps, utils.CreateScriptStep(image,
"npm_coverage",
"coverage",
"npm run coverage",
))
}

// add well-known lint command
if _, ok := json.Scripts["lint"]; ok {
stage.Steps = append(stage.Steps, utils.CreateScriptStep(image,
"npm_lint",
"lint",
"npm run lint",
))
}

// add well-known e2e command
if _, ok := json.Scripts["e2e"]; ok {
stage.Steps = append(stage.Steps, utils.CreateScriptStep(image,
"npm_e2e",
"e2e",
"npm run e2e",
))
}

// add well-known e2e docker if infra is cloud
if _, ok := json.Scripts["e2e:docker"]; ok && image == "" {
// add well-known dist command
if _, ok := json.Scripts["dist"]; ok {
stage.Steps = append(stage.Steps, utils.CreateScriptStep(image,
"npm_e2e_docker",
"npm run e2e docker",
"dist",
"npm run dist",
))
}

// add well-known dist command
if _, ok := json.Scripts["dist"]; ok {
// add well-known build command
if _, ok := json.Scripts["build"]; ok {
stage.Steps = append(stage.Steps, utils.CreateScriptStep(image,
"npm_dist",
"npm run dist",
"build",
"npm run build",
))
}

// add well-known e2e docker if infra is cloud
if _, ok := json.Scripts["e2e:docker"]; ok && image == "" {
stage.Steps = append(stage.Steps, utils.CreateScriptStep(image,
"e2e_docker",
"npm run e2e docker",
))
}

Expand Down