Skip to content

Commit 8e3489e

Browse files
authored
refactor: cleanup regarding build pipeline, cleanup of deps (#97)
2 parents a1b0814 + cee20fc commit 8e3489e

File tree

18 files changed

+53
-175
lines changed

18 files changed

+53
-175
lines changed

.changeset/stale-actors-vanish.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@calycode/types': minor
3+
'@calycode/utils': minor
4+
'@calycode/core': minor
5+
'@calycode/cli': minor
6+
---
7+
8+
feat: adding graceful, simple exit handling
9+
feat: fixing and wrapping up backup exporting command
10+
fix: registry file type .xano -> .xs
11+
refactor: marked types, utils, core as devDeps as they are all bundled at build --> reduce deps
12+
refactor: minor cleanup, removal of context-switching command, registry schema links fixed

esbuild.base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { BuildOptions } from 'esbuild';
44
export const baseConfig: BuildOptions = {
55
bundle: true, // Always bundle
66
sourcemap: true, // Useful for debugging
7-
logLevel: 'info', // Show logs
7+
logLevel: 'warning', // Show logs
88
target: 'node18', // Good default for most Node CLI tools
99
treeShaking: true,
1010
minify: true, // Minify output for smaller bundles

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@calycode/xano-tools-workspace",
3-
"version": "0.1.1",
3+
"version": "0.6.0",
44
"type": "module",
55
"description": "Supercharge your Xano workflow: automate backups, docs, testing, and version control—no AI guesswork, just reliable, transparent dev tools.",
66
"workspaces": [
@@ -13,7 +13,7 @@
1313
"build": "tsc --build",
1414
"build:docs": "tsx scripts/generate-caly-cli-docs.ts",
1515
"build:packages": "pnpm -r --reporter=silent --workspace-concurrency=1 run build",
16-
"caly": "pnpm --filter @calycode/cli run caly",
16+
"xano": "pnpm --filter @calycode/cli run xano",
1717
"clean": "pnpm -r run clean && trash dist tsconfig.tsbuildinfo",
1818
"prepublishOnly": "pnpm run build:packages",
1919
"serve-registry": "npx serve registry --listen 3030"

packages/cli/package.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,21 @@
4242
"url": "https://github.com/calycode/xano-tools/issues"
4343
},
4444
"homepage": "https://github.com/calycode/xano-tools/tree/main/packages/cli#readme",
45-
"dependencies": {
46-
"@clack/prompts": "^0.11.0",
45+
"devDependencies": {
4746
"@calycode/core": "workspace:*",
4847
"@calycode/types": "workspace:*",
4948
"@calycode/utils": "workspace:*",
49+
"shx": "^0.4.0",
50+
"@clack/prompts": "^0.11.0",
5051
"commander": "^14.0.0",
5152
"js-yaml": "^4.1.0",
52-
"tar": "^7.4.3",
53-
"uvu": "^0.5.6"
53+
"tar": "^7.4.3"
5454
},
5555
"scripts": {
5656
"clean": "trash dist tsconfig.tsbuildinfo",
5757
"build:js": "tsx esbuild.config.ts",
5858
"build:chmod": "shx chmod +x dist/index.cjs",
5959
"build": "pnpm clean && pnpm build:js && pnpm build:chmod && pnpm link -g",
6060
"xano": "node dist/index.cjs"
61-
},
62-
"devDependencies": {
63-
"shx": "^0.4.0"
6461
}
6562
}

packages/cli/src/commands/analyze.ts

Lines changed: 0 additions & 121 deletions
This file was deleted.

packages/cli/src/commands/context.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,6 @@ async function switchContextWizard(
8181
);
8282
}
8383

84-
function registerSwitchContextCommand(program, core) {
85-
const cmd = program.command('switch-context').description('Switch instance/workspace context');
86-
addFullContextOptions(cmd);
87-
cmd.action(
88-
withErrorHandler(async (opts) => {
89-
if (opts.instance && opts.workspace && opts.branch) {
90-
await core.switchContext({
91-
instance: opts.instance,
92-
workspace: opts.workspace,
93-
branch: opts.branch,
94-
});
95-
} else {
96-
await switchContextWizard(opts, core);
97-
}
98-
})
99-
);
100-
}
101-
10284
function registerCurrentContextCommand(program, core) {
10385
program.command('current-context').action(async () => {
10486
const startDir = process.cwd();
@@ -107,4 +89,4 @@ function registerCurrentContextCommand(program, core) {
10789
});
10890
}
10991

110-
export { registerSwitchContextCommand, registerCurrentContextCommand };
92+
export { registerCurrentContextCommand };

packages/cli/src/commands/registry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ function registerRegistryScaffoldCommand(program, core) {
158158
program
159159
.command('registry-scaffold')
160160
.description(
161-
'Scaffold a Xano registry folder with a sample component. Xano registry can be used to share and reuse prebuilt components. In the registry you have to follow the [registry](https://nextcurve.hu/schemas/registry/registry.json) and [registry item](https://nextcurve.hu/schemas/registry/registry-item.json) schemas.'
161+
'Scaffold a Xano registry folder with a sample component. Xano registry can be used to share and reuse prebuilt components. In the registry you have to follow the [registry](https://calycode.com/schemas/registry/registry.json) and [registry item](https://calycode.com/schemas/registry/registry-item.json) schemas.'
162162
)
163163
.option('--output <path>', 'Output path for the registry')
164164
.option(

packages/cli/src/commands/serve.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { addApiGroupOptions, addFullContextOptions, chooseApiGroupOrAll } from '
44
import { resolveConfigs } from '../utils/commands/context-resolution';
55
import { findProjectRoot } from '../utils/commands/project-root-finder';
66

7-
// [ ] CLI
87
async function serveOas({ instance, workspace, branch, group, listen = 5999, cors = false, core }) {
98
const { instanceConfig, workspaceConfig, branchConfig } = await resolveConfigs({
109
cliContext: { instance, workspace, branch },
@@ -55,7 +54,6 @@ async function serveOas({ instance, workspace, branch, group, listen = 5999, cor
5554
});
5655
}
5756

58-
// [ ] CLI
5957
function serveRegistry({ root = 'registry', listen = 5000, cors = false }) {
6058
return new Promise<void>((resolve, reject) => {
6159
const serveArgs = [String(root), '-l', String(listen)];
@@ -78,7 +76,6 @@ function serveRegistry({ root = 'registry', listen = 5000, cors = false }) {
7876
});
7977
}
8078

81-
// [ ] CLI
8279
function registerRegistryServeCommand(program) {
8380
program
8481
.command('serve-registry')
@@ -100,7 +97,6 @@ function registerRegistryServeCommand(program) {
10097
});
10198
}
10299

103-
// [ ] CLI
104100
function registerOasServeCommand(program, core) {
105101
const cmd = program
106102
.command('serve-oas')

packages/cli/src/program.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ import { font } from './utils';
33
import pkg from '../../../package.json' with {type: "json"};
44

55
// Import commands:
6-
import { registerCurrentContextCommand, registerSwitchContextCommand } from './commands/context';
6+
import { registerCurrentContextCommand } from './commands/context';
77
import { registerExportBackupCommand, registerRestoreBackupCommand } from './commands/backups';
8-
//import { registerFetchFunctionsInXanoScript } from './commands/analyze';
98
import { registerGenerateCodeCommand } from './commands/generate-code';
109
import { registerGenerateOasCommand } from './commands/generate-oas';
1110
import { registerGenerateRepoCommand } from './commands/generate-repo';
@@ -74,13 +73,11 @@ program
7473

7574
// --- Register your commands here ---
7675
registerSetupCommand(program, core);
77-
registerSwitchContextCommand(program, core);
7876
registerGenerateOasCommand(program, core);
7977
registerOasServeCommand(program, core);
8078
registerGenerateCodeCommand(program, core);
8179
registerGenerateRepoCommand(program, core);
8280
registerBuildXanoscriptRepoCommand(program, core);
83-
//registerFetchFunctionsInXanoScript(program, core);
8481
registerRegistryAddCommand(program, core);
8582
registerRegistryScaffoldCommand(program, core);
8683
registerRegistryServeCommand(program);
@@ -105,7 +102,7 @@ program.configureHelp({
105102
const groups = [
106103
{
107104
title: font.combo.boldCyan('Core Commands:'),
108-
commands: ['setup', 'switch-context'],
105+
commands: ['setup'],
109106
},
110107
{
111108
title: font.combo.boldCyan('Code Generation:'),

packages/cli/src/utils/commands/option-sets.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// [ ] CLI, the whole file
21
/**
32
* Attach shared context options to a Commander command.
43
* @param {Command} cmd - The commander command object

0 commit comments

Comments
 (0)