-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f4cdef
commit 197bf7c
Showing
44 changed files
with
1,720 additions
and
1,769 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"editor.defaultFormatter": "biomejs.biome", | ||
"editor.formatOnSave": true, | ||
"editor.formatOnType": true, | ||
"[typescript]": { | ||
"editor.defaultFormatter": "biomejs.biome" | ||
}, | ||
"[typescriptreact]": { | ||
"editor.defaultFormatter": "biomejs.biome" | ||
}, | ||
"[json]": { | ||
"editor.defaultFormatter": "biomejs.biome" | ||
}, | ||
"editor.codeActionsOnSave": { | ||
"quickfix.biome": "explicit", | ||
"source.organizeImports.biome": "explicit" | ||
}, | ||
"[prisma]": { | ||
"editor.defaultFormatter": "Prisma.prisma" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,115 +1,112 @@ | ||
import { Command } from "commander"; | ||
import prompts from "prompts"; | ||
import { existsSync, promises as fs } from "node:fs"; | ||
import { resolve, dirname, relative } from "node:path"; | ||
import { fileURLToPath } from "node:url"; | ||
import chalk from "chalk"; | ||
import { Command } from 'commander' | ||
import prompts from 'prompts' | ||
import { existsSync, promises as fs } from 'node:fs' | ||
import { resolve, dirname, relative } from 'node:path' | ||
import { fileURLToPath } from 'node:url' | ||
import chalk from 'chalk' | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = dirname(__filename); | ||
const __filename = fileURLToPath(import.meta.url) | ||
const __dirname = dirname(__filename) | ||
|
||
export const init = new Command() | ||
.name("init") | ||
.description("Initialize required configuration files") | ||
.name('init') | ||
.description('Initialize required configuration files') | ||
.action(async () => { | ||
const responses = await prompts([ | ||
{ | ||
type: "toggle", | ||
name: "typescript", | ||
message: "Are you using TypeScript?", | ||
type: 'toggle', | ||
name: 'typescript', | ||
message: 'Are you using TypeScript?', | ||
initial: true, | ||
active: "yes", | ||
inactive: "no", | ||
active: 'yes', | ||
inactive: 'no' | ||
}, | ||
{ | ||
type: "text", | ||
name: "tw_config_path", | ||
message: "Enter the path where your tailwind config file is located", | ||
initial: (prev) => | ||
prev === true ? "./tailwind.config.ts" : "./tailwind.config.js", | ||
type: 'text', | ||
name: 'tw_config_path', | ||
message: 'Enter the path where your tailwind config file is located', | ||
initial: prev => (prev === true ? './tailwind.config.ts' : './tailwind.config.js') | ||
}, | ||
{ | ||
type: "toggle", | ||
name: "overwrite_tw_config", | ||
message: "Do you want to overwrite your existing tailwind config?", | ||
type: 'toggle', | ||
name: 'overwrite_tw_config', | ||
message: 'Do you want to overwrite your existing tailwind config?', | ||
initial: false, | ||
active: "yes", | ||
inactive: "no", | ||
active: 'yes', | ||
inactive: 'no' | ||
}, | ||
{ | ||
type: "text", | ||
name: "styles_path", | ||
message: "Enter the path where your styles file is located", | ||
initial: "./app/globals.css", | ||
}, | ||
]); | ||
type: 'text', | ||
name: 'styles_path', | ||
message: 'Enter the path where your styles file is located', | ||
initial: './app/globals.css' | ||
} | ||
]) | ||
|
||
await executeConfig(responses); | ||
}); | ||
await executeConfig(responses) | ||
}) | ||
|
||
async function executeConfig(responses) { | ||
const fileEnc = "utf-8"; | ||
const overwriteTWConfig = responses.overwrite_tw_config; | ||
const extension = responses.typescript ? "ts" : "js"; | ||
const configDir = resolve(__dirname, "../config"); | ||
const presetSourcePath = resolve(configDir, `rubric.preset.${extension}`); | ||
const tailwindConfigSourcePath = resolve( | ||
configDir, | ||
`tailwind.config.${extension}`, | ||
); | ||
const stylesSourcePath = resolve(configDir, "globals.css"); | ||
const fileEnc = 'utf-8' | ||
const overwriteTWConfig = responses.overwrite_tw_config | ||
const extension = responses.typescript ? 'ts' : 'js' | ||
const configDir = resolve(__dirname, '../config') | ||
const presetSourcePath = resolve(configDir, `rubric.preset.${extension}`) | ||
const tailwindConfigSourcePath = resolve(configDir, `tailwind.config.${extension}`) | ||
const stylesSourcePath = resolve(configDir, 'globals.css') | ||
|
||
const tailwindConfigDestinationPath = resolve( | ||
process.cwd(), | ||
responses.tw_config_path, | ||
); | ||
const tailwindConfigDestinationPath = resolve(process.cwd(), responses.tw_config_path) | ||
const presetDestinationPath = resolve( | ||
dirname(tailwindConfigDestinationPath), | ||
`rubric.preset.${extension}`, | ||
); | ||
const stylesDestinationPath = resolve(process.cwd(), responses.styles_path); | ||
`rubric.preset.${extension}` | ||
) | ||
const stylesDestinationPath = resolve(process.cwd(), responses.styles_path) | ||
|
||
if (existsSync(presetSourcePath)) { | ||
const presetConfig = await fs.readFile(presetSourcePath, fileEnc); | ||
await fs.writeFile(presetDestinationPath, presetConfig, fileEnc); | ||
const presetConfig = await fs.readFile(presetSourcePath, fileEnc) | ||
await fs.writeFile(presetDestinationPath, presetConfig, fileEnc) | ||
console.log( | ||
`Preset file written to ${chalk.green(relative(process.cwd(), presetDestinationPath))}`, | ||
); | ||
`Preset file written to ${chalk.green(relative(process.cwd(), presetDestinationPath))}` | ||
) | ||
} else { | ||
console.error(chalk.red("Preset file not found")); | ||
console.error(chalk.red('Preset file not found')) | ||
} | ||
|
||
if (existsSync(stylesSourcePath)) { | ||
try { | ||
const [styleInsertion, userStyles] = await Promise.all([ | ||
fs.readFile(stylesSourcePath, fileEnc), | ||
fs.readFile(stylesDestinationPath, fileEnc), | ||
]); | ||
const insertionPoint = "@tailwind utilities;"; | ||
const index = userStyles.indexOf(insertionPoint) + insertionPoint.length; | ||
const updatedStyles = `${userStyles.slice(0, index)}\n\n${styleInsertion}${userStyles.slice(index)}`; | ||
await fs.writeFile(stylesDestinationPath, updatedStyles, fileEnc); | ||
fs.readFile(stylesDestinationPath, fileEnc) | ||
]) | ||
const insertionPoint = '@tailwind utilities;' | ||
const index = userStyles.indexOf(insertionPoint) + insertionPoint.length | ||
const updatedStyles = `${userStyles.slice(0, index)}\n\n${styleInsertion}${userStyles.slice(index)}` | ||
await fs.writeFile(stylesDestinationPath, updatedStyles, fileEnc) | ||
console.log( | ||
`Styles file written to ${chalk.green(relative(process.cwd(), stylesDestinationPath))}`, | ||
); | ||
`Styles file written to ${chalk.green(relative(process.cwd(), stylesDestinationPath))}` | ||
) | ||
} catch (error) { | ||
console.error( | ||
chalk.red( | ||
"Failed to write to styles file. Ensure the path is correct and the file is writable.", | ||
), | ||
); | ||
'Failed to write to styles file. Ensure the path is correct and the file is writable.' | ||
) | ||
) | ||
} | ||
} | ||
|
||
if (!overwriteTWConfig) { | ||
const presetPrompt = `${chalk.green("+")} ${chalk.dim("presets: [")}${chalk.blue(`require("./rubric.preset.${extension}")`)}${chalk.dim("],")}`; | ||
const contentPrompt = `${chalk.green("+")} ${chalk.dim("content: [")}${chalk.blue(`"./node_modules/rubricui/dist/**/*.{js,jsx,ts,tsx}"`)}${chalk.dim("],")}`; | ||
console.log(`\nManual changes required to ${chalk.bold(`tailwind.config.${extension}`)}:\n${presetPrompt}\n${contentPrompt}`); | ||
const presetPrompt = `${chalk.green('+')} ${chalk.dim('presets: [')}${chalk.blue(`require("./rubric.preset.${extension}")`)}${chalk.dim('],')}` | ||
const contentPrompt = `${chalk.green('+')} ${chalk.dim('content: [')}${chalk.blue(`"./node_modules/rubricui/dist/**/*.{js,jsx,ts,tsx}"`)}${chalk.dim('],')}` | ||
console.log( | ||
`\nManual changes required to ${chalk.bold(`tailwind.config.${extension}`)}:\n${presetPrompt}\n${contentPrompt}` | ||
) | ||
} else if (existsSync(tailwindConfigSourcePath)) { | ||
const tailwindConfig = await fs.readFile(tailwindConfigSourcePath, fileEnc); | ||
await fs.writeFile(tailwindConfigDestinationPath, tailwindConfig, fileEnc); | ||
console.log(`Tailwind config file written to ${chalk.green(relative(process.cwd(), tailwindConfigDestinationPath))}`); | ||
const tailwindConfig = await fs.readFile(tailwindConfigSourcePath, fileEnc) | ||
await fs.writeFile(tailwindConfigDestinationPath, tailwindConfig, fileEnc) | ||
console.log( | ||
`Tailwind config file written to ${chalk.green(relative(process.cwd(), tailwindConfigDestinationPath))}` | ||
) | ||
} else { | ||
console.error(chalk.red("Tailwind config file not found")); | ||
console.error(chalk.red('Tailwind config file not found')) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
@layer base { | ||
:root { | ||
--rubricui-primary: 252 252 252; | ||
--rubricui-contrast: 5 5 5; | ||
} | ||
:root { | ||
--rubricui-primary: 252 252 252; | ||
--rubricui-contrast: 5 5 5; | ||
} | ||
|
||
.dark { | ||
--rubricui-primary: 5 5 5; | ||
--rubricui-contrast: 252 252 252; | ||
} | ||
.dark { | ||
--rubricui-primary: 5 5 5; | ||
--rubricui-contrast: 252 252 252; | ||
} | ||
} | ||
|
||
@layer base { | ||
body { | ||
@apply bg-rubricui-primary text-rubricui-contrast; | ||
font-feature-settings: "rlig" 1, "calt" 1; | ||
} | ||
button:hover { | ||
text-shadow: 0px 0px 10px rgb(var(--rubricui-primary)); | ||
} | ||
} | ||
body { | ||
@apply bg-rubricui-primary text-rubricui-contrast; | ||
font-feature-settings: "rlig" 1, "calt" 1; | ||
} | ||
button:hover { | ||
text-shadow: 0px 0px 10px rgb(var(--rubricui-primary)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,39 @@ | ||
const rubricConfig = { | ||
content: ["./node_modules/rubricui/dist/**/*.{js,jsx,ts,tsx}"], | ||
content: ['./node_modules/rubricui/dist/**/*.{js,jsx,ts,tsx}'], | ||
theme: { | ||
extend: { | ||
colors: { | ||
"rubricui-primary": "rgb(var(--rubricui-primary) / <alpha-value>)", | ||
"rubricui-contrast": "rgb(var(--rubricui-contrast) / <alpha-value>)", | ||
'rubricui-primary': 'rgb(var(--rubricui-primary) / <alpha-value>)', | ||
'rubricui-contrast': 'rgb(var(--rubricui-contrast) / <alpha-value>)' | ||
}, | ||
transitionDuration: { | ||
"rubricui-duration": "300ms", | ||
'rubricui-duration': '300ms' | ||
}, | ||
keyframes: { | ||
"rubricui-loading-rotate": { | ||
"0%": { transform: "rotate(0deg)" }, | ||
"25%": { transform: "rotate(90deg)" }, | ||
"50%": { transform: "rotate(180deg)" }, | ||
"75%": { transform: "rotate(270deg)" }, | ||
"100%": { transform: "rotate(360deg)" }, | ||
'rubricui-loading-rotate': { | ||
'0%': { transform: 'rotate(0deg)' }, | ||
'25%': { transform: 'rotate(90deg)' }, | ||
'50%': { transform: 'rotate(180deg)' }, | ||
'75%': { transform: 'rotate(270deg)' }, | ||
'100%': { transform: 'rotate(360deg)' } | ||
}, | ||
"accordion-down": { | ||
from: { height: "0" }, | ||
to: { height: "var(--radix-accordion-content-height)" }, | ||
}, | ||
"accordion-up": { | ||
from: { height: "var(--radix-accordion-content-height)" }, | ||
to: { height: "0" }, | ||
'accordion-down': { | ||
from: { height: '0' }, | ||
to: { height: 'var(--radix-accordion-content-height)' } | ||
}, | ||
'accordion-up': { | ||
from: { height: 'var(--radix-accordion-content-height)' }, | ||
to: { height: '0' } | ||
} | ||
}, | ||
animation: { | ||
"rubricui-loading-rotate": | ||
"rubricui-loading-rotate 1s steps(1) infinite", | ||
"accordion-down": "accordion-down 0.2s ease-out", | ||
"accordion-up": "accordion-up 0.2s ease-out", | ||
}, | ||
}, | ||
'rubricui-loading-rotate': 'rubricui-loading-rotate 1s steps(1) infinite', | ||
'accordion-down': 'accordion-down 0.2s ease-out', | ||
'accordion-up': 'accordion-up 0.2s ease-out' | ||
} | ||
} | ||
}, | ||
plugins: [require("tailwindcss-animate"), require("@tailwindcss/typography")], | ||
}; | ||
plugins: [require('tailwindcss-animate'), require('@tailwindcss/typography')] | ||
} | ||
|
||
export default rubricConfig; | ||
export default rubricConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,41 @@ | ||
import type { Config } from "tailwindcss"; | ||
import type { Config } from 'tailwindcss' | ||
|
||
const rubricConfig = { | ||
content: ["./node_modules/rubricui/dist/**/*.{js,jsx,ts,tsx}"], | ||
content: ['./node_modules/rubricui/dist/**/*.{js,jsx,ts,tsx}'], | ||
theme: { | ||
extend: { | ||
colors: { | ||
"rubricui-primary": "rgb(var(--rubricui-primary) / <alpha-value>)", | ||
"rubricui-contrast": "rgb(var(--rubricui-contrast) / <alpha-value>)", | ||
'rubricui-primary': 'rgb(var(--rubricui-primary) / <alpha-value>)', | ||
'rubricui-contrast': 'rgb(var(--rubricui-contrast) / <alpha-value>)' | ||
}, | ||
transitionDuration: { | ||
"rubricui-duration": "300ms", | ||
'rubricui-duration': '300ms' | ||
}, | ||
keyframes: { | ||
"rubricui-loading-rotate": { | ||
"0%": { transform: "rotate(0deg)" }, | ||
"25%": { transform: "rotate(90deg)" }, | ||
"50%": { transform: "rotate(180deg)" }, | ||
"75%": { transform: "rotate(270deg)" }, | ||
"100%": { transform: "rotate(360deg)" }, | ||
'rubricui-loading-rotate': { | ||
'0%': { transform: 'rotate(0deg)' }, | ||
'25%': { transform: 'rotate(90deg)' }, | ||
'50%': { transform: 'rotate(180deg)' }, | ||
'75%': { transform: 'rotate(270deg)' }, | ||
'100%': { transform: 'rotate(360deg)' } | ||
}, | ||
"accordion-down": { | ||
from: { height: "0" }, | ||
to: { height: "var(--radix-accordion-content-height)" }, | ||
}, | ||
"accordion-up": { | ||
from: { height: "var(--radix-accordion-content-height)" }, | ||
to: { height: "0" }, | ||
'accordion-down': { | ||
from: { height: '0' }, | ||
to: { height: 'var(--radix-accordion-content-height)' } | ||
}, | ||
'accordion-up': { | ||
from: { height: 'var(--radix-accordion-content-height)' }, | ||
to: { height: '0' } | ||
} | ||
}, | ||
animation: { | ||
"rubricui-loading-rotate": | ||
"rubricui-loading-rotate 1s steps(1) infinite", | ||
"accordion-down": "accordion-down 0.2s ease-out", | ||
"accordion-up": "accordion-up 0.2s ease-out", | ||
}, | ||
}, | ||
'rubricui-loading-rotate': 'rubricui-loading-rotate 1s steps(1) infinite', | ||
'accordion-down': 'accordion-down 0.2s ease-out', | ||
'accordion-up': 'accordion-up 0.2s ease-out' | ||
} | ||
} | ||
}, | ||
plugins: [require("tailwindcss-animate"), require("@tailwindcss/typography")], | ||
} satisfies Config; | ||
plugins: [require('tailwindcss-animate'), require('@tailwindcss/typography')] | ||
} satisfies Config | ||
|
||
export default rubricConfig; | ||
export default rubricConfig |
Oops, something went wrong.