zshy 0.0.2 → 0.0.4
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/out/index.cjs +11 -21
- package/out/index.js +11 -21
- package/out/utils.cjs +1 -1
- package/out/utils.js +1 -1
- package/package.json +3 -2
package/out/index.cjs
CHANGED
|
@@ -62,10 +62,8 @@ async function main() {
|
|
|
62
62
|
let args;
|
|
63
63
|
try {
|
|
64
64
|
args = (0, arg_1.default)({
|
|
65
|
-
"--project": String,
|
|
66
65
|
"--help": Boolean,
|
|
67
66
|
// Aliases
|
|
68
|
-
"-p": "--project",
|
|
69
67
|
"-h": "--help",
|
|
70
68
|
});
|
|
71
69
|
}
|
|
@@ -82,20 +80,13 @@ async function main() {
|
|
|
82
80
|
Usage: zshy [options]
|
|
83
81
|
|
|
84
82
|
Options:
|
|
85
|
-
-p, --project <path> Path to tsconfig.json file
|
|
86
83
|
-h, --help Show this help message
|
|
87
84
|
|
|
88
85
|
Examples:
|
|
89
|
-
zshy
|
|
90
|
-
zshy -p ./tsconfig.build.json # Use specific tsconfig file
|
|
91
|
-
zshy --project ./tsconfig.prod.json
|
|
86
|
+
zshy # Use ./tsconfig.json or package.json#zshy.tsconfig
|
|
92
87
|
`);
|
|
93
88
|
process.exit(0);
|
|
94
89
|
}
|
|
95
|
-
const projectPath = args["--project"];
|
|
96
|
-
if (projectPath) {
|
|
97
|
-
console.log(`⚙️ Using custom project path: ${projectPath}`);
|
|
98
|
-
}
|
|
99
90
|
///////////////////////////////////
|
|
100
91
|
/// find and read pkg json ///
|
|
101
92
|
///////////////////////////////////
|
|
@@ -166,12 +157,12 @@ Examples:
|
|
|
166
157
|
///////////////////////////
|
|
167
158
|
// Determine tsconfig.json path
|
|
168
159
|
let tsconfigPath;
|
|
169
|
-
if (
|
|
170
|
-
// Resolve the provided
|
|
171
|
-
const resolvedProjectPath = path.resolve(
|
|
160
|
+
if (config.tsconfig) {
|
|
161
|
+
// Resolve the provided tsconfig path against package.json directory
|
|
162
|
+
const resolvedProjectPath = path.resolve(pkgJsonDir, config.tsconfig);
|
|
172
163
|
if (fs.existsSync(resolvedProjectPath)) {
|
|
173
164
|
if (fs.statSync(resolvedProjectPath).isDirectory()) {
|
|
174
|
-
console.error(`❌
|
|
165
|
+
console.error(`❌ zshy.tsconfig must point to a tsconfig.json file, not a directory: ${resolvedProjectPath}`);
|
|
175
166
|
process.exit(1);
|
|
176
167
|
}
|
|
177
168
|
else {
|
|
@@ -180,7 +171,7 @@ Examples:
|
|
|
180
171
|
}
|
|
181
172
|
}
|
|
182
173
|
else {
|
|
183
|
-
console.error(`❌
|
|
174
|
+
console.error(`❌ Tsconfig file not found: ${resolvedProjectPath}`);
|
|
184
175
|
process.exit(1);
|
|
185
176
|
}
|
|
186
177
|
}
|
|
@@ -237,12 +228,11 @@ Examples:
|
|
|
237
228
|
];
|
|
238
229
|
}
|
|
239
230
|
else {
|
|
240
|
-
console.warn(`⚠️ You're building your code to the project root. This means your compiled files will be generated alongside your source files
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
`);
|
|
231
|
+
console.warn(`⚠️ You're building your code to the project root. This means your compiled files will be generated alongside your source files.
|
|
232
|
+
➜ Ensure that your "files" in package.json excludes TypeScript source files, or your users may experience .d.ts resolution issues in some environments:
|
|
233
|
+
|
|
234
|
+
"files": ["**/*.js", "**/*.mjs", "**/*.cjs", "**/*.d.ts", "**/*.d.mts", "**/*.d.cts"],
|
|
235
|
+
`);
|
|
246
236
|
}
|
|
247
237
|
}
|
|
248
238
|
else {
|
package/out/index.js
CHANGED
|
@@ -24,10 +24,8 @@ async function main() {
|
|
|
24
24
|
let args;
|
|
25
25
|
try {
|
|
26
26
|
args = parseArgs({
|
|
27
|
-
"--project": String,
|
|
28
27
|
"--help": Boolean,
|
|
29
28
|
// Aliases
|
|
30
|
-
"-p": "--project",
|
|
31
29
|
"-h": "--help",
|
|
32
30
|
});
|
|
33
31
|
}
|
|
@@ -44,20 +42,13 @@ async function main() {
|
|
|
44
42
|
Usage: zshy [options]
|
|
45
43
|
|
|
46
44
|
Options:
|
|
47
|
-
-p, --project <path> Path to tsconfig.json file
|
|
48
45
|
-h, --help Show this help message
|
|
49
46
|
|
|
50
47
|
Examples:
|
|
51
|
-
zshy
|
|
52
|
-
zshy -p ./tsconfig.build.json # Use specific tsconfig file
|
|
53
|
-
zshy --project ./tsconfig.prod.json
|
|
48
|
+
zshy # Use ./tsconfig.json or package.json#zshy.tsconfig
|
|
54
49
|
`);
|
|
55
50
|
process.exit(0);
|
|
56
51
|
}
|
|
57
|
-
const projectPath = args["--project"];
|
|
58
|
-
if (projectPath) {
|
|
59
|
-
console.log(`⚙️ Using custom project path: ${projectPath}`);
|
|
60
|
-
}
|
|
61
52
|
///////////////////////////////////
|
|
62
53
|
/// find and read pkg json ///
|
|
63
54
|
///////////////////////////////////
|
|
@@ -128,12 +119,12 @@ Examples:
|
|
|
128
119
|
///////////////////////////
|
|
129
120
|
// Determine tsconfig.json path
|
|
130
121
|
let tsconfigPath;
|
|
131
|
-
if (
|
|
132
|
-
// Resolve the provided
|
|
133
|
-
const resolvedProjectPath = path.resolve(
|
|
122
|
+
if (config.tsconfig) {
|
|
123
|
+
// Resolve the provided tsconfig path against package.json directory
|
|
124
|
+
const resolvedProjectPath = path.resolve(pkgJsonDir, config.tsconfig);
|
|
134
125
|
if (fs.existsSync(resolvedProjectPath)) {
|
|
135
126
|
if (fs.statSync(resolvedProjectPath).isDirectory()) {
|
|
136
|
-
console.error(`❌
|
|
127
|
+
console.error(`❌ zshy.tsconfig must point to a tsconfig.json file, not a directory: ${resolvedProjectPath}`);
|
|
137
128
|
process.exit(1);
|
|
138
129
|
}
|
|
139
130
|
else {
|
|
@@ -142,7 +133,7 @@ Examples:
|
|
|
142
133
|
}
|
|
143
134
|
}
|
|
144
135
|
else {
|
|
145
|
-
console.error(`❌
|
|
136
|
+
console.error(`❌ Tsconfig file not found: ${resolvedProjectPath}`);
|
|
146
137
|
process.exit(1);
|
|
147
138
|
}
|
|
148
139
|
}
|
|
@@ -199,12 +190,11 @@ Examples:
|
|
|
199
190
|
];
|
|
200
191
|
}
|
|
201
192
|
else {
|
|
202
|
-
console.warn(`⚠️ You're building your code to the project root. This means your compiled files will be generated alongside your source files
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
`);
|
|
193
|
+
console.warn(`⚠️ You're building your code to the project root. This means your compiled files will be generated alongside your source files.
|
|
194
|
+
➜ Ensure that your "files" in package.json excludes TypeScript source files, or your users may experience .d.ts resolution issues in some environments:
|
|
195
|
+
|
|
196
|
+
"files": ["**/*.js", "**/*.mjs", "**/*.cjs", "**/*.d.ts", "**/*.d.mts", "**/*.d.cts"],
|
|
197
|
+
`);
|
|
208
198
|
}
|
|
209
199
|
}
|
|
210
200
|
else {
|
package/out/utils.cjs
CHANGED
|
@@ -69,7 +69,7 @@ function readTsconfig(tsconfigPath) {
|
|
|
69
69
|
// Parse the config
|
|
70
70
|
const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(configPath));
|
|
71
71
|
if (parsedConfig.errors.length > 0) {
|
|
72
|
-
console.error("Error parsing tsconfig.json:");
|
|
72
|
+
console.error("❌ Error parsing tsconfig.json:");
|
|
73
73
|
for (const error of parsedConfig.errors) {
|
|
74
74
|
console.error(ts.formatDiagnostic(error, {
|
|
75
75
|
getCurrentDirectory: () => ts.sys.getCurrentDirectory(),
|
package/out/utils.js
CHANGED
|
@@ -31,7 +31,7 @@ export function readTsconfig(tsconfigPath) {
|
|
|
31
31
|
// Parse the config
|
|
32
32
|
const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(configPath));
|
|
33
33
|
if (parsedConfig.errors.length > 0) {
|
|
34
|
-
console.error("Error parsing tsconfig.json:");
|
|
34
|
+
console.error("❌ Error parsing tsconfig.json:");
|
|
35
35
|
for (const error of parsedConfig.errors) {
|
|
36
36
|
console.error(ts.formatDiagnostic(error, {
|
|
37
37
|
getCurrentDirectory: () => ts.sys.getCurrentDirectory(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zshy",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Gold-standard build tool for TypeScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -63,7 +63,8 @@
|
|
|
63
63
|
},
|
|
64
64
|
"sourceDialects": [
|
|
65
65
|
"@zod/source"
|
|
66
|
-
]
|
|
66
|
+
],
|
|
67
|
+
"tsconfig": "./tsconfig.build.json"
|
|
67
68
|
},
|
|
68
69
|
"main": "./out/index.cjs",
|
|
69
70
|
"types": "./out/index.d.cts",
|