Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update deisgn/react 19/tailwind 4/components styles #44

Open
wants to merge 104 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
952a4b8
chore: run tailwind upgrade
mehdibha Nov 22, 2024
4759c10
chore: we're getting there
mehdibha Nov 22, 2024
aab0de9
fix: format
mehdibha Nov 22, 2024
2a6c2dc
fix: minor fixes
mehdibha Nov 22, 2024
4cc5365
fix: other fixes
mehdibha Nov 22, 2024
f194cee
chore: everything is working*
mehdibha Dec 1, 2024
b5fda69
fix: format
mehdibha Dec 1, 2024
f2a1be4
fix: minor fixes
mehdibha Dec 2, 2024
86e5a24
fix: format
mehdibha Dec 2, 2024
dabc983
refactor: new architecture
mehdibha Dec 3, 2024
184d126
chore: update imports
mehdibha Dec 3, 2024
eea2b7f
chore: update imports
mehdibha Dec 3, 2024
becc401
chore: remove old registry
mehdibha Dec 3, 2024
ccbb99a
chore update demos import
mehdibha Dec 3, 2024
e209e5a
refactor: refactor demos
mehdibha Dec 3, 2024
b223949
fix: format
mehdibha Dec 3, 2024
219b473
chore: clean up
mehdibha Dec 3, 2024
b88705d
fix: add missing demos
mehdibha Dec 3, 2024
ceeb460
fix: format
mehdibha Dec 3, 2024
ac6125b
fix: missing demos
mehdibha Dec 3, 2024
a7ff28c
chore: clean up
mehdibha Dec 5, 2024
9a36195
refactor: new build-registry structure
mehdibha Dec 5, 2024
5188a7f
chore: we're getting there
mehdibha Dec 7, 2024
7cf7e3d
chore: we're getting there
mehdibha Dec 7, 2024
979975b
chore: will be back
mehdibha Dec 8, 2024
fe72d73
chore: update dynamic components
mehdibha Dec 10, 2024
12db22c
refactor: clean up
mehdibha Dec 26, 2024
69e10d9
feat: add landing page
mehdibha Jan 2, 2025
0f3b2ab
fix: format
mehdibha Jan 2, 2025
108d7a3
refactor: clean up project
mehdibha Jan 9, 2025
874550d
fix: format
mehdibha Jan 9, 2025
95cfa86
feat: landing page
mehdibha Jan 9, 2025
64a49c4
core: upgrade to next 15
mehdibha Jan 10, 2025
0f9b51b
refactor:rewrite alert component
mehdibha Jan 10, 2025
135a3f2
docs: update ComponentPreview
mehdibha Jan 11, 2025
eca6ffb
feat: style switcher
mehdibha Jan 11, 2025
3d318e9
fix: format
mehdibha Jan 11, 2025
47ad9ba
feat: new variants for alert
mehdibha Jan 12, 2025
246cf28
fix: format
mehdibha Jan 12, 2025
2094b29
refactor: update registry
mehdibha Jan 14, 2025
7e51ac8
fix: update imports
mehdibha Jan 14, 2025
a03fcfd
fix: format
mehdibha Jan 14, 2025
0169680
chore: clean up
mehdibha Jan 15, 2025
9d3aaa9
refactor: update components
mehdibha Jan 17, 2025
ca57db6
refactor: group calendar and range-calendar in same file
mehdibha Jan 17, 2025
8008e96
refactor: update components
mehdibha Jan 19, 2025
ee58465
chore: remove disclosure for now
mehdibha Jan 19, 2025
5c058b2
refactor: better folder structure
mehdibha Jan 19, 2025
b12dc7a
refactor: update components
mehdibha Jan 21, 2025
8bfe233
refactor: update overlay components
mehdibha Jan 22, 2025
73d1883
docs: update overlay components
mehdibha Jan 22, 2025
afc6f43
refactor: update components
mehdibha Jan 25, 2025
89dc3d5
fix: fix component preview
mehdibha Jan 25, 2025
65aed0b
fix: update import
mehdibha Jan 25, 2025
e42392f
feat: table component
mehdibha Jan 26, 2025
e299b94
chore: update separator
mehdibha Jan 26, 2025
e95e843
Merge remote-tracking branch 'origin/main' into next
mehdibha Jan 26, 2025
7d57db3
fix: format
mehdibha Jan 26, 2025
7fc34e2
fix: format
mehdibha Jan 26, 2025
2ce79e7
feat: update progress component
mehdibha Jan 27, 2025
863e824
feat: update colorpicker component
mehdibha Jan 28, 2025
aeb0da6
fix: format
mehdibha Jan 28, 2025
d1603fb
fix: fix build errors
mehdibha Jan 28, 2025
ab65112
feat: color components
mehdibha Jan 29, 2025
318abe4
feat(cli): cli structure
mehdibha Jan 31, 2025
3472df4
fix: fix type errors
mehdibha Jan 31, 2025
0e0684b
chore: update next config
mehdibha Jan 31, 2025
f60cb17
feat: add custom portal container for demos
mehdibha Jan 31, 2025
0e92e33
chore: update docs
mehdibha Jan 31, 2025
5e19869
chore: update component preview
mehdibha Jan 31, 2025
21ac896
fix: fix build error
mehdibha Jan 31, 2025
ce9c302
fix: fix theme switcher overflow
mehdibha Jan 31, 2025
0193af1
chore: update docs
mehdibha Jan 31, 2025
82e9022
chore(docs): update components
mehdibha Jan 31, 2025
c99846f
chore(docs): update components
mehdibha Jan 31, 2025
d903aca
chore: update registry file names
mehdibha Feb 1, 2025
8841069
fix: fix type errors
mehdibha Feb 1, 2025
4110a3d
refactor: better folder structure
mehdibha Feb 1, 2025
5cf65a8
feat: style-switcher
mehdibha Feb 1, 2025
7cfed64
feat: registry
mehdibha Feb 1, 2025
b1bd2bf
chore: update registry
mehdibha Feb 1, 2025
2a0ea1a
chore: cli is getting there
mehdibha Feb 1, 2025
d9dcbf9
chore: update deps
mehdibha Feb 1, 2025
d709477
fix: format
mehdibha Feb 1, 2025
7034be7
feat(cli): update files
mehdibha Feb 2, 2025
e258ba1
chore: update registry deps
mehdibha Feb 2, 2025
624d72d
fix: format
mehdibha Feb 2, 2025
5e62705
feat(cli): update imports
mehdibha Feb 2, 2025
6699d64
chore: update registry
mehdibha Feb 2, 2025
c0fc3ab
chore: rename hook
mehdibha Feb 2, 2025
2d16f92
feat: auto install the correct icon library
mehdibha Feb 2, 2025
37c9f6b
refactor: move all schemas to a dedicated package
mehdibha Feb 3, 2025
7fe0fe2
chore: update eslint
mehdibha Feb 3, 2025
5c6c313
fix: fix lint and type errors
mehdibha Feb 3, 2025
3029f0b
fix: fix type & lint errors
mehdibha Feb 3, 2025
ee00f31
feat: new website design
mehdibha Feb 4, 2025
57cf269
feat: landing page
mehdibha Feb 5, 2025
24229e8
feat: update logo
mehdibha Feb 5, 2025
5a70b91
fix: fix lint errors
mehdibha Feb 5, 2025
c6b3c76
fix: fix type errors
mehdibha Feb 5, 2025
7c093f3
fix: fix type errors
mehdibha Feb 5, 2025
7b3bea7
fix: format
mehdibha Feb 5, 2025
e7223f4
fix: minor fixes
mehdibha Feb 5, 2025
bc85479
feat: enhance landing page
mehdibha Feb 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 11 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"build": "turbo run build",
"build:cli": "turbo --filter=dotui-cli build",
"build:www": "pnpm --filter=www build",
"build:internal-registry": "pnpm --filter=www build:internal-registry",
"build:registry": "pnpm --filter=www build:registry",
"build:docs": "pnpm --filter=www build:docs",
"dev": "turbo run dev --parallel",
Expand All @@ -42,15 +43,17 @@
"@changesets/cli": "^2.26.1",
"@commitlint/cli": "^17.6.3",
"@commitlint/config-conventional": "^17.6.3",
"@dotui/eslint-config": "workspace:*",
"@manypkg/cli": "^0.21.4",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"eslint": "^8",
"eslint-config-next": "^14.0.4",
"eslint-config-prettier": "^9.1.0",
"eslint-config-turbo": "^2.1.3",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.8",
"turbo": "^2.0.12"
"prettier": "^3.4.2",
"prettier-plugin-tailwindcss": "^0.6.11",
"turbo": "^2.4.0"
},
"packageManager": "pnpm@9.5.0"
"packageManager": "pnpm@9.5.0",
"pnpm": {
"patchedDependencies": {
"tailwind-variants": "patches/tailwind-variants.patch"
}
}
}
12 changes: 0 additions & 12 deletions packages/cli/.eslintrc.cjs

