@luxass/neoman
v1.1.1
Published
A small yeoman generator alternative
Downloads
71
Readme
📋 neoman
A small yeoman
alternative
📦 Installation
npm install @luxass/neoman
📚 Usage
import { createEnvironment, NeomanGenerator } from "@luxass/neoman";
function projectGenerator(): NeomanGenerator<Record<string, unknown>> {
return {
sourceRoot: "./template",
destinationRoot: "./out",
run: async (ctx) => {
// Get the context from the environment
const name = ctx.options.name;
// Copy a file
await ctx.copy(templatePath(".eslintrc"), destinationPath(".eslintrc"));
// Copy a directory
await ctx.copy(templatePath("src"), destinationPath("src"));
// Copy a template
await ctx.copyTpl(
templatePath("package.json"),
destinationPath("package.json"),
{
name: ctx.name
}
);
}
};
}
const env = createEnvironment({
generators: {
// You can register generators here
"neoman-namespace": projectGenerator
},
context: {
name: "Tim"
}
}).register("neoman-namespace:2", projectGenerator);
// This will now give your intellisense.
env.run("neoman-namespace:2");
📄 License
Published under MIT License.