create-commandkit 1.2.1-dev.20260414125348 → 1.2.1-dev.20261013130331
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/README.md +8 -8
- package/dist/functions/fetchExample.js +25 -6
- package/dist/index.js +1 -1
- package/dist/utils.js +2 -2
- package/package.json +14 -12
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/
|
|
2
|
+
<img src="https://raw.githubusercontent.com/neplexlabs/commandkit/main/apps/website/static/img/ckit_logo.svg" width="60%" />
|
|
3
3
|
<br />
|
|
4
4
|
<a href="https://commandkit.dev/discord"><img src="https://img.shields.io/discord/1055188344188973066?color=5865F2&logo=discord&logoColor=white" alt="support server" /></a>
|
|
5
5
|
<a href="https://www.npmjs.com/package/create-commandkit"><img src="https://img.shields.io/npm/v/create-commandkit?maxAge=3600" alt="npm version" /></a>
|
|
@@ -68,13 +68,13 @@ npx create-commandkit@latest --example "https://github.com/user/repo" --example-
|
|
|
68
68
|
### Available Examples
|
|
69
69
|
|
|
70
70
|
<!-- BEGIN_AVAILABLE_EXAMPLES -->
|
|
71
|
-
- `basic-js` - [examples/basic-js](https://github.com/
|
|
72
|
-
- `basic-ts` - [examples/basic-ts](https://github.com/
|
|
73
|
-
- `deno-ts` - [examples/deno-ts](https://github.com/
|
|
74
|
-
- `with-ai` - [examples/with-ai](https://github.com/
|
|
75
|
-
- `with-leveling-system` - [examples/with-leveling-system](https://github.com/
|
|
76
|
-
- `with-workflow` - [examples/with-workflow](https://github.com/
|
|
77
|
-
- `without-cli` - [examples/without-cli](https://github.com/
|
|
71
|
+
- `basic-js` - [examples/basic-js](https://github.com/neplexlabs/commandkit/tree/main/examples/basic-js)
|
|
72
|
+
- `basic-ts` - [examples/basic-ts](https://github.com/neplexlabs/commandkit/tree/main/examples/basic-ts)
|
|
73
|
+
- `deno-ts` - [examples/deno-ts](https://github.com/neplexlabs/commandkit/tree/main/examples/deno-ts)
|
|
74
|
+
- `with-ai` - [examples/with-ai](https://github.com/neplexlabs/commandkit/tree/main/examples/with-ai)
|
|
75
|
+
- `with-leveling-system` - [examples/with-leveling-system](https://github.com/neplexlabs/commandkit/tree/main/examples/with-leveling-system)
|
|
76
|
+
- `with-workflow` - [examples/with-workflow](https://github.com/neplexlabs/commandkit/tree/main/examples/with-workflow)
|
|
77
|
+
- `without-cli` - [examples/without-cli](https://github.com/neplexlabs/commandkit/tree/main/examples/without-cli)
|
|
78
78
|
<!-- END_AVAILABLE_EXAMPLES -->
|
|
79
79
|
|
|
80
80
|
### Examples
|
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
|
|
4
|
-
import tiged from 'tiged';
|
|
3
|
+
import { downloadTemplate } from 'giget';
|
|
5
4
|
import { validateExampleName } from './validate.js';
|
|
5
|
+
function toGigetSource(source) {
|
|
6
|
+
if (!source.startsWith('http://') && !source.startsWith('https://')) {
|
|
7
|
+
return `github:${source}`;
|
|
8
|
+
}
|
|
9
|
+
const url = new URL(source);
|
|
10
|
+
const segments = url.pathname.split('/').filter(Boolean);
|
|
11
|
+
const [owner, rawRepository, tree, ...rest] = segments;
|
|
12
|
+
if (!owner || !rawRepository) {
|
|
13
|
+
throw new Error('GitHub example URLs must include an owner and repository');
|
|
14
|
+
}
|
|
15
|
+
const repository = rawRepository.replace(/\.git$/, '');
|
|
16
|
+
if (tree === 'tree' && rest.length > 0) {
|
|
17
|
+
const [ref, ...subdirectory] = rest;
|
|
18
|
+
const path = subdirectory.length > 0 ? `/${subdirectory.join('/')}` : '';
|
|
19
|
+
return `github:${owner}/${repository}${path}#${ref}`;
|
|
20
|
+
}
|
|
21
|
+
if (segments.length === 2) {
|
|
22
|
+
return `github:${owner}/${repository}`;
|
|
23
|
+
}
|
|
24
|
+
throw new Error('GitHub example URLs must point to a repository or a /tree/<branch>/<path> directory');
|
|
25
|
+
}
|
|
6
26
|
export async function fetchExample({ example, examplePath, targetDir, }) {
|
|
7
27
|
const validation = validateExampleName(example);
|
|
8
28
|
if (!validation.valid) {
|
|
@@ -21,11 +41,10 @@ export async function fetchExample({ example, examplePath, targetDir, }) {
|
|
|
21
41
|
const tempDir = path.join(targetDir, '.temp-example');
|
|
22
42
|
try {
|
|
23
43
|
// Download the example
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
44
|
+
await downloadTemplate(toGigetSource(sourceUrl), {
|
|
45
|
+
dir: tempDir,
|
|
46
|
+
forceClean: true,
|
|
27
47
|
});
|
|
28
|
-
await emitter.clone(tempDir);
|
|
29
48
|
// If examplePath is specified, navigate to that subdirectory
|
|
30
49
|
const sourceDir = examplePath ? path.join(tempDir, examplePath) : tempDir;
|
|
31
50
|
if (examplePath && !fs.existsSync(sourceDir)) {
|
package/dist/index.js
CHANGED
|
@@ -197,7 +197,7 @@ To start your bot${projectDir !== '.' ? `, ${colors.magenta(`cd ${projectDir}`)}
|
|
|
197
197
|
${colors.magenta(command('start'))} - Run your bot in production mode
|
|
198
198
|
|
|
199
199
|
• Documentation: ${colors.blue('https://commandkit.dev')}
|
|
200
|
-
• GitHub: ${colors.blue('https://github.com/
|
|
200
|
+
• GitHub: ${colors.blue('https://github.com/neplexlabs/commandkit')}
|
|
201
201
|
• Neplex: ${colors.blue('https://neplextech.com')}
|
|
202
202
|
• Discord community: ${colors.blue('https://commandkit.dev/discord')}
|
|
203
203
|
|
package/dist/utils.js
CHANGED
|
@@ -46,7 +46,7 @@ export function isOfficialExample(example) {
|
|
|
46
46
|
try {
|
|
47
47
|
const url = new URL(example);
|
|
48
48
|
return (url.hostname === 'github.com' &&
|
|
49
|
-
url.pathname.startsWith('/
|
|
49
|
+
url.pathname.startsWith('/neplexlabs/commandkit'));
|
|
50
50
|
}
|
|
51
51
|
catch {
|
|
52
52
|
return false;
|
|
@@ -70,7 +70,7 @@ export function getInstallCommand(manager, deps, dev = false) {
|
|
|
70
70
|
}
|
|
71
71
|
export async function fetchAvailableExamples() {
|
|
72
72
|
try {
|
|
73
|
-
const response = await fetch('https://api.github.com/repos/
|
|
73
|
+
const response = await fetch('https://api.github.com/repos/neplexlabs/commandkit/contents/examples', {
|
|
74
74
|
signal: AbortSignal.timeout(10_000),
|
|
75
75
|
headers: {
|
|
76
76
|
'User-Agent': 'create-commandkit',
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-commandkit",
|
|
3
3
|
"description": "Effortlessly create a CommandKit project",
|
|
4
|
-
"version": "1.2.1-dev.
|
|
4
|
+
"version": "1.2.1-dev.20261013130331",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
|
-
"bin": "./dist/index.js",
|
|
8
7
|
"type": "module",
|
|
9
8
|
"license": "MIT",
|
|
10
9
|
"keywords": [
|
|
@@ -22,32 +21,35 @@
|
|
|
22
21
|
],
|
|
23
22
|
"repository": {
|
|
24
23
|
"type": "git",
|
|
25
|
-
"url": "https://github.com/
|
|
24
|
+
"url": "https://github.com/neplexlabs/commandkit",
|
|
26
25
|
"directory": "packages/create-commandkit"
|
|
27
26
|
},
|
|
28
27
|
"homepage": "https://commandkit.dev",
|
|
29
28
|
"dependencies": {
|
|
30
|
-
"@clack/prompts": "^1.
|
|
31
|
-
"commander": "^
|
|
32
|
-
"fs-extra": "^11.
|
|
29
|
+
"@clack/prompts": "^1.8.1",
|
|
30
|
+
"commander": "^15.0.0",
|
|
31
|
+
"fs-extra": "^11.4.1",
|
|
32
|
+
"giget": "^3.3.1",
|
|
33
33
|
"gradient-string": "^3.0.0",
|
|
34
|
-
"ora": "^9.
|
|
34
|
+
"ora": "^9.4.1",
|
|
35
35
|
"picocolors": "^1.1.1",
|
|
36
|
-
"
|
|
37
|
-
"validate-npm-package-name": "^7.0.2"
|
|
36
|
+
"validate-npm-package-name": "^8.0.0"
|
|
38
37
|
},
|
|
39
38
|
"devDependencies": {
|
|
40
39
|
"@types/fs-extra": "^11.0.4",
|
|
41
40
|
"@types/gradient-string": "^1.1.6",
|
|
42
|
-
"@types/node": "^25.
|
|
41
|
+
"@types/node": "^25.9.9",
|
|
43
42
|
"@types/validate-npm-package-name": "^4.0.2",
|
|
44
|
-
"tsx": "^4.
|
|
43
|
+
"tsx": "^4.23.15",
|
|
45
44
|
"typescript": "^5.9.3",
|
|
46
|
-
"tsconfig": "0.0.0-dev.
|
|
45
|
+
"tsconfig": "0.0.0-dev.20261013130331"
|
|
47
46
|
},
|
|
48
47
|
"scripts": {
|
|
49
48
|
"check-types": "tsc --noEmit",
|
|
50
49
|
"dev": "tsc --watch",
|
|
51
50
|
"build": "tsc && tsx scripts/sync-available-examples.ts"
|
|
51
|
+
},
|
|
52
|
+
"bin": {
|
|
53
|
+
"create-commandkit": "./dist/index.js"
|
|
52
54
|
}
|
|
53
55
|
}
|