@b9g/shovel 0.2.14 → 0.2.15

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.
Files changed (2) hide show
  1. package/bin/create.js +25 -13
  2. package/package.json +1 -1
package/bin/create.js CHANGED
@@ -294,6 +294,11 @@ async function createProject(config, projectPath) {
294
294
  devDependencies["@eslint/js"] = "^10.0.0";
295
295
  if (config.typescript) {
296
296
  devDependencies["typescript-eslint"] = "^8.0.0";
297
+ } else {
298
+ devDependencies["globals"] = "^16.0.0";
299
+ }
300
+ if (isCrank) {
301
+ devDependencies["eslint-plugin-crank"] = "^0.2.0";
297
302
  }
298
303
  }
299
304
  const scripts = {
@@ -358,23 +363,34 @@ async function createProject(config, projectPath) {
358
363
  );
359
364
  }
360
365
  if (hasClientBundle) {
366
+ const crankImport = isCrank ? `import crank from "eslint-plugin-crank";
367
+ ` : "";
368
+ const crankConfig = isCrank ? `
369
+ { plugins: { crank }, rules: crank.configs.recommended.rules },` : "";
361
370
  let eslintConfig;
362
371
  if (config.typescript) {
363
372
  eslintConfig = `import js from "@eslint/js";
364
373
  import tseslint from "typescript-eslint";
365
-
374
+ ${crankImport}
366
375
  export default tseslint.config(
367
376
  js.configs.recommended,
368
377
  tseslint.configs.recommended,
369
- { ignores: ["dist/"] },
378
+ { ignores: ["dist/"] },${crankConfig}
370
379
  );
371
380
  `;
372
381
  } else {
382
+ let langOpts = "globals: globals.browser";
383
+ let filesOpt = "";
384
+ if (isCrank && config.useJSX) {
385
+ filesOpt = `files: ["**/*.{js,jsx}"], `;
386
+ langOpts += ", parserOptions: { ecmaFeatures: { jsx: true } }";
387
+ }
373
388
  eslintConfig = `import js from "@eslint/js";
374
-
389
+ import globals from "globals";
390
+ ${crankImport}
375
391
  export default [
376
- js.configs.recommended,
377
- { ignores: ["dist/"] },
392
+ { ${filesOpt}...js.configs.recommended, languageOptions: { ${langOpts} } },
393
+ { ignores: ["dist/"] },${crankConfig}
378
394
  ];
379
395
  `;
380
396
  }
@@ -783,8 +799,7 @@ export function Page({title, children, clientUrl}${t ? ": {title: string, childr
783
799
  export function *Counter(${t ? "this: Context" : ""}) {
784
800
  let count = 0;
785
801
  const handleClick = () => {
786
- count++;
787
- this.refresh();
802
+ this.refresh(() => count++);
788
803
  };
789
804
  for ({} of this) {
790
805
  yield <button onclick={handleClick}>Clicked: {count}</button>;
@@ -866,8 +881,7 @@ export function Page({title, children, clientUrl}${t ? ": {title: string, childr
866
881
  export function *Counter(${t ? "this: Context" : ""}) {
867
882
  let count = 0;
868
883
  const handleClick = () => {
869
- count++;
870
- this.refresh();
884
+ this.refresh(() => count++);
871
885
  };
872
886
  for ({} of this) {
873
887
  yield jsx\`<button onclick=\${handleClick}>Clicked: \${count}</button>\`;
@@ -1261,8 +1275,7 @@ export function Page({title, children, clientUrl}${t ? ": {title: string, childr
1261
1275
  export function *Counter(${t ? "this: Context" : ""}) {
1262
1276
  let count = 0;
1263
1277
  const handleClick = () => {
1264
- count++;
1265
- this.refresh();
1278
+ this.refresh(() => count++);
1266
1279
  };
1267
1280
  for ({} of this) {
1268
1281
  yield <button onclick={handleClick}>Clicked: {count}</button>;
@@ -1363,8 +1376,7 @@ export function Page({title, children, clientUrl}${t ? ": {title: string, childr
1363
1376
  export function *Counter(${t ? "this: Context" : ""}) {
1364
1377
  let count = 0;
1365
1378
  const handleClick = () => {
1366
- count++;
1367
- this.refresh();
1379
+ this.refresh(() => count++);
1368
1380
  };
1369
1381
  for ({} of this) {
1370
1382
  yield jsx\`<button onclick=\${handleClick}>Clicked: \${count}</button>\`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b9g/shovel",
3
- "version": "0.2.14",
3
+ "version": "0.2.15",
4
4
  "description": "ServiceWorker-first universal deployment platform. Write ServiceWorker apps once, deploy anywhere (Node/Bun/Cloudflare). Registry-based multi-app orchestration.",
5
5
  "license": "MIT",
6
6
  "repository": {