@gilav21/shadcn-angular 0.0.18 → 0.0.20
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/dist/commands/add.d.ts +1 -0
- package/dist/commands/add.js +8 -5
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +6 -4
- package/dist/index.js +2 -0
- package/dist/registry/index.js +9 -4
- package/package.json +1 -1
- package/src/commands/add.ts +11 -6
- package/src/commands/init.ts +7 -4
- package/src/index.ts +2 -0
- package/src/registry/index.ts +9 -4
package/dist/commands/add.d.ts
CHANGED
package/dist/commands/add.js
CHANGED
|
@@ -10,9 +10,12 @@ import { installPackages } from '../utils/package-manager.js';
|
|
|
10
10
|
import { writeShortcutRegistryIndex } from '../utils/shortcut-registry.js';
|
|
11
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
12
|
const __dirname = path.dirname(__filename);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
function getRegistryBaseUrl(branch) {
|
|
14
|
+
return `https://raw.githubusercontent.com/gilav21/shadcn-angular/${branch}/packages/components/ui`;
|
|
15
|
+
}
|
|
16
|
+
function getLibRegistryBaseUrl(branch) {
|
|
17
|
+
return `https://raw.githubusercontent.com/gilav21/shadcn-angular/${branch}/packages/components/lib`;
|
|
18
|
+
}
|
|
16
19
|
// Components source directory (relative to CLI dist folder) for local dev
|
|
17
20
|
function getLocalComponentsDir() {
|
|
18
21
|
// From dist/commands/add.js -> packages/components/ui
|
|
@@ -57,7 +60,7 @@ async function fetchComponentContent(file, options) {
|
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
62
|
// 2. Fetch from remote registry
|
|
60
|
-
const url = `${
|
|
63
|
+
const url = `${getRegistryBaseUrl(options.branch)}/${file}`;
|
|
61
64
|
try {
|
|
62
65
|
const response = await fetch(url);
|
|
63
66
|
if (!response.ok) {
|
|
@@ -80,7 +83,7 @@ async function fetchLibContent(file, options) {
|
|
|
80
83
|
return fs.readFile(localPath, 'utf-8');
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
|
-
const url = `${
|
|
86
|
+
const url = `${getLibRegistryBaseUrl(options.branch)}/${file}`;
|
|
84
87
|
const response = await fetch(url);
|
|
85
88
|
if (!response.ok) {
|
|
86
89
|
throw new Error(`Failed to fetch library file from ${url}: ${response.statusText}`);
|
package/dist/commands/init.d.ts
CHANGED
package/dist/commands/init.js
CHANGED
|
@@ -9,7 +9,9 @@ import { getStylesTemplate } from '../templates/styles.js';
|
|
|
9
9
|
import { getUtilsTemplate } from '../templates/utils.js';
|
|
10
10
|
import { installPackages } from '../utils/package-manager.js';
|
|
11
11
|
import { writeShortcutRegistryIndex } from '../utils/shortcut-registry.js';
|
|
12
|
-
|
|
12
|
+
function getLibRegistryBaseUrl(branch) {
|
|
13
|
+
return `https://raw.githubusercontent.com/gilav21/shadcn-angular/${branch}/packages/components/lib`;
|
|
14
|
+
}
|
|
13
15
|
const __filename = fileURLToPath(import.meta.url);
|
|
14
16
|
const __dirname = path.dirname(__filename);
|
|
15
17
|
function getLocalLibDir() {
|
|
@@ -19,7 +21,7 @@ function getLocalLibDir() {
|
|
|
19
21
|
}
|
|
20
22
|
return null;
|
|
21
23
|
}
|
|
22
|
-
async function fetchLibFileContent(file) {
|
|
24
|
+
async function fetchLibFileContent(file, branch) {
|
|
23
25
|
const localLibDir = getLocalLibDir();
|
|
24
26
|
if (localLibDir) {
|
|
25
27
|
const localPath = path.join(localLibDir, file);
|
|
@@ -27,7 +29,7 @@ async function fetchLibFileContent(file) {
|
|
|
27
29
|
return fs.readFile(localPath, 'utf-8');
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
|
-
const url = `${
|
|
32
|
+
const url = `${getLibRegistryBaseUrl(branch)}/${file}`;
|
|
31
33
|
const response = await fetch(url);
|
|
32
34
|
if (!response.ok) {
|
|
33
35
|
throw new Error(`Failed to fetch library file from ${url}: ${response.statusText}`);
|
|
@@ -200,7 +202,7 @@ export async function init(options) {
|
|
|
200
202
|
await fs.writeFile(path.join(libDir, 'utils.ts'), getUtilsTemplate());
|
|
201
203
|
spinner.text = 'Created utils.ts';
|
|
202
204
|
const shortcutServicePath = path.join(libDir, 'shortcut-binding.service.ts');
|
|
203
|
-
const shortcutServiceContent = await fetchLibFileContent('shortcut-binding.service.ts');
|
|
205
|
+
const shortcutServiceContent = await fetchLibFileContent('shortcut-binding.service.ts', options.branch);
|
|
204
206
|
await fs.writeFile(shortcutServicePath, shortcutServiceContent);
|
|
205
207
|
spinner.text = 'Created shortcut-binding.service.ts';
|
|
206
208
|
if (createShortcutRegistry) {
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ program
|
|
|
12
12
|
.description('Initialize shadcn-angular in your project')
|
|
13
13
|
.option('-y, --yes', 'Skip confirmation prompt')
|
|
14
14
|
.option('-d, --defaults', 'Use default configuration')
|
|
15
|
+
.option('-b, --branch <branch>', 'GitHub branch to fetch components from', 'master')
|
|
15
16
|
.action(init);
|
|
16
17
|
program
|
|
17
18
|
.command('add')
|
|
@@ -22,5 +23,6 @@ program
|
|
|
22
23
|
.option('-a, --all', 'Add all available components')
|
|
23
24
|
.option('-p, --path <path>', 'The path to add the component to')
|
|
24
25
|
.option('--remote', 'Force remote fetch from GitHub registry')
|
|
26
|
+
.option('-b, --branch <branch>', 'GitHub branch to fetch components from', 'master')
|
|
25
27
|
.action(add);
|
|
26
28
|
program.parse();
|
package/dist/registry/index.js
CHANGED
|
@@ -201,7 +201,7 @@ export const registry = {
|
|
|
201
201
|
},
|
|
202
202
|
input: {
|
|
203
203
|
name: 'input',
|
|
204
|
-
files: ['input.component.ts'],
|
|
204
|
+
files: ['input.component.ts', 'input-group.token.ts'],
|
|
205
205
|
},
|
|
206
206
|
'input-group': {
|
|
207
207
|
name: 'input-group',
|
|
@@ -311,7 +311,7 @@ export const registry = {
|
|
|
311
311
|
},
|
|
312
312
|
textarea: {
|
|
313
313
|
name: 'textarea',
|
|
314
|
-
files: ['textarea.component.ts'],
|
|
314
|
+
files: ['textarea.component.ts', 'input-group.token.ts'],
|
|
315
315
|
},
|
|
316
316
|
timeline: {
|
|
317
317
|
name: 'timeline',
|
|
@@ -554,7 +554,12 @@ export const registry = {
|
|
|
554
554
|
// Kanban
|
|
555
555
|
kanban: {
|
|
556
556
|
name: 'kanban',
|
|
557
|
-
files: ['kanban.component.ts'],
|
|
558
|
-
dependencies: [
|
|
557
|
+
files: ['kanban.component.ts', 'kanban-locales.ts'],
|
|
558
|
+
dependencies: [
|
|
559
|
+
'badge', 'avatar', 'scroll-area', 'separator',
|
|
560
|
+
'button', 'input', 'textarea', 'label',
|
|
561
|
+
'chip-list', 'autocomplete',
|
|
562
|
+
'dialog', 'alert-dialog', 'context-menu',
|
|
563
|
+
],
|
|
559
564
|
},
|
|
560
565
|
};
|
package/package.json
CHANGED
package/src/commands/add.ts
CHANGED
|
@@ -12,9 +12,13 @@ import { writeShortcutRegistryIndex, type ShortcutRegistryEntry } from '../utils
|
|
|
12
12
|
const __filename = fileURLToPath(import.meta.url);
|
|
13
13
|
const __dirname = path.dirname(__filename);
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
function getRegistryBaseUrl(branch: string) {
|
|
16
|
+
return `https://raw.githubusercontent.com/gilav21/shadcn-angular/${branch}/packages/components/ui`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function getLibRegistryBaseUrl(branch: string) {
|
|
20
|
+
return `https://raw.githubusercontent.com/gilav21/shadcn-angular/${branch}/packages/components/lib`;
|
|
21
|
+
}
|
|
18
22
|
|
|
19
23
|
// Components source directory (relative to CLI dist folder) for local dev
|
|
20
24
|
function getLocalComponentsDir(): string | null {
|
|
@@ -36,7 +40,8 @@ interface AddOptions {
|
|
|
36
40
|
overwrite?: boolean;
|
|
37
41
|
all?: boolean;
|
|
38
42
|
path?: string;
|
|
39
|
-
remote?: boolean;
|
|
43
|
+
remote?: boolean;
|
|
44
|
+
branch: string;
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
function getLocalLibDir(): string | null {
|
|
@@ -74,7 +79,7 @@ async function fetchComponentContent(file: string, options: AddOptions): Promise
|
|
|
74
79
|
}
|
|
75
80
|
|
|
76
81
|
// 2. Fetch from remote registry
|
|
77
|
-
const url = `${
|
|
82
|
+
const url = `${getRegistryBaseUrl(options.branch)}/${file}`;
|
|
78
83
|
try {
|
|
79
84
|
const response = await fetch(url);
|
|
80
85
|
if (!response.ok) {
|
|
@@ -99,7 +104,7 @@ async function fetchLibContent(file: string, options: AddOptions): Promise<strin
|
|
|
99
104
|
}
|
|
100
105
|
}
|
|
101
106
|
|
|
102
|
-
const url = `${
|
|
107
|
+
const url = `${getLibRegistryBaseUrl(options.branch)}/${file}`;
|
|
103
108
|
const response = await fetch(url);
|
|
104
109
|
if (!response.ok) {
|
|
105
110
|
throw new Error(`Failed to fetch library file from ${url}: ${response.statusText}`);
|
package/src/commands/init.ts
CHANGED
|
@@ -10,7 +10,9 @@ import { getUtilsTemplate } from '../templates/utils.js';
|
|
|
10
10
|
import { installPackages } from '../utils/package-manager.js';
|
|
11
11
|
import { writeShortcutRegistryIndex } from '../utils/shortcut-registry.js';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
function getLibRegistryBaseUrl(branch: string) {
|
|
14
|
+
return `https://raw.githubusercontent.com/gilav21/shadcn-angular/${branch}/packages/components/lib`;
|
|
15
|
+
}
|
|
14
16
|
const __filename = fileURLToPath(import.meta.url);
|
|
15
17
|
const __dirname = path.dirname(__filename);
|
|
16
18
|
|
|
@@ -22,7 +24,7 @@ function getLocalLibDir(): string | null {
|
|
|
22
24
|
return null;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
async function fetchLibFileContent(file: string): Promise<string> {
|
|
27
|
+
async function fetchLibFileContent(file: string, branch: string): Promise<string> {
|
|
26
28
|
const localLibDir = getLocalLibDir();
|
|
27
29
|
if (localLibDir) {
|
|
28
30
|
const localPath = path.join(localLibDir, file);
|
|
@@ -31,7 +33,7 @@ async function fetchLibFileContent(file: string): Promise<string> {
|
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
const url = `${
|
|
36
|
+
const url = `${getLibRegistryBaseUrl(branch)}/${file}`;
|
|
35
37
|
const response = await fetch(url);
|
|
36
38
|
if (!response.ok) {
|
|
37
39
|
throw new Error(`Failed to fetch library file from ${url}: ${response.statusText}`);
|
|
@@ -42,6 +44,7 @@ async function fetchLibFileContent(file: string): Promise<string> {
|
|
|
42
44
|
interface InitOptions {
|
|
43
45
|
yes?: boolean;
|
|
44
46
|
defaults?: boolean;
|
|
47
|
+
branch: string;
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
function resolveProjectPath(cwd: string, inputPath: string): string {
|
|
@@ -227,7 +230,7 @@ export async function init(options: InitOptions) {
|
|
|
227
230
|
spinner.text = 'Created utils.ts';
|
|
228
231
|
|
|
229
232
|
const shortcutServicePath = path.join(libDir, 'shortcut-binding.service.ts');
|
|
230
|
-
const shortcutServiceContent = await fetchLibFileContent('shortcut-binding.service.ts');
|
|
233
|
+
const shortcutServiceContent = await fetchLibFileContent('shortcut-binding.service.ts', options.branch);
|
|
231
234
|
await fs.writeFile(shortcutServicePath, shortcutServiceContent);
|
|
232
235
|
spinner.text = 'Created shortcut-binding.service.ts';
|
|
233
236
|
|
package/src/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ program
|
|
|
15
15
|
.description('Initialize shadcn-angular in your project')
|
|
16
16
|
.option('-y, --yes', 'Skip confirmation prompt')
|
|
17
17
|
.option('-d, --defaults', 'Use default configuration')
|
|
18
|
+
.option('-b, --branch <branch>', 'GitHub branch to fetch components from', 'master')
|
|
18
19
|
.action(init);
|
|
19
20
|
|
|
20
21
|
program
|
|
@@ -26,6 +27,7 @@ program
|
|
|
26
27
|
.option('-a, --all', 'Add all available components')
|
|
27
28
|
.option('-p, --path <path>', 'The path to add the component to')
|
|
28
29
|
.option('--remote', 'Force remote fetch from GitHub registry')
|
|
30
|
+
.option('-b, --branch <branch>', 'GitHub branch to fetch components from', 'master')
|
|
29
31
|
.action(add);
|
|
30
32
|
|
|
31
33
|
program.parse();
|
package/src/registry/index.ts
CHANGED
|
@@ -218,7 +218,7 @@ export const registry: Record<string, ComponentDefinition> = {
|
|
|
218
218
|
},
|
|
219
219
|
input: {
|
|
220
220
|
name: 'input',
|
|
221
|
-
files: ['input.component.ts'],
|
|
221
|
+
files: ['input.component.ts', 'input-group.token.ts'],
|
|
222
222
|
},
|
|
223
223
|
'input-group': {
|
|
224
224
|
name: 'input-group',
|
|
@@ -328,7 +328,7 @@ export const registry: Record<string, ComponentDefinition> = {
|
|
|
328
328
|
},
|
|
329
329
|
textarea: {
|
|
330
330
|
name: 'textarea',
|
|
331
|
-
files: ['textarea.component.ts'],
|
|
331
|
+
files: ['textarea.component.ts', 'input-group.token.ts'],
|
|
332
332
|
},
|
|
333
333
|
timeline: {
|
|
334
334
|
name: 'timeline',
|
|
@@ -571,7 +571,12 @@ export const registry: Record<string, ComponentDefinition> = {
|
|
|
571
571
|
// Kanban
|
|
572
572
|
kanban: {
|
|
573
573
|
name: 'kanban',
|
|
574
|
-
files: ['kanban.component.ts'],
|
|
575
|
-
dependencies: [
|
|
574
|
+
files: ['kanban.component.ts', 'kanban-locales.ts'],
|
|
575
|
+
dependencies: [
|
|
576
|
+
'badge', 'avatar', 'scroll-area', 'separator',
|
|
577
|
+
'button', 'input', 'textarea', 'label',
|
|
578
|
+
'chip-list', 'autocomplete',
|
|
579
|
+
'dialog', 'alert-dialog', 'context-menu',
|
|
580
|
+
],
|
|
576
581
|
},
|
|
577
582
|
};
|