-
-
Notifications
You must be signed in to change notification settings - Fork 1
perf(core): update package manager and fix paths #276
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
Changes from all commits
f060ebd
feee232
aae8d79
3d93fe2
67ece3b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,28 +4,27 @@ import { getPackages } from "@manypkg/get-packages"; | |||||||||||||||||||||||||||||||||
| import * as cp from "node:child_process"; | ||||||||||||||||||||||||||||||||||
| import * as fs from "node:fs"; | ||||||||||||||||||||||||||||||||||
| import path from "node:path"; | ||||||||||||||||||||||||||||||||||
| import * as url from "node:url"; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (process.env.CI) process.exit(0); | ||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The removal of the |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| const sh = String.raw; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| const { packages, rootPackage } = await getPackages(process.cwd()); | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| const allRootDependencies = { | ||||||||||||||||||||||||||||||||||
| ...rootPackage?.packageJson.devDependencies, | ||||||||||||||||||||||||||||||||||
| ...rootPackage?.packageJson.dependencies, | ||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| const stephansamaPackageNames = new Set( | ||||||||||||||||||||||||||||||||||
| Object.keys(allRootDependencies).filter((dependency) => { | ||||||||||||||||||||||||||||||||||
| return dependency.startsWith("@stephansama/"); | ||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||
| Object.keys({ | ||||||||||||||||||||||||||||||||||
| ...rootPackage?.packageJson.devDependencies, | ||||||||||||||||||||||||||||||||||
| ...rootPackage?.packageJson.dependencies, | ||||||||||||||||||||||||||||||||||
| }).filter((dependency) => dependency.startsWith("@stephansama/")), | ||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| const stephansamaPackages = packages.filter((pkg) => { | ||||||||||||||||||||||||||||||||||
| return stephansamaPackageNames.has(pkg.packageJson.name); | ||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| const packageBins = new Array<string>(); | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| for (const pkg of stephansamaPackages) { | ||||||||||||||||||||||||||||||||||
| const hasAllOutputs = pkg.packageJson.files.every((file) => { | ||||||||||||||||||||||||||||||||||
| return fs.existsSync(path.resolve(pkg.dir, file)); | ||||||||||||||||||||||||||||||||||
|
|
@@ -35,8 +34,22 @@ for (const pkg of stephansamaPackages) { | |||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| console.info(`running build for ${pkg.packageJson.name}`); | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| cp.execSync(sh`pnpm --filter='${pkg.packageJson.name}' run build`, { | ||||||||||||||||||||||||||||||||||
| encoding: "utf8", | ||||||||||||||||||||||||||||||||||
| stdio: "inherit", | ||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||
| if (pkg.packageJson.bin) { | ||||||||||||||||||||||||||||||||||
| const { bin } = pkg.packageJson; | ||||||||||||||||||||||||||||||||||
| const binName = pkg.packageJson.name.replace("@stephansama/", ""); | ||||||||||||||||||||||||||||||||||
| const entries = typeof bin === "string" ? [binName] : Object.keys(bin); | ||||||||||||||||||||||||||||||||||
| packageBins.push(...entries); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| const buildPackageCommand = sh`pnpm --filter='${pkg.packageJson.name}' run build`; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| cp.execSync(buildPackageCommand, { encoding: "utf8", stdio: "inherit" }); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| const dirname = path.dirname(url.fileURLToPath(import.meta.url)); | ||||||||||||||||||||||||||||||||||
| const nodeBinDirectory = path.resolve(dirname, "../../node_modules/.bin/"); | ||||||||||||||||||||||||||||||||||
| const nodeBins = await fs.promises.readdir(nodeBinDirectory); | ||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The const nodeBins = fs.existsSync(nodeBinDirectory) ? await fs.promises.readdir(nodeBinDirectory) : []; |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (packageBins.some((bin) => !nodeBins.includes(bin))) { | ||||||||||||||||||||||||||||||||||
| cp.execSync(sh`pnpm install`, { stdio: "inherit" }); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+53
to
55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Executing
Comment on lines
+49
to
55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add error handling for missing Line 49 calls 🛡️ Proposed fix to add error handling const dirname = path.dirname(url.fileURLToPath(import.meta.url));
const nodeBinDirectory = path.resolve(dirname, "../../node_modules/.bin/");
-const nodeBins = await fs.promises.readdir(nodeBinDirectory);
+const nodeBins = fs.existsSync(nodeBinDirectory)
+ ? await fs.promises.readdir(nodeBinDirectory)
+ : [];
if (packageBins.some((bin) => !nodeBins.includes(bin))) {
cp.execSync(sh`pnpm install`, { stdio: "inherit" });
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
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.
🧩 Analysis chain
🏁 Script executed:
Repository: stephansama/packages
Length of output: 1126
🏁 Script executed:
Repository: stephansama/packages
Length of output: 410
🏁 Script executed:
fd -t f 'schema.d.*' core/multipublish/Repository: stephansama/packages
Length of output: 46
🏁 Script executed:
Repository: stephansama/packages
Length of output: 131
Update the
typesfield to point to the correct location indistdirectory.The
typesfield on line 30 points to./config/schema.d.cts, but this file does not exist. Since the schema export now points to./dist/schema.jsonand the build is configured withdts: truefor the schema entry, the type declaration file should be generated in thedistdirectory. Update the types field to./dist/schema.d.tsor the appropriate generated file location to ensure the package exports valid type definitions.🤖 Prompt for AI Agents