makepack 1.5.8 → 1.5.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "makepack",
3
- "version": "1.5.8",
3
+ "version": "1.5.9",
4
4
  "type": "module",
5
5
  "description": "A CLI tool to create, build, and manage JavaScript, TypeScript, React, and React-TypeScript libraries for npm projects.",
6
6
  "files": [
@@ -33,27 +33,30 @@ const build = async () => {
33
33
  }
34
34
 
35
35
  if (build.types) {
36
- const rootDir = process.cwd(); // Get the project root directory
37
- const tsconfigPath = path.join(rootDir, 'tsconfig.json');
38
-
36
+ const tsconfigPath = path.resolve(process.cwd(), "tsconfig.json");
39
37
  let tsconfig = {};
40
38
  if (fs.existsSync(tsconfigPath)) {
41
- const rawConfig = fs.readFileSync(tsconfigPath, 'utf8');
42
- const parsedConfig = ts.parseConfigFileTextToJson(tsconfigPath, rawConfig);
43
- if (parsedConfig.error) {
44
- console.error("❌ Error parsing tsconfig.json:", parsedConfig.error);
39
+ const parsedConfig = ts.getParsedCommandLineOfConfigFile(
40
+ tsconfigPath,
41
+ {},
42
+ ts.sys
43
+ );
44
+
45
+ if (!parsedConfig) {
46
+ console.error("❌ Error parsing tsconfig.json");
47
+ process.exit(1);
45
48
  } else {
46
- tsconfig = parsedConfig.config.compilerOptions || {};
49
+ tsconfig = parsedConfig.options;
47
50
  }
48
51
  }
49
52
 
50
53
  tsconfig = {
51
54
  allowJs: true,
52
- target: ts.ScriptTarget.ESNext,
55
+ target: ts.ScriptTarget.ESNext, // Ensure it's an enum
53
56
  skipLibCheck: true,
54
57
  moduleResolution: ts.ModuleResolutionKind.Node10,
55
- ...tsconfig,
56
- outDir: path.join(outdir, 'types'),
58
+ ...tsconfig, // Preserve root tsconfig settings
59
+ outDir: path.join(outdir, "types"),
57
60
  declaration: true,
58
61
  emitDeclarationOnly: true,
59
62
  noEmit: false,