mirror of
https://github.com/chenasraf/simple-scaffold.git
synced 2026-05-17 17:28:09 +00:00
chore!: remove Name from default data
This commit is contained in:
@@ -16,7 +16,7 @@ import {
|
||||
handleTemplateFile,
|
||||
} from "./file"
|
||||
import { LogLevel, MinimalConfig, Resolver, ScaffoldCmdConfig, ScaffoldConfig } from "./types"
|
||||
import { defaultHelpers, registerHelpers } from "./parser"
|
||||
import { registerHelpers } from "./parser"
|
||||
import { log, logInitStep, logInputFile } from "./logger"
|
||||
import { parseConfigFile } from "./config"
|
||||
|
||||
@@ -57,7 +57,7 @@ export async function Scaffold(config: ScaffoldConfig): Promise<void> {
|
||||
|
||||
registerHelpers(config)
|
||||
try {
|
||||
config.data = { name: config.name, Name: defaultHelpers.pascalCase(config.name ?? ""), ...config.data }
|
||||
config.data = { name: config.name, ...config.data }
|
||||
logInitStep(config)
|
||||
for (let _template of config.templates) {
|
||||
try {
|
||||
@@ -109,7 +109,7 @@ export async function Scaffold(config: ScaffoldConfig): Promise<void> {
|
||||
* @category Main
|
||||
* @return {Promise<void>} A promise that resolves when the scaffold is complete
|
||||
*/
|
||||
Scaffold.fromConfig = async function(
|
||||
Scaffold.fromConfig = async function (
|
||||
/** The path or URL to the config file */
|
||||
pathOrUrl: string,
|
||||
/** Information needed before loading the config */
|
||||
|
||||
@@ -32,7 +32,7 @@ const fileStructWithData = {
|
||||
const fileStructNested = {
|
||||
input: {
|
||||
"{{name}}-1.txt": "This should be in root",
|
||||
"{{Name}}": {
|
||||
"{{pascalCase name}}": {
|
||||
"{{name}}-2.txt": "Hello, my value is {{value}}",
|
||||
moreNesting: {
|
||||
"{{name}}-3.txt": "Hi! My value is actually NOT {{value}}!",
|
||||
@@ -257,7 +257,7 @@ describe("Scaffold", () => {
|
||||
test("should allow override function", async () => {
|
||||
await Scaffold({
|
||||
name: "app_name",
|
||||
output: (fullPath, basedir, basename) => join("custom-output", `${basename.split(".")[0]}`),
|
||||
output: (_, __, basename) => join("custom-output", `${basename.split(".")[0]}`),
|
||||
templates: ["input"],
|
||||
data: { value: "1" },
|
||||
verbose: 0,
|
||||
|
||||
Reference in New Issue
Block a user