@tixyel/cli 1.0.0 → 2.0.1

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,49 +0,0 @@
1
- import { readFile, writeFile } from 'fs/promises';
2
- import { join } from 'path';
3
- import { parse } from 'jsonc-parser';
4
- /**
5
- * Bumps the version of a widget configuration
6
- */
7
- export async function bumpWidgetVersion(widgetPath, bumpType = 'patch') {
8
- try {
9
- const configPath = join(widgetPath, '.tixyel');
10
- const content = await readFile(configPath, 'utf-8');
11
- const config = parse(content);
12
- if (!config.version) {
13
- config.version = '0.0.0';
14
- }
15
- // Parse current version
16
- const [major, minor, patch] = config.version.split('.').map(Number);
17
- // Calculate new version
18
- let newVersion;
19
- switch (bumpType) {
20
- case 'major':
21
- newVersion = `${major + 1}.0.0`;
22
- break;
23
- case 'minor':
24
- newVersion = `${major}.${minor + 1}.0`;
25
- break;
26
- case 'patch':
27
- default:
28
- newVersion = `${major}.${minor}.${patch + 1}`;
29
- break;
30
- }
31
- // Update config
32
- config.version = newVersion;
33
- // Write back to file (JSON format)
34
- const formattedContent = JSON.stringify(config, null, 2);
35
- await writeFile(configPath, formattedContent, 'utf-8');
36
- return newVersion;
37
- }
38
- catch (error) {
39
- console.error(`Failed to bump version in ${widgetPath}:`, error);
40
- return null;
41
- }
42
- }
43
- /**
44
- * Prompts user to select version bump type
45
- */
46
- export async function promptVersionBump() {
47
- // This will be used with inquirer in the build command
48
- return 'patch'; // Default, will be replaced with prompt
49
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * Finds the workspace root by searching for tixyel.config.ts or tixyel.config.js
3
- * Searches upwards from the current directory
4
- */
5
- export declare function findWorkspaceRoot(startPath?: string): Promise<string | null>;
6
- /**
7
- * Gets the relative path from a widget directory to the workspace root config
8
- */
9
- export declare function getConfigPathFromWidget(widgetPath: string, workspaceRoot: string): string;
10
- /**
11
- * Validates that workspace is initialized
12
- */
13
- export declare function validateWorkspaceInit(): Promise<string>;
@@ -1,43 +0,0 @@
1
- import { resolve, relative } from 'path';
2
- import { existsSync } from 'fs';
3
- /**
4
- * Finds the workspace root by searching for tixyel.config.ts or tixyel.config.js
5
- * Searches upwards from the current directory
6
- */
7
- export async function findWorkspaceRoot(startPath = process.cwd()) {
8
- let currentPath = resolve(startPath);
9
- // Limit search to 10 levels up to avoid infinite loops
10
- for (let i = 0; i < 10; i++) {
11
- const configTs = resolve(currentPath, 'tixyel.config.ts');
12
- const configJs = resolve(currentPath, 'tixyel.config.js');
13
- if (existsSync(configTs) || existsSync(configJs)) {
14
- return currentPath;
15
- }
16
- const parentPath = resolve(currentPath, '..');
17
- if (parentPath === currentPath) {
18
- // Reached filesystem root
19
- break;
20
- }
21
- currentPath = parentPath;
22
- }
23
- return null;
24
- }
25
- /**
26
- * Gets the relative path from a widget directory to the workspace root config
27
- */
28
- export function getConfigPathFromWidget(widgetPath, workspaceRoot) {
29
- const relPath = relative(widgetPath, resolve(workspaceRoot, 'tixyel.config.ts'));
30
- // Normalize path separators and ensure it starts with ./
31
- const normalized = relPath.replace(/\\/g, '/');
32
- return normalized.startsWith('.') ? normalized : `./${normalized}`;
33
- }
34
- /**
35
- * Validates that workspace is initialized
36
- */
37
- export async function validateWorkspaceInit() {
38
- const workspaceRoot = await findWorkspaceRoot();
39
- if (!workspaceRoot) {
40
- throw new Error('❌ Workspace not initialized. Run `tixyel init` in your workspace root first.');
41
- }
42
- return workspaceRoot;
43
- }