rwsdk 1.0.0-alpha.20-test.20250929174617 → 1.0.0-alpha.20-test.20250929180819
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/scripts/addon.mjs +11 -14
- package/package.json +1 -1
package/dist/scripts/addon.mjs
CHANGED
|
@@ -7,26 +7,20 @@ import path from "node:path";
|
|
|
7
7
|
import { Readable } from "node:stream";
|
|
8
8
|
import { pipeline } from "node:stream/promises";
|
|
9
9
|
async function getRwSdkProjectRootDir(cwd) {
|
|
10
|
-
const pnpmWorkspaceYamlPath = await findUp("pnpm-workspace.yaml", { cwd });
|
|
11
|
-
if (pnpmWorkspaceYamlPath) {
|
|
12
|
-
return path.dirname(pnpmWorkspaceYamlPath);
|
|
13
|
-
}
|
|
14
10
|
const packageJsonPath = await findUp("package.json", { cwd });
|
|
15
11
|
if (packageJsonPath) {
|
|
16
|
-
|
|
17
|
-
const packageJson = JSON.parse(packageJsonContent);
|
|
18
|
-
if (packageJson.workspaces) {
|
|
19
|
-
return path.dirname(packageJsonPath);
|
|
20
|
-
}
|
|
12
|
+
return path.dirname(packageJsonPath);
|
|
21
13
|
}
|
|
22
|
-
// If not in a monorepo, assume the current directory is the project root
|
|
23
14
|
return cwd;
|
|
24
15
|
}
|
|
25
16
|
export const addon = async () => {
|
|
26
|
-
const addonName = process.argv[
|
|
27
|
-
|
|
17
|
+
const addonName = process.argv[2];
|
|
18
|
+
console.log(process.argv);
|
|
19
|
+
if (!addonName ||
|
|
20
|
+
process.argv.find((arg) => arg === "-h") ||
|
|
21
|
+
process.argv.find((arg) => arg === "--help")) {
|
|
28
22
|
console.error("Please specify the addon name.");
|
|
29
|
-
console.error(
|
|
23
|
+
console.error(`Usage: npx rwsdk addon <addon-name>`);
|
|
30
24
|
process.exit(1);
|
|
31
25
|
}
|
|
32
26
|
try {
|
|
@@ -34,7 +28,10 @@ export const addon = async () => {
|
|
|
34
28
|
const packageJsonPath = path.resolve(projectRootDir, "package.json");
|
|
35
29
|
const packageJsonContent = await fs.readFile(packageJsonPath, "utf-8");
|
|
36
30
|
const { dependencies, devDependencies } = JSON.parse(packageJsonContent);
|
|
37
|
-
|
|
31
|
+
let rwsdkVersion = dependencies?.rwsdk || devDependencies?.rwsdk;
|
|
32
|
+
if (rwsdkVersion === "workspace:*") {
|
|
33
|
+
throw new Error('The "rwsdk" dependency is set to "workspace:*". Please use a specific version of the SDK.');
|
|
34
|
+
}
|
|
38
35
|
if (!rwsdkVersion) {
|
|
39
36
|
console.error('Could not find "rwsdk" in your dependencies or devDependencies.');
|
|
40
37
|
process.exit(1);
|
package/package.json
CHANGED