@raketa-cloud/design-cli 1.1.1 → 1.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raketa-cloud/design-cli",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "CLI for building and previewing local design systems",
5
5
  "repository": {
6
6
  "type": "git",
package/preset.mjs CHANGED
@@ -7,8 +7,8 @@ import { promisify } from 'node:util';
7
7
  const exec = promisify(execFile);
8
8
  // Honor the user's Git credentials and SSH configuration while avoiding prompts.
9
9
  const env = { ...process.env, GIT_TERMINAL_PROMPT: '0' };
10
- async function git(args, cwd) {
11
- const { stdout } = await exec('git', ['-c', 'core.hooksPath=/dev/null', '-c', 'core.fsmonitor=false', ...args], { cwd, env, maxBuffer: 10 * 1024 * 1024 });
10
+ async function git(args, cwd, readOnly = false) {
11
+ const { stdout } = await exec('git', ['-c', 'core.hooksPath=/dev/null', '-c', 'core.fsmonitor=false', ...args], { cwd, env: readOnly ? { ...env, GIT_OPTIONAL_LOCKS: '0' } : env, maxBuffer: 10 * 1024 * 1024 });
12
12
  return stdout.trim();
13
13
  }
14
14
  function presetConfig(context) {
@@ -38,9 +38,9 @@ async function validateCheckout(context, lock) {
38
38
  try {
39
39
  if (!(await lstat(path)).isDirectory()) throw new Error('not a directory');
40
40
  const [head, origin, status] = await Promise.all([
41
- git(['rev-parse', '--verify', 'HEAD^{commit}'], path),
42
- git(['config', '--get', 'remote.origin.url'], path),
43
- git(['status', '--porcelain', '--untracked-files=all', '--ignore-submodules=none'], path),
41
+ git(['rev-parse', '--verify', 'HEAD^{commit}'], path, true),
42
+ git(['config', '--get', 'remote.origin.url'], path, true),
43
+ git(['status', '--porcelain', '--untracked-files=all', '--ignore-submodules=none'], path, true),
44
44
  ]);
45
45
  if (head !== lock.commit || origin !== source(lock.repo, context) || status) throw new Error('checkout differs from lock or has local changes');
46
46
  return path;
@@ -217,7 +217,12 @@ function scheduleReload() {
217
217
  }
218
218
  const sharedRoot = await presetDesign(context);
219
219
  for (const directory of [...new Set([root, ...(sharedRoot ? [sharedRoot] : []), ...(!toolDir.startsWith(root + sep) && toolDir !== root ? [toolDir] : [])])]) {
220
- const watcher = watch(directory, { recursive: true }, scheduleReload);
220
+ const watcher = watch(directory, { recursive: true }, (_event, name) => {
221
+ // Git may refresh its index while preset validation runs during a request.
222
+ // Those metadata writes are not design changes and must not reload the page.
223
+ if (name && String(name).split(/[\\/]/).includes('.git')) return;
224
+ scheduleReload();
225
+ });
221
226
  watcher.on('error', error => console.error('Live reload watcher failed:', error));
222
227
  }
223
228
  // Watch the one configured output directory; theme generation occurs outside .design.