@frontfriend/tailwind 2.1.2 → 2.1.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/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var O=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var
|
|
2
|
+
var O=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var x=O((V,I)=>{var u=require("fs"),F=require("path");function D(){let e=process.cwd(),n=F.join(e,"node_modules",".cache","frontfriend","icons.json"),o=F.join(e,"types","frontfriend-icons.d.ts");u.existsSync(n)||(console.error('[FrontFriend] Error: icons.json not found. Please run "npx frontfriend setup" first.'),process.exit(1));try{let r=function(t){for(let i of Object.values(t))typeof i=="string"?s.add(i):typeof i=="object"&&i!==null&&r(i)},g=function(t,i=" "){let f=[];for(let[k,h]of Object.entries(t))typeof h=="string"?f.push(`${i}${k}: '${h}';`):typeof h=="object"&&h!==null&&(f.push(`${i}${k}: {`),f.push(g(h,i+" ")),f.push(`${i}};`));return f.join(`
|
|
3
3
|
`)};var a=r,c=g;let l=JSON.parse(u.readFileSync(n,"utf-8")),s=new Set;r(l);let p=Array.from(s).map(t=>`'${t}'`).join(" | "),y=`// Generated by @frontfriend/tailwind
|
|
4
4
|
// DO NOT EDIT THIS FILE MANUALLY
|
|
5
5
|
|
|
@@ -13,9 +13,6 @@ declare module '@frontfriend/tailwind' {
|
|
|
13
13
|
export interface TypedIconSet extends IconSetStructure {
|
|
14
14
|
${g(l)}
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
// Override the iconSet type with the typed version
|
|
18
|
-
export const iconSet: TypedIconSet;
|
|
19
16
|
}
|
|
20
17
|
|
|
21
18
|
// Augment Vue component types with exact icon names
|
|
@@ -38,8 +35,8 @@ declare module '@/src/components/ui/icon' {
|
|
|
38
35
|
declare module '@/src/components/ui/icon/Icon.vue' {
|
|
39
36
|
export type IconName = ${p||"string"};
|
|
40
37
|
}
|
|
41
|
-
`,$=F.dirname(o);u.existsSync($)||u.mkdirSync($,{recursive:!0}),u.writeFileSync(o,y),console.log("[FrontFriend] \u2713 Generated icon types at types/frontfriend-icons.d.ts");let w=F.join(e,"tsconfig.json");if(u.existsSync(w)){let t=JSON.parse(u.readFileSync(w,"utf-8"));t.include||(t.include=[]);let i="types/**/*.d.ts";t.include.includes(i)||(t.include.push(i),u.writeFileSync(w,JSON.stringify(t,null,2)),console.log("[FrontFriend] \u2713 Updated tsconfig.json to include generated types"))}}catch(l){console.error("[FrontFriend] Error generating icon types:",l.message),process.exit(1)}}require.main===I&&D();I.exports={generateIconTypes:D}});var{Command:L}=require("commander"),
|
|
42
|
-
`);let o=await new
|
|
38
|
+
`,$=F.dirname(o);u.existsSync($)||u.mkdirSync($,{recursive:!0}),u.writeFileSync(o,y),console.log("[FrontFriend] \u2713 Generated icon types at types/frontfriend-icons.d.ts");let w=F.join(e,"tsconfig.json");if(u.existsSync(w)){let t=JSON.parse(u.readFileSync(w,"utf-8"));t.include||(t.include=[]);let i="types/**/*.d.ts";t.include.includes(i)||(t.include.push(i),u.writeFileSync(w,JSON.stringify(t,null,2)),console.log("[FrontFriend] \u2713 Updated tsconfig.json to include generated types"))}}catch(l){console.error("[FrontFriend] Error generating icon types:",l.message),process.exit(1)}}require.main===I&&D();I.exports={generateIconTypes:D}});var{Command:L}=require("commander"),S=require("./lib/config/config-loader"),j=require("./lib/config/cache-manager"),{APIClient:R}=require("./lib/core/api-client"),{ComponentDownloader:q}=require("./lib/core/component-downloader"),N=require("./lib/core/token-processor"),{ConfigError:C,APIError:E,CacheError:T}=require("./lib/core/errors"),b=require("path"),m=new L;m.name("frontfriend").description("FrontFriend Tailwind CLI - Manage design tokens and cache").version("2.0.0");m.command("init").description("Initialize FrontFriend configuration and fetch from API").option("--force","Force refresh even if cache is valid").action(async e=>{try{console.log("\u{1F527} FrontFriend Setup"),console.log(`==================
|
|
39
|
+
`);let o=await new S().load();if(!o.ffId)throw new C(`ff-id not found in frontfriend.config.js
|
|
43
40
|
Please add "ff-id" to your frontfriend.config.js file`,"ff-id");console.log("\u{1F4CB} Configuration loaded"),console.log(` FF_ID: ${o.ffId}`),console.log(` App Root: ${o.appRoot}
|
|
44
41
|
`);let a=new j(o.appRoot);!e.force&&a.exists()&&a.isValid()&&(console.log("\u2705 Cache is valid and up to date"),console.log(" Use --force to refresh anyway"),process.exit(0)),console.log("\u{1F50D} Checking cache..."),e.force?console.log(` Force refresh requested
|
|
45
42
|
`):a.exists()?console.log(` Cache expired
|
|
@@ -47,17 +44,17 @@ declare module '@/src/components/ui/icon/Icon.vue' {
|
|
|
47
44
|
`),console.log("\u{1F310} Fetching configuration...");let c=new R(o.ffId,{baseURL:o["api-url"]||o.apiUrl});(o["api-url"]||o.apiUrl)&&console.log(` Using API URL: ${o["api-url"]||o.apiUrl}`);let l=null;try{l=await c.fetchProcessedTokens()}catch(d){console.log(` \u26A0\uFE0F Failed to fetch pre-processed tokens: ${d.message}`)}if(l){console.log(" \u2713 Pre-processed tokens fetched from server"),console.log(` \u2713 Skipping local processing
|
|
48
45
|
`),console.log("\u{1F4BE} Saving cache..."),a.save(l),console.log(` \u2713 Cache saved successfully
|
|
49
46
|
`),console.log("\u2705 Setup complete!"),console.log(" Your FrontFriend configuration has been cached."),console.log(" The Tailwind plugin will now use this cached data.");let d=require("fs"),P=b.join(o.appRoot,"tsconfig.json");if(d.existsSync(P)){console.log(`
|
|
50
|
-
\u{1F524} Generating TypeScript types...`);try{let{generateIconTypes:v}=
|
|
47
|
+
\u{1F524} Generating TypeScript types...`);try{let{generateIconTypes:v}=x();v()}catch(v){console.log(" \u26A0\uFE0F Type generation failed:",v.message),console.log(' Run "npx frontfriend generate-types" manually to retry')}}process.exit(0)}console.log(` \u2139\uFE0F Pre-processed tokens not available, falling back to local processing
|
|
51
48
|
`);let[s,r,g,p,y,$]=await Promise.all([c.fetchTokens(),c.fetchComponentsConfig(),c.fetchFonts(),c.fetchIcons(),c.fetchVersion(),c.fetchCustomCss()]);if(console.log(" \u2713 Tokens fetched"),s.global||s.colors||s.semantic||s.semanticDark){let d=[s.global?"global":null,s.colors?"colors":null,s.semantic?"semantic":null,s.semanticDark?"semanticDark":null].filter(Boolean).join(", ");console.log(` (Found: ${d})`)}console.log(" \u2713 Components config fetched"),console.log(" \u2713 Fonts fetched"),console.log(" \u2713 Icons fetched"),console.log(" \u2713 Version fetched"),console.log(` \u2713 Custom CSS fetched
|
|
52
49
|
`),console.log("\u2699\uFE0F Processing tokens...");let w=new N;console.log(" Processing raw token data...");let t=await w.process({colors:s.colors||s.global,semantic:s.semantic,semanticDark:s.semanticDark,fonts:g,globalTokens:s.global,animations:s.animations,version:y==null?void 0:y.version,ffId:o.ffId,customCss:$});console.log(" \u2713 Colors processed"),console.log(" \u2713 Semantic tokens processed"),t.fontFaces.length>0&&console.log(` \u2713 ${t.fontFaces.length} font faces processed`),Object.keys(t.animations).length>0&&console.log(` \u2713 ${Object.keys(t.animations).length} animations processed`),console.log(`
|
|
53
50
|
`);let i=w.extractClassesFromComponentsConfig(r),f={tokens:t.utilities,variables:t.variables,semanticVariables:t.semanticVariables,semanticDarkVariables:t.semanticDarkVariables,fonts:t.fontFaces,icons:p,componentsConfig:r,keyframes:t.keyframes,animations:t.animations,safelist:t.safelist,version:y,metadata:t.metadata,cls:i||[],custom:t.custom};console.log("\u{1F4BE} Saving cache..."),console.log(" Cache data summary:"),console.log(` - Tokens: ${Object.keys(f.tokens||{}).length} utilities`),console.log(` - Variables: ${Object.keys(f.variables||{}).length} CSS variables`),console.log(` - Semantic variables: ${Object.keys(f.semanticVariables||{}).length} semantic variables`),console.log(` - Font faces: ${(f.fonts||[]).length} fonts`),console.log(` - Classes: ${(f.cls||[]).length} extracted classes`),a.save(f),console.log(` \u2713 Cache saved successfully
|
|
54
51
|
`),console.log("\u2705 Setup complete!"),console.log(" Your FrontFriend configuration has been cached."),console.log(" The Tailwind plugin will now use this cached data.");let k=require("fs"),h=b.join(o.appRoot,"tsconfig.json");if(k.existsSync(h)){console.log(`
|
|
55
|
-
\u{1F524} Generating TypeScript types...`);try{let{generateIconTypes:d}=
|
|
56
|
-
`);let n=new
|
|
57
|
-
`);let{generateIconTypes:e}=
|
|
58
|
-
`);let n=await new
|
|
52
|
+
\u{1F524} Generating TypeScript types...`);try{let{generateIconTypes:d}=x();d()}catch(d){console.log(" \u26A0\uFE0F Type generation failed:",d.message),console.log(' Run "npx frontfriend generate-types" manually to retry')}}process.exit(0)}catch(n){n instanceof C?console.error("\u274C Configuration Error:",n.message):n instanceof E?(console.error("\u274C API Error:",n.message),console.error(` Status: ${n.statusCode}`),console.error(` URL: ${n.url}`)):n instanceof T?(console.error("\u274C Cache Error:",n.message),console.error(` Operation: ${n.operation}`)):console.error("\u274C Setup failed:",n.message),process.exit(1)}});m.command("clean").description("Remove cached configuration").action(async()=>{try{console.log(`\u{1F9F9} Cleaning FrontFriend cache...
|
|
53
|
+
`);let n=new S().load(),o=new j(n.appRoot);o.exists()?(o.clear(),console.log("\u2705 Cache cleared successfully")):console.log("\u2139\uFE0F No cache found"),process.exit(0)}catch(e){e instanceof T?(console.error("\u274C Cache Error:",e.message),console.error(` Operation: ${e.operation}`)):console.error("\u274C Clean failed:",e.message),process.exit(1)}});m.command("generate-types").description("Generate TypeScript types from cached icons.json").action(async()=>{try{console.log(`\u{1F524} Generating TypeScript types...
|
|
54
|
+
`);let{generateIconTypes:e}=x();e(),process.exit(0)}catch(e){console.error("\u274C Type generation failed:",e.message),process.exit(1)}});m.command("status").description("Show cache status and configuration").action(async()=>{try{console.log("\u{1F4CA} FrontFriend Status"),console.log(`===================
|
|
55
|
+
`);let n=await new S().load();console.log("Configuration:"),console.log(` FF_ID: ${n.ffId||"Not set"}`),console.log(` App Root: ${n.appRoot}
|
|
59
56
|
`);let o=new j(n.appRoot),a=o.getCacheDir();if(console.log("Cache:"),console.log(` Directory: ${b.relative(process.cwd(),a)}`),o.exists()){console.log(` Status: ${o.isValid()?"\u2705 Valid":"\u26A0\uFE0F Expired"}`);let c=o.load();if(c&&c.metadata){let l=new Date(c.metadata.timestamp);console.log(` Created: ${l.toLocaleString()}`),console.log(` Version: ${c.metadata.version||"Unknown"}`)}}else console.log(" Status: \u274C Not found");process.exit(0)}catch(e){e instanceof C?console.error("\u274C Configuration Error:",e.message):e instanceof T?(console.error("\u274C Cache Error:",e.message),console.error(` Operation: ${e.operation}`)):console.error("\u274C Status check failed:",e.message),process.exit(1)}});m.command("download").description("Download components from registry").argument("<components...>",'component names to download (or "all" to download all components)').option("-f, --framework <framework>","Framework to download components for (react/vue)").option("-o, --output <path>","Output directory for components").option("--overwrite","Overwrite existing files").action(async(e,n)=>{try{console.log(`\u{1F4E6} Downloading components...
|
|
60
|
-
`);let a=await new
|
|
57
|
+
`);let a=await new S().load();if(!a.ffId)throw new C(`ff-id not found in frontfriend.config.js
|
|
61
58
|
Please add "ff-id" to your frontfriend.config.js file`,"ff-id");let c=new q({appRoot:a.appRoot,config:a,framework:n.framework,outputPath:n.output,overwrite:n.overwrite}),l=e;if(e.length===1&&e[0].toLowerCase()==="all"){let r=await c.getAllComponents(),g=await c.getCustomComponents();r.length===0&&(console.error("\u274C Failed to fetch component list"),process.exit(1)),l=[...r,...g],console.log("\u{1F4CB} Configuration"),console.log(` Framework: ${c.framework}`),console.log(` Output: ${c.outputPath}`),console.log(` Components: All ${r.length} standard components`),g.length>0&&console.log(` Custom: ${g.length} custom components for ff-id: ${a.ffId||a["ff-id"]}`),console.log("")}else console.log("\u{1F4CB} Configuration"),console.log(` Framework: ${c.framework}`),console.log(` Output: ${c.outputPath}`),console.log(` Components: ${e.join(", ")}
|
|
62
59
|
`);let s=await c.downloadComponents(l);s.successful.length>0&&(console.log(`
|
|
63
60
|
\u2705 Download complete!`),console.log(` Downloaded: ${s.successful.length} components`)),s.failed.length>0&&(console.log(""),s.failed.forEach(r=>{r.error.includes("not found")?console.log(`\u274C ${r.error}`):console.log(`\u274C Failed to download ${r.component}: ${r.error}`)})),s.successful.length>0&&s.dependencies.length>0&&(console.log(`
|
|
@@ -71,9 +71,6 @@ declare module '@frontfriend/tailwind' {
|
|
|
71
71
|
export interface TypedIconSet extends IconSetStructure {
|
|
72
72
|
${generateInterface(icons)}
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
// Override the iconSet type with the typed version
|
|
76
|
-
export const iconSet: TypedIconSet;
|
|
77
74
|
}
|
|
78
75
|
|
|
79
76
|
// Augment Vue component types with exact icon names
|
package/dist/types/index.d.ts
CHANGED
|
@@ -44,6 +44,11 @@ declare module '@frontfriend/tailwind' {
|
|
|
44
44
|
variables: Record<string, string>;
|
|
45
45
|
colorMap: Record<string, string>;
|
|
46
46
|
}
|
|
47
|
+
|
|
48
|
+
// Base interface for icon set structure
|
|
49
|
+
export interface IconSetStructure {
|
|
50
|
+
[key: string]: string | IconSetStructure;
|
|
51
|
+
}
|
|
47
52
|
|
|
48
53
|
const plugin: PluginCreator<PluginOptions>;
|
|
49
54
|
export default plugin;
|
package/package.json
CHANGED
|
@@ -71,9 +71,6 @@ declare module '@frontfriend/tailwind' {
|
|
|
71
71
|
export interface TypedIconSet extends IconSetStructure {
|
|
72
72
|
${generateInterface(icons)}
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
// Override the iconSet type with the typed version
|
|
76
|
-
export const iconSet: TypedIconSet;
|
|
77
74
|
}
|
|
78
75
|
|
|
79
76
|
// Augment Vue component types with exact icon names
|