Review round 1 for the Node build module: build depth (1490), bin scripts for the test script (1491), toolchain.reported and its stream (1483, 1488); delta part 3 of 4
This commit is contained in:
@@ -83,8 +83,25 @@ func (m *Module) build(ctx context.Context, args map[string]any) (any, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := m.provide(root); err != nil {
|
||||
return nil, fmt.Errorf("providing the toolchain's packages to the workspace: %w", err)
|
||||
if why, err := lockProblem(dir, module); err != nil || why != "" {
|
||||
if err == nil {
|
||||
err = fmt.Errorf("%s was refused by the fetch: %s", name, why)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
// Built at the build agent's depth (builder.go: the module at /app/modules/module, the packages at /app/node_modules),
|
||||
// so the path comments esbuild writes, `../../node_modules/...`, and with them the bundle's bytes equal its.
|
||||
stage := filepath.Join(root, "stage-"+a.Name)
|
||||
if err := os.RemoveAll(stage); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
src := dir
|
||||
dir = filepath.Join(stage, "modules", "module")
|
||||
if err := copyTree(src, dir); err != nil {
|
||||
return nil, fmt.Errorf("staging the module: %w", err)
|
||||
}
|
||||
if err := copyPackages(filepath.Join(m.toolchainDir(), "node_modules"), filepath.Join(stage, "node_modules")); err != nil {
|
||||
return nil, fmt.Errorf("providing the toolchain's packages to the build: %w", err)
|
||||
}
|
||||
out, final := Out(a.Name), Out(a.Name)+".bundled"
|
||||
if err := os.MkdirAll(filepath.Join(dir, out), 0o755); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user