Skip to content

Commit

Permalink
updated migration script to remove @janus-idp/cli from devDependencies
Browse files Browse the repository at this point in the history
Signed-off-by: Kashish Mittal <[email protected]>
  • Loading branch information
04kash committed Oct 24, 2024
1 parent 10fc48c commit 3727bc0
Showing 1 changed file with 8 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,14 @@ export default async (opts: OptionValues) => {
}
}

// remove @janus-idp/cli from devDeps
delete movedPackageJson.devDependencies['@janus-idp/cli'];

// Remove export-dynamic and export-dynamic:clean scripts if they exist
delete movedPackageJson.scripts['export-dynamic'];
delete movedPackageJson.scripts['export-dynamic:clean'];
delete movedPackageJson.scripts.postversion;

// If it's a frontend package do some magic
const frontendDevDeps = {
'@testing-library/dom': '^10.0.0',
Expand Down Expand Up @@ -518,35 +526,6 @@ export default async (opts: OptionValues) => {
console.error(`Exec failed: ${error}`);
}

// Run yarn export dynamic in each package
for (const pkg of packagesToBeMoved) {
console.log(
chalk.yellow`Running yarn export-dynamic in ${pkg.packageJson.name}`,
);
const packagePath = path.join(workspacePath, pkg.relativeDir);

try {
// Read the package.json file
const packageJsonPath = path.join(packagePath, 'package.json');
const packageJson = await fs.readFile(packageJsonPath, 'utf-8');
const packageData = JSON.parse(packageJson);

// Check if the export-dynamic script exists
if (packageData.scripts && packageData.scripts['export-dynamic']) {
await exec('yarn', ['export-dynamic', '--clean'], {
cwd: packagePath,
shell: true,
});
} else {
console.log(
chalk.yellow`Skipping ${pkg.packageJson.name}: No export-dynamic script found.`,
);
}
} catch (error) {
console.log(error);
}
}

console.log(chalk.yellow`Running yarn tsc:full in new repository`);
try {
await exec('yarn tsc:full', { cwd: workspacePath, shell: true });
Expand Down

0 comments on commit 3727bc0

Please sign in to comment.