Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@embrace-io/web-cli",
"bin": {
"embrace-web-cli": "dist/index.js"
"embrace-web-cli": "dist/index.mjs"
},
"version": "2.9.0",
"description": "Embrace Web CLI for uploading sourcemaps and versioning bundles",
Expand All @@ -11,14 +11,12 @@
},
"scripts": {
"clean": "npx rimraf dist",
"compile": "tsc && esbuild src/index.ts --bundle --format=esm --platform=node --target=es2022 --outfile=dist/index.js --external:commander",
"compile": "npm run clean && tsc && tsdown",
"test": "tsx --test src/**/*.test.ts",
"validate": "bash scripts/validate-cli.sh"
"validate": "tsx scripts/validate-cli.ts"
},
"files": [
"dist",
"LICENSE",
"README.md"
Comment on lines -19 to -21
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license and readme are always included by npm

"dist"
],
"bugs": {
"url": "https://github.com/embrace-io/embrace-web-sdk/issues",
Expand Down
53 changes: 0 additions & 53 deletions cli/scripts/validate-cli.sh

This file was deleted.

43 changes: 43 additions & 0 deletions cli/scripts/validate-cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { execSync } from 'node:child_process';
import { mkdtempSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { COLORS, log, logSection } from '../../scripts/build-config.js';

const CLI_FILE = 'dist/index.mjs';
const cliDir = join(import.meta.dirname, '..');

function run(cmd: string, cwd = cliDir) {
return execSync(cmd, { cwd, encoding: 'utf-8', stdio: 'pipe' });
}

logSection('CLI Validation');

// ES compatibility check
log('Checking ES compatibility...', COLORS.blue);
run(`npx es-check es2022 ${CLI_FILE} --module --allow-hash-bang`);
log(' ✓ ES2022 compatible', COLORS.green);

// Integration test
log('Testing CLI execution...', COLORS.blue);
const tempDir = mkdtempSync(join(tmpdir(), 'embrace-cli-validate-'));

try {
execSync('npm init -y', { cwd: tempDir, stdio: 'pipe' });
execSync(`npm install ${cliDir}`, { cwd: tempDir, stdio: 'pipe' });

const helpOutput = execSync('npx embrace-web-cli --help', {
cwd: tempDir,
encoding: 'utf-8',
});

if (!helpOutput.includes('Commands:')) {
log(' ✗ No commands found in CLI help', COLORS.red);
process.exit(1);
}
log(' ✓ CLI executes and has command structure', COLORS.green);
} finally {
rmSync(tempDir, { recursive: true, force: true });
}

log('\n✓ All CLI validations passed!', COLORS.green + COLORS.bold);
12 changes: 12 additions & 0 deletions cli/tsdown.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from 'tsdown';

export default defineConfig({
entry: ['src/index.ts'],
format: ['esm'],
target: 'es2022',
platform: 'node',
outDir: 'dist',
external: ['commander'],
clean: true,
publint: true,
});
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scripts/build-config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Shared build configuration for Embrace Web SDK
// Shared build configuration for SDK and CLI

// Maximum bundle size (gzipped) to ensure fast load times
export const MAX_BUNDLE_SIZE_KB = 100;
Expand Down
72 changes: 0 additions & 72 deletions scripts/measureSize.ts

This file was deleted.

Loading