@raketa-cloud/design-cli 1.1.1 → 1.1.3
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/README.md +1 -0
- package/package.json +1 -1
- package/preset.mjs +5 -5
- package/showcase/serve.mjs +8 -2
package/README.md
CHANGED
|
@@ -52,6 +52,7 @@ The disposable `.design/.preset/` cache is ignored by its own ignore file. Insta
|
|
|
52
52
|
For live preset development, set `DESIGN_PRESET_DIR` to a local checkout and run generate or serve. Changes to that checkout are visible through the runtime link and showcase. This override is forbidden when `CI` is set. Restart the showcase after changing the checkout location.
|
|
53
53
|
|
|
54
54
|
Token JSON objects merge recursively; arrays replace wholesale. Local component and layout pattern directories replace the entire matching preset pattern. Additional local component CSS follows preset CSS. `tokenOverrides` maps `:root` and `.dark` to existing CSS variable names and values; unknown names are rejected. For example: `"tokenOverrides": { ":root": { "--color-action": "#123456" } }`. Not every valid CSS color expression can be rendered in catalog swatches; inspect the actual preview and generated CSS.
|
|
55
|
+
The showcase uses the host's `_theme_preview.html` when present, otherwise the preset's; if neither exists it displays a placeholder.
|
|
55
56
|
|
|
56
57
|
Preset repositories, previews and runtime JavaScript are trusted inputs. The installer does not invoke preset install scripts, but Git uses your configuration and credentials, including any configured checkout filters. Using preset CSS, JavaScript or Tailwind plugins can execute or load untrusted content. Review changes and test framework integration separately.
|
|
57
58
|
|
package/package.json
CHANGED
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;
|
package/showcase/serve.mjs
CHANGED
|
@@ -200,7 +200,8 @@ function themePreview(name, details, snippet) {
|
|
|
200
200
|
}
|
|
201
201
|
async function showcase() {
|
|
202
202
|
const data = await catalog(await loadConfig());
|
|
203
|
-
const [components, layouts, assets, name, fontsLink,
|
|
203
|
+
const [components, layouts, assets, name, fontsLink, snippetPath] = await Promise.all([exampleIndex('components'), exampleIndex('layouts'), assetIndex(), designName(), optionalFontsLink(), overlayPath(await loadConfig(), '_theme_preview.html')]);
|
|
204
|
+
const snippet = snippetPath ? await readFile(snippetPath, 'utf8') : null;
|
|
204
205
|
const themeSets = Object.entries(resolveThemeDetails(data));
|
|
205
206
|
const themes = snippet === null ? '<p class="empty">Add _theme_preview.html to preview themes.</p>' : '<div class="theme-previews">' + themeSets.map(([name, details]) => themePreview(name === 'light' ? 'Default' : name, details, snippet)).join('') + '</div>';
|
|
206
207
|
const typography = typographyPreview(data);
|
|
@@ -217,7 +218,12 @@ function scheduleReload() {
|
|
|
217
218
|
}
|
|
218
219
|
const sharedRoot = await presetDesign(context);
|
|
219
220
|
for (const directory of [...new Set([root, ...(sharedRoot ? [sharedRoot] : []), ...(!toolDir.startsWith(root + sep) && toolDir !== root ? [toolDir] : [])])]) {
|
|
220
|
-
const watcher = watch(directory, { recursive: true },
|
|
221
|
+
const watcher = watch(directory, { recursive: true }, (_event, name) => {
|
|
222
|
+
// Git may refresh its index while preset validation runs during a request.
|
|
223
|
+
// Those metadata writes are not design changes and must not reload the page.
|
|
224
|
+
if (name && String(name).split(/[\\/]/).includes('.git')) return;
|
|
225
|
+
scheduleReload();
|
|
226
|
+
});
|
|
221
227
|
watcher.on('error', error => console.error('Live reload watcher failed:', error));
|
|
222
228
|
}
|
|
223
229
|
// Watch the one configured output directory; theme generation occurs outside .design.
|