create-commandkit 1.2.2 → 1.2.4

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.
@@ -1,8 +1,28 @@
1
1
  import fs from 'fs-extra';
2
2
  import path from 'node:path';
3
- // @ts-ignore
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
- const emitter = tiged(sourceUrl, {
25
- mode: 'tar',
26
- disableCache: true,
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
File without changes
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.2",
4
+ "version": "1.2.4",
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": [
@@ -26,28 +25,31 @@
26
25
  "directory": "packages/create-commandkit"
27
26
  },
28
27
  "homepage": "https://commandkit.dev",
29
- "scripts": {
30
- "check-types": "tsc --noEmit",
31
- "dev": "tsc --watch",
32
- "build": "tsc && tsx scripts/sync-available-examples.ts"
33
- },
34
28
  "dependencies": {
35
- "@clack/prompts": "^1.7.0",
29
+ "@clack/prompts": "^1.8.1",
36
30
  "commander": "^15.0.0",
37
- "fs-extra": "^11.3.6",
31
+ "fs-extra": "^11.4.1",
32
+ "giget": "^3.3.1",
38
33
  "gradient-string": "^3.0.0",
39
34
  "ora": "^9.4.1",
40
35
  "picocolors": "^1.1.1",
41
- "tiged": "^2.12.8",
42
36
  "validate-npm-package-name": "^8.0.0"
43
37
  },
44
38
  "devDependencies": {
45
39
  "@types/fs-extra": "^11.0.4",
46
40
  "@types/gradient-string": "^1.1.6",
47
- "@types/node": "^25.9.5",
41
+ "@types/node": "^25.9.9",
48
42
  "@types/validate-npm-package-name": "^4.0.2",
49
- "tsconfig": "workspace:*",
50
- "tsx": "^4.23.1",
51
- "typescript": "catalog:build"
43
+ "tsx": "^4.23.15",
44
+ "typescript": "^5.9.3",
45
+ "tsconfig": "1.2.4"
46
+ },
47
+ "scripts": {
48
+ "check-types": "tsc --noEmit",
49
+ "dev": "tsc --watch",
50
+ "build": "tsc && tsx scripts/sync-available-examples.ts"
51
+ },
52
+ "bin": {
53
+ "create-commandkit": "./dist/index.js"
52
54
  }
53
- }
55
+ }