Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed prisma plugin from package.json of template #65

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/commands/create/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,45 @@ export default async function create(
const gitFilePath = path.join(process.cwd(),projectName, ".git");
fsExtras.removeSync(gitFilePath);

const addPackageToDependencies = (
packageName: string,
packageVersion: string,
packageJsonPath: string
) => {
// Read the existing package.json file
fsExtras.readFile(packageJsonPath, 'utf8', (err: any, data: any) => {
if (err) {
console.error('Error reading package.json:', err);
return;
}

try {
const packageJson = JSON.parse(data);

// Add the package to the dependencies
packageJson.dependencies = packageJson.dependencies || {};
packageJson.dependencies[packageName] = packageVersion;

// Write the updated package.json back to the file
fsExtras.writeFile(
packageJsonPath,
JSON.stringify(packageJson, null, 2),
'utf8',
(err: any) => {
if (err) {
console.error('Error writing package.json:', err);
return;
}
}
);
} catch (parseError) {
console.error('Error parsing package.json:', parseError);
}
});
};

await addPackageToDependencies('@godspeedsystems/plugins-prisma-as-datastore','latest',`${projectDirPath}/package.json`)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just do the npm install to install plugin instead of re-writing package.json


await installDependencies(projectDirPath,projectName);

try {
Expand Down
Loading