makepack 1.5.5 → 1.5.7
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.
|
|
3
|
+
"version": "1.5.7",
|
|
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": [
|
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/devnax/makepack#readme",
|
|
27
27
|
"scripts": {
|
|
28
|
-
"start": "node ./src/index.js"
|
|
28
|
+
"start": "node ./src/index.js start",
|
|
29
|
+
"create": "node ./src/index.js create",
|
|
30
|
+
"build": "node ./src/index.js build"
|
|
29
31
|
},
|
|
30
32
|
"dependencies": {
|
|
31
33
|
"@vitejs/plugin-react": "^4.3.4",
|
|
@@ -33,15 +33,35 @@ const build = async () => {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
if (build.types) {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const rootDir = process.cwd(); // Get the project root directory
|
|
37
|
+
const tsconfigPath = path.join(rootDir, 'tsconfig.json');
|
|
38
|
+
|
|
39
|
+
let tsconfig = {};
|
|
40
|
+
if (fs.existsSync(tsconfigPath)) {
|
|
41
|
+
console.log("✅ Found tsconfig.json, loading...");
|
|
42
|
+
const rawConfig = fs.readFileSync(tsconfigPath, 'utf8');
|
|
43
|
+
const parsedConfig = ts.parseConfigFileTextToJson(tsconfigPath, rawConfig);
|
|
44
|
+
if (parsedConfig.error) {
|
|
45
|
+
console.error("❌ Error parsing tsconfig.json:", parsedConfig.error);
|
|
46
|
+
} else {
|
|
47
|
+
tsconfig = parsedConfig.config.compilerOptions || {};
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
console.log("⚠️ No tsconfig.json found, using default settings.");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
tsconfig = {
|
|
54
|
+
allowJs: true,
|
|
55
|
+
target: ts.ScriptTarget.ESNext,
|
|
56
|
+
skipLibCheck: true,
|
|
57
|
+
moduleResolution: ts.ModuleResolutionKind.Node10,
|
|
58
|
+
...tsconfig,
|
|
59
|
+
outDir: path.join(rootDir, 'types'),
|
|
38
60
|
declaration: true,
|
|
39
61
|
emitDeclarationOnly: true,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
esModuleInterop: true,
|
|
44
|
-
}
|
|
62
|
+
noEmit: false,
|
|
63
|
+
};
|
|
64
|
+
|
|
45
65
|
spinner.text = "Generating TypeScript declarations..."
|
|
46
66
|
const files = await glob("src/**/*.{tsx,ts,js,jsx}") || []
|
|
47
67
|
const program = ts.createProgram(files, tsconfig);
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import fs from 'fs-extra'
|
|
2
2
|
import path from 'path'
|
|
3
|
-
import { fileURLToPath } from 'url'
|
|
4
|
-
export const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
5
3
|
|
|
6
4
|
export default async () => {
|
|
7
|
-
|
|
8
|
-
const readme = fs.readFileSync(path.resolve(__dirname, '../../../../readme.md'), 'utf-8')
|
|
5
|
+
const readme = fs.readFileSync(path.join(process.cwd(), 'readme.md'), 'utf-8')
|
|
9
6
|
const content = readme
|
|
10
7
|
return {
|
|
11
8
|
content,
|
package/src/makepack-config.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import path from 'path'
|
|
2
2
|
import fs from 'fs-extra'
|
|
3
|
-
import { pathToFileURL } from 'url';
|
|
4
3
|
|
|
5
4
|
const makepackConfig = async () => {
|
|
6
|
-
const makepack = path.resolve(process.cwd(), "makepack.js");
|
|
7
5
|
|
|
8
6
|
const defaultConfig = {
|
|
9
7
|
build: {
|
|
@@ -43,10 +41,11 @@ const makepackConfig = async () => {
|
|
|
43
41
|
express: (_app) => { }
|
|
44
42
|
}
|
|
45
43
|
}
|
|
44
|
+
const configPath = path.resolve(process.cwd(), "makepack.js");
|
|
46
45
|
|
|
47
|
-
if (fs.existsSync(
|
|
46
|
+
if (fs.existsSync(configPath)) {
|
|
48
47
|
try {
|
|
49
|
-
const c = await import(
|
|
48
|
+
const c = await import(`file://${configPath}`)
|
|
50
49
|
const configFn = c.default
|
|
51
50
|
if (typeof configFn === 'function') {
|
|
52
51
|
const nc = configFn(defaultConfig)
|