mirror of
https://github.com/nilbuild/diffity.git
synced 2026-09-19 07:26:16 +08:00
fix: issues with comments
This commit is contained in:
+3
-1
@@ -7,7 +7,9 @@ concurrently(
|
||||
{ command: 'npm run dev -w @diffity/parser', name: 'parser' },
|
||||
{ command: 'npm run dev -w @diffity/git', name: 'git' },
|
||||
{ command: 'npm run dev:watch -w diffity', name: 'cli' },
|
||||
{ command: 'npm run dev -w @diffity/ui', name: 'ui' },
|
||||
// `vite build --watch` instead of `vite dev` so the output lands in dist/ui
|
||||
// where the CLI server can serve it. `vite dev` only serves from memory.
|
||||
{ command: 'npx -w @diffity/ui vite build --watch', name: 'ui' },
|
||||
{
|
||||
command: 'tsx --watch-path=packages/skills scripts/build-skills.ts',
|
||||
name: 'skills',
|
||||
|
||||
+13
-3
@@ -1,4 +1,4 @@
|
||||
import { symlinkSync, unlinkSync, existsSync, mkdirSync } from 'fs';
|
||||
import { writeFileSync, chmodSync, unlinkSync, existsSync, mkdirSync } from 'fs';
|
||||
import { resolve, dirname, join } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
@@ -6,6 +6,7 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const rootDir = resolve(__dirname, '..');
|
||||
const binDir = join(rootDir, '.bin');
|
||||
const cliEntry = join(rootDir, 'packages', 'cli', 'dist', 'index.js');
|
||||
const watchDir = join(rootDir, 'packages', 'cli', 'dist');
|
||||
const linkPath = join(binDir, 'diffity-dev');
|
||||
|
||||
mkdirSync(binDir, { recursive: true });
|
||||
@@ -14,10 +15,19 @@ if (existsSync(linkPath)) {
|
||||
unlinkSync(linkPath);
|
||||
}
|
||||
|
||||
symlinkSync(cliEntry, linkPath);
|
||||
// Shell script instead of a symlink to dist/index.js so we can use node --watch.
|
||||
// A symlink would run the CLI once and never pick up server-side changes.
|
||||
// --watch-path: auto-restart when tsc --watch recompiles dist/
|
||||
// --no-open: prevent opening a new browser tab on every restart
|
||||
const script = `#!/usr/bin/env bash
|
||||
exec node --watch-path="${watchDir}" "${cliEntry}" --no-open "$@"
|
||||
`;
|
||||
|
||||
writeFileSync(linkPath, script);
|
||||
chmodSync(linkPath, 0o755);
|
||||
|
||||
const pathIncludes = process.env.PATH?.includes(binDir);
|
||||
console.log(`Linked diffity-dev -> ${cliEntry}`);
|
||||
console.log(`Created diffity-dev (auto-restarts on changes)`);
|
||||
if (!pathIncludes) {
|
||||
console.log(`\nAdd this to your shell profile to use diffity-dev globally:`);
|
||||
console.log(` export PATH="${binDir}:$PATH"`);
|
||||
|
||||
Reference in New Issue
Block a user