fix(presetter): resolve presets as a tree not a list
This commit is contained in:
parent
530399e182
commit
f3c1738abb
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
import { readdirSync } from 'fs';
|
import { readdirSync } from 'fs';
|
||||||
import { resolve } from 'path';
|
import { resolve } from 'path';
|
||||||
import { resolveContext, resolveDynamicMap } from 'presetter';
|
import { loadDynamicMap, resolveContext } from 'presetter';
|
||||||
|
|
||||||
import getPresetAsset from '#index';
|
import getPresetAsset from '#index';
|
||||||
|
|
||||||
|
@ -27,15 +27,18 @@ jest.mock('path', () => ({
|
||||||
|
|
||||||
describe('fn:getPresetAsset', () => {
|
describe('fn:getPresetAsset', () => {
|
||||||
it('use all templates', async () => {
|
it('use all templates', async () => {
|
||||||
const assets = [await getPresetAsset()];
|
const asset = await getPresetAsset();
|
||||||
const context = await resolveContext(assets, {
|
const context = await resolveContext({
|
||||||
target: { name: 'preset', root: '/', package: {} },
|
graph: [{ name: 'preset', asset, nodes: [] }],
|
||||||
custom: { preset: 'preset' },
|
context: {
|
||||||
|
target: { name: 'preset', root: '/', package: {} },
|
||||||
|
custom: { preset: 'preset' },
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// load all potential dynamic content
|
// load all potential dynamic content
|
||||||
await resolveDynamicMap(assets, context, 'supplementaryConfig');
|
await loadDynamicMap(asset.supplementaryConfig, context);
|
||||||
await resolveDynamicMap(assets, context, 'template');
|
await loadDynamicMap(asset.template, context);
|
||||||
|
|
||||||
const TEMPLATES = resolve(__dirname, '..', 'templates');
|
const TEMPLATES = resolve(__dirname, '..', 'templates');
|
||||||
const allTemplates = await readdirSync(TEMPLATES);
|
const allTemplates = await readdirSync(TEMPLATES);
|
||||||
|
|
Loading…
Reference in New Issue