chore!: remove Name from default data

This commit is contained in:
2024-01-21 03:34:44 +02:00
committed by Chen Asraf
parent c6b185cd8f
commit c04d1cc42a
3 changed files with 5 additions and 5 deletions

View File

@@ -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 */

View File

@@ -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,