@pure-ds/core 0.5.5 ā 0.5.7
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/INTELLISENSE.md +3 -3
- package/dist/types/pds.d.ts +2 -0
- package/dist/types/public/assets/js/pds-manager.d.ts +2 -2
- package/dist/types/public/assets/js/pds.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-enhancers-meta.d.ts +13 -0
- package/dist/types/src/js/pds-core/pds-enhancers-meta.d.ts.map +1 -0
- package/dist/types/src/js/pds-core/pds-enhancers.d.ts +0 -15
- package/dist/types/src/js/pds-core/pds-enhancers.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-live.d.ts.map +1 -1
- package/package.json +7 -5
- package/packages/pds-cli/bin/pds-bootstrap.js +291 -0
- package/packages/pds-cli/bin/pds-static.js +1 -1
- package/packages/pds-cli/bin/postinstall.mjs +23 -15
- package/packages/pds-cli/bin/sync-assets.js +1 -1
- package/public/assets/js/app.js +10 -64
- package/public/assets/js/pds-manager.js +8 -8
- package/public/assets/js/pds.js +4 -58
- package/public/assets/pds/vscode-custom-data.json +4 -4
- package/readme.md +35 -21
- package/src/js/pds-core/pds-enhancers-meta.js +104 -0
- package/src/js/pds-core/pds-enhancers.js +9 -106
- package/src/js/pds-core/pds-live.js +2 -0
- package/src/js/pds-core/pds-registry.js +1 -1
- package/src/js/pds.d.ts +2 -0
- package/src/js/pds.js +1 -1
package/INTELLISENSE.md
CHANGED
|
@@ -20,14 +20,14 @@ Pure Design System provides comprehensive IntelliSense support for both HTML and
|
|
|
20
20
|
|
|
21
21
|
## š¦ Generation
|
|
22
22
|
|
|
23
|
-
IntelliSense data is automatically generated when you
|
|
23
|
+
IntelliSense data is automatically generated when you build PDS assets:
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
26
|
# Generate all IntelliSense data (recommended)
|
|
27
27
|
npm run pds:dx
|
|
28
28
|
|
|
29
|
-
# Or as part of full
|
|
30
|
-
npm run pds:
|
|
29
|
+
# Or as part of full build
|
|
30
|
+
npm run pds:build
|
|
31
31
|
|
|
32
32
|
# Or generate individually
|
|
33
33
|
npm run pds:manifest # HTML IntelliSense only
|
package/dist/types/pds.d.ts
CHANGED
|
@@ -168,6 +168,8 @@ export class PDS extends EventTarget {
|
|
|
168
168
|
static isLiveMode: () => boolean;
|
|
169
169
|
static findComponentForElement?: (el: Element) => ComponentDef | null;
|
|
170
170
|
static presets?: Record<string, any>;
|
|
171
|
+
static enhancerMetadata?: Array<{ selector: string; description?: string; demoHtml?: string }>;
|
|
172
|
+
static defaultEnhancers?: Array<any>;
|
|
171
173
|
static ontology?: any;
|
|
172
174
|
static enums?: Record<string, any>;
|
|
173
175
|
static common?: Record<string, any>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
declare function
|
|
1
|
+
export { nt as startLive };
|
|
2
|
+
declare function nt(n: any, t: any, { emitReady: e, applyResolvedTheme: a, setupSystemListenerIfNeeded: r }: {
|
|
3
3
|
emitReady: any;
|
|
4
4
|
applyResolvedTheme: any;
|
|
5
5
|
setupSystemListenerIfNeeded: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds.d.ts","sourceRoot":"","sources":["../../../../../public/assets/js/pds.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"pds.d.ts","sourceRoot":"","sources":["../../../../../public/assets/js/pds.js"],"names":[],"mappings":";AA+BooB;;;;EAAQ"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PDS Enhancer Metadata (live mode only)
|
|
3
|
+
*
|
|
4
|
+
* This file contains description and demoHtml for runtime inspection tools.
|
|
5
|
+
* It is intentionally kept separate from pds-enhancers.js to keep the
|
|
6
|
+
* production pds.js bundle lean.
|
|
7
|
+
*/
|
|
8
|
+
export const defaultPDSEnhancerMetadata: {
|
|
9
|
+
selector: string;
|
|
10
|
+
description: string;
|
|
11
|
+
demoHtml: string;
|
|
12
|
+
}[];
|
|
13
|
+
//# sourceMappingURL=pds-enhancers-meta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pds-enhancers-meta.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-enhancers-meta.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;IA+FE"}
|
|
@@ -7,21 +7,6 @@
|
|
|
7
7
|
export const defaultPDSEnhancers: {
|
|
8
8
|
run: typeof enhanceAccordion;
|
|
9
9
|
selector: string;
|
|
10
|
-
description: string;
|
|
11
|
-
demoHtml: string;
|
|
12
|
-
}[];
|
|
13
|
-
/**
|
|
14
|
-
* Metadata-only export for build tools and documentation.
|
|
15
|
-
* This is semantically identical to enhancerDefinitions but exported
|
|
16
|
-
* for tooling that wants to explicitly access metadata without run functions.
|
|
17
|
-
*
|
|
18
|
-
* Build tools can safely import defaultPDSEnhancers too - Node.js won't
|
|
19
|
-
* execute browser-only DOM code in the run functions.
|
|
20
|
-
*/
|
|
21
|
-
export const defaultPDSEnhancerMetadata: {
|
|
22
|
-
selector: string;
|
|
23
|
-
description: string;
|
|
24
|
-
demoHtml: string;
|
|
25
10
|
}[];
|
|
26
11
|
declare function enhanceAccordion(elem: any): void;
|
|
27
12
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds-enhancers.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-enhancers.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pds-enhancers.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-enhancers.js"],"names":[],"mappings":"AAyZA;;;;;GAKG;AACH;;;IAGI;AAvYJ,mDAeC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds-live.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-live.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pds-live.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-live.js"],"names":[],"mappings":"AAyMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6NC;0BAlayB,oBAAoB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pure-ds/core",
|
|
3
3
|
"shortname": "pds",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.7",
|
|
5
5
|
"description": "Pure Design System - Why develop a Design System when you can generate one?",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -26,11 +26,12 @@
|
|
|
26
26
|
"module": "./public/assets/js/pds.js",
|
|
27
27
|
"types": "./dist/types/pds.d.ts",
|
|
28
28
|
"bin": {
|
|
29
|
-
"pds-
|
|
29
|
+
"pds-build": "packages/pds-cli/bin/pds-static.js",
|
|
30
30
|
"pds-sync-assets": "packages/pds-cli/bin/sync-assets.js",
|
|
31
31
|
"pds-build-icons": "packages/pds-cli/bin/pds-build-icons.js",
|
|
32
32
|
"pds-setup-copilot": "packages/pds-cli/bin/pds-setup-copilot.js",
|
|
33
|
-
"pds-init-config": "packages/pds-cli/bin/pds-init-config.js"
|
|
33
|
+
"pds-init-config": "packages/pds-cli/bin/pds-init-config.js",
|
|
34
|
+
"pds-bootstrap": "packages/pds-cli/bin/pds-bootstrap.js"
|
|
34
35
|
},
|
|
35
36
|
"exports": {
|
|
36
37
|
".": {
|
|
@@ -75,9 +76,10 @@
|
|
|
75
76
|
"build": "node esbuild-build.js",
|
|
76
77
|
"types": "tsc -p tsconfig.json && node scripts/sync-types.mjs",
|
|
77
78
|
"postinstall": "node packages/pds-cli/bin/postinstall.mjs",
|
|
78
|
-
"prepds:
|
|
79
|
-
"pds:
|
|
79
|
+
"prepds:build": "npm run types",
|
|
80
|
+
"pds:build": "node packages/pds-cli/bin/pds-static.js",
|
|
80
81
|
"pds:build-icons": "node packages/pds-cli/bin/pds-build-icons.js",
|
|
82
|
+
"pds:bootstrap": "node packages/pds-cli/bin/pds-bootstrap.js",
|
|
81
83
|
"pds:manifest": "node packages/pds-cli/bin/generate-manifest.js",
|
|
82
84
|
"pds:css-data": "node packages/pds-cli/bin/generate-css-data.js",
|
|
83
85
|
"pds:dx": "node packages/pds-cli/bin/pds-dx.js",
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { readFile, writeFile, mkdir, access } from 'fs/promises';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { spawn } from 'child_process';
|
|
6
|
+
|
|
7
|
+
const projectRoot = process.cwd();
|
|
8
|
+
|
|
9
|
+
function log(message) {
|
|
10
|
+
console.log(message);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async function ensureDir(dirPath) {
|
|
14
|
+
await mkdir(dirPath, { recursive: true });
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async function writeFileIfMissing(filePath, content) {
|
|
18
|
+
try {
|
|
19
|
+
await access(filePath);
|
|
20
|
+
log(`āŖļø Skipping existing ${path.relative(projectRoot, filePath)}`);
|
|
21
|
+
return false;
|
|
22
|
+
} catch {
|
|
23
|
+
await ensureDir(path.dirname(filePath));
|
|
24
|
+
await writeFile(filePath, content, 'utf8');
|
|
25
|
+
log(`ā
Created ${path.relative(projectRoot, filePath)}`);
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function getNpmCommand() {
|
|
31
|
+
return process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function readPackageJson() {
|
|
35
|
+
const pkgPath = path.join(projectRoot, 'package.json');
|
|
36
|
+
const raw = await readFile(pkgPath, 'utf8');
|
|
37
|
+
return { pkgPath, pkg: JSON.parse(raw) };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function writePackageJson(pkgPath, pkg) {
|
|
41
|
+
await writeFile(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function buildIndexHtml() {
|
|
45
|
+
return `<!doctype html>
|
|
46
|
+
<html lang="en">
|
|
47
|
+
<head>
|
|
48
|
+
<meta charset="UTF-8" />
|
|
49
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
50
|
+
<title>Pure Design System</title>
|
|
51
|
+
|
|
52
|
+
<!-- PDS Styles -->
|
|
53
|
+
<link rel="stylesheet" href="/assets/css/app.css" />
|
|
54
|
+
|
|
55
|
+
<!-- Import Map for Lit components -->
|
|
56
|
+
<script type="importmap">
|
|
57
|
+
{
|
|
58
|
+
"imports": {
|
|
59
|
+
"#pds/lit": "/assets/js/lit.js"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<!-- App Script -->
|
|
65
|
+
<script type="module" src="/assets/js/app.js" defer></script>
|
|
66
|
+
</head>
|
|
67
|
+
|
|
68
|
+
<body class="container">
|
|
69
|
+
<header class="stack-sm">
|
|
70
|
+
<p class="badge">Pure Design System</p>
|
|
71
|
+
<h1>Design systems, generated.</h1>
|
|
72
|
+
<p class="text-muted">This starter is ready for your custom tokens, components, and brand.</p>
|
|
73
|
+
</header>
|
|
74
|
+
|
|
75
|
+
<main></main>
|
|
76
|
+
|
|
77
|
+
<footer class="text-sm text-muted">
|
|
78
|
+
<small>© 2026 Pure Design System</small>
|
|
79
|
+
</footer>
|
|
80
|
+
</body>
|
|
81
|
+
</html>
|
|
82
|
+
`;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function buildAppCss() {
|
|
86
|
+
return `html:not(.pds-ready) {
|
|
87
|
+
opacity: 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
main {
|
|
91
|
+
margin-top: var(--spacing-8);
|
|
92
|
+
}
|
|
93
|
+
`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function buildWcHome() {
|
|
97
|
+
return `customElements.define(
|
|
98
|
+
"wc-home",
|
|
99
|
+
class extends HTMLElement {
|
|
100
|
+
connectedCallback() {
|
|
101
|
+
this.innerHTML = /*html*/ \`
|
|
102
|
+
<article class="card text-center border-gradient surface-translucent-50">
|
|
103
|
+
<header>
|
|
104
|
+
<h1>Welcome to Pure Design System</h1>
|
|
105
|
+
<h2>Beautiful backgrounds generated from your color palette</h2>
|
|
106
|
+
</header>
|
|
107
|
+
<div class="stack-lg">
|
|
108
|
+
<p>
|
|
109
|
+
This is a demo of a web component using Pure Design System.
|
|
110
|
+
It showcases the design tokens, components, and utilities provided by PDS.
|
|
111
|
+
</p>
|
|
112
|
+
</div>
|
|
113
|
+
<nav class="flex justify-center gap-sm">
|
|
114
|
+
<button class="btn-primary btn-lg" data-enhanced-btn-working="true">
|
|
115
|
+
Get Started
|
|
116
|
+
</button>
|
|
117
|
+
<button class="btn-secondary btn-lg" data-enhanced-btn-working="true">
|
|
118
|
+
Learn More
|
|
119
|
+
</button>
|
|
120
|
+
</nav>
|
|
121
|
+
</article>
|
|
122
|
+
\`;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
`;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function buildAppJs() {
|
|
130
|
+
return `import { PDS } from '@pure-ds/core';
|
|
131
|
+
import { config } from '../../pds.config.js';
|
|
132
|
+
|
|
133
|
+
await PDS.start(config);
|
|
134
|
+
PDS.theme = 'light';
|
|
135
|
+
|
|
136
|
+
await import('/assets/wc/wc-home.js');
|
|
137
|
+
|
|
138
|
+
const main = document.querySelector('main');
|
|
139
|
+
if (main && !main.querySelector('wc-home')) {
|
|
140
|
+
main.innerHTML = '<wc-home></wc-home>';
|
|
141
|
+
}
|
|
142
|
+
`;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function buildEsbuildDevCjs() {
|
|
146
|
+
return `const esbuild = require('esbuild');
|
|
147
|
+
|
|
148
|
+
async function start() {
|
|
149
|
+
const ctx = await esbuild.context({
|
|
150
|
+
entryPoints: ['src/js/app.js'],
|
|
151
|
+
outdir: 'public/assets/js',
|
|
152
|
+
bundle: true,
|
|
153
|
+
format: 'esm',
|
|
154
|
+
sourcemap: true,
|
|
155
|
+
publicPath: '/assets/js',
|
|
156
|
+
external: ['/assets/wc/*'],
|
|
157
|
+
logLevel: 'info'
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
await ctx.watch();
|
|
161
|
+
const { host, port } = await ctx.serve({ servedir: 'public', port: 4173 });
|
|
162
|
+
console.log('Dev server running at http://' + host + ':' + port);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
start().catch((err) => {
|
|
166
|
+
console.error(err);
|
|
167
|
+
process.exit(1);
|
|
168
|
+
});
|
|
169
|
+
`;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function buildEsbuildDevEsm() {
|
|
173
|
+
return `import esbuild from 'esbuild';
|
|
174
|
+
|
|
175
|
+
const ctx = await esbuild.context({
|
|
176
|
+
entryPoints: ['src/js/app.js'],
|
|
177
|
+
outdir: 'public/assets/js',
|
|
178
|
+
bundle: true,
|
|
179
|
+
format: 'esm',
|
|
180
|
+
sourcemap: true,
|
|
181
|
+
publicPath: '/assets/js',
|
|
182
|
+
external: ['/assets/wc/*'],
|
|
183
|
+
logLevel: 'info'
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
await ctx.watch();
|
|
187
|
+
const { host, port } = await ctx.serve({ servedir: 'public', port: 4173 });
|
|
188
|
+
console.log('Dev server running at http://' + host + ':' + port);
|
|
189
|
+
`;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
async function ensurePackageScripts(pkg, pkgPath) {
|
|
193
|
+
pkg.scripts = pkg.scripts || {};
|
|
194
|
+
let changed = false;
|
|
195
|
+
|
|
196
|
+
if (!pkg.scripts.dev) {
|
|
197
|
+
pkg.scripts.dev = 'node esbuild-dev.js';
|
|
198
|
+
changed = true;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (!pkg.scripts['pds:bootstrap']) {
|
|
202
|
+
pkg.scripts['pds:bootstrap'] = 'pds-bootstrap';
|
|
203
|
+
changed = true;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (changed) {
|
|
207
|
+
await writePackageJson(pkgPath, pkg);
|
|
208
|
+
log('ā
Updated package.json scripts');
|
|
209
|
+
} else {
|
|
210
|
+
log('āŖļø package.json scripts already configured');
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
async function ensureEsbuildDependency(pkg, pkgPath) {
|
|
215
|
+
const version = '^0.19.0';
|
|
216
|
+
const hasDev = pkg.devDependencies && pkg.devDependencies.esbuild;
|
|
217
|
+
const hasDep = pkg.dependencies && pkg.dependencies.esbuild;
|
|
218
|
+
|
|
219
|
+
if (hasDev || hasDep) {
|
|
220
|
+
log('āŖļø esbuild already installed');
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const npmCmd = getNpmCommand();
|
|
225
|
+
log('š¦ Installing esbuild...');
|
|
226
|
+
|
|
227
|
+
await new Promise((resolve, reject) => {
|
|
228
|
+
const child = spawn(npmCmd, ['install', '--save-dev', `esbuild@${version}`], {
|
|
229
|
+
cwd: projectRoot,
|
|
230
|
+
stdio: 'inherit',
|
|
231
|
+
shell: true
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
child.on('exit', (code) => {
|
|
235
|
+
if (code === 0) resolve();
|
|
236
|
+
else reject(new Error(`npm install failed with code ${code}`));
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
const updated = JSON.parse(await readFile(pkgPath, 'utf8'));
|
|
241
|
+
Object.assign(pkg, updated);
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
async function runDevServer() {
|
|
246
|
+
const npmCmd = getNpmCommand();
|
|
247
|
+
log('š Starting dev server...');
|
|
248
|
+
|
|
249
|
+
await new Promise((resolve, reject) => {
|
|
250
|
+
const child = spawn(npmCmd, ['run', 'dev'], {
|
|
251
|
+
cwd: projectRoot,
|
|
252
|
+
stdio: 'inherit',
|
|
253
|
+
shell: true
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
child.on('exit', (code) => {
|
|
257
|
+
if (code === 0) resolve();
|
|
258
|
+
else reject(new Error(`npm run dev exited with code ${code}`));
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
async function main() {
|
|
264
|
+
log('\nā” PDS Bootstrap\n');
|
|
265
|
+
|
|
266
|
+
const { pkgPath, pkg } = await readPackageJson();
|
|
267
|
+
const isModule = pkg.type === 'module';
|
|
268
|
+
|
|
269
|
+
await ensurePackageScripts(pkg, pkgPath);
|
|
270
|
+
await ensureEsbuildDependency(pkg, pkgPath);
|
|
271
|
+
|
|
272
|
+
await writeFileIfMissing(path.join(projectRoot, 'public', 'index.html'), buildIndexHtml());
|
|
273
|
+
await writeFileIfMissing(path.join(projectRoot, 'public', 'assets', 'css', 'app.css'), buildAppCss());
|
|
274
|
+
await writeFileIfMissing(path.join(projectRoot, 'src', 'js', 'app.js'), buildAppJs());
|
|
275
|
+
await writeFileIfMissing(
|
|
276
|
+
path.join(projectRoot, 'public', 'assets', 'wc', 'wc-home.js'),
|
|
277
|
+
buildWcHome()
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
const esbuildDevPath = path.join(projectRoot, 'esbuild-dev.js');
|
|
281
|
+
const esbuildDevContent = isModule ? buildEsbuildDevEsm() : buildEsbuildDevCjs();
|
|
282
|
+
await writeFileIfMissing(esbuildDevPath, esbuildDevContent);
|
|
283
|
+
|
|
284
|
+
log('\nā
Bootstrap files ready.\n');
|
|
285
|
+
await runDevServer();
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
main().catch((err) => {
|
|
289
|
+
console.error('ā Bootstrap failed:', err?.message || err);
|
|
290
|
+
process.exit(1);
|
|
291
|
+
});
|
|
@@ -601,7 +601,7 @@ if (process.argv[1]) {
|
|
|
601
601
|
const scriptPath = fileURLToPath(import.meta.url);
|
|
602
602
|
const argPath = process.argv[1];
|
|
603
603
|
// Check if this is the main module being executed
|
|
604
|
-
if (argPath === scriptPath || argPath.endsWith('pds-static.js') || argPath.endsWith('pds-
|
|
604
|
+
if (argPath === scriptPath || argPath.endsWith('pds-static.js') || argPath.endsWith('pds-build')) {
|
|
605
605
|
main();
|
|
606
606
|
}
|
|
607
607
|
}
|
|
@@ -110,9 +110,9 @@ async function findConsumerRoot() {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
|
-
* Ensure consumer package.json contains a handy
|
|
113
|
+
* Ensure consumer package.json contains a handy build script
|
|
114
114
|
*/
|
|
115
|
-
async function
|
|
115
|
+
async function ensureBuildScript(consumerRoot) {
|
|
116
116
|
try {
|
|
117
117
|
const consumerPkgPath = path.join(consumerRoot, 'package.json');
|
|
118
118
|
const consumerPkgRaw = await readFile(consumerPkgPath, 'utf8');
|
|
@@ -120,8 +120,8 @@ async function ensureExportScript(consumerRoot) {
|
|
|
120
120
|
|
|
121
121
|
consumerPkg.scripts = consumerPkg.scripts || {};
|
|
122
122
|
|
|
123
|
-
const desiredScriptName = 'pds:
|
|
124
|
-
const desiredScriptCmd = 'pds-
|
|
123
|
+
const desiredScriptName = 'pds:build';
|
|
124
|
+
const desiredScriptCmd = 'pds-build';
|
|
125
125
|
|
|
126
126
|
if (!consumerPkg.scripts[desiredScriptName]) {
|
|
127
127
|
consumerPkg.scripts[desiredScriptName] = desiredScriptCmd;
|
|
@@ -131,7 +131,7 @@ async function ensureExportScript(consumerRoot) {
|
|
|
131
131
|
console.log(`š§ Script "${desiredScriptName}" already present in consumer package.json`);
|
|
132
132
|
}
|
|
133
133
|
} catch (e) {
|
|
134
|
-
console.warn('ā ļø Could not ensure pds:
|
|
134
|
+
console.warn('ā ļø Could not ensure pds:build script in consumer package.json:', e.message);
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
@@ -418,8 +418,8 @@ async function copyPdsAssets() {
|
|
|
418
418
|
// Copy Copilot instructions to consumer project
|
|
419
419
|
await copyCopilotInstructions(consumerRoot);
|
|
420
420
|
|
|
421
|
-
// Proactively add
|
|
422
|
-
await
|
|
421
|
+
// Proactively add build & build-icons scripts to consumer package.json (still helpful)
|
|
422
|
+
await ensureBuildScript(consumerRoot);
|
|
423
423
|
try {
|
|
424
424
|
const consumerPkgPath = path.join(consumerRoot, 'package.json');
|
|
425
425
|
const pkgRaw = await readFile(consumerPkgPath, 'utf8');
|
|
@@ -432,26 +432,34 @@ async function copyPdsAssets() {
|
|
|
432
432
|
await writeFile(consumerPkgPath, JSON.stringify(pkgJson, null, 2) + '\n');
|
|
433
433
|
console.log(`š§© Added "${buildIconsName}" script to consumer package.json`);
|
|
434
434
|
}
|
|
435
|
+
|
|
436
|
+
const bootstrapName = 'pds:bootstrap';
|
|
437
|
+
const bootstrapCmd = 'pds-bootstrap';
|
|
438
|
+
if (!pkgJson.scripts[bootstrapName]) {
|
|
439
|
+
pkgJson.scripts[bootstrapName] = bootstrapCmd;
|
|
440
|
+
await writeFile(consumerPkgPath, JSON.stringify(pkgJson, null, 2) + '\n');
|
|
441
|
+
console.log(`š§© Added "${bootstrapName}" script to consumer package.json`);
|
|
442
|
+
}
|
|
435
443
|
} catch (e) {
|
|
436
444
|
console.warn('ā ļø Could not ensure pds:build-icons script in consumer package.json:', e?.message || e);
|
|
437
445
|
}
|
|
438
446
|
|
|
439
447
|
// NEW BEHAVIOR: We no longer copy web components automatically to /auto-define/.
|
|
440
|
-
// Reason: static
|
|
448
|
+
// Reason: static build (pds:build) is now the single source of truth for placing
|
|
441
449
|
// components under [static.root]/components/ (see pds.config.js). This reduces
|
|
442
450
|
// side-effects during npm install and avoids stale/legacy /auto-define/ layout.
|
|
443
451
|
console.log('š« Skipping legacy auto-copy of components to ./public/auto-define/.');
|
|
444
452
|
|
|
445
|
-
// Auto-run pds:
|
|
453
|
+
// Auto-run pds:build by default (can be disabled with PDS_SKIP_EXPORT)
|
|
446
454
|
if (
|
|
447
455
|
process.env.PDS_SKIP_EXPORT === '1' ||
|
|
448
456
|
process.env.PDS_SKIP_EXPORT === 'true' ||
|
|
449
457
|
process.env.npm_config_pds_skip_export === 'true'
|
|
450
458
|
) {
|
|
451
|
-
console.log('āļø Skipping pds:
|
|
452
|
-
console.log('š¦ To generate static assets run: npm run pds:
|
|
459
|
+
console.log('āļø Skipping pds:build (PDS_SKIP_EXPORT set)');
|
|
460
|
+
console.log('š¦ To generate static assets run: npm run pds:build');
|
|
453
461
|
} else {
|
|
454
|
-
console.log('š Running pds:
|
|
462
|
+
console.log('š Running pds:build automatically...');
|
|
455
463
|
const staticModuleUrl = pathToFileURL(path.join(__dirname, 'pds-static.js')).href;
|
|
456
464
|
const previousEnv = {
|
|
457
465
|
PDS_POSTINSTALL: process.env.PDS_POSTINSTALL,
|
|
@@ -467,8 +475,8 @@ async function copyPdsAssets() {
|
|
|
467
475
|
const { runPdsStatic } = await import(staticModuleUrl);
|
|
468
476
|
await runPdsStatic({ cwd: consumerRoot });
|
|
469
477
|
} catch (e) {
|
|
470
|
-
console.error('ā Auto-
|
|
471
|
-
console.log('š” You can run it manually: npm run pds:
|
|
478
|
+
console.error('ā Auto-build failed:', e?.message || e);
|
|
479
|
+
console.log('š” You can run it manually: npm run pds:build');
|
|
472
480
|
} finally {
|
|
473
481
|
if (previousEnv.PDS_POSTINSTALL === undefined) {
|
|
474
482
|
delete process.env.PDS_POSTINSTALL;
|
|
@@ -510,7 +518,7 @@ async function copyPdsAssets() {
|
|
|
510
518
|
}
|
|
511
519
|
} catch (error) {
|
|
512
520
|
console.error('ā PDS postinstall failed (non-fatal):', error.message);
|
|
513
|
-
console.log('š” Static
|
|
521
|
+
console.log('š” Static build still available via: npm run pds:build');
|
|
514
522
|
process.exitCode = 1;
|
|
515
523
|
}
|
|
516
524
|
}
|
|
@@ -199,7 +199,7 @@ async function syncAssets(options = {}) {
|
|
|
199
199
|
}
|
|
200
200
|
await syncDirectory(autoDefineSource, autoDefineTarget, 'components/');
|
|
201
201
|
|
|
202
|
-
// Note: icons are not synced in this flow; use pds:
|
|
202
|
+
// Note: icons are not synced in this flow; use pds:build if needed
|
|
203
203
|
|
|
204
204
|
// Update tracking file
|
|
205
205
|
if (!dryRun) {
|