create-bascik 1.0.0-rc.1 → 1.0.0-rc.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/assets/SKILL.md +11 -0
- package/dist/scaffold.js +1 -1
- package/package.json +1 -1
- package/src/scaffold.ts +1 -1
package/assets/SKILL.md
CHANGED
|
@@ -28,6 +28,8 @@ This file contains the **complete, centralized documentation and development ski
|
|
|
28
28
|
* It does not add any JavaScript to pages. Every script in the output was written by you.
|
|
29
29
|
* It does not require Web Components, Shadow DOM, or any browser-specific API.
|
|
30
30
|
|
|
31
|
+
**Node version:** Node.js 24 LTS is recommended. The minimum is 22.18, which provides native TypeScript stripping.
|
|
32
|
+
|
|
31
33
|
### End-to-End Example: Input → Output
|
|
32
34
|
|
|
33
35
|
One component file, its usage, and the scoped build output:
|
|
@@ -100,6 +102,12 @@ Because IDs are scoped per instance, the same component can appear multiple time
|
|
|
100
102
|
* Bascik consumes those instructions at build time. They are not runtime directives that require a client library to interpret them.
|
|
101
103
|
* **Tag structure ordering rule:** When writing component files containing both styles and scripts alongside HTML, always place `<style>` tags above the HTML markup as a style guide, and always place `<script>` tags below the HTML markup.
|
|
102
104
|
|
|
105
|
+
### Script Ownership and Decomposition
|
|
106
|
+
* Put page behavior in that page's script and component behavior in that component's script. Prefer a focused inline `<script>` or a same-directory companion `.js`/`.ts` referenced with `<script src="...">` over a page-wide `main.js` that queries and coordinates every component's DOM.
|
|
107
|
+
* Keep scripts small enough that their owning markup and behavior can be understood together. Split unrelated behavior into multiple component scripts rather than accumulating it in one global application script.
|
|
108
|
+
* A shared script is appropriate when it provides genuinely shared code or state, such as one authenticated API client or a third-party library used by several components. Load shared code once, give components a small explicit interface to it, and keep component-specific DOM behavior in the component.
|
|
109
|
+
* Client scripts are not npm bundlers. Bare package imports do not resolve in the browser; see [JavaScript Libraries & Progressive Enhancement](#12-javascript-libraries--progressive-enhancement) for bundling a shared dependency.
|
|
110
|
+
|
|
103
111
|
### Repository Layout and the Create App
|
|
104
112
|
|
|
105
113
|
The repo is split into four top-level folders:
|
|
@@ -1273,6 +1281,7 @@ src/
|
|
|
1273
1281
|
|
|
1274
1282
|
### Static Assets and Subdirectories
|
|
1275
1283
|
* **One Publish Tree:** Put images, fonts, downloads, standalone browser JavaScript, CSS, and other public assets under `directory.pages`. Colocate them with a route or use shared subdirectories such as `src/pages/assets/`. Eligible files copy to `directory.out` with relative structure preserved.
|
|
1284
|
+
* **Source versus generated output:** `directory.pages` and `directory.components` are authored inputs. Do not write generated bundles, compiled scripts, or other build products into `src/`, including `src/pages/assets/`. Write generated public files to `BASCIK_OUT_DIR` (normally `dist/`) from an existing `pipeline.exec` script. Keep generated output out of version control.
|
|
1276
1285
|
* **Project-Specific Exclusions:** `assets.exclude` adds glob exclusions matched relative to `directory.pages`. Keep tests and source-only helpers outside the publish tree.
|
|
1277
1286
|
* **Auto-Minification:** CSS and JS files placed in `src/pages/` are automatically minified by `bascik --build` and `bascik --server`; no config is required. Custom BYOMinifier minifier/transformer functions (e.g. PostCSS/Autoprefixer, LightningCSS, esbuild, terser) can be assigned to `minify.css` and `minify.js` only when a project needs non-default processing.
|
|
1278
1287
|
* **Built-In Deny-List:** Dotfiles, dot-directories, `node_modules`, `.html`, `.ts`, `.mjs`, `.cjs`, `.mts`, `.cts`, `.map`, `.md`, test/spec files, and inlined stylesheets never copy. This deny-list always applies, including when `assets.exclude` is configured.
|
|
@@ -1561,6 +1570,8 @@ Add a CDN `<script src>` tag to the page `<head>` or a shared head component. Ba
|
|
|
1561
1570
|
|
|
1562
1571
|
**Bare specifiers do not work in client scripts.** Bascik does not rewrite `import x from 'some-package'` in a `<script type="module">`; the browser receives it verbatim and fails with `Failed to resolve module specifier`. Bare specifiers work only in `data-bascik-build` and `data-bascik-server` scripts, which run in Node.js. For an npm package with no CDN build, bundle it with esbuild as a `pipeline.exec` step (`phase: 'pre'`), write the bundle into `dist/assets/js/`, and import it from the page with a root-relative URL.
|
|
1563
1572
|
|
|
1573
|
+
The bundler entrypoint should contain only code that is genuinely shared, such as a third-party library bundle or shared runtime state. Keep page- and component-specific behavior in that page's or component's own script; do not move all UI logic into one large bundled entrypoint just to import an npm dependency.
|
|
1574
|
+
|
|
1564
1575
|
```html
|
|
1565
1576
|
<head>
|
|
1566
1577
|
<script src="https://unpkg.com/petite-vue" defer init></script>
|
package/dist/scaffold.js
CHANGED
|
@@ -26,7 +26,7 @@ export const PACKAGE_JSON = (name) => JSON.stringify({
|
|
|
26
26
|
e2e: "playwright test --config e2e/playwright.config.ts",
|
|
27
27
|
},
|
|
28
28
|
dependencies: {
|
|
29
|
-
"@bascik/bascik": "^1.0.0-rc.
|
|
29
|
+
"@bascik/bascik": "^1.0.0-rc.2",
|
|
30
30
|
},
|
|
31
31
|
devDependencies: {
|
|
32
32
|
"@bascik/language-server": "^0.1.0-rc.1",
|
package/package.json
CHANGED
package/src/scaffold.ts
CHANGED
|
@@ -32,7 +32,7 @@ export const PACKAGE_JSON = (name: string): string =>
|
|
|
32
32
|
e2e: "playwright test --config e2e/playwright.config.ts",
|
|
33
33
|
},
|
|
34
34
|
dependencies: {
|
|
35
|
-
"@bascik/bascik": "^1.0.0-rc.
|
|
35
|
+
"@bascik/bascik": "^1.0.0-rc.2",
|
|
36
36
|
},
|
|
37
37
|
devDependencies: {
|
|
38
38
|
"@bascik/language-server": "^0.1.0-rc.1",
|