@archetypeai/ds-cli 0.3.26 → 0.3.32
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/commands/create.js +1 -1
- package/commands/init.js +1 -1
- package/files/AGENTS.md +1 -1
- package/files/CLAUDE.md +1 -1
- package/lib/add-ds-lib-tokens.js +1 -1
- package/lib/add-ds-ui-svelte.js +1 -1
- package/lib/install-fonts-local.js +16 -141
- package/lib/scaffold-ds-svelte-project.js +4 -8
- package/package.json +1 -1
package/commands/create.js
CHANGED
package/commands/init.js
CHANGED
package/files/AGENTS.md
CHANGED
package/files/CLAUDE.md
CHANGED
package/lib/add-ds-lib-tokens.js
CHANGED
package/lib/add-ds-ui-svelte.js
CHANGED
|
@@ -192,7 +192,7 @@ export async function addDsUiSvelte(args) {
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
// configure CSS imports in layout.css
|
|
195
|
-
prependCss(projectDir
|
|
195
|
+
prependCss(projectDir);
|
|
196
196
|
|
|
197
197
|
const installSpinner = p.spinner();
|
|
198
198
|
installSpinner.start('Installing components');
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
import { existsSync, readdirSync, copyFileSync, mkdirSync
|
|
1
|
+
import { existsSync, readdirSync, copyFileSync, mkdirSync } from 'fs';
|
|
2
2
|
import { join, resolve } from 'path';
|
|
3
3
|
|
|
4
|
+
// strip surrounding quotes that some terminals (VS Code, Cursor) add on drag-and-drop
|
|
5
|
+
function sanitizePath(p) {
|
|
6
|
+
const trimmed = p.trim();
|
|
7
|
+
if (
|
|
8
|
+
(trimmed.startsWith("'") && trimmed.endsWith("'")) ||
|
|
9
|
+
(trimmed.startsWith('"') && trimmed.endsWith('"'))
|
|
10
|
+
) {
|
|
11
|
+
return trimmed.slice(1, -1);
|
|
12
|
+
}
|
|
13
|
+
return trimmed;
|
|
14
|
+
}
|
|
15
|
+
|
|
4
16
|
// all 15 required font files
|
|
5
17
|
export const REQUIRED_FONTS = [
|
|
6
18
|
// PP Neue Montreal Sans (.ttf)
|
|
@@ -22,135 +34,9 @@ export const REQUIRED_FONTS = [
|
|
|
22
34
|
'PPNeueMontrealMono-Bold.otf'
|
|
23
35
|
];
|
|
24
36
|
|
|
25
|
-
// hardcoded fonts.css template
|
|
26
|
-
export const FONTS_CSS = `/* PP Neue Montreal Sans*/
|
|
27
|
-
|
|
28
|
-
@font-face {
|
|
29
|
-
font-family: 'PP Neue Montreal';
|
|
30
|
-
src: url('/fonts/PPNeueMontreal-Thin.ttf') format('truetype');
|
|
31
|
-
font-weight: 100;
|
|
32
|
-
font-style: normal;
|
|
33
|
-
font-display: swap;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@font-face {
|
|
37
|
-
font-family: 'PP Neue Montreal';
|
|
38
|
-
src: url('/fonts/PPNeueMontreal-ThinItalic.ttf') format('truetype');
|
|
39
|
-
font-weight: 100;
|
|
40
|
-
font-style: italic;
|
|
41
|
-
font-display: swap;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@font-face {
|
|
45
|
-
font-family: 'PP Neue Montreal';
|
|
46
|
-
src: url('/fonts/PPNeueMontreal-Light.ttf') format('truetype');
|
|
47
|
-
font-weight: 300;
|
|
48
|
-
font-style: normal;
|
|
49
|
-
font-display: swap;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@font-face {
|
|
53
|
-
font-family: 'PP Neue Montreal';
|
|
54
|
-
src: url('/fonts/PPNeueMontreal-Regular.ttf') format('truetype');
|
|
55
|
-
font-weight: 400;
|
|
56
|
-
font-style: normal;
|
|
57
|
-
font-display: swap;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@font-face {
|
|
61
|
-
font-family: 'PP Neue Montreal';
|
|
62
|
-
src: url('/fonts/PPNeueMontreal-Italic.ttf') format('truetype');
|
|
63
|
-
font-weight: 400;
|
|
64
|
-
font-style: italic;
|
|
65
|
-
font-display: swap;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
@font-face {
|
|
69
|
-
font-family: 'PP Neue Montreal';
|
|
70
|
-
src: url('/fonts/PPNeueMontreal-Book.ttf') format('truetype');
|
|
71
|
-
font-weight: 400;
|
|
72
|
-
font-style: normal;
|
|
73
|
-
font-display: swap;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
@font-face {
|
|
77
|
-
font-family: 'PP Neue Montreal';
|
|
78
|
-
src: url('/fonts/PPNeueMontreal-Medium.ttf') format('truetype');
|
|
79
|
-
font-weight: 500;
|
|
80
|
-
font-style: normal;
|
|
81
|
-
font-display: swap;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
@font-face {
|
|
85
|
-
font-family: 'PP Neue Montreal';
|
|
86
|
-
src: url('/fonts/PPNeueMontreal-Bold.ttf') format('truetype');
|
|
87
|
-
font-weight: 700;
|
|
88
|
-
font-style: normal;
|
|
89
|
-
font-display: swap;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
@font-face {
|
|
93
|
-
font-family: 'PP Neue Montreal';
|
|
94
|
-
src: url('/fonts/PPNeueMontreal-BoldItalic.ttf') format('truetype');
|
|
95
|
-
font-weight: 700;
|
|
96
|
-
font-style: italic;
|
|
97
|
-
font-display: swap;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/* PP Neue Montreal Mono */
|
|
101
|
-
|
|
102
|
-
@font-face {
|
|
103
|
-
font-family: 'PP Neue Montreal Mono';
|
|
104
|
-
src: url('/fonts/PPNeueMontrealMono-Thin.otf') format('opentype');
|
|
105
|
-
font-weight: 100;
|
|
106
|
-
font-style: normal;
|
|
107
|
-
font-display: swap;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
@font-face {
|
|
111
|
-
font-family: 'PP Neue Montreal Mono';
|
|
112
|
-
src: url('/fonts/PPNeueMontrealMono-Regular.otf') format('opentype');
|
|
113
|
-
font-weight: 400;
|
|
114
|
-
font-style: normal;
|
|
115
|
-
font-display: swap;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
@font-face {
|
|
119
|
-
font-family: 'PP Neue Montreal Mono';
|
|
120
|
-
src: url('/fonts/PPNeueMontrealMono-RegularItalic.otf') format('opentype');
|
|
121
|
-
font-weight: 400;
|
|
122
|
-
font-style: italic;
|
|
123
|
-
font-display: swap;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
@font-face {
|
|
127
|
-
font-family: 'PP Neue Montreal Mono';
|
|
128
|
-
src: url('/fonts/PPNeueMontrealMono-Book.otf') format('opentype');
|
|
129
|
-
font-weight: 400;
|
|
130
|
-
font-style: normal;
|
|
131
|
-
font-display: swap;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
@font-face {
|
|
135
|
-
font-family: 'PP Neue Montreal Mono';
|
|
136
|
-
src: url('/fonts/PPNeueMontrealMono-Medium.otf') format('opentype');
|
|
137
|
-
font-weight: 500;
|
|
138
|
-
font-style: normal;
|
|
139
|
-
font-display: swap;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
@font-face {
|
|
143
|
-
font-family: 'PP Neue Montreal Mono';
|
|
144
|
-
src: url('/fonts/PPNeueMontrealMono-Bold.otf') format('opentype');
|
|
145
|
-
font-weight: 700;
|
|
146
|
-
font-style: normal;
|
|
147
|
-
font-display: swap;
|
|
148
|
-
}
|
|
149
|
-
`;
|
|
150
|
-
|
|
151
37
|
// validate that a directory contains all required font files
|
|
152
38
|
export function validateFontsPath(fontsPath) {
|
|
153
|
-
const resolved = resolve(fontsPath);
|
|
39
|
+
const resolved = resolve(sanitizePath(fontsPath));
|
|
154
40
|
|
|
155
41
|
if (!existsSync(resolved)) {
|
|
156
42
|
return { valid: false, missing: REQUIRED_FONTS, error: `Path does not exist: ${resolved}` };
|
|
@@ -177,7 +63,7 @@ export function validateFontsPath(fontsPath) {
|
|
|
177
63
|
|
|
178
64
|
// copy required font files to <project>/static/fonts/
|
|
179
65
|
export function copyFontsToStatic(fontsPath, projectPath) {
|
|
180
|
-
const src = resolve(fontsPath);
|
|
66
|
+
const src = resolve(sanitizePath(fontsPath));
|
|
181
67
|
const dest = join(projectPath, 'static', 'fonts');
|
|
182
68
|
mkdirSync(dest, { recursive: true });
|
|
183
69
|
|
|
@@ -188,17 +74,7 @@ export function copyFontsToStatic(fontsPath, projectPath) {
|
|
|
188
74
|
return REQUIRED_FONTS.length;
|
|
189
75
|
}
|
|
190
76
|
|
|
191
|
-
//
|
|
192
|
-
function writeFontsCss(projectPath) {
|
|
193
|
-
const cssPath = join(projectPath, 'src', 'routes', 'fonts.css');
|
|
194
|
-
const dir = join(projectPath, 'src', 'routes');
|
|
195
|
-
if (!existsSync(dir)) {
|
|
196
|
-
mkdirSync(dir, { recursive: true });
|
|
197
|
-
}
|
|
198
|
-
writeFileSync(cssPath, FONTS_CSS);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// orchestrate: validate, copy fonts, write fonts.css
|
|
77
|
+
// orchestrate: validate and copy font files to static/fonts/
|
|
202
78
|
export function installLocalFonts(fontsPath, projectPath) {
|
|
203
79
|
const validation = validateFontsPath(fontsPath);
|
|
204
80
|
if (!validation.valid) {
|
|
@@ -206,7 +82,6 @@ export function installLocalFonts(fontsPath, projectPath) {
|
|
|
206
82
|
}
|
|
207
83
|
|
|
208
84
|
const fileCount = copyFontsToStatic(fontsPath, projectPath);
|
|
209
|
-
writeFontsCss(projectPath);
|
|
210
85
|
|
|
211
86
|
return { success: true, fileCount };
|
|
212
87
|
}
|
|
@@ -143,11 +143,9 @@ export function cn(...inputs) {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
// configure CSS
|
|
146
|
-
export function configureCss(projectPath
|
|
146
|
+
export function configureCss(projectPath) {
|
|
147
147
|
let css = '';
|
|
148
|
-
|
|
149
|
-
css += '@import "./fonts.css";\n';
|
|
150
|
-
}
|
|
148
|
+
css += '@import "@archetypeai/ds-lib-tokens/fonts.css";\n';
|
|
151
149
|
css += '@import "@archetypeai/ds-lib-tokens/theme.css";\n';
|
|
152
150
|
css += '@import "tailwindcss";\n';
|
|
153
151
|
css += '@import "tw-animate-css";\n';
|
|
@@ -175,7 +173,7 @@ export async function installTailwind(pm, projectPath) {
|
|
|
175
173
|
}
|
|
176
174
|
|
|
177
175
|
// prepend CSS imports to existing layout.css
|
|
178
|
-
export function prependCss(projectPath
|
|
176
|
+
export function prependCss(projectPath) {
|
|
179
177
|
const cssPath = join(projectPath, 'src/routes/layout.css');
|
|
180
178
|
|
|
181
179
|
let existing = '';
|
|
@@ -190,9 +188,7 @@ export function prependCss(projectPath, includeFonts) {
|
|
|
190
188
|
}
|
|
191
189
|
|
|
192
190
|
let imports = '';
|
|
193
|
-
|
|
194
|
-
imports += '@import "./fonts.css";\n';
|
|
195
|
-
}
|
|
191
|
+
imports += '@import "@archetypeai/ds-lib-tokens/fonts.css";\n';
|
|
196
192
|
imports += '@import "@archetypeai/ds-lib-tokens/theme.css";\n';
|
|
197
193
|
imports += '@import "tailwindcss";\n';
|
|
198
194
|
imports += '@import "tw-animate-css";\n';
|