@gilav21/shadcn-angular 0.0.24 → 0.0.26
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 +2 -0
- package/dist/commands/add.js +169 -114
- package/dist/commands/add.spec.js +17 -23
- package/dist/commands/diff.d.ts +8 -0
- package/dist/commands/diff.js +99 -0
- package/dist/commands/help.js +15 -6
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +171 -185
- package/dist/commands/list.d.ts +1 -0
- package/dist/commands/list.js +50 -0
- package/dist/index.js +21 -1
- package/dist/registry/index.d.ts +122 -12
- package/dist/registry/index.js +59 -158
- package/dist/utils/config.d.ts +1 -1
- package/dist/utils/config.js +22 -2
- package/dist/utils/paths.d.ts +7 -0
- package/dist/utils/paths.js +43 -0
- package/dist/utils/shortcut-registry.js +1 -13
- package/package.json +1 -1
- package/scripts/sync-registry.ts +347 -0
- package/src/commands/add.spec.ts +22 -32
- package/src/commands/add.ts +211 -137
- package/src/commands/diff.ts +133 -0
- package/src/commands/help.ts +15 -6
- package/src/commands/init.ts +329 -314
- package/src/commands/list.ts +66 -0
- package/src/index.ts +24 -1
- package/src/registry/index.ts +73 -169
- package/src/utils/config.ts +22 -3
- package/src/utils/paths.ts +52 -0
- package/src/utils/shortcut-registry.ts +1 -15
- package/vitest.config.ts +7 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import type { Config } from './config.js';
|
|
4
|
+
import { resolveProjectPath, aliasToProjectPath } from './paths.js';
|
|
4
5
|
|
|
5
6
|
export interface ShortcutRegistryEntry {
|
|
6
7
|
exportName: string;
|
|
@@ -8,21 +9,6 @@ export interface ShortcutRegistryEntry {
|
|
|
8
9
|
sourceFile: string;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
function aliasToProjectPath(aliasOrPath: string): string {
|
|
12
|
-
return aliasOrPath.startsWith('@/')
|
|
13
|
-
? path.join('src', aliasOrPath.slice(2))
|
|
14
|
-
: aliasOrPath;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function resolveProjectPath(cwd: string, inputPath: string): string {
|
|
18
|
-
const resolved = path.resolve(cwd, inputPath);
|
|
19
|
-
const relative = path.relative(cwd, resolved);
|
|
20
|
-
if (relative.startsWith('..') || path.isAbsolute(relative)) {
|
|
21
|
-
throw new Error(`Path must stay inside the project directory: ${inputPath}`);
|
|
22
|
-
}
|
|
23
|
-
return resolved;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
12
|
function getShortcutRegistryIndexPath(cwd: string, config: Config): string {
|
|
27
13
|
const libDir = resolveProjectPath(cwd, aliasToProjectPath(config.aliases.utils));
|
|
28
14
|
return path.join(libDir, 'shortcut-registry.index.ts');
|