This file was deleted.

4 changes: 4 additions & 0 deletions packages/cli/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { config } from "@dotui/eslint-config/base";

/** @type {import("eslint").Linter.Config} */
export default config;
55 changes: 17 additions & 38 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"license": "MIT",
"author": {
"name": "mehdibha",
"url": "https://twitter.com/mehdibha_"
"url": "https://x.com/mehdibha_"
},
"repository": {
"type": "git",
Expand All @@ -34,8 +34,11 @@
"clean": "rimraf dist && rimraf components",
"start:dev": "cross-env REGISTRY_URL=http://localhost:3000/registry node dist/index.js",
"start": "node dist/index.js",
"lint": "eslint . --fix",
"lint:check": "eslint . --max-warnings 0",
"format": "prettier --write \"**/*.{ts,tsx,mdx}\" --cache --log-level warn",
"format:check": "prettier --check \"**/*.{ts,tsx,mdx}\" --cache --log-level warn",
"typecheck": "tsc --noEmit",
"release": "changeset version",
"pub:beta": "pnpm build && pnpm publish --no-git-checks --access public --tag beta",
"pub:next": "pnpm build && pnpm publish --no-git-checks --access public --tag next",
Expand All @@ -44,50 +47,26 @@
"test:dev": "REGISTRY_URL=http://localhost:3000/registry vitest run"
},
"dependencies": {
"@antfu/ni": "^0.21.4",
"@babel/core": "^7.22.1",
"@babel/parser": "^7.22.6",
"@babel/plugin-transform-typescript": "^7.22.5",
"async-retry": "^1.3.3",
"ci-info": "^4.0.0",
"@clack/prompts": "^0.9.1",
"@dotui/schemas": "workspace:*",
"@types/fs-extra": "^11.0.4",
"commander": "^10.0.0",
"conf": "^13.0.1",
"cosmiconfig": "^8.1.3",
"cross-spawn": "^7.0.3",
"cosmiconfig": "^9.0.0",
"deepmerge": "^4.3.1",
"diff": "^5.1.0",
"execa": "^7.0.0",
"fast-glob": "^3.3.2",
"fs-extra": "^11.1.0",
"https-proxy-agent": "^6.2.0",
"kleur": "^4.1.5",
"lodash.template": "^4.5.0",
"node-fetch": "^3.3.0",
"ora": "^6.1.2",
"execa": "^9.5.2",
"fast-glob": "^3.3.3",
"fs-extra": "^11.3.0",
"package-manager-detector": "^0.2.9",
"picocolors": "^1.1.0",
"postcss": "^8.4.31",
"prompts": "^2.4.2",
"recast": "^0.23.2",
"stringify-object": "^5.0.0",
"tar": "^7.4.3",
"ts-morph": "^18.0.0",
"ts-morph": "^25.0.0",
"tsconfig-paths": "^4.2.0",
"type-fest": "^4.33.0",
"zod": "^3.22.4"
},
"devDependencies": {
"@dotui/registry": "workspace:*",
"@types/async-retry": "^1.4.8",
"@types/babel__core": "^7.20.1",
"@types/diff": "^5.0.3",
"@types/fs-extra": "^11.0.1",
"@types/lodash.template": "^4.5.1",
"@types/prompts": "^2.4.2",
"@types/stringify-object": "^4.0.5",
"@types/validate-npm-package-name": "^4.0.2",
"rimraf": "^6.0.1",
"tailwindcss": "^3.4.3",
"tsup": "^6.6.3",
"type-fest": "^3.8.0",
"@dotui/eslint-config": "workspace:*",
"@types/node": "^18.17.0",
"tsup": "^8.3.6",
"typescript": "^5"
}
}
253 changes: 49 additions & 204 deletions packages/cli/src/commands/add.ts
Original file line number Diff line number Diff line change
@@ -1,204 +1,49 @@
import { Command } from "commander";
import path from "path";
import prompts from "prompts";
import { z } from "zod";
import { addComponents } from "@/helpers/add-components";
import { getConfig } from "@/helpers/get-config";
import { handleError } from "@/helpers/handle-error";
import { getRegistryIndex } from "@/helpers/registry";
import { highlight, logger } from "@/utils";

