diff options
author | Pauline <git@ethanlibs.co> | 2023-11-26 22:55:04 -0500 |
---|---|---|
committer | Pauline <git@ethanlibs.co> | 2023-11-26 22:55:04 -0500 |
commit | 181547a25213bee8a20002e07344b957386c4d0f (patch) | |
tree | 1e1b4815166342406026478c00604cdd65e64660 /packages | |
parent | 955e820f1ccb59467a4f27c5c77738a7ebff193e (diff) | |
download | Nexus-181547a25213bee8a20002e07344b957386c4d0f.tar.gz Nexus-181547a25213bee8a20002e07344b957386c4d0f.tar.bz2 Nexus-181547a25213bee8a20002e07344b957386c4d0f.zip |
feat(build): transfer everything to esm/ts
Diffstat (limited to 'packages')
-rw-r--r-- | packages/config/base.tsconfig.json | 2 | ||||
-rw-r--r-- | packages/config/index.ts (renamed from packages/config/index.js) | 0 | ||||
-rw-r--r-- | packages/config/package.json | 8 | ||||
-rw-r--r-- | packages/config/vitest.shared.ts | 8 | ||||
-rw-r--r-- | packages/ui/package.json | 12 | ||||
-rw-r--r-- | packages/ui/postcss.config.js | 3 | ||||
-rw-r--r-- | packages/ui/postcss.config.ts | 8 | ||||
-rw-r--r-- | packages/ui/src/index.ts | 1 | ||||
-rw-r--r-- | packages/ui/style/index.ts (renamed from packages/ui/style/index.js) | 0 | ||||
-rw-r--r-- | packages/ui/style/postcss.config.js | 1 | ||||
-rw-r--r-- | packages/ui/style/postcss.ts | 1 | ||||
-rw-r--r-- | packages/ui/style/tailwind.ts (renamed from packages/ui/style/tailwind.js) | 34 | ||||
-rw-r--r-- | packages/ui/tailwind.config.js | 2 | ||||
-rw-r--r-- | packages/ui/tailwind.config.ts | 3 | ||||
-rw-r--r-- | packages/ui/vitest.config.ts | 3 |
15 files changed, 50 insertions, 36 deletions
diff --git a/packages/config/base.tsconfig.json b/packages/config/base.tsconfig.json index 2d27ce4..17c8f2a 100644 --- a/packages/config/base.tsconfig.json +++ b/packages/config/base.tsconfig.json @@ -17,6 +17,6 @@ "resolveJsonModule": true, "module": "ESNext", "target": "ESNext", - "types": ["vite/client"] + "types": ["vite/client", "vitest/globals"] } } diff --git a/packages/config/index.js b/packages/config/index.ts index cf96492..cf96492 100644 --- a/packages/config/index.js +++ b/packages/config/index.ts diff --git a/packages/config/package.json b/packages/config/package.json index dbdad1b..4b480ef 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -5,13 +5,17 @@ "exports": { "./*": "./*", "./vite": "./vite", - "./vite/relAlias": "./vite/relAlias" + "./vite/relAlias": "./vite/relAlias", + "./vitest": "./vitest.shared" }, + "main": "index.ts", + "types": "index.ts", "devDependencies": { "@vitejs/plugin-react": "^4.2.0", "regexpp": "^3.2.0", "vite-plugin-html": "^3.2.0", "vite-plugin-svgr": "^4.2.0", - "vite-tsconfig-paths": "^4.2.1" + "vite-tsconfig-paths": "^4.2.1", + "vitest": "^0.34.6" } } diff --git a/packages/config/vitest.shared.ts b/packages/config/vitest.shared.ts new file mode 100644 index 0000000..313a0ff --- /dev/null +++ b/packages/config/vitest.shared.ts @@ -0,0 +1,8 @@ +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + test: { + globals: true, + reporters: ['dot'], + }, +}); diff --git a/packages/ui/package.json b/packages/ui/package.json index c2c95a0..54f5c8f 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -4,16 +4,17 @@ "exports": { ".": "./src/index.ts", "./src/forms": "./src/forms/index.ts", - "./postcss": "./style/postcss.config.js", - "./tailwind": "./style/tailwind.js", - "./style": "./style/index.js", + "./postcss": "./style/postcss", + "./tailwind": "./style/tailwind", + "./style": "./style", "./style/style.scss": "./style/style.scss", "./package.json": "./package.json" }, "main": "src/index.ts", "types": "src/index.ts", "scripts": { - "typecheck": "tsc -b" + "typecheck": "tsc -b", + "test": "vitest" }, "dependencies": { "@headlessui/react": "^1.7.17", @@ -45,6 +46,7 @@ "sass": "^1.69.5", "tailwindcss": "^3.3.5", "tailwindcss-animate": "^1.0.7", - "typescript": "^5.3.2" + "typescript": "^5.3.2", + "vitest": "^0.34.6" } } diff --git a/packages/ui/postcss.config.js b/packages/ui/postcss.config.js deleted file mode 100644 index cc95735..0000000 --- a/packages/ui/postcss.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - plugins: [require('tailwindcss'), require('autoprefixer')], -}; diff --git a/packages/ui/postcss.config.ts b/packages/ui/postcss.config.ts new file mode 100644 index 0000000..2eb70ea --- /dev/null +++ b/packages/ui/postcss.config.ts @@ -0,0 +1,8 @@ +import autoprefixer from 'autoprefixer'; +import tailwindcss from 'tailwindcss'; + +const config = { + plugins: [autoprefixer(), tailwindcss()], +}; + +export default config; diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts index 904db93..98af4eb 100644 --- a/packages/ui/src/index.ts +++ b/packages/ui/src/index.ts @@ -1 +1,2 @@ export { cva, cx } from 'class-variance-authority'; +export * from './utils'; diff --git a/packages/ui/style/index.js b/packages/ui/style/index.ts index 423b033..423b033 100644 --- a/packages/ui/style/index.js +++ b/packages/ui/style/index.ts diff --git a/packages/ui/style/postcss.config.js b/packages/ui/style/postcss.config.js deleted file mode 100644 index 0b6eba2..0000000 --- a/packages/ui/style/postcss.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../postcss.config'); diff --git a/packages/ui/style/postcss.ts b/packages/ui/style/postcss.ts new file mode 100644 index 0000000..60d0ac7 --- /dev/null +++ b/packages/ui/style/postcss.ts @@ -0,0 +1 @@ +export { default } from '../postcss.config'; diff --git a/packages/ui/style/tailwind.js b/packages/ui/style/tailwind.ts index 8ebf041..73c8fc7 100644 --- a/packages/ui/style/tailwind.js +++ b/packages/ui/style/tailwind.ts @@ -1,20 +1,16 @@ -const defaultTheme = require('tailwindcss/defaultTheme'); +import type { Config } from 'tailwindcss'; -/** @type {(varName: string) => string} */ -// eslint-disable-next-line unused-imports/no-unused-vars -const alpha = varName => `hsla(var(${varName}), <alpha-value>)`; -const contentExts = `{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue,stories.tsx}`; +import forms from '@tailwindcss/forms'; +import typography from '@tailwindcss/typography'; +import headlessui from '@headlessui/tailwindcss'; +import animate from 'tailwindcss-animate'; +import radix from 'tailwindcss-radix'; -// TODO: make this not CJS +export const alpha = (varName: string) => `hsla(var(${varName}), <alpha-value>)`; +export const contentExts = `{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue,stories.tsx}`; -/** - * @param {string} app - * @param {import('tailwindcss').Config} options - * @returns {import('tailwindcss').Config} the tailwind config - */ -module.exports = (app, options) => { - /** @type {import('tailwindcss').Config} */ - const config = { +export default async (app: string, options?: Config): Promise<Config> => { + const config: Config = { content: [ `../../apps/${app}/src/**/*.${contentExts}`, `../../packages/*/src/**/*.${contentExts}`, @@ -28,7 +24,6 @@ module.exports = (app, options) => { md: '868px', lg: '1024px', xl: '1280px', - ...defaultTheme.screens, }, fontSize: { 'xs': '12px', @@ -108,18 +103,13 @@ module.exports = (app, options) => { }, }, }, - plugins: [ - require('@tailwindcss/forms'), - require('tailwindcss-animate'), - require('@headlessui/tailwindcss'), - require('tailwindcss-radix')(), - ], + plugins: [forms, animate, headlessui, radix], ...options, }; if (app === 'website') - config.plugins.push(require('@tailwindcss/typography')); + config.plugins!.push(typography); return config; }; diff --git a/packages/ui/tailwind.config.js b/packages/ui/tailwind.config.js deleted file mode 100644 index 8c53793..0000000 --- a/packages/ui/tailwind.config.js +++ /dev/null @@ -1,2 +0,0 @@ -/** @type {import('tailwindcss').Config} */ -module.exports = require('./style/tailwind')('web'); diff --git a/packages/ui/tailwind.config.ts b/packages/ui/tailwind.config.ts new file mode 100644 index 0000000..0c30ba3 --- /dev/null +++ b/packages/ui/tailwind.config.ts @@ -0,0 +1,3 @@ +import tailwindConfig from './style/tailwind'; + +export default await tailwindConfig('web'); diff --git a/packages/ui/vitest.config.ts b/packages/ui/vitest.config.ts new file mode 100644 index 0000000..3160c1a --- /dev/null +++ b/packages/ui/vitest.config.ts @@ -0,0 +1,3 @@ +import vitestShared from '@polyfrost/config/vitest.shared'; + +export default vitestShared; |