create-druid-ui 1.0.0-next.2

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/bin/create.js ADDED
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/index.ts
4
+ import { mkdirSync, writeFileSync } from "node:fs";
5
+ import { join, resolve } from "node:path";
6
+ import { execSync } from "node:child_process";
7
+ var projectName = process.argv[2];
8
+ var projectPath = process.argv[3];
9
+ if (!projectName) {
10
+ console.error("Usage: create-druid-ui <project-name> [path]");
11
+ process.exit(1);
12
+ }
13
+ var projectDir = projectPath ? resolve(projectPath) : resolve(projectName);
14
+ console.log(`Creating druid-ui project in ${projectDir}...`);
15
+ mkdirSync(join(projectDir, "src"), { recursive: true });
16
+ var packageJson = {
17
+ name: projectName,
18
+ private: true,
19
+ version: "0.0.0",
20
+ type: "module",
21
+ scripts: {
22
+ build: "druid-ui-build src/index.tsx"
23
+ },
24
+ dependencies: {
25
+ "@druid-ui/component": "next",
26
+ "@druid-ui/build": "next"
27
+ }
28
+ };
29
+ writeFileSync(
30
+ join(projectDir, "package.json"),
31
+ JSON.stringify(packageJson, null, " ") + "\n"
32
+ );
33
+ var tsconfig = {
34
+ compilerOptions: {
35
+ target: "ESNext",
36
+ module: "ESNext",
37
+ moduleResolution: "bundler",
38
+ strict: true,
39
+ esModuleInterop: true,
40
+ skipLibCheck: true,
41
+ jsx: "react",
42
+ jsxFactory: "d",
43
+ jsxFragmentFactory: "Fragment",
44
+ outDir: "./dist"
45
+ },
46
+ files: ["node_modules/@druid-ui/component/src/jsx.d.ts"],
47
+ include: ["src/**/*"],
48
+ exclude: ["node_modules"]
49
+ };
50
+ writeFileSync(
51
+ join(projectDir, "tsconfig.json"),
52
+ JSON.stringify(tsconfig, null, " ") + "\n"
53
+ );
54
+ writeFileSync(join(projectDir, "src", "index.tsx"), "");
55
+ console.log("Project files created.");
56
+ console.log("Installing dependencies...");
57
+ try {
58
+ execSync("npm install", { cwd: projectDir, stdio: "inherit" });
59
+ console.log("");
60
+ console.log("Done! To get started:");
61
+ console.log("");
62
+ console.log(` cd ${projectName}`);
63
+ console.log(" npm run build");
64
+ console.log("");
65
+ } catch {
66
+ console.error("");
67
+ console.error("npm install failed. You can run it manually:");
68
+ console.error(` cd ${projectName} && npm install`);
69
+ console.error("");
70
+ }
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "create-druid-ui",
3
+ "version": "1.0.0-next.2",
4
+ "type": "module",
5
+ "bin": {
6
+ "create-druid-ui": "./bin/create.js"
7
+ },
8
+ "files": [
9
+ "bin",
10
+ "src"
11
+ ],
12
+ "scripts": {
13
+ "build": "esbuild src/index.ts --bundle --platform=node --format=esm --target=node22 --outfile=bin/create.js"
14
+ },
15
+ "devDependencies": {
16
+ "esbuild": "^0.25.11",
17
+ "typescript": "~5.8.3"
18
+ }
19
+ }
package/src/index.ts ADDED
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { mkdirSync, writeFileSync } from "node:fs";
4
+ import { join, resolve } from "node:path";
5
+ import { execSync } from "node:child_process";
6
+
7
+ const projectName = process.argv[2];
8
+ const projectPath = process.argv[3];
9
+
10
+ if (!projectName) {
11
+ console.error("Usage: create-druid-ui <project-name> [path]");
12
+ process.exit(1);
13
+ }
14
+
15
+ const projectDir = projectPath ? resolve(projectPath) : resolve(projectName);
16
+
17
+ console.log(`Creating druid-ui project in ${projectDir}...`);
18
+
19
+ mkdirSync(join(projectDir, "src"), { recursive: true });
20
+
21
+ const packageJson = {
22
+ name: projectName,
23
+ private: true,
24
+ version: "0.0.0",
25
+ type: "module",
26
+ scripts: {
27
+ build: "druid-ui-build src/index.tsx",
28
+ },
29
+ dependencies: {
30
+ "@druid-ui/component": "next",
31
+ "@druid-ui/build": "next",
32
+ },
33
+ };
34
+
35
+ writeFileSync(
36
+ join(projectDir, "package.json"),
37
+ JSON.stringify(packageJson, null, "\t") + "\n",
38
+ );
39
+
40
+ const tsconfig = {
41
+ compilerOptions: {
42
+ target: "ESNext",
43
+ module: "ESNext",
44
+ moduleResolution: "bundler",
45
+ strict: true,
46
+ esModuleInterop: true,
47
+ skipLibCheck: true,
48
+ jsx: "react",
49
+ jsxFactory: "d",
50
+ jsxFragmentFactory: "Fragment",
51
+ outDir: "./dist",
52
+ },
53
+ files: ["node_modules/@druid-ui/component/src/jsx.d.ts"],
54
+ include: ["src/**/*"],
55
+ exclude: ["node_modules"],
56
+ };
57
+
58
+ writeFileSync(
59
+ join(projectDir, "tsconfig.json"),
60
+ JSON.stringify(tsconfig, null, "\t") + "\n",
61
+ );
62
+
63
+ writeFileSync(join(projectDir, "src", "index.tsx"), "");
64
+
65
+ console.log("Project files created.");
66
+ console.log("Installing dependencies...");
67
+
68
+ try {
69
+ execSync("npm install", { cwd: projectDir, stdio: "inherit" });
70
+ console.log("");
71
+ console.log("Done! To get started:");
72
+ console.log("");
73
+ console.log(` cd ${projectName}`);
74
+ console.log(" npm run build");
75
+ console.log("");
76
+ } catch {
77
+ console.error("");
78
+ console.error("npm install failed. You can run it manually:");
79
+ console.error(` cd ${projectName} && npm install`);
80
+ console.error("");
81
+ }