e2e-test: update to provide version lookup helper to template
This commit is contained in:
@@ -84,11 +84,23 @@ async function buildDistWorkspace(workspaceName: string, rootDir: string) {
|
||||
const path = paths.resolveOwnRoot(pkgJsonPath);
|
||||
const pkgTemplate = await fs.readFile(path, 'utf8');
|
||||
const { dependencies = {}, devDependencies = {} } = JSON.parse(
|
||||
handlebars.compile(pkgTemplate)({
|
||||
version: '0.0.0',
|
||||
privatePackage: true,
|
||||
scopeName: '@backstage',
|
||||
}),
|
||||
handlebars.compile(pkgTemplate)(
|
||||
{
|
||||
privatePackage: true,
|
||||
scopeName: '@backstage',
|
||||
},
|
||||
{
|
||||
helpers: {
|
||||
version(name: string) {
|
||||
const pkg = require(`${name}/package.json`);
|
||||
if (!pkg) {
|
||||
throw new Error(`No version available for package ${name}`);
|
||||
}
|
||||
return pkg.version;
|
||||
},
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
Array<string>()
|
||||
|
||||
Reference in New Issue
Block a user