chore: Update package.json scripts for backend and frontend
This commit is contained in:
parent
da38227067
commit
d83803394b
6 changed files with 889 additions and 106 deletions
43
tooling/updatePackages.ts
Normal file
43
tooling/updatePackages.ts
Normal file
|
@ -0,0 +1,43 @@
|
|||
import { readFileSync, writeFileSync } from 'fs';
|
||||
|
||||
const rootConfigPath = './package.json';
|
||||
const rootConfig = JSON.parse(readFileSync(rootConfigPath, 'utf8'));
|
||||
|
||||
// Read the package.json file
|
||||
const packageJsonPath = './frontend/package.json';
|
||||
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
||||
|
||||
packageJson.name = rootConfig.name + '_frontend';
|
||||
packageJson.version = rootConfig.version;
|
||||
packageJson.description = rootConfig.description;
|
||||
packageJson.author = rootConfig.author;
|
||||
packageJson.license = rootConfig.license;
|
||||
packageJson.repository = rootConfig.repository;
|
||||
packageJson.bugs = rootConfig.bugs;
|
||||
packageJson.homepage = rootConfig.homepage;
|
||||
packageJson.contributors = rootConfig.contributors;
|
||||
packageJson.keywords = rootConfig.keywords;
|
||||
|
||||
// Write the updated package.json file
|
||||
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
||||
|
||||
// Read the composer.json file
|
||||
const composerJsonPath = './backend/composer.json';
|
||||
const composerJson = JSON.parse(readFileSync(composerJsonPath, 'utf8'));
|
||||
|
||||
composerJson.name ='josunlp/' + rootConfig.name + '_backend';
|
||||
composerJson.version = rootConfig.version;
|
||||
composerJson.description = rootConfig.description;
|
||||
composerJson.authors = rootConfig.contributors.map((contributor: any) => {
|
||||
return {
|
||||
name: contributor.name,
|
||||
email: contributor.email
|
||||
};
|
||||
});
|
||||
composerJson.license = rootConfig.license;
|
||||
composerJson.keywords = rootConfig.keywords;
|
||||
|
||||
// Write the updated composer.json file
|
||||
writeFileSync(composerJsonPath, JSON.stringify(composerJson, null, 2));
|
||||
|
||||
console.log('Updated package.json and composer.json files');
|
Loading…
Add table
Add a link
Reference in a new issue