agnosticui-cli 2.0.0-alpha.2
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 +1268 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +98 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/add.d.ts +3 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +464 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +381 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/list.d.ts +2 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +72 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/remove.d.ts +3 -0
- package/dist/commands/remove.d.ts.map +1 -0
- package/dist/commands/remove.js +96 -0
- package/dist/commands/remove.js.map +1 -0
- package/dist/commands/sync.d.ts +6 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +143 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/types/index.d.ts +61 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/components.d.ts +76 -0
- package/dist/utils/components.d.ts.map +1 -0
- package/dist/utils/components.js +208 -0
- package/dist/utils/components.js.map +1 -0
- package/dist/utils/config.d.ts +9 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +78 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/dependencies.d.ts +23 -0
- package/dist/utils/dependencies.d.ts.map +1 -0
- package/dist/utils/dependencies.js +93 -0
- package/dist/utils/dependencies.js.map +1 -0
- package/dist/utils/files.d.ts +48 -0
- package/dist/utils/files.d.ts.map +1 -0
- package/dist/utils/files.js +171 -0
- package/dist/utils/files.js.map +1 -0
- package/dist/utils/logger.d.ts +11 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +34 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ag sync command - Update reference library from tarball
|
|
3
|
+
*/
|
|
4
|
+
import * as p from '@clack/prompts';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { existsSync } from 'node:fs';
|
|
7
|
+
import { logger } from '../utils/logger.js';
|
|
8
|
+
import { loadConfig, saveConfig } from '../utils/config.js';
|
|
9
|
+
import { extractTarball, ensureDir, pathExists } from '../utils/files.js';
|
|
10
|
+
import pc from 'picocolors';
|
|
11
|
+
const DEFAULT_REFERENCE_PATH = './agnosticui';
|
|
12
|
+
export async function sync(options = {}) {
|
|
13
|
+
console.log('');
|
|
14
|
+
p.intro(pc.bold(pc.cyan('AgnosticUI Local - Sync')));
|
|
15
|
+
// Check if initialized
|
|
16
|
+
const config = await loadConfig();
|
|
17
|
+
if (!config) {
|
|
18
|
+
logger.error('AgnosticUI is not initialized in this project.');
|
|
19
|
+
logger.info('Run ' + pc.cyan('npx ag init') + ' to initialize first.');
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
// Determine tarball path
|
|
23
|
+
let tarballPath = options.tarball;
|
|
24
|
+
if (!tarballPath) {
|
|
25
|
+
// Use tarball path from config
|
|
26
|
+
if (!config.tarball?.source) {
|
|
27
|
+
logger.error('No tarball path found in config.');
|
|
28
|
+
logger.info('Please specify a tarball path: ' + pc.cyan('npx ag sync --tarball /path/to/tarball.tgz'));
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
tarballPath = config.tarball.source;
|
|
32
|
+
}
|
|
33
|
+
// Resolve to absolute path
|
|
34
|
+
tarballPath = path.resolve(tarballPath);
|
|
35
|
+
// Check if tarball exists
|
|
36
|
+
logger.newline();
|
|
37
|
+
logger.info('Looking for tarball at:');
|
|
38
|
+
console.log(' ' + pc.dim(tarballPath));
|
|
39
|
+
logger.newline();
|
|
40
|
+
if (!existsSync(tarballPath)) {
|
|
41
|
+
logger.error('Tarball not found at saved location!');
|
|
42
|
+
logger.info('Please specify a new tarball path:');
|
|
43
|
+
logger.info(' ' + pc.cyan(`npx ag sync --tarball /path/to/tarball.tgz`));
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
// Read version from tarball (extract to temp dir first to peek at version.json)
|
|
47
|
+
let tarballVersion = 'unknown';
|
|
48
|
+
const tempExtractPath = path.join(DEFAULT_REFERENCE_PATH, '.temp-sync');
|
|
49
|
+
try {
|
|
50
|
+
await ensureDir(tempExtractPath);
|
|
51
|
+
await extractTarball(tarballPath, tempExtractPath);
|
|
52
|
+
const versionJsonPath = path.join(tempExtractPath, 'version.json');
|
|
53
|
+
if (pathExists(versionJsonPath)) {
|
|
54
|
+
const { readFile } = await import('node:fs/promises');
|
|
55
|
+
const versionData = JSON.parse(await readFile(versionJsonPath, 'utf-8'));
|
|
56
|
+
tarballVersion = versionData.version || tarballVersion;
|
|
57
|
+
}
|
|
58
|
+
// Clean up temp extraction
|
|
59
|
+
const { rm } = await import('node:fs/promises');
|
|
60
|
+
await rm(tempExtractPath, { recursive: true, force: true });
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
// If we can't read version, continue anyway
|
|
64
|
+
logger.warn('Could not read version from tarball, continuing...');
|
|
65
|
+
}
|
|
66
|
+
logger.info(pc.green('✓') + ` Found tarball (version ${pc.cyan(tarballVersion)})`);
|
|
67
|
+
logger.newline();
|
|
68
|
+
// Confirm with user (unless forced)
|
|
69
|
+
if (!options.force) {
|
|
70
|
+
const shouldProceed = await p.confirm({
|
|
71
|
+
message: 'Proceed with sync?',
|
|
72
|
+
initialValue: true,
|
|
73
|
+
});
|
|
74
|
+
if (p.isCancel(shouldProceed) || !shouldProceed) {
|
|
75
|
+
p.cancel('Operation cancelled.');
|
|
76
|
+
process.exit(0);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// Start spinner
|
|
80
|
+
const spinner = p.spinner();
|
|
81
|
+
spinner.start('Syncing reference library...');
|
|
82
|
+
try {
|
|
83
|
+
// Extract tarball to reference path (overwrite)
|
|
84
|
+
spinner.message('Extracting reference library...');
|
|
85
|
+
await ensureDir(DEFAULT_REFERENCE_PATH);
|
|
86
|
+
await extractTarball(tarballPath, DEFAULT_REFERENCE_PATH);
|
|
87
|
+
// Copy CSS tokens to components/styles directory
|
|
88
|
+
spinner.message('Updating CSS tokens...');
|
|
89
|
+
const componentsPath = config.paths.components;
|
|
90
|
+
const stylesPath = path.join(componentsPath, 'styles');
|
|
91
|
+
await ensureDir(stylesPath);
|
|
92
|
+
const tokensSourcePath = path.join(DEFAULT_REFERENCE_PATH, 'src', 'styles');
|
|
93
|
+
const tokenFiles = ['ag-tokens.css', 'ag-tokens-dark.css'];
|
|
94
|
+
for (const tokenFile of tokenFiles) {
|
|
95
|
+
const srcFile = path.join(tokensSourcePath, tokenFile);
|
|
96
|
+
const destFile = path.join(stylesPath, tokenFile);
|
|
97
|
+
// console.log(' ' + pc.cyan('✓') + ' srcFile → ' + pc.dim(srcFile));
|
|
98
|
+
// console.log(' ' + pc.cyan('✓') + ' destFile → ' + pc.dim(destFile));
|
|
99
|
+
if (pathExists(srcFile)) {
|
|
100
|
+
const { copyFile } = await import('node:fs/promises');
|
|
101
|
+
await copyFile(srcFile, destFile);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// Copy shared infrastructure (shared, utils, styles, types)
|
|
105
|
+
spinner.message('Updating shared infrastructure...');
|
|
106
|
+
const { copyDirectoryFiltered } = await import('../utils/files.js');
|
|
107
|
+
const infraDirs = ['shared', 'utils', 'styles', 'types'];
|
|
108
|
+
for (const dir of infraDirs) {
|
|
109
|
+
const srcDir = path.join(DEFAULT_REFERENCE_PATH, 'src', dir);
|
|
110
|
+
const destDir = path.join(componentsPath, dir);
|
|
111
|
+
if (pathExists(srcDir)) {
|
|
112
|
+
await copyDirectoryFiltered(srcDir, destDir, {
|
|
113
|
+
exclude: ['*.spec.ts', '*.spec.js'] // Skip test files
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Update config with new tarball info
|
|
118
|
+
spinner.message('Updating configuration...');
|
|
119
|
+
config.tarball = {
|
|
120
|
+
source: tarballPath,
|
|
121
|
+
version: tarballVersion,
|
|
122
|
+
installed: new Date().toISOString(),
|
|
123
|
+
};
|
|
124
|
+
await saveConfig(config);
|
|
125
|
+
spinner.stop(pc.green('✓') + ' Sync completed successfully!');
|
|
126
|
+
// Success message
|
|
127
|
+
p.outro(pc.green('Reference library updated!'));
|
|
128
|
+
logger.newline();
|
|
129
|
+
logger.info(pc.dim('Updated:'));
|
|
130
|
+
console.log(' ' + pc.cyan('✓') + ' Reference library → ' + pc.dim('./agnosticui/'));
|
|
131
|
+
console.log(' ' + pc.cyan('✓') + ' CSS tokens → ' + pc.dim(`${componentsPath}/styles/`));
|
|
132
|
+
console.log(' ' + pc.cyan('✓') + ' Shared infrastructure → ' + pc.dim(`${componentsPath}/shared/, ${componentsPath}/utils/, ${componentsPath}/styles/, ${componentsPath}/types/`));
|
|
133
|
+
console.log(' ' + pc.cyan('✓') + ' Config → ' + pc.dim('agnosticui.config.json'));
|
|
134
|
+
logger.newline();
|
|
135
|
+
logger.info(pc.dim('Your components in ') + pc.cyan(componentsPath) + pc.dim(' were not modified.'));
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
spinner.stop(pc.red('✖') + ' Failed to sync');
|
|
139
|
+
logger.error(`Sync failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
140
|
+
process.exit(1);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAAA;;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C1F,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,2BAA2B,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,cAAc,aAAa,cAAc,YAAY,cAAc,aAAa,cAAc,SAAS,CAAC,CAAC,CAAC;QACpL,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,YAAY,GAAG,EAAE,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC,CAAC;QACnF,MAAM,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,qBAAqB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC;IACvG,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,iBAAiB,CAAC,CAAC;QAC9C,MAAM,CAAC,KAAK,CAAC,gBAAgB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;QACzF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgnosticUI CLI Types
|
|
3
|
+
*/
|
|
4
|
+
export type Framework = 'react' | 'vue' | 'lit' | 'svelte';
|
|
5
|
+
export interface AgnosticUIConfig {
|
|
6
|
+
$schema?: string;
|
|
7
|
+
version: string;
|
|
8
|
+
framework: Framework;
|
|
9
|
+
paths: {
|
|
10
|
+
reference: string;
|
|
11
|
+
components: string;
|
|
12
|
+
styles?: string;
|
|
13
|
+
};
|
|
14
|
+
tarball?: {
|
|
15
|
+
source: string;
|
|
16
|
+
version: string;
|
|
17
|
+
installed: string;
|
|
18
|
+
};
|
|
19
|
+
components: Record<string, ComponentEntry>;
|
|
20
|
+
ai?: {
|
|
21
|
+
includeReference?: boolean;
|
|
22
|
+
includeContext?: boolean;
|
|
23
|
+
contextPath?: string;
|
|
24
|
+
};
|
|
25
|
+
git?: {
|
|
26
|
+
commitReference?: boolean;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface ComponentEntry {
|
|
30
|
+
added: string;
|
|
31
|
+
version: string;
|
|
32
|
+
framework: Framework;
|
|
33
|
+
files: string[];
|
|
34
|
+
}
|
|
35
|
+
export interface ComponentMetadata {
|
|
36
|
+
name: string;
|
|
37
|
+
version: string;
|
|
38
|
+
frameworks: Framework[];
|
|
39
|
+
hasCore: boolean;
|
|
40
|
+
hasReact: boolean;
|
|
41
|
+
hasVue: boolean;
|
|
42
|
+
hasLit: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface TarballMetadata {
|
|
45
|
+
version: string;
|
|
46
|
+
built: string;
|
|
47
|
+
components: string[];
|
|
48
|
+
}
|
|
49
|
+
export interface InitOptions {
|
|
50
|
+
framework?: Framework;
|
|
51
|
+
componentsPath?: string;
|
|
52
|
+
tarball?: string;
|
|
53
|
+
version?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface AddOptions {
|
|
56
|
+
force?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface RemoveOptions {
|
|
59
|
+
force?: boolean;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IAC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EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Framework, ComponentMetadata } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get list of available components from the reference library
|
|
4
|
+
*/
|
|
5
|
+
export declare function getAvailableComponents(referencePath: string): Promise<string[]>;
|
|
6
|
+
/**
|
|
7
|
+
* Check if a component exists in the reference library
|
|
8
|
+
*/
|
|
9
|
+
export declare function componentExists(referencePath: string, componentName: string): Promise<boolean>;
|
|
10
|
+
/**
|
|
11
|
+
* Get metadata about a component
|
|
12
|
+
*/
|
|
13
|
+
export declare function getComponentMetadata(referencePath: string, componentName: string): Promise<ComponentMetadata | null>;
|
|
14
|
+
/**
|
|
15
|
+
* Get the source paths for a component based on framework
|
|
16
|
+
*/
|
|
17
|
+
export declare function getComponentSourcePaths(referencePath: string, componentName: string, framework: Framework): {
|
|
18
|
+
core: string;
|
|
19
|
+
framework: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Get the destination paths for a component
|
|
23
|
+
*/
|
|
24
|
+
export declare function getComponentDestinationPaths(componentsPath: string, componentName: string): {
|
|
25
|
+
core: string;
|
|
26
|
+
framework: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Normalize component name (handle case variations)
|
|
30
|
+
*/
|
|
31
|
+
export declare function normalizeComponentName(name: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Scan a file for shared component dependencies
|
|
34
|
+
* Looks for imports like: import ../../shared/CloseButton/...
|
|
35
|
+
*/
|
|
36
|
+
export declare function scanForSharedDependencies(filePath: string): Promise<string[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Scan a file for utility dependencies
|
|
39
|
+
* Looks for imports like: import ... from '../../utils/slot'
|
|
40
|
+
*/
|
|
41
|
+
export declare function scanForUtilsDependencies(filePath: string): Promise<string[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Get the source paths for a shared component
|
|
44
|
+
*/
|
|
45
|
+
export declare function getSharedComponentSourcePaths(referencePath: string, componentName: string): {
|
|
46
|
+
path: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Get the source path for a utility
|
|
50
|
+
*/
|
|
51
|
+
export declare function getUtilSourcePath(referencePath: string, utilName: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Scan a file for style dependencies
|
|
54
|
+
* Looks for imports like: import ... from '../../../styles/motion.styles'
|
|
55
|
+
*/
|
|
56
|
+
export declare function scanForStyleDependencies(filePath: string): Promise<string[]>;
|
|
57
|
+
/**
|
|
58
|
+
* Get the source path for a style file
|
|
59
|
+
*/
|
|
60
|
+
export declare function getStyleSourcePath(referencePath: string, styleName: string): string;
|
|
61
|
+
/**
|
|
62
|
+
* Scan a file for type dependencies
|
|
63
|
+
* Looks for imports like: import type ... from '../../../types/fx'
|
|
64
|
+
*/
|
|
65
|
+
export declare function scanForTypeDependencies(filePath: string): Promise<string[]>;
|
|
66
|
+
/**
|
|
67
|
+
* Get the source path for a type file
|
|
68
|
+
*/
|
|
69
|
+
export declare function getTypeSourcePath(referencePath: string, typeName: string): string;
|
|
70
|
+
/**
|
|
71
|
+
* Scan a file for component dependencies
|
|
72
|
+
* Looks for imports like: import "../../IconButton/core/IconButton"
|
|
73
|
+
* or: import { ... } from "../../ComponentName/..."
|
|
74
|
+
*/
|
|
75
|
+
export declare function scanForComponentDependencies(filePath: string): Promise<string[]>;
|
|
76
|
+
//# sourceMappingURL=components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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M,CAAA;CAAE,CAKlB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,GACf,MAAM,CAIR;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAYlF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,GAChB,MAAM,CAGR;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAYjF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,GACf,MAAM,CAGR;AAED;;;;GAIG;AACH,wBAAsB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CActF"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component utilities for working with AgnosticUI components
|
|
3
|
+
*/
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { readdir } from 'node:fs/promises';
|
|
6
|
+
import { pathExists, isDirectory } from './files.js';
|
|
7
|
+
/**
|
|
8
|
+
* Get list of available components from the reference library
|
|
9
|
+
*/
|
|
10
|
+
export async function getAvailableComponents(referencePath) {
|
|
11
|
+
const componentsPath = path.join(referencePath, 'src/components');
|
|
12
|
+
if (!pathExists(componentsPath)) {
|
|
13
|
+
throw new Error(`Reference library not found at: ${referencePath}`);
|
|
14
|
+
}
|
|
15
|
+
const entries = await readdir(componentsPath, { withFileTypes: true });
|
|
16
|
+
// Filter out non-component directories (shared, react barrel, etc.)
|
|
17
|
+
const components = entries
|
|
18
|
+
.filter(entry => entry.isDirectory())
|
|
19
|
+
.map(entry => entry.name)
|
|
20
|
+
.filter(name => name !== 'shared' &&
|
|
21
|
+
name !== 'react' &&
|
|
22
|
+
!name.startsWith('.') &&
|
|
23
|
+
!name.startsWith('_'))
|
|
24
|
+
.sort();
|
|
25
|
+
return components;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Check if a component exists in the reference library
|
|
29
|
+
*/
|
|
30
|
+
export async function componentExists(referencePath, componentName) {
|
|
31
|
+
const componentPath = path.join(referencePath, 'src/components', componentName);
|
|
32
|
+
return pathExists(componentPath) && await isDirectory(componentPath);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Get metadata about a component
|
|
36
|
+
*/
|
|
37
|
+
export async function getComponentMetadata(referencePath, componentName) {
|
|
38
|
+
const componentPath = path.join(referencePath, 'src/components', componentName);
|
|
39
|
+
if (!pathExists(componentPath)) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
const hasCore = pathExists(path.join(componentPath, 'core'));
|
|
43
|
+
const hasReact = pathExists(path.join(componentPath, 'react'));
|
|
44
|
+
const hasVue = pathExists(path.join(componentPath, 'vue'));
|
|
45
|
+
const hasLit = hasCore; // Lit is the core
|
|
46
|
+
const frameworks = [];
|
|
47
|
+
if (hasReact)
|
|
48
|
+
frameworks.push('react');
|
|
49
|
+
if (hasVue)
|
|
50
|
+
frameworks.push('vue');
|
|
51
|
+
if (hasLit)
|
|
52
|
+
frameworks.push('lit');
|
|
53
|
+
return {
|
|
54
|
+
name: componentName,
|
|
55
|
+
version: '2.0.0-alpha', // TODO: Read from version.json
|
|
56
|
+
frameworks,
|
|
57
|
+
hasCore,
|
|
58
|
+
hasReact,
|
|
59
|
+
hasVue,
|
|
60
|
+
hasLit,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get the source paths for a component based on framework
|
|
65
|
+
*/
|
|
66
|
+
export function getComponentSourcePaths(referencePath, componentName, framework) {
|
|
67
|
+
const componentPath = path.join(referencePath, 'src/components', componentName);
|
|
68
|
+
return {
|
|
69
|
+
core: path.join(componentPath, 'core'),
|
|
70
|
+
framework: path.join(componentPath, framework),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get the destination paths for a component
|
|
75
|
+
*/
|
|
76
|
+
export function getComponentDestinationPaths(componentsPath, componentName) {
|
|
77
|
+
const destPath = path.join(componentsPath, componentName);
|
|
78
|
+
return {
|
|
79
|
+
core: path.join(destPath, 'core'),
|
|
80
|
+
framework: path.join(destPath, 'react'), // Framework-specific path
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Normalize component name (handle case variations)
|
|
85
|
+
*/
|
|
86
|
+
export function normalizeComponentName(name) {
|
|
87
|
+
// Capitalize first letter
|
|
88
|
+
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Scan a file for shared component dependencies
|
|
92
|
+
* Looks for imports like: import ../../shared/CloseButton/...
|
|
93
|
+
*/
|
|
94
|
+
export async function scanForSharedDependencies(filePath) {
|
|
95
|
+
const { readFile } = await import('node:fs/promises');
|
|
96
|
+
try {
|
|
97
|
+
const content = await readFile(filePath, 'utf-8');
|
|
98
|
+
const sharedRegex = /import\s+['"](?:\.\.\/)+shared\/([^/]+)/g;
|
|
99
|
+
const matches = [...content.matchAll(sharedRegex)];
|
|
100
|
+
return matches.map(match => match[1]);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
return [];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Scan a file for utility dependencies
|
|
108
|
+
* Looks for imports like: import ... from '../../utils/slot'
|
|
109
|
+
*/
|
|
110
|
+
export async function scanForUtilsDependencies(filePath) {
|
|
111
|
+
const { readFile } = await import('node:fs/promises');
|
|
112
|
+
try {
|
|
113
|
+
const content = await readFile(filePath, 'utf-8');
|
|
114
|
+
// Match ../utils/filename or ../../utils/filename
|
|
115
|
+
const utilsRegex = /import\s+.*?from\s+['"](?:\.\.\/)+utils\/([^/'"]+)['"]/g;
|
|
116
|
+
const matches = [...content.matchAll(utilsRegex)];
|
|
117
|
+
return matches.map(match => match[1]); // returns filename like 'slot'
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
return [];
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Get the source paths for a shared component
|
|
125
|
+
*/
|
|
126
|
+
export function getSharedComponentSourcePaths(referencePath, componentName) {
|
|
127
|
+
// Shared components are in lib/src/components/shared/<Name>
|
|
128
|
+
return {
|
|
129
|
+
path: path.join(referencePath, 'src/components/shared', componentName),
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Get the source path for a utility
|
|
134
|
+
*/
|
|
135
|
+
export function getUtilSourcePath(referencePath, utilName) {
|
|
136
|
+
// Utils are in lib/src/utils/<Name>.ts or similar
|
|
137
|
+
// We assume imports like 'utils/slot' map to 'lib/src/utils/slot.ts'
|
|
138
|
+
return path.join(referencePath, 'src/utils', `${utilName}.ts`);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Scan a file for style dependencies
|
|
142
|
+
* Looks for imports like: import ... from '../../../styles/motion.styles'
|
|
143
|
+
*/
|
|
144
|
+
export async function scanForStyleDependencies(filePath) {
|
|
145
|
+
const { readFile } = await import('node:fs/promises');
|
|
146
|
+
try {
|
|
147
|
+
const content = await readFile(filePath, 'utf-8');
|
|
148
|
+
// Match ../styles/filename or ../../styles/filename or ../../../styles/filename
|
|
149
|
+
const stylesRegex = /import\s+.*?from\s+['"](?:\.\.\/)+styles\/([^'"]+)['"]/g;
|
|
150
|
+
const matches = [...content.matchAll(stylesRegex)];
|
|
151
|
+
return matches.map(match => match[1]); // returns filename like 'motion.styles'
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
return [];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Get the source path for a style file
|
|
159
|
+
*/
|
|
160
|
+
export function getStyleSourcePath(referencePath, styleName) {
|
|
161
|
+
// Styles are in lib/src/styles/<Name>.ts or similar
|
|
162
|
+
return path.join(referencePath, 'src/styles', `${styleName}.ts`);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Scan a file for type dependencies
|
|
166
|
+
* Looks for imports like: import type ... from '../../../types/fx'
|
|
167
|
+
*/
|
|
168
|
+
export async function scanForTypeDependencies(filePath) {
|
|
169
|
+
const { readFile } = await import('node:fs/promises');
|
|
170
|
+
try {
|
|
171
|
+
const content = await readFile(filePath, 'utf-8');
|
|
172
|
+
// Match ../types/filename or ../../types/filename or ../../../types/filename
|
|
173
|
+
const typesRegex = /import\s+.*?from\s+['"](?:\.\.\/)+types\/([^'"]+)['"]/g;
|
|
174
|
+
const matches = [...content.matchAll(typesRegex)];
|
|
175
|
+
return matches.map(match => match[1]); // returns filename like 'fx'
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Get the source path for a type file
|
|
183
|
+
*/
|
|
184
|
+
export function getTypeSourcePath(referencePath, typeName) {
|
|
185
|
+
// Types are in lib/src/types/<Name>.ts or similar
|
|
186
|
+
return path.join(referencePath, 'src/types', `${typeName}.ts`);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Scan a file for component dependencies
|
|
190
|
+
* Looks for imports like: import "../../IconButton/core/IconButton"
|
|
191
|
+
* or: import { ... } from "../../ComponentName/..."
|
|
192
|
+
*/
|
|
193
|
+
export async function scanForComponentDependencies(filePath) {
|
|
194
|
+
const { readFile } = await import('node:fs/promises');
|
|
195
|
+
try {
|
|
196
|
+
const content = await readFile(filePath, 'utf-8');
|
|
197
|
+
// Match ../../ComponentName/ patterns in imports
|
|
198
|
+
const componentRegex = /import\s+(?:.*?from\s+)?['"](?:\.\.\/){2,}([A-Z][^/'"]+)\//g;
|
|
199
|
+
const matches = [...content.matchAll(componentRegex)];
|
|
200
|
+
const components = matches.map(match => match[1]); // Extract component name
|
|
201
|
+
// Remove duplicates and filter out 'shared' directory
|
|
202
|
+
return [...new Set(components)].filter(name => name !== 'shared');
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
return [];
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/utils/components.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAErD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,aAAqB;IAChE,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;IAElE,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,mCAAmC,aAAa,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,cAAc,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAEvE,oEAAoE;IACpE,MAAM,UAAU,GAAG,OAAO;SACvB,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;SACpC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;SACxB,MAAM,CAAC,IAAI,CAAC,EAAE,CACb,IAAI,KAAK,QAAQ;QACjB,IAAI,KAAK,OAAO;QAChB,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QACrB,CAA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C,CAAC,CAAC,CAAC,CAAC,6BAA6B;IACtE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,aAAqB,EACrB,QAAgB;IAEhB,kDAAkD;IAClD,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,EAAE,GAAG,QAAQ,KAAK,CAAC,CAAC;AACjE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,QAAgB;IACjE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAEtD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAClD,iDAAiD;QACjD,MAAM,cAAc,GAAG,6DAA6D,CAAC;QACrF,MAAM,OAAO,GAAG,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC;QACtD,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,yBAAyB;QAC5E,sDAAsD;QACtD,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;IACpE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AgnosticUIConfig, Framework, ComponentEntry } from '../types/index.js';
|
|
2
|
+
export declare function loadConfig(cwd?: string): Promise<AgnosticUIConfig | null>;
|
|
3
|
+
export declare function saveConfig(config: AgnosticUIConfig, cwd?: string): Promise<void>;
|
|
4
|
+
export declare function createDefaultConfig(framework: Framework, componentsPath: string, version: string): AgnosticUIConfig;
|
|
5
|
+
export declare function addComponentToConfig(config: AgnosticUIConfig, componentName: string, version: string, files: string[]): AgnosticUIConfig;
|
|
6
|
+
export declare function hasComponent(config: AgnosticUIConfig, componentName: string): boolean;
|
|
7
|
+
export declare function getComponentEntry(config: AgnosticUIConfig, componentName: string): ComponentEntry | null;
|
|
8
|
+
export declare function removeComponentFromConfig(config: AgnosticUIConfig, componentName: string): AgnosticUIConfig;
|
|
9
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAIrF,wBAAsB,UAAU,CAAC,GAAG,GAAE,MAAsB,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAa9F;AAED,wBAAsB,UAAU,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,GAAE,MAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAQrG;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAmBnH;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,gBAAgB,EACxB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EAAE,GACd,gBAAgB,CAelB;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAErF;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAExG;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,gBAAgB,EACxB,aAAa,EAAE,MAAM,GACpB,gBAAgB,CAOlB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration file management
|
|
3
|
+
*/
|
|
4
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
5
|
+
import { existsSync } from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
const CONFIG_FILE_NAME = 'agnosticui.config.json';
|
|
8
|
+
export async function loadConfig(cwd = process.cwd()) {
|
|
9
|
+
const configPath = path.join(cwd, CONFIG_FILE_NAME);
|
|
10
|
+
if (!existsSync(configPath)) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
const content = await readFile(configPath, 'utf-8');
|
|
15
|
+
return JSON.parse(content);
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
throw new Error(`Failed to read config file: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export async function saveConfig(config, cwd = process.cwd()) {
|
|
22
|
+
const configPath = path.join(cwd, CONFIG_FILE_NAME);
|
|
23
|
+
try {
|
|
24
|
+
await writeFile(configPath, JSON.stringify(config, null, 2) + '\n', 'utf-8');
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
throw new Error(`Failed to write config file: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export function createDefaultConfig(framework, componentsPath, version) {
|
|
31
|
+
return {
|
|
32
|
+
$schema: 'https://agnosticui.com/schema.json',
|
|
33
|
+
version,
|
|
34
|
+
framework,
|
|
35
|
+
paths: {
|
|
36
|
+
reference: './agnosticui',
|
|
37
|
+
components: componentsPath,
|
|
38
|
+
},
|
|
39
|
+
components: {},
|
|
40
|
+
ai: {
|
|
41
|
+
includeReference: true,
|
|
42
|
+
includeContext: true,
|
|
43
|
+
contextPath: './agnosticui/docs',
|
|
44
|
+
},
|
|
45
|
+
git: {
|
|
46
|
+
commitReference: true,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export function addComponentToConfig(config, componentName, version, files) {
|
|
51
|
+
const entry = {
|
|
52
|
+
added: new Date().toISOString(),
|
|
53
|
+
version,
|
|
54
|
+
framework: config.framework,
|
|
55
|
+
files,
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
...config,
|
|
59
|
+
components: {
|
|
60
|
+
...config.components,
|
|
61
|
+
[componentName]: entry,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export function hasComponent(config, componentName) {
|
|
66
|
+
return componentName in config.components;
|
|
67
|
+
}
|
|
68
|
+
export function getComponentEntry(config, componentName) {
|
|
69
|
+
return config.components[componentName] || null;
|
|
70
|
+
}
|
|
71
|
+
export function removeComponentFromConfig(config, componentName) {
|
|
72
|
+
const { [componentName]: _, ...remainingComponents } = config.components;
|
|
73
|
+
return {
|
|
74
|
+
...config,
|
|
75
|
+
components: remainingComponents,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,MAAM,gBAAgB,GAAG,wBAAwB,CAAC;AAElD,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IAC1D,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;IAEpD,IAAI,CAAC,UAAU,CAAC,UAA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jC;QACD,GAAG,EAAE;YACH,eAAe,EAAE,IAAI;SACtB;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,MAAwB,EACxB,aAAqB,EACrB,OAAe,EACf,KAAe;IAEf,MAAM,KAAK,GAAmB;QAC5B,KAAK,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAC/B,OAAO;QACP,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,KAAK;KACN,CAAC;IAEF,OAAO;QACL,GAAG,MAAM;QACT,UAAU,EAAE;YACV,GAAG,MAAM,CAAC,UAAU;YACpB,CAAC,aAAa,CAAC,EAAE,KAAK;SACvB;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAwB,EAAE,aAAqB;IAC1E,OAAO,aAAa,IAAI,MAAM,CAAC,UAAU,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAwB,EAAE,aAAqB;IAC/E,OAAO,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,MAAwB,EACxB,aAAqB;IAErB,MAAM,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE,GAAG,mBAAmB,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC;IAEzE,OAAO;QACL,GAAG,MAAM;QACT,UAAU,EAAE,mBAAmB;KAChC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Framework } from '../types/index.js';
|
|
2
|
+
export type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun';
|
|
3
|
+
/**
|
|
4
|
+
* Detect the package manager being used in the project
|
|
5
|
+
*/
|
|
6
|
+
export declare function detectPackageManager(cwd?: string): PackageManager;
|
|
7
|
+
/**
|
|
8
|
+
* Get the install command for a package manager
|
|
9
|
+
*/
|
|
10
|
+
export declare function getInstallCommand(packageManager: PackageManager, packages: string[]): string;
|
|
11
|
+
/**
|
|
12
|
+
* Get required dependencies for a framework
|
|
13
|
+
*/
|
|
14
|
+
export declare function getFrameworkDependencies(framework: Framework): string[];
|
|
15
|
+
/**
|
|
16
|
+
* Install dependencies using the detected package manager
|
|
17
|
+
*/
|
|
18
|
+
export declare function installDependencies(packages: string[], cwd?: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Check if dependencies are already installed
|
|
21
|
+
*/
|
|
22
|
+
export declare function checkDependenciesInstalled(packages: string[], cwd?: string): boolean;
|
|
23
|
+
//# sourceMappingURL=dependencies.d.ts.map
|