create-druid-ui 1.0.0 → 1.0.1
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 +24 -57
- package/package.json +5 -2
- package/src/index.ts +29 -66
package/bin/create.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { downloadTemplate } from "giget";
|
|
5
|
+
import { resolve } from "node:path";
|
|
6
6
|
import { execSync } from "node:child_process";
|
|
7
7
|
var projectName = process.argv[2];
|
|
8
8
|
var projectPath = process.argv[3];
|
|
@@ -11,60 +11,27 @@ if (!projectName) {
|
|
|
11
11
|
process.exit(1);
|
|
12
12
|
}
|
|
13
13
|
var projectDir = projectPath ? resolve(projectPath) : resolve(projectName);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
14
|
+
async function main() {
|
|
15
|
+
console.log(`Creating druid-ui project "${projectName}" in ${projectDir}...`);
|
|
16
|
+
await downloadTemplate("gh:highcard-dev/druid-ui/examples/starter", {
|
|
17
|
+
dir: projectDir,
|
|
18
|
+
force: false
|
|
19
|
+
});
|
|
20
|
+
console.log("Project files created.");
|
|
21
|
+
console.log("Installing dependencies...");
|
|
22
|
+
try {
|
|
23
|
+
execSync("npm install", { cwd: projectDir, stdio: "inherit" });
|
|
24
|
+
console.log("");
|
|
25
|
+
console.log("Done! To get started:");
|
|
26
|
+
console.log("");
|
|
27
|
+
console.log(` cd ${projectName}`);
|
|
28
|
+
console.log(" npm run dev");
|
|
29
|
+
console.log("");
|
|
30
|
+
} catch {
|
|
31
|
+
console.error("");
|
|
32
|
+
console.error("npm install failed. You can run it manually:");
|
|
33
|
+
console.error(` cd ${projectName} && npm install`);
|
|
34
|
+
console.error("");
|
|
27
35
|
}
|
|
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
36
|
}
|
|
37
|
+
main().catch(console.error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-druid-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-druid-ui": "./bin/create.js"
|
|
@@ -10,7 +10,10 @@
|
|
|
10
10
|
"src"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
-
"build": "esbuild src/index.ts --bundle --platform=node --format=esm --target=node22 --outfile=bin/create.js"
|
|
13
|
+
"build": "esbuild src/index.ts --bundle --platform=node --format=esm --target=node22 --packages=external --outfile=bin/create.js"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"giget": "^2.0.0"
|
|
14
17
|
},
|
|
15
18
|
"devDependencies": {
|
|
16
19
|
"esbuild": "^0.25.11",
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { downloadTemplate } from "giget";
|
|
4
|
+
import { resolve } from "node:path";
|
|
5
5
|
import { execSync } from "node:child_process";
|
|
6
6
|
|
|
7
7
|
const projectName = process.argv[2];
|
|
@@ -14,68 +14,31 @@ if (!projectName) {
|
|
|
14
14
|
|
|
15
15
|
const projectDir = projectPath ? resolve(projectPath) : resolve(projectName);
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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("");
|
|
17
|
+
async function main() {
|
|
18
|
+
console.log(`Creating druid-ui project "${projectName}" in ${projectDir}...`);
|
|
19
|
+
|
|
20
|
+
await downloadTemplate("gh:highcard-dev/druid-ui/examples/starter", {
|
|
21
|
+
dir: projectDir,
|
|
22
|
+
force: false,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
console.log("Project files created.");
|
|
26
|
+
console.log("Installing dependencies...");
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
execSync("npm install", { cwd: projectDir, stdio: "inherit" });
|
|
30
|
+
console.log("");
|
|
31
|
+
console.log("Done! To get started:");
|
|
32
|
+
console.log("");
|
|
33
|
+
console.log(` cd ${projectName}`);
|
|
34
|
+
console.log(" npm run dev");
|
|
35
|
+
console.log("");
|
|
36
|
+
} catch {
|
|
37
|
+
console.error("");
|
|
38
|
+
console.error("npm install failed. You can run it manually:");
|
|
39
|
+
console.error(` cd ${projectName} && npm install`);
|
|
40
|
+
console.error("");
|
|
41
|
+
}
|
|
81
42
|
}
|
|
43
|
+
|
|
44
|
+
main().catch(console.error);
|