fix: hook names

This commit is contained in:
cha0s 2022-03-01 10:30:33 -06:00
parent 263681344a
commit e69e162ec6
3 changed files with 8 additions and 5 deletions

View File

@ -19,7 +19,7 @@ const create = async (flecks) => {
throw new Error(`@flecks/create-app: invalid app name: ${errors.join(', ')}`);
}
const destination = join(cwd, name);
await move(name, join(__dirname, 'template'), destination, flecks);
await move(name, join(__dirname, 'template'), destination, 'app', flecks);
await build(destination);
};

View File

@ -20,7 +20,7 @@ const testDestination = async (destination) => {
}
};
export default async (name, source, destination, flecks) => {
export default async (name, source, destination, type, flecks) => {
if (!await testDestination(destination)) {
const error = new Error(
`@flecks/create-fleck: destination '${destination} already exists: aborting`,
@ -37,9 +37,12 @@ export default async (name, source, destination, flecks) => {
delete files[path];
});
// Defaults.
flecks.set('@flecks/create-fleck.packager', flecks.get('@flecks/create-fleck.packager', ['...']));
flecks.set(
`@flecks/create-${type}.packager`,
flecks.get(`@flecks/create-${type}.packager`, ['...']),
);
// Send it out.
await flecks.invokeSequentialAsync('@flecks/create-fleck/packager', fileTree);
await flecks.invokeSequentialAsync(`@flecks/create-${type}/packager`, fileTree);
// Add project name to `package.json`.
fileTree.pipe(
'package.json',

View File

@ -60,7 +60,7 @@ const create = async (flecks) => {
const path = scope && (await hasPackages(cwd)) ? join(cwd, 'packages') : cwd;
const name = [scope, pkg].filter((e) => !!e).join('/');
const destination = join(path, pkg);
await move(name, join(__dirname, 'template'), destination, flecks);
await move(name, join(__dirname, 'template'), destination, 'fleck', flecks);
await build(destination);
};