-
Notifications
You must be signed in to change notification settings - Fork 218
chore: separate yarn workspaces #2790
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
133 changes: 133 additions & 0 deletions
133
dynamic-plugins/.yarn/patches/@backstage-plugin-auth-node-npm-0.6.0-69f2f0dc3f.patch
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,51 +1,115 @@ | ||
| const fs = require('fs'); | ||
| const path = require('path'); | ||
| const process = require('process'); | ||
| const fs = require("fs").promises; // Use the promises API | ||
| const path = require("path"); | ||
| const process = require("process"); | ||
|
|
||
| process.chdir(path.join(__dirname, '..')); | ||
|
|
||
| if (!process.argv[2]) { | ||
| console.log('Usage: node copy-plugins.js <destination directory>'); | ||
| process.exit(1); | ||
| // Helper function to check if a directory exists | ||
| async function directoryExists(dirPath) { | ||
| try { | ||
| const stats = await fs.stat(dirPath); | ||
| return stats.isDirectory(); | ||
| } catch (error) { | ||
| if (error.code === "ENOENT") { | ||
| return false; | ||
| } | ||
| throw error; // Re-throw unexpected errors | ||
| } | ||
| } | ||
|
|
||
| const destination = process.argv[2]; | ||
| fs.mkdirSync(destination, { recursive: true }); | ||
| async function main() { | ||
| process.chdir(path.join(__dirname, "..")); | ||
|
|
||
| const wrappersDir = path.join('.', 'wrappers'); | ||
| if (!process.argv[2]) { | ||
| console.log("Usage: node copy-plugins.js <destination directory>"); | ||
| process.exit(1); | ||
| } | ||
|
|
||
| const wrappers = fs | ||
| .readdirSync(wrappersDir, { | ||
| withFileTypes: true, | ||
| }) | ||
| .filter(dirent => dirent.isDirectory()) | ||
| .map(dirent => path.join(wrappersDir, dirent.name)); | ||
| const destination = process.argv[2]; | ||
| // Ensure destination exists using async mkdir | ||
| await fs.mkdir(destination, { recursive: true }); | ||
| console.log(`Ensured destination directory exists: ${destination}`); | ||
|
|
||
| for (const directory of wrappers) { | ||
| const distDynamicDir = path.join(directory, 'dist-dynamic'); | ||
| const wrappersDir = path.join(".", "wrappers"); | ||
|
|
||
| const packageToCopy = fs.existsSync(distDynamicDir) | ||
| ? distDynamicDir | ||
| : directory; | ||
| // Read directories asynchronously | ||
| const dirents = await fs.readdir(wrappersDir, { withFileTypes: true }); | ||
|
|
||
| const pkgJsonPath = path.join(packageToCopy, 'package.json'); | ||
| if (!fs.existsSync(pkgJsonPath)) { | ||
| console.error(`No 'package.json' in '${directory}': skipping`); | ||
| continue; | ||
| } | ||
| const pkgJson = require(fs.realpathSync(pkgJsonPath)); | ||
| if (!pkgJson?.name) { | ||
| console.error( | ||
| `Package '${directory}' is missing 'package.json' or 'name' attribute.`, | ||
| ); | ||
| continue; | ||
| } | ||
| const copyName = pkgJson.name.replace(/^@/, '').replace(/\//, '-'); | ||
| const wrapperDirs = dirents | ||
| .filter((dirent) => dirent.isDirectory()) | ||
| .map((dirent) => path.join(wrappersDir, dirent.name)); | ||
|
|
||
| // Create an array of promises, one for each directory processing task | ||
| const copyPromises = wrapperDirs.map(async (directory) => { | ||
| try { | ||
| const distDynamicDir = path.join(directory, "dist-dynamic"); | ||
| let packageToCopy = directory; // Default source | ||
|
|
||
| // Check asynchronously if dist-dynamic exists and is a directory | ||
| if (await directoryExists(distDynamicDir)) { | ||
| packageToCopy = distDynamicDir; | ||
| } | ||
|
|
||
| const pkgJsonPath = path.join(packageToCopy, "package.json"); | ||
| let pkgJson; | ||
| try { | ||
| // Read and parse package.json asynchronously | ||
| const pkgJsonContent = await fs.readFile(pkgJsonPath, "utf-8"); | ||
| pkgJson = JSON.parse(pkgJsonContent); | ||
| } catch (error) { | ||
| if (error.code === "ENOENT") { | ||
| console.error( | ||
| `Skipping '${directory}': No 'package.json' found in '${packageToCopy}'`, | ||
| ); | ||
| return; // Skip this directory successfully (promise resolves) | ||
| } | ||
| // Re-throw other read/parse errors | ||
| throw new Error( | ||
| `Error reading package.json from ${pkgJsonPath}: ${error.message}`, | ||
| ); | ||
| } | ||
|
|
||
| console.log(`Copying ${packageToCopy} to ${destination}`); | ||
| const destinationDir = path.join(destination, copyName); | ||
| fs.rmSync(destinationDir, { recursive: true, force: true }); | ||
| fs.cpSync(fs.realpathSync(packageToCopy), destinationDir, { | ||
| recursive: true, | ||
| if (!pkgJson?.name) { | ||
| console.error( | ||
| `Skipping '${directory}': Invalid 'package.json' in '${packageToCopy}' (missing 'name' attribute).`, | ||
| ); | ||
| return; // Skip this directory successfully (promise resolves) | ||
| } | ||
|
|
||
| const copyName = pkgJson.name.replace(/^@/, "").replace(/\//, "-"); | ||
| const destinationDir = path.join(destination, copyName); | ||
| // Get the real path of the source directory asynchronously | ||
| const sourceRealPath = await fs.realpath(packageToCopy); | ||
|
|
||
| console.log( | ||
| `Processing ${pkgJson.name}: Copying ${sourceRealPath} to ${destinationDir}`, | ||
| ); | ||
|
|
||
| // Remove destination directory asynchronously | ||
| await fs.rm(destinationDir, { recursive: true, force: true }); | ||
|
|
||
| // Copy directory asynchronously | ||
| await fs.cp(sourceRealPath, destinationDir, { recursive: true }); | ||
|
|
||
| console.log(`Finished copying ${pkgJson.name} to ${destinationDir}`); | ||
| } catch (error) { | ||
| // Log the error and re-throw to make Promise.all fail | ||
| console.error(`Error processing directory '${directory}':`, error); | ||
| throw error; | ||
| } | ||
| }); | ||
|
|
||
| // Wait for all copy operations to complete | ||
| try { | ||
| await Promise.all(copyPromises); | ||
| console.log("\nAll plugins copied successfully."); | ||
| } catch (error) { | ||
| // Error is already logged in the individual promise catch block | ||
| console.error("\nOne or more plugins failed to copy. See errors above."); | ||
| process.exit(1); // Exit with error status | ||
| } | ||
| } | ||
|
|
||
| // Run the main async function and catch any top-level errors | ||
| main().catch((err) => { | ||
| console.error("Script execution failed:", err); | ||
| process.exit(1); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| { | ||
| "name": "dynamic-plugins-root", | ||
| "version": "1.7.0", | ||
| "private": true, | ||
| "engines": { | ||
| "node": "22" | ||
| }, | ||
| "scripts": { | ||
| "build": "turbo run build", | ||
| "tsc": "turbo run tsc", | ||
| "export-dynamic": "turbo run export-dynamic", | ||
| "export-dynamic:clean": "turbo run export-dynamic:clean", | ||
| "copy-dynamic-plugins": "turbo copy-dynamic-plugins --", | ||
| "clean": "turbo run clean", | ||
| "test": "turbo run test", | ||
| "lint:check": "turbo run lint:check", | ||
| "lint:fix": "turbo run lint:fix" | ||
| }, | ||
| "workspaces": { | ||
| "packages": [ | ||
| "_utils", | ||
| "wrappers/*" | ||
| ] | ||
| }, | ||
| "devDependencies": { | ||
| "turbo": "2.5.0" | ||
| }, | ||
| "resolutions": { | ||
| "@types/react": "18.3.20", | ||
| "@types/react-dom": "18.3.6", | ||
| "@rjsf/utils": "=5.24.0", | ||
| "@aws-sdk/util-utf8-browser": "npm:@smithy/util-utf8@~2", | ||
| "@kubernetes/client-node@npm:0.20.0/jsonpath-plus": "^10.3.0", | ||
| "@backstage/plugin-auth-node@^0.6.0": "patch:@backstage/plugin-auth-node@npm%3A0.6.0#./.yarn/patches/@backstage-plugin-auth-node-npm-0.6.0-69f2f0dc3f.patch", | ||
| "@backstage/plugin-auth-node@0.6.0": "patch:@backstage/plugin-auth-node@npm%3A0.6.0#./.yarn/patches/@backstage-plugin-auth-node-npm-0.6.0-69f2f0dc3f.patch", | ||
| "@backstage/plugin-auth-node@^0.5.6": "patch:@backstage/plugin-auth-node@npm%3A0.6.0#./.yarn/patches/@backstage-plugin-auth-node-npm-0.6.0-69f2f0dc3f.patch", | ||
| "@backstage/plugin-auth-node@^0.5.1": "patch:@backstage/plugin-auth-node@npm%3A0.6.0#./.yarn/patches/@backstage-plugin-auth-node-npm-0.6.0-69f2f0dc3f.patch", | ||
| "@backstage/plugin-auth-node@^0.4.17": "patch:@backstage/plugin-auth-node@npm%3A0.6.0#./.yarn/patches/@backstage-plugin-auth-node-npm-0.6.0-69f2f0dc3f.patch", | ||
| "@backstage/plugin-auth-node@^0.4.13": "patch:@backstage/plugin-auth-node@npm%3A0.6.0#./.yarn/patches/@backstage-plugin-auth-node-npm-0.6.0-69f2f0dc3f.patch", | ||
| "@backstage/plugin-auth-node@^0.5.2": "patch:@backstage/plugin-auth-node@npm%3A0.6.0#./.yarn/patches/@backstage-plugin-auth-node-npm-0.6.0-69f2f0dc3f.patch", | ||
| "@backstage/plugin-auth-node@^0.4.16": "patch:@backstage/plugin-auth-node@npm%3A0.6.0#./.yarn/patches/@backstage-plugin-auth-node-npm-0.6.0-69f2f0dc3f.patch" | ||
| }, | ||
| "packageManager": "yarn@3.8.7" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| { | ||
| "$schema": "https://turbo.build/schema.json", | ||
| "tasks": { | ||
| "export-dynamic": { | ||
| "dependsOn": ["tsc"] | ||
| }, | ||
| "export-dynamic:clean": { | ||
| "cache": false, | ||
| "dependsOn": ["tsc"] | ||
| }, | ||
| "start": { | ||
| "cache": false, | ||
| "persistent": true | ||
| }, | ||
| "build": { | ||
| "outputs": ["dist/**"], | ||
| "dependsOn": ["tsc", "^build"] | ||
| }, | ||
| "clean": { | ||
| "cache": false | ||
| }, | ||
| "test": { | ||
| "outputs": ["coverage/**"] | ||
| }, | ||
| "lint:check": {}, | ||
| "lint:fix": { | ||
| "cache": false | ||
| }, | ||
| "tsc": { | ||
| "dependsOn": ["^tsc"] | ||
| }, | ||
| "copy-dynamic-plugins": {} | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This resolution can be removed if we switch to using @backstage-community/plugin-rbac 1.40.1