Skip to content

Commit

Permalink
feat(ui/website): use shared libs configs
Browse files Browse the repository at this point in the history
  • Loading branch information
MFarabi619 committed Nov 19, 2024
1 parent d3a1ff3 commit d37a8c7
Show file tree
Hide file tree
Showing 33 changed files with 809 additions and 120 deletions.
2 changes: 1 addition & 1 deletion apps/website/app/nx-welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ export function NxWelcome({ title }: { title: string }) {
`,
}}
/>
<div className="wrapper bg-black">
<div className="wrapper bg-red-400">
<div className="container">
<div id="welcome">
<h1>
Expand Down
10 changes: 2 additions & 8 deletions apps/website/app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LinksFunction, MetaFunction } from '@remix-run/node'
import type { LinksFunction } from '@remix-run/node'

import {
Links,
Expand All @@ -7,16 +7,10 @@ import {
Scripts,
ScrollRestoration,
} from '@remix-run/react'
import twStyles from './tailwind.css'

export const meta: MetaFunction = () => [
{
title: 'New Remix App',
},
]
import '@cuhacking/utils/global.css'

export const links: LinksFunction = () => [
{ rel: 'stylesheet', href: twStyles },
{ rel: 'preconnect', href: 'https://fonts.googleapis.com' },
{
rel: 'preconnect',
Expand Down
4 changes: 2 additions & 2 deletions apps/website/app/routes/_index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import NxWelcome from '../nx-welcome'

export const meta: MetaFunction = () => {
return [
{ title: 'New Remix App' },
{ name: 'description', content: 'Welcome to Remix!' },
{ title: 'cuHacking 2025' },
{ name: 'description', content: 'Carleton University\'s Official Hackathon.' },
]
}

Expand Down
3 changes: 0 additions & 3 deletions apps/website/app/tailwind.css

This file was deleted.

28 changes: 16 additions & 12 deletions apps/website/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import type { Config } from 'tailwindcss'
import { createGlobPatternsForDependencies } from '@nx/react/tailwind'
// import type { Config } from 'tailwindcss'
// import { createGlobPatternsForDependencies } from '@nx/react/tailwind'

export default {
content: [
'./app/**/*.{js,jsx,ts,tsx}',
...createGlobPatternsForDependencies(__dirname),
],
theme: {
extend: {},
},
plugins: [],
} satisfies Config
// export default {
// content: [
// './app/**/*.{js,jsx,ts,tsx}',
// ...createGlobPatternsForDependencies(__dirname),
// ],
// theme: {
// extend: {},
// },
// plugins: [],
// } satisfies Config

import { buildConfig } from '../../libs/shared/utils/src/tailwind.config'

export default buildConfig(__dirname)
15 changes: 15 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": false,
"tailwind": {
"config": "libs/shared/utils/tailwind.config.js",
"css": "libs/shared/utils/global.css",
"baseColor": "neutral",
"cssVariables": true
},
"aliases": {
"components": "@cuhacking/ui",
"utils": "@cuhacking/utils"
}
}
2 changes: 1 addition & 1 deletion libs/shared/config/tailwind/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createGlobPatternsForDependencies } from '@nx/react/tailwind'

export default {
content: [
'./app/**/*.{js,jsx,ts,tsx}',
'{src,pages,components,app}/**/*!(*.stories|*.spec).{ts,tsx,html}',
...createGlobPatternsForDependencies(__dirname),
],
theme: {
Expand Down
12 changes: 12 additions & 0 deletions libs/shared/ui/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
[
"@nx/react/babel",
{
"runtime": "automatic",
"useBuiltIns": "usage"
}
]
],
"plugins": []
}
16 changes: 0 additions & 16 deletions libs/shared/ui/.storybook/main.ts

This file was deleted.

Empty file.
37 changes: 37 additions & 0 deletions libs/shared/ui/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// const nx = require("@nx/eslint-plugin");
// const baseConfig = require("../../eslint.config.js");

// module.exports = [
// ...baseConfig,
// ...nx.configs["flat/react"],
// {
// files: [
// "**/*.ts",
// "**/*.tsx",
// "**/*.js",
// "**/*.jsx"
// ],
// // Override or add rules here
// rules: {}
// }
// ];

import baseConfigPromise from '../../../eslint.config.js'

export default (async () => {
const baseConfig = await baseConfigPromise

return [
...baseConfig,
{
files: [
'**/*.ts',
'**/*.tsx',
'**/*.js',
'**/*.jsx',
],
// Override or add rules here
rules: {},
},
]
})()
12 changes: 0 additions & 12 deletions libs/shared/ui/package.json

This file was deleted.

9 changes: 6 additions & 3 deletions libs/shared/ui/project.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"name": "ui",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/shared/ui/src",
"projectType": "library",
"tags": [],
"// targets": "to see all targets run: nx show project ui --web",
"targets": {}
"targets": {
"add-component": {
"executor": "@nx-extend/shadcn-ui:add"
}
}
}
1 change: 0 additions & 1 deletion libs/shared/ui/src/index.ts

This file was deleted.

9 changes: 0 additions & 9 deletions libs/shared/ui/src/lib/ui.stories.tsx

This file was deleted.

9 changes: 0 additions & 9 deletions libs/shared/ui/src/lib/ui.tsx

This file was deleted.

5 changes: 2 additions & 3 deletions libs/shared/ui/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"jsx": "react-jsx",
"allowJs": false,
"strict": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": false
},
"references": [
{
"path": "./tsconfig.storybook.json"
"path": "./tsconfig.lib.json"
}
],
"files": [],
Expand Down
23 changes: 23 additions & 0 deletions libs/shared/ui/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"types": [
"node",
"@nx/react/typings/cssmodule.d.ts",
"@nx/react/typings/image.d.ts"
],
"outDir": "../../../dist/out-tsc"
},
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"],
"exclude": [
"jest.config.ts",
"src/**/*.spec.ts",
"src/**/*.test.ts",
"src/**/*.spec.tsx",
"src/**/*.test.tsx",
"src/**/*.spec.js",
"src/**/*.test.js",
"src/**/*.spec.jsx",
"src/**/*.test.jsx"
]
}
16 changes: 0 additions & 16 deletions libs/shared/ui/tsconfig.storybook.json

This file was deleted.

12 changes: 12 additions & 0 deletions libs/shared/utils/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
[
"@nx/react/babel",
{
"runtime": "automatic",
"useBuiltIns": "usage"
}
]
],
"plugins": []
}
7 changes: 7 additions & 0 deletions libs/shared/utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# utils

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `nx test utils` to execute the unit tests via [Jest](https://jestjs.io).
37 changes: 37 additions & 0 deletions libs/shared/utils/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// const nx = require("@nx/eslint-plugin");
// const baseConfig = require("../../eslint.config.js");

// module.exports = [
// ...baseConfig,
// ...nx.configs["flat/react"],
// {
// files: [
// "**/*.ts",
// "**/*.tsx",
// "**/*.js",
// "**/*.jsx"
// ],
// // Override or add rules here
// rules: {}
// }
// ];

import baseConfigPromise from '../../../eslint.config.js'

export default (async () => {
const baseConfig = await baseConfigPromise

return [
...baseConfig,
{
files: [
'**/*.ts',
'**/*.tsx',
'**/*.js',
'**/*.jsx',
],
// Override or add rules here
rules: {},
},
]
})()
9 changes: 9 additions & 0 deletions libs/shared/utils/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "utils",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/shared/utils/src",
"projectType": "library",
"tags": [],
"// targets": "to see all targets run: nx show project utils --web",
"targets": {}
}
6 changes: 6 additions & 0 deletions libs/shared/utils/src/cn.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { type ClassValue, clsx } from 'clsx'
import { twMerge } from 'tailwind-merge'

export const cn = function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
Loading

0 comments on commit d37a8c7

Please sign in to comment.