export const addOptionsSchema = z.object({
components: z.array(z.string()).optional(),
yes: z.boolean(),
overwrite: z.boolean(),
cwd: z.string(),
all: z.boolean(),
path: z.string().optional(),
silent: z.boolean(),
srcDir: z.boolean().optional(),
});

export const addCommand = new Command()
.name("add")
.description("add a component to your project")
.argument(
"[components...]",
"the components to add or a url to the component."
)
.option("-y, --yes", "skip confirmation prompt.", false)
.option("-o, --overwrite", "overwrite existing files.", false)
.option(
"-c, --cwd <cwd>",
"the working directory. defaults to the current directory.",
process.cwd()
)
.option("-a, --all", "add all available components", false)
.option("-p, --path <path>", "the path to add the component to.")
.option("-s, --silent", "mute output.", false)
.option(
"--src-dir",
"use the src directory when creating a new project.",
false
)
.action(async (components, opts) => {
try {
logger.log(`${highlight.warn("⚠️ dotui-cli is under development.")}`);
logger.log(`You can follow the progress on https://x.com/mehdibha_.`);
logger.break();
return;
const options = addOptionsSchema.parse({
components,
cwd: path.resolve(opts.cwd),
...opts,
});

// Confirm if user is installing themes.
// For now, we assume a theme is prefixed with "theme-".
const isTheme = options.components?.some((component) =>
component.includes("theme-")
);
if (!options.yes && isTheme) {
logger.break();
const { confirm } = await prompts({
type: "confirm",
name: "confirm",
message: highlight.warn(
"You are about to install a new theme. \nExisting CSS variables will be overwritten. Continue?"
),
});
if (!confirm) {
logger.break();
logger.log("Theme installation cancelled.");
logger.break();
process.exit(1);
}
}

if (!options.components?.length) {
options.components = await promptForRegistryComponents(options);
}

// let { errors, config } = await preFlightAdd(options)

// // No component.json file. Prompt the user to run init.
// if (errors[ERRORS.MISSING_CONFIG]) {
// const { proceed } = await prompts({
// type: "confirm",
// name: "proceed",
// message: `You need to create a ${highlight.info(
// "component.json"
// )} file to add components. Proceed?`,
// initial: true,
// })

// if (!proceed) {
// logger.break()
// process.exit(1)
// }

// config = await runInit({
// cwd: options.cwd,
// yes: true,
// force: true,
// defaults: false,
// skipPreflight: false,
// silent: true,
// isNewProject: false,
// srcDir: options.srcDir,
// })
// }

// if (errors[ERRORS.MISSING_DIR_OR_EMPTY_PROJECT]) {
// const { projectPath } = await createProject({
// cwd: options.cwd,
// force: options.overwrite,
// srcDir: options.srcDir,
// });
// if (!projectPath) {
// logger.break();
// process.exit(1);
// }
// options.cwd = projectPath;

// config = await runInit({
// cwd: options.cwd,
// yes: true,
// force: true,
// defaults: false,
// skipPreflight: true,
// silent: true,
// isNewProject: true,
// srcDir: options.srcDir,
// });

// shouldUpdateAppIndex =
// options.components?.length === 1 &&
// !!options.components[0].match(/\/chat\/b\//);
// }

// if (!config) {
// throw new Error(
// `Failed to read config at ${highlight.info(options.cwd)}.`
// );
// }
const config = await getConfig(options.cwd);
if (!config) {
throw new Error(
`Failed to read config at ${highlight.info(options.cwd)}.`
);
}
await addComponents(options.components, config, options);
} catch (error) {
logger.break();
handleError(error);
}
});

