Skip to content

Commit

Permalink
feat: mix in output related content
Browse files Browse the repository at this point in the history
  • Loading branch information
arlac77 committed Mar 14, 2024
1 parent f75bd59 commit 3da4782
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
16 changes: 13 additions & 3 deletions src/extract-from-package.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ export async function* extractFromPackage(options = {}, env = {}) {
properties = { ...fragment.properties, ...properties };
dependencies = mergeDependencies(dependencies, fragment.dependencies);
Object.assign(output, fragment.output);

if (fragment.content) {
content.push([fragment.content, fragment.dir]);
}
Expand All @@ -333,7 +334,6 @@ export async function* extractFromPackage(options = {}, env = {}) {
}
}


// @ts-ignore
Object.assign(properties, root.properties);
delete properties.dependencies;
Expand All @@ -346,7 +346,6 @@ export async function* extractFromPackage(options = {}, env = {}) {
return a;
}, []);


const result = {
context,
variant: { name, priority: variant.priority },
Expand Down Expand Up @@ -380,11 +379,22 @@ export async function* extractFromPackage(options = {}, env = {}) {
result.properties.arch = arch;
}

let sources = [];

if (output.content) {
sources = context
.expand([[output.content, root.dir]])
.reduce((a, c) => {
a.push(...content2Sources(c[0], c[1]));
return a;
}, []);
}

yield {
...result,
variant: { ...result.variant, output: name },
output: { [name]: output },
// sources: [...result.sources, ...output.sources],
sources: [...result.sources, ...sources],
dependencies: mergeDependencies(
result.dependencies,
output.dependencies
Expand Down
14 changes: 9 additions & 5 deletions tests/extract-from-package-ava.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,18 @@ test(
sources: [
new FileContentProvider(
{
base: new URL(
"../build/efpt-n2",
import.meta.url
).pathname,
base: new URL("../build/efpt-n2", import.meta.url).pathname,
pattern: ["*"]
},
{ destination: "/service/myservice" }
)
),
new FileContentProvider(
{
base: new URL("../build/efpt-n2/pkg", import.meta.url).pathname,
pattern: ["myconfig.json"]
},
{ destination: "/etc/myconfig.json" }
)
]
}
]
Expand Down

0 comments on commit 3da4782

Please sign in to comment.