create-z3 0.0.26 → 0.0.27
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/index.js
CHANGED
|
@@ -2126,63 +2126,6 @@ Make sure you are authenticated with GitHub CLI (run "gh auth login")`
|
|
|
2126
2126
|
* @param convertToOklch - Whether to convert theme colors to OKLCH format (default: true)
|
|
2127
2127
|
* @returns Theme CSS content in OKLCH format (if conversion enabled)
|
|
2128
2128
|
*/
|
|
2129
|
-
async fetchThemeFromUrl(url, convertToOklch = true) {
|
|
2130
|
-
const spinner = ora("Fetching TweakCN theme...").start();
|
|
2131
|
-
try {
|
|
2132
|
-
const response = await fetch(url);
|
|
2133
|
-
if (!response.ok) {
|
|
2134
|
-
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
2135
|
-
}
|
|
2136
|
-
const html = await response.text();
|
|
2137
|
-
spinner.succeed("TweakCN theme fetched");
|
|
2138
|
-
const convertSpinner = ora("Extracting theme data...").start();
|
|
2139
|
-
try {
|
|
2140
|
-
const lightStylesMatch = html.match(/const defaultLightStyles = ({[^}]+});/);
|
|
2141
|
-
const darkStylesMatch = html.match(/const defaultDarkStyles = ({[^}]+});/);
|
|
2142
|
-
if (!lightStylesMatch || !darkStylesMatch) {
|
|
2143
|
-
throw new Error("Could not find theme data in HTML");
|
|
2144
|
-
}
|
|
2145
|
-
const lightStyles = JSON.parse(lightStylesMatch[1]);
|
|
2146
|
-
const darkStyles = JSON.parse(darkStylesMatch[1]);
|
|
2147
|
-
const css = this.generateCSSFromThemeData(lightStyles, darkStyles);
|
|
2148
|
-
convertSpinner.succeed("Theme data extracted");
|
|
2149
|
-
return css;
|
|
2150
|
-
} catch (extractError) {
|
|
2151
|
-
convertSpinner.fail("Failed to extract theme data");
|
|
2152
|
-
throw new Error(
|
|
2153
|
-
`Theme extraction failed: ${extractError instanceof Error ? extractError.message : "Unknown error"}`
|
|
2154
|
-
);
|
|
2155
|
-
}
|
|
2156
|
-
} catch (error) {
|
|
2157
|
-
spinner.fail("Failed to fetch TweakCN theme");
|
|
2158
|
-
throw new Error(
|
|
2159
|
-
`Theme fetch failed: ${error instanceof Error ? error.message : "Unknown error"}
|
|
2160
|
-
Please check the URL and your internet connection, then try again.`
|
|
2161
|
-
);
|
|
2162
|
-
}
|
|
2163
|
-
}
|
|
2164
|
-
/**
|
|
2165
|
-
* Generates CSS from TweakCN theme data objects
|
|
2166
|
-
* Converts JSON theme data to CSS custom properties
|
|
2167
|
-
*
|
|
2168
|
-
* @param lightStyles - Light theme styles object
|
|
2169
|
-
* @param darkStyles - Dark theme styles object
|
|
2170
|
-
* @returns Formatted CSS with :root and .dark blocks
|
|
2171
|
-
*/
|
|
2172
|
-
generateCSSFromThemeData(lightStyles, darkStyles) {
|
|
2173
|
-
const formatStyles = (styles) => {
|
|
2174
|
-
return Object.entries(styles).map(([key, value]) => ` --${key}: ${value};`).join("\n");
|
|
2175
|
-
};
|
|
2176
|
-
const rootBlock = `:root {
|
|
2177
|
-
${formatStyles(lightStyles)}
|
|
2178
|
-
}`;
|
|
2179
|
-
const darkBlock = `.dark {
|
|
2180
|
-
${formatStyles(darkStyles)}
|
|
2181
|
-
}`;
|
|
2182
|
-
return `${rootBlock}
|
|
2183
|
-
|
|
2184
|
-
${darkBlock}`;
|
|
2185
|
-
}
|
|
2186
2129
|
/**
|
|
2187
2130
|
* Main orchestration method for project initialization
|
|
2188
2131
|
* Coordinates all setup steps in sequence
|
|
@@ -2264,14 +2207,8 @@ ${darkBlock}`;
|
|
|
2264
2207
|
const themeSpinner = ora("Applying theme...").start();
|
|
2265
2208
|
try {
|
|
2266
2209
|
let themeContent;
|
|
2267
|
-
if (options.tweakcnTheme) {
|
|
2268
|
-
|
|
2269
|
-
themeContent = await this.fetchThemeFromUrl(options.tweakcnTheme.content);
|
|
2270
|
-
} else if (options.tweakcnTheme.type === "css") {
|
|
2271
|
-
themeContent = options.tweakcnTheme.content;
|
|
2272
|
-
} else {
|
|
2273
|
-
themeContent = options.tweakcnTheme.content;
|
|
2274
|
-
}
|
|
2210
|
+
if (options.tweakcnTheme && options.tweakcnTheme.type === "css") {
|
|
2211
|
+
themeContent = options.tweakcnTheme.content;
|
|
2275
2212
|
await this.applyTweakCNTheme(themeContent);
|
|
2276
2213
|
themeSpinner.succeed("TweakCN theme applied");
|
|
2277
2214
|
} else {
|
|
@@ -2681,16 +2618,24 @@ program.name("create-z3").version(packageJson.version).description("CLI for scaf
|
|
|
2681
2618
|
console.log(chalk2.yellow(" Your app will have no user authentication."));
|
|
2682
2619
|
console.log();
|
|
2683
2620
|
}
|
|
2684
|
-
|
|
2685
|
-
|
|
2621
|
+
console.log();
|
|
2622
|
+
console.log(chalk2.dim('\u{1F4A1} Tip: Visit a TweakCN theme, click the "Code" button, and paste the CSS here.'));
|
|
2623
|
+
console.log(chalk2.dim(" Example: https://tweakcn.com/themes/[theme-id]"));
|
|
2624
|
+
const tweakcnThemeInput = await input({
|
|
2625
|
+
message: "Paste TweakCN theme CSS (optional, press Enter to skip):",
|
|
2686
2626
|
default: ""
|
|
2687
2627
|
});
|
|
2688
2628
|
let tweakcnTheme;
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2629
|
+
const trimmedInput = tweakcnThemeInput.trim();
|
|
2630
|
+
if (trimmedInput) {
|
|
2631
|
+
if (trimmedInput.includes(":root") || trimmedInput.includes("--background") || trimmedInput.includes("oklch")) {
|
|
2632
|
+
tweakcnTheme = {
|
|
2633
|
+
type: "css",
|
|
2634
|
+
content: trimmedInput
|
|
2635
|
+
};
|
|
2636
|
+
} else {
|
|
2637
|
+
console.log(chalk2.yellow("\n\u26A0\uFE0F Invalid CSS: Expected CSS with :root and color variables. Skipping theme.\n"));
|
|
2638
|
+
}
|
|
2694
2639
|
}
|
|
2695
2640
|
const initGit = await confirm({
|
|
2696
2641
|
message: "Initialize Git repository?",
|
package/package.json
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1
5
|
import type { Where } from "better-auth/types";
|
|
2
6
|
import type {
|
|
3
7
|
GenericActionCtx,
|
|
@@ -186,7 +190,7 @@ export const convexAdapter = <DataModel extends GenericDataModel>(
|
|
|
186
190
|
return new Date(data).getTime();
|
|
187
191
|
}
|
|
188
192
|
// Handle array fields - Better Auth serializes them as JSON strings
|
|
189
|
-
if (fieldAttributes.type
|
|
193
|
+
if ((fieldAttributes.type as string)?.endsWith("[]")) {
|
|
190
194
|
if (typeof data === "string") {
|
|
191
195
|
try {
|
|
192
196
|
return JSON.parse(data);
|