diff --git a/src/index.ts b/src/index.ts index 5f96496..3d253a8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -42,9 +42,9 @@ async function main() { // 2. Get Configs and modules const { configs, modules } = getConfigs(preferences) - /* - await wrapInSpinner('Building `package.json`', buildPackage, template.dir, configs, modules) - */ + // 3. Build `package.json` + await wrapInSpinner('Building `package.json`', buildPackage, preferences, configs, modules) + // 4. Build `nuxt.config.ts` await wrapInSpinner('Building `nuxt.config.ts`', buildNuxtConfig, template.dir, configs, modules) diff --git a/src/steps/3.buildPackage.ts b/src/steps/3.buildPackage.ts index 7a45961..ce1582f 100644 --- a/src/steps/3.buildPackage.ts +++ b/src/steps/3.buildPackage.ts @@ -1,8 +1,8 @@ -import type { Config, Dependency, ModuleConfig, Script } from '../types' +import type { Config, Dependency, ModuleConfig, Preferences, Script } from '../types' import { addPackageDependencies } from '../utils/package/addPackageDependency' import { addPackageScripts } from '../utils/package/addPackageScript' -export default async function (templateDir: string, configs: Config[], modules: ModuleConfig[]) { +export default async function (preferences: Preferences, configs: Config[], modules: ModuleConfig[]) { // If no configs or modules were passed, skip. if (configs.length === 0 && modules.length === 0) { return @@ -23,13 +23,13 @@ export default async function (templateDir: string, configs: Config[], modules: // 2. Add the dependencies to the `package.json` await addPackageDependencies({ - projectDir: templateDir, + projectDir: preferences.setProjectName, dependencies: dependenciesToAdd }) // 3. Add the scripts to the `package.json` await addPackageScripts({ - projectDir: templateDir, + projectDir: preferences.setProjectName, scripts: scriptsToAdd }) }