@hardkas/config 0.8.9-alpha → 0.8.10-alpha

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.
Files changed (2) hide show
  1. package/dist/index.js +13 -6
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -80,17 +80,24 @@ async function loadHardkasConfig(options = {}) {
80
80
  }
81
81
  async function loadConfigFile(filePath, cwd) {
82
82
  try {
83
- const isTestMode = process.env.NODE_ENV === "test" || process.env.VITEST;
84
83
  const jitiOptions = {};
85
- if (isTestMode) {
86
- try {
87
- const _dirname = path.dirname(fileURLToPath(import.meta.url));
88
- const resolvedSdk = path.resolve(_dirname, "../../sdk/src/index.ts");
84
+ try {
85
+ const _dirname = path.dirname(fileURLToPath(import.meta.url));
86
+ const resolvedSdk = path.resolve(_dirname, "../../sdk/src/index.ts");
87
+ const rootPkgPath = path.resolve(_dirname, "../../../package.json");
88
+ let isMonorepoDev = false;
89
+ if (fs.existsSync(resolvedSdk) && fs.existsSync(rootPkgPath)) {
90
+ const rootPkg = JSON.parse(fs.readFileSync(rootPkgPath, "utf8"));
91
+ if (rootPkg.name === "hardkas-monorepo") {
92
+ isMonorepoDev = true;
93
+ }
94
+ }
95
+ if (isMonorepoDev) {
89
96
  jitiOptions.alias = {
90
97
  "@hardkas/sdk": resolvedSdk
91
98
  };
92
- } catch (e) {
93
99
  }
100
+ } catch (e) {
94
101
  }
95
102
  const jiti = createJiti(import.meta.url, jitiOptions);
96
103
  const module = await jiti.import(filePath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hardkas/config",
3
- "version": "0.8.9-alpha",
3
+ "version": "0.8.10-alpha",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  ],
19
19
  "dependencies": {
20
20
  "jiti": "^2.4.2",
21
- "@hardkas/core": "0.8.9-alpha"
21
+ "@hardkas/core": "0.8.10-alpha"
22
22
  },
23
23
  "devDependencies": {
24
24
  "tsup": "^8.3.5",