create-dalila 1.2.14 → 1.2.16
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 +6 -2
- package/index.js +11 -0
- package/package.json +1 -1
- package/template/build.mjs +2192 -0
- package/template/index.html +7 -0
- package/template/package.json +3 -2
- package/template/src/app/page.ts +1 -1
- package/template/src/main.ts +17 -0
package/README.md
CHANGED
|
@@ -23,11 +23,14 @@ Open http://localhost:4242 to see your app.
|
|
|
23
23
|
- Dev server + route generation watcher
|
|
24
24
|
- TypeScript support out of the box
|
|
25
25
|
- Minimal CSS styling
|
|
26
|
+
- `dompurify` installed and wired into the runtime bootstrap
|
|
27
|
+
- Trusted Types enabled in the starter runtime config
|
|
26
28
|
|
|
27
29
|
## Project Structure
|
|
28
30
|
|
|
29
31
|
```
|
|
30
32
|
my-app/
|
|
33
|
+
├── build.mjs # Packages a standalone dist/ preview build
|
|
31
34
|
├── dev.mjs # Runs route watcher + dev server
|
|
32
35
|
├── index.html # App shell
|
|
33
36
|
├── src/
|
|
@@ -35,7 +38,7 @@ my-app/
|
|
|
35
38
|
│ │ ├── layout.html
|
|
36
39
|
│ │ ├── page.html
|
|
37
40
|
│ │ └── page.ts
|
|
38
|
-
│ ├── main.ts # Router bootstrap
|
|
41
|
+
│ ├── main.ts # Router bootstrap + runtime security defaults
|
|
39
42
|
│ └── style.css # Styles
|
|
40
43
|
├── package.json
|
|
41
44
|
└── tsconfig.json
|
|
@@ -46,7 +49,8 @@ my-app/
|
|
|
46
49
|
- `npm run dev` - Start dev server and route watcher
|
|
47
50
|
- `npm run routes` - Generate route files once
|
|
48
51
|
- `npm run routes:watch` - Watch route files and regenerate outputs
|
|
49
|
-
- `npm run build` -
|
|
52
|
+
- `npm run build` - Generate routes, compile TypeScript, and package an optimized standalone `dist/`
|
|
53
|
+
- `npm run preview` - Serve the built `dist/` output locally
|
|
50
54
|
|
|
51
55
|
## Learn More
|
|
52
56
|
|
package/index.js
CHANGED
|
@@ -131,6 +131,16 @@ function updatePackageJson(projectPath, projectName) {
|
|
|
131
131
|
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
function updateTemplatePlaceholders(projectPath, projectName) {
|
|
135
|
+
const trustedTypesPolicyName = `${projectName}-html`;
|
|
136
|
+
const mainPath = path.join(projectPath, 'src', 'main.ts');
|
|
137
|
+
const source = fs.readFileSync(mainPath, 'utf8');
|
|
138
|
+
fs.writeFileSync(
|
|
139
|
+
mainPath,
|
|
140
|
+
source.replaceAll('__DALILA_TRUSTED_TYPES_POLICY__', trustedTypesPolicyName)
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
134
144
|
function main() {
|
|
135
145
|
ensureSupportedNode();
|
|
136
146
|
|
|
@@ -184,6 +194,7 @@ function main() {
|
|
|
184
194
|
|
|
185
195
|
// Update package.json with project name
|
|
186
196
|
updatePackageJson(projectPath, projectName);
|
|
197
|
+
updateTemplatePlaceholders(projectPath, projectName);
|
|
187
198
|
|
|
188
199
|
// Success message
|
|
189
200
|
console.log(`${green('Done!')} Created ${bold(projectName)}\n`);
|