async function promptForRegistryComponents(
options: z.infer<typeof addOptionsSchema>
) {
const registryIndex = await getRegistryIndex();
if (!registryIndex) {
logger.break();
handleError(new Error("Failed to fetch registry index."));
return [];
}

if (options.all) {
return registryIndex.map((entry) => entry.name);
}

if (options.components?.length) {
return options.components;
}

const { components } = await prompts({
type: "multiselect",
name: "components",
message: "Which components would you like to add?",
hint: "Space to select. A to toggle all. Enter to submit.",
instructions: false,
choices: registryIndex
.filter((entry) => entry.type === "registry:core")
.map((entry) => ({
title: entry.name,
value: entry.name,
selected: options.all ? true : options.components?.includes(entry.name),
})),
});

if (!components?.length) {
logger.warn("No components selected. Exiting.");
logger.info("");
process.exit(1);
}

const result = z.array(z.string()).safeParse(components);
if (!result.success) {
logger.error("");
handleError(new Error("Something went wrong. Please try again."));
return [];
}
return result.data;
}
import * as p from "@clack/prompts";
import { Command } from "commander";
import { addChecks } from "@/helpers/add-checks";
import { addPrimitives } from "@/helpers/add-primitives";
import { handleError } from "@/helpers/handle-error";
import { c } from "@/utils";

export const addCommand = new Command()
.name("add")
.description(
"add primitives to your project and install required dependencies"
)
.argument(
"[primitives...]",
"the primitives to add wheather components, hoooks, themes."
)
.helpOption("-h, --help", "show all available options")
.option("-o, --overwrite", "overwrite existing files.", true)
.option("-a, --all", "add all available core components.", false)
.option(
"-d --dir",
"the working directory. defaults to the current directory.",
process.cwd()
)
.action(
async (
primitives: string[],
options: { overwrite: boolean; all: boolean; dir: string }
) => {
try {
p.intro("Adding primitives.");
const { config } = await addChecks(options.dir);
await addPrimitives(primitives, config, {
overwrite: options.overwrite,
message: "Updating your project",
});
p.outro(
`Successfully added ${c.info("button, text-field, and 21 other components.")}`
);
} catch (error) {
p.outro(
c.error(
"Someting went wrong. If the problem persists, please open an issue on GitHub."
)
);
handleError(error);
}
}
);
Loading
Loading