create-rsbuild 0.7.3 → 0.7.5

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 (29) hide show
  1. package/dist/index.js +285 -43
  2. package/package.json +2 -1
  3. package/template-biome/biome.json +25 -0
  4. package/template-biome/extra-package.json +9 -0
  5. package/template-eslint/common-js/eslint.config.mjs +8 -0
  6. package/template-eslint/common-js/extra-package.json +10 -0
  7. package/template-eslint/common-ts/eslint.config.mjs +10 -0
  8. package/template-eslint/common-ts/extra-package.json +11 -0
  9. package/template-eslint/react-js/eslint.config.mjs +11 -0
  10. package/template-eslint/react-js/extra-package.json +12 -0
  11. package/template-eslint/react-ts/eslint.config.mjs +13 -0
  12. package/template-eslint/react-ts/extra-package.json +13 -0
  13. package/template-eslint/svelte-js/eslint.config.mjs +20 -0
  14. package/template-eslint/svelte-js/extra-package.json +11 -0
  15. package/template-eslint/svelte-ts/eslint.config.mjs +28 -0
  16. package/template-eslint/svelte-ts/extra-package.json +13 -0
  17. package/template-eslint/vue-js/eslint.config.mjs +10 -0
  18. package/template-eslint/vue-js/extra-package.json +11 -0
  19. package/template-eslint/vue-ts/eslint.config.mjs +12 -0
  20. package/template-eslint/vue-ts/extra-package.json +12 -0
  21. package/template-preact-ts/src/index.tsx +4 -1
  22. package/template-prettier/.prettierignore +4 -0
  23. package/template-prettier/.prettierrc +3 -0
  24. package/template-prettier/extra-package.json +8 -0
  25. package/template-react-ts/src/index.tsx +9 -6
  26. package/template-solid-ts/src/index.tsx +4 -1
  27. package/template-svelte-js/src/index.js +0 -3
  28. package/template-svelte-ts/package.json +3 -1
  29. package/template-svelte-ts/src/index.ts +0 -3
package/dist/index.js CHANGED
@@ -38,12 +38,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
38
38
  mod
39
39
  ));
40
40
 
41
- // ../../node_modules/.pnpm/@modern-js+module-tools@2.51.0_eslint@9.4.0_typescript@5.4.5/node_modules/@modern-js/module-tools/shims/esm.js
41
+ // ../../node_modules/.pnpm/@modern-js+module-tools@2.52.0_eslint@9.4.0_typescript@5.4.5/node_modules/@modern-js/module-tools/shims/esm.js
42
42
  import { fileURLToPath } from "url";
43
43
  import path from "path";
44
44
  var getFilename, getDirname, __dirname;
45
45
  var init_esm = __esm({
46
- "../../node_modules/.pnpm/@modern-js+module-tools@2.51.0_eslint@9.4.0_typescript@5.4.5/node_modules/@modern-js/module-tools/shims/esm.js"() {
46
+ "../../node_modules/.pnpm/@modern-js+module-tools@2.52.0_eslint@9.4.0_typescript@5.4.5/node_modules/@modern-js/module-tools/shims/esm.js"() {
47
47
  "use strict";
48
48
  getFilename = () => fileURLToPath(import.meta.url);
49
49
  getDirname = () => path.dirname(getFilename());
@@ -223,6 +223,110 @@ var require_picocolors2 = __commonJS({
223
223
  }
224
224
  });
225
225
 
226
+ // ../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js
227
+ var require_cjs = __commonJS({
228
+ "../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js"(exports, module) {
229
+ "use strict";
230
+ init_esm();
231
+ var isMergeableObject = function isMergeableObject2(value) {
232
+ return isNonNullObject(value) && !isSpecial(value);
233
+ };
234
+ function isNonNullObject(value) {
235
+ return !!value && typeof value === "object";
236
+ }
237
+ function isSpecial(value) {
238
+ var stringValue = Object.prototype.toString.call(value);
239
+ return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
240
+ }
241
+ var canUseSymbol = typeof Symbol === "function" && Symbol.for;
242
+ var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
243
+ function isReactElement(value) {
244
+ return value.$$typeof === REACT_ELEMENT_TYPE;
245
+ }
246
+ function emptyTarget(val) {
247
+ return Array.isArray(val) ? [] : {};
248
+ }
249
+ function cloneUnlessOtherwiseSpecified(value, options) {
250
+ return options.clone !== false && options.isMergeableObject(value) ? deepmerge2(emptyTarget(value), value, options) : value;
251
+ }
252
+ function defaultArrayMerge(target, source, options) {
253
+ return target.concat(source).map(function(element) {
254
+ return cloneUnlessOtherwiseSpecified(element, options);
255
+ });
256
+ }
257
+ function getMergeFunction(key, options) {
258
+ if (!options.customMerge) {
259
+ return deepmerge2;
260
+ }
261
+ var customMerge = options.customMerge(key);
262
+ return typeof customMerge === "function" ? customMerge : deepmerge2;
263
+ }
264
+ function getEnumerableOwnPropertySymbols(target) {
265
+ return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
266
+ return Object.propertyIsEnumerable.call(target, symbol);
267
+ }) : [];
268
+ }
269
+ function getKeys(target) {
270
+ return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
271
+ }
272
+ function propertyIsOnObject(object, property) {
273
+ try {
274
+ return property in object;
275
+ } catch (_3) {
276
+ return false;
277
+ }
278
+ }
279
+ function propertyIsUnsafe(target, key) {
280
+ return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
281
+ }
282
+ function mergeObject(target, source, options) {
283
+ var destination = {};
284
+ if (options.isMergeableObject(target)) {
285
+ getKeys(target).forEach(function(key) {
286
+ destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
287
+ });
288
+ }
289
+ getKeys(source).forEach(function(key) {
290
+ if (propertyIsUnsafe(target, key)) {
291
+ return;
292
+ }
293
+ if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
294
+ destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
295
+ } else {
296
+ destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
297
+ }
298
+ });
299
+ return destination;
300
+ }
301
+ function deepmerge2(target, source, options) {
302
+ options = options || {};
303
+ options.arrayMerge = options.arrayMerge || defaultArrayMerge;
304
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
305
+ options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
306
+ var sourceIsArray = Array.isArray(source);
307
+ var targetIsArray = Array.isArray(target);
308
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
309
+ if (!sourceAndTargetTypesMatch) {
310
+ return cloneUnlessOtherwiseSpecified(source, options);
311
+ } else if (sourceIsArray) {
312
+ return options.arrayMerge(target, source, options);
313
+ } else {
314
+ return mergeObject(target, source, options);
315
+ }
316
+ }
317
+ deepmerge2.all = function deepmergeAll(array, options) {
318
+ if (!Array.isArray(array)) {
319
+ throw new Error("first argument should be an array");
320
+ }
321
+ return array.reduce(function(prev, next) {
322
+ return deepmerge2(prev, next, options);
323
+ }, {});
324
+ };
325
+ var deepmerge_1 = deepmerge2;
326
+ module.exports = deepmerge_1;
327
+ }
328
+ });
329
+
226
330
  // src/index.ts
227
331
  init_esm();
228
332
  import fs from "fs";
@@ -543,6 +647,41 @@ var x = class {
543
647
  }
544
648
  }
545
649
  };
650
+ var pD = Object.defineProperty;
651
+ var fD = (t, u, F) => u in t ? pD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F;
652
+ var K = (t, u, F) => (fD(t, typeof u != "symbol" ? u + "" : u, F), F);
653
+ var gD = class extends x {
654
+ constructor(u) {
655
+ super(u, false), K(this, "options"), K(this, "cursor", 0), this.options = u.options, this.value = [...u.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: F }) => F === u.cursorAt), 0), this.on("key", (F) => {
656
+ F === "a" && this.toggleAll();
657
+ }), this.on("cursor", (F) => {
658
+ switch (F) {
659
+ case "left":
660
+ case "up":
661
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
662
+ break;
663
+ case "down":
664
+ case "right":
665
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
666
+ break;
667
+ case "space":
668
+ this.toggleValue();
669
+ break;
670
+ }
671
+ });
672
+ }
673
+ get _value() {
674
+ return this.options[this.cursor].value;
675
+ }
676
+ toggleAll() {
677
+ const u = this.value.length === this.options.length;
678
+ this.value = u ? [] : this.options.map((F) => F.value);
679
+ }
680
+ toggleValue() {
681
+ const u = this.value.includes(this._value);
682
+ this.value = u ? this.value.filter((F) => F !== this._value) : [...this.value, this._value];
683
+ }
684
+ };
546
685
  var bD = Object.defineProperty;
547
686
  var wD = (t, u, F) => u in t ? bD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F;
548
687
  var Z = (t, u, F) => (wD(t, typeof u != "symbol" ? u + "" : u, F), F);
@@ -604,7 +743,7 @@ var H = o("◆", "*");
604
743
  var I2 = o("■", "x");
605
744
  var x2 = o("▲", "x");
606
745
  var S2 = o("◇", "o");
607
- var K = o("┌", "T");
746
+ var K2 = o("┌", "T");
608
747
  var a2 = o("│", "|");
609
748
  var d2 = o("└", "—");
610
749
  var b2 = o("●", ">");
@@ -683,6 +822,50 @@ ${import_picocolors2.default.cyan(d2)}
683
822
  }
684
823
  } }).prompt();
685
824
  };
825
+ var ae = (r2) => {
826
+ const n = (i, t) => {
827
+ const s = i.label ?? String(i.value);
828
+ return t === "active" ? `${import_picocolors2.default.cyan(C)} ${s} ${i.hint ? import_picocolors2.default.dim(`(${i.hint})`) : ""}` : t === "selected" ? `${import_picocolors2.default.green(w2)} ${import_picocolors2.default.dim(s)}` : t === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}` : t === "active-selected" ? `${import_picocolors2.default.green(w2)} ${s} ${i.hint ? import_picocolors2.default.dim(`(${i.hint})`) : ""}` : t === "submitted" ? `${import_picocolors2.default.dim(s)}` : `${import_picocolors2.default.dim(M2)} ${import_picocolors2.default.dim(s)}`;
829
+ };
830
+ return new gD({ options: r2.options, initialValues: r2.initialValues, required: r2.required ?? true, cursorAt: r2.cursorAt, validate(i) {
831
+ if (this.required && i.length === 0)
832
+ return `Please select at least one option.
833
+ ${import_picocolors2.default.reset(import_picocolors2.default.dim(`Press ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" space ")))} to select, ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" enter ")))} to submit`))}`;
834
+ }, render() {
835
+ let i = `${import_picocolors2.default.gray(a2)}
836
+ ${y2(this.state)} ${r2.message}
837
+ `;
838
+ switch (this.state) {
839
+ case "submit":
840
+ return `${i}${import_picocolors2.default.gray(a2)} ${this.options.filter(({ value: t }) => this.value.includes(t)).map((t) => n(t, "submitted")).join(import_picocolors2.default.dim(", ")) || import_picocolors2.default.dim("none")}`;
841
+ case "cancel": {
842
+ const t = this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => n(s, "cancelled")).join(import_picocolors2.default.dim(", "));
843
+ return `${i}${import_picocolors2.default.gray(a2)} ${t.trim() ? `${t}
844
+ ${import_picocolors2.default.gray(a2)}` : ""}`;
845
+ }
846
+ case "error": {
847
+ const t = this.error.split(`
848
+ `).map((s, c2) => c2 === 0 ? `${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(s)}` : ` ${s}`).join(`
849
+ `);
850
+ return i + import_picocolors2.default.yellow(a2) + " " + this.options.map((s, c2) => {
851
+ const l2 = this.value.includes(s.value), u = c2 === this.cursor;
852
+ return u && l2 ? n(s, "active-selected") : l2 ? n(s, "selected") : n(s, u ? "active" : "inactive");
853
+ }).join(`
854
+ ${import_picocolors2.default.yellow(a2)} `) + `
855
+ ` + t + `
856
+ `;
857
+ }
858
+ default:
859
+ return `${i}${import_picocolors2.default.cyan(a2)} ${this.options.map((t, s) => {
860
+ const c2 = this.value.includes(t.value), l2 = s === this.cursor;
861
+ return l2 && c2 ? n(t, "active-selected") : c2 ? n(t, "selected") : n(t, l2 ? "active" : "inactive");
862
+ }).join(`
863
+ ${import_picocolors2.default.cyan(a2)} `)}
864
+ ${import_picocolors2.default.cyan(d2)}
865
+ `;
866
+ }
867
+ } }).prompt();
868
+ };
686
869
  var R2 = (r2) => r2.replace(me(), "");
687
870
  var le = (r2 = "", n = "") => {
688
871
  const i = `
@@ -712,6 +895,9 @@ function me() {
712
895
  return new RegExp(r2, "g");
713
896
  }
714
897
 
898
+ // src/index.ts
899
+ var import_deepmerge = __toESM(require_cjs());
900
+
715
901
  // ../../node_modules/.pnpm/rslog@1.2.2/node_modules/rslog/dist/index.mjs
716
902
  init_esm();
717
903
  import process2 from "process";
@@ -1003,6 +1189,7 @@ function checkCancel(value) {
1003
1189
  if (hD(value)) {
1004
1190
  cancelAndExit();
1005
1191
  }
1192
+ return value;
1006
1193
  }
1007
1194
  function formatTargetDir(targetDir) {
1008
1195
  return targetDir.trim().replace(/\/+$/g, "");
@@ -1030,57 +1217,83 @@ async function main() {
1030
1217
  const packageRoot = path2.resolve(__dirname, "..");
1031
1218
  const packageJsonPath = path2.join(packageRoot, "package.json");
1032
1219
  const { version } = __require(packageJsonPath);
1033
- let targetDir = await te({
1034
- message: "Input target folder",
1035
- placeholder: "my-project",
1036
- validate(value) {
1037
- if (value.length === 0) {
1038
- return "Target folder is required";
1220
+ let targetDir = checkCancel(
1221
+ await te({
1222
+ message: "Input target folder",
1223
+ placeholder: "my-project",
1224
+ validate(value) {
1225
+ if (value.length === 0) {
1226
+ return "Target folder is required";
1227
+ }
1039
1228
  }
1040
- }
1041
- });
1042
- checkCancel(targetDir);
1229
+ })
1230
+ );
1043
1231
  targetDir = formatTargetDir(targetDir);
1044
1232
  const distFolder = path2.join(cwd, targetDir);
1045
1233
  if (fs.existsSync(distFolder) && !isEmptyDir(distFolder)) {
1046
- const option = await ie({
1047
- message: `"${targetDir}" is not empty, please choose:`,
1048
- options: [
1049
- { value: "yes", label: "Continue and override files" },
1050
- { value: "no", label: "Cancel operation" }
1051
- ]
1052
- });
1053
- checkCancel(option);
1234
+ const option = checkCancel(
1235
+ await ie({
1236
+ message: `"${targetDir}" is not empty, please choose:`,
1237
+ options: [
1238
+ { value: "yes", label: "Continue and override files" },
1239
+ { value: "no", label: "Cancel operation" }
1240
+ ]
1241
+ })
1242
+ );
1054
1243
  if (option === "no") {
1055
1244
  cancelAndExit();
1056
1245
  }
1057
1246
  }
1058
- const framework = await ie({
1059
- message: "Select framework",
1060
- options: [
1061
- { value: "react", label: "React" },
1062
- { value: "vue3", label: "Vue 3" },
1063
- { value: "vue2", label: "Vue 2" },
1064
- { value: "lit", label: "Lit" },
1065
- { value: "preact", label: "Preact" },
1066
- { value: "svelte", label: "Svelte" },
1067
- { value: "solid", label: "Solid" },
1068
- { value: "vanilla", label: "Vanilla" }
1069
- ]
1070
- });
1071
- checkCancel(framework);
1072
- const language = await ie({
1073
- message: "Select language",
1074
- options: [
1075
- { value: "ts", label: "TypeScript" },
1076
- { value: "js", label: "JavaScript" }
1077
- ]
1078
- });
1079
- checkCancel(language);
1247
+ const framework = checkCancel(
1248
+ await ie({
1249
+ message: "Select framework",
1250
+ options: [
1251
+ { value: "react", label: "React" },
1252
+ { value: "vue3", label: "Vue 3" },
1253
+ { value: "vue2", label: "Vue 2" },
1254
+ { value: "lit", label: "Lit" },
1255
+ { value: "preact", label: "Preact" },
1256
+ { value: "svelte", label: "Svelte" },
1257
+ { value: "solid", label: "Solid" },
1258
+ { value: "vanilla", label: "Vanilla" }
1259
+ ]
1260
+ })
1261
+ );
1262
+ const language = checkCancel(
1263
+ await ie({
1264
+ message: "Select language",
1265
+ options: [
1266
+ { value: "ts", label: "TypeScript" },
1267
+ { value: "js", label: "JavaScript" }
1268
+ ]
1269
+ })
1270
+ );
1271
+ const tools = checkCancel(
1272
+ await ae({
1273
+ message: "Select additional tools (use arrow keys / space bar)",
1274
+ options: [
1275
+ { value: "biome", label: "Add Biome for code linting and formatting" },
1276
+ { value: "eslint", label: "Add ESLint for code linting" },
1277
+ { value: "prettier", label: "Add Prettier for code formatting" }
1278
+ ]
1279
+ })
1280
+ );
1080
1281
  const srcFolder = path2.join(packageRoot, `template-${framework}-${language}`);
1081
1282
  const commonFolder = path2.join(packageRoot, "template-common");
1082
1283
  copyFolder(commonFolder, distFolder, version);
1083
1284
  copyFolder(srcFolder, distFolder, version, path2.basename(targetDir));
1285
+ for (const tool of tools) {
1286
+ const toolFolder = path2.join(packageRoot, `template-${tool}`);
1287
+ if (tool === "eslint") {
1288
+ let subFolder = path2.join(toolFolder, `${framework}-${language}`);
1289
+ if (!fs.existsSync(subFolder)) {
1290
+ subFolder = path2.join(toolFolder, `common-${language}`);
1291
+ }
1292
+ copyFolder(subFolder, distFolder, version);
1293
+ } else {
1294
+ copyFolder(toolFolder, distFolder, version);
1295
+ }
1296
+ }
1084
1297
  const nextSteps = [
1085
1298
  `cd ${targetDir}`,
1086
1299
  `${pkgManager} i`,
@@ -1089,6 +1302,31 @@ async function main() {
1089
1302
  le(nextSteps.join("\n"), "Next steps");
1090
1303
  $e("Done.");
1091
1304
  }
1305
+ function sortObjectKeys(obj) {
1306
+ const sortedKeys = Object.keys(obj).sort();
1307
+ const sortedObj = {};
1308
+ for (const key of sortedKeys) {
1309
+ sortedObj[key] = obj[key];
1310
+ }
1311
+ return sortedObj;
1312
+ }
1313
+ function mergePackageJson(targetPackage, extraPackage) {
1314
+ if (!fs.existsSync(targetPackage)) {
1315
+ return;
1316
+ }
1317
+ const content = (0, import_deepmerge.default)(
1318
+ JSON.parse(fs.readFileSync(targetPackage, "utf-8")),
1319
+ JSON.parse(fs.readFileSync(extraPackage, "utf-8"))
1320
+ );
1321
+ for (const key of ["scripts", "dependencies", "devDependencies"]) {
1322
+ if (!(key in content)) {
1323
+ continue;
1324
+ }
1325
+ content[key] = sortObjectKeys(content[key]);
1326
+ }
1327
+ fs.writeFileSync(targetPackage, `${JSON.stringify(content, null, 2)}
1328
+ `);
1329
+ }
1092
1330
  function copyFolder(src, dist, version, name) {
1093
1331
  const renameFiles = {
1094
1332
  gitignore: ".gitignore"
@@ -1104,6 +1342,9 @@ function copyFolder(src, dist, version, name) {
1104
1342
  const stat = fs.statSync(srcFile);
1105
1343
  if (stat.isDirectory()) {
1106
1344
  copyFolder(srcFile, distFile, version);
1345
+ } else if (file === "extra-package.json") {
1346
+ const targetPackage = path2.resolve(dist, "package.json");
1347
+ mergePackageJson(targetPackage, srcFile);
1107
1348
  } else {
1108
1349
  fs.copyFileSync(srcFile, distFile);
1109
1350
  if (file === "package.json") {
@@ -1116,8 +1357,9 @@ var updatePackageJson = (pkgJsonPath, version, name) => {
1116
1357
  let content = fs.readFileSync(pkgJsonPath, "utf-8");
1117
1358
  content = content.replace(/workspace:\*/g, `^${version}`);
1118
1359
  const pkg = JSON.parse(content);
1119
- if (name)
1360
+ if (name && name !== ".") {
1120
1361
  pkg.name = name;
1362
+ }
1121
1363
  fs.writeFileSync(pkgJsonPath, JSON.stringify(pkg, null, 2));
1122
1364
  };
1123
1365
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-rsbuild",
3
- "version": "0.7.3",
3
+ "version": "0.7.5",
4
4
  "description": "Create a new Rsbuild project",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "repository": {
@@ -28,6 +28,7 @@
28
28
  "devDependencies": {
29
29
  "@clack/prompts": "^0.7.0",
30
30
  "@types/node": "18.x",
31
+ "deepmerge": "^4.3.1",
31
32
  "rslog": "^1.2.2",
32
33
  "typescript": "^5.4.2"
33
34
  },
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
3
+ "organizeImports": {
4
+ "enabled": true
5
+ },
6
+ "vcs": {
7
+ "enabled": true,
8
+ "clientKind": "git",
9
+ "useIgnoreFile": true
10
+ },
11
+ "formatter": {
12
+ "indentStyle": "space"
13
+ },
14
+ "javascript": {
15
+ "formatter": {
16
+ "quoteStyle": "single"
17
+ }
18
+ },
19
+ "linter": {
20
+ "enabled": true,
21
+ "rules": {
22
+ "recommended": true
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "scripts": {
3
+ "check": "biome check --write",
4
+ "format": "biome format --write"
5
+ },
6
+ "devDependencies": {
7
+ "@biomejs/biome": "^1.8.0"
8
+ }
9
+ }
@@ -0,0 +1,8 @@
1
+ import js from '@eslint/js';
2
+ import globals from 'globals';
3
+
4
+ export default [
5
+ { languageOptions: { globals: globals.browser } },
6
+ js.configs.recommended,
7
+ { ignores: ['dist/'] },
8
+ ];
@@ -0,0 +1,10 @@
1
+ {
2
+ "scripts": {
3
+ "lint": "eslint ."
4
+ },
5
+ "devDependencies": {
6
+ "@eslint/js": "^9.4.0",
7
+ "eslint": "9.x",
8
+ "globals": "^15.4.0"
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ import js from '@eslint/js';
2
+ import globals from 'globals';
3
+ import ts from 'typescript-eslint';
4
+
5
+ export default [
6
+ { languageOptions: { globals: globals.browser } },
7
+ js.configs.recommended,
8
+ ...ts.configs.recommended,
9
+ { ignores: ['dist/'] },
10
+ ];
@@ -0,0 +1,11 @@
1
+ {
2
+ "scripts": {
3
+ "lint": "eslint ."
4
+ },
5
+ "devDependencies": {
6
+ "@eslint/js": "^9.4.0",
7
+ "eslint": "9.x",
8
+ "globals": "^15.4.0",
9
+ "typescript-eslint": "^7.12.0"
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ import { fixupConfigRules } from '@eslint/compat';
2
+ import js from '@eslint/js';
3
+ import react from 'eslint-plugin-react/configs/recommended.js';
4
+ import globals from 'globals';
5
+
6
+ export default [
7
+ { languageOptions: { globals: globals.browser } },
8
+ js.configs.recommended,
9
+ ...fixupConfigRules(react),
10
+ { ignores: ['dist/'] },
11
+ ];
@@ -0,0 +1,12 @@
1
+ {
2
+ "scripts": {
3
+ "lint": "eslint ."
4
+ },
5
+ "devDependencies": {
6
+ "@eslint/compat": "^1.0.3",
7
+ "@eslint/js": "^9.4.0",
8
+ "eslint": "9.x",
9
+ "eslint-plugin-react": "^7.34.2",
10
+ "globals": "^15.4.0"
11
+ }
12
+ }
@@ -0,0 +1,13 @@
1
+ import { fixupConfigRules } from '@eslint/compat';
2
+ import js from '@eslint/js';
3
+ import react from 'eslint-plugin-react/configs/recommended.js';
4
+ import globals from 'globals';
5
+ import ts from 'typescript-eslint';
6
+
7
+ export default [
8
+ { languageOptions: { globals: globals.browser } },
9
+ js.configs.recommended,
10
+ ...ts.configs.recommended,
11
+ ...fixupConfigRules(react),
12
+ { ignores: ['dist/'] },
13
+ ];
@@ -0,0 +1,13 @@
1
+ {
2
+ "scripts": {
3
+ "lint": "eslint ."
4
+ },
5
+ "devDependencies": {
6
+ "@eslint/compat": "^1.0.3",
7
+ "@eslint/js": "^9.4.0",
8
+ "eslint": "9.x",
9
+ "eslint-plugin-react": "^7.34.2",
10
+ "globals": "^15.4.0",
11
+ "typescript-eslint": "^7.12.0"
12
+ }
13
+ }
@@ -0,0 +1,20 @@
1
+ import js from '@eslint/js';
2
+ import svelte from 'eslint-plugin-svelte';
3
+ import globals from 'globals';
4
+
5
+ /** @type {import('eslint').Linter.FlatConfig[]} */
6
+ export default [
7
+ js.configs.recommended,
8
+ ...svelte.configs['flat/recommended'],
9
+ {
10
+ languageOptions: {
11
+ globals: {
12
+ ...globals.browser,
13
+ ...globals.node,
14
+ },
15
+ },
16
+ },
17
+ {
18
+ ignores: ['dist/'],
19
+ },
20
+ ];
@@ -0,0 +1,11 @@
1
+ {
2
+ "scripts": {
3
+ "lint": "eslint ."
4
+ },
5
+ "devDependencies": {
6
+ "@eslint/js": "^9.4.0",
7
+ "eslint": "9.x",
8
+ "eslint-plugin-svelte": "^2.36.0",
9
+ "globals": "^15.4.0"
10
+ }
11
+ }
@@ -0,0 +1,28 @@
1
+ import js from '@eslint/js';
2
+ import svelte from 'eslint-plugin-svelte';
3
+ import globals from 'globals';
4
+ import ts from 'typescript-eslint';
5
+
6
+ /** @type {import('eslint').Linter.FlatConfig[]} */
7
+ export default [
8
+ js.configs.recommended,
9
+ ...ts.configs.recommended,
10
+ ...svelte.configs['flat/recommended'],
11
+ {
12
+ languageOptions: {
13
+ globals: {
14
+ ...globals.browser,
15
+ ...globals.node,
16
+ },
17
+ },
18
+ },
19
+ {
20
+ files: ['**/*.svelte'],
21
+ languageOptions: {
22
+ parserOptions: {
23
+ parser: ts.parser,
24
+ },
25
+ },
26
+ },
27
+ { ignores: ['dist/'] },
28
+ ];
@@ -0,0 +1,13 @@
1
+ {
2
+ "scripts": {
3
+ "lint": "eslint ."
4
+ },
5
+ "devDependencies": {
6
+ "@eslint/js": "^9.4.0",
7
+ "eslint": "9.x",
8
+ "eslint-plugin-svelte": "^2.36.0",
9
+ "globals": "^15.4.0",
10
+ "typescript-eslint": "^8.0.0-alpha.20"
11
+ },
12
+ "type": "module"
13
+ }
@@ -0,0 +1,10 @@
1
+ import js from '@eslint/js';
2
+ import vue from 'eslint-plugin-vue';
3
+ import globals from 'globals';
4
+
5
+ export default [
6
+ { languageOptions: { globals: globals.browser } },
7
+ js.configs.recommended,
8
+ ...vue.configs['flat/essential'],
9
+ { ignores: ['dist/'] },
10
+ ];
@@ -0,0 +1,11 @@
1
+ {
2
+ "scripts": {
3
+ "lint": "eslint ."
4
+ },
5
+ "devDependencies": {
6
+ "@eslint/js": "^9.4.0",
7
+ "eslint": "9.x",
8
+ "eslint-plugin-vue": "^9.26.0",
9
+ "globals": "^15.4.0"
10
+ }
11
+ }
@@ -0,0 +1,12 @@
1
+ import js from '@eslint/js';
2
+ import vue from 'eslint-plugin-vue';
3
+ import globals from 'globals';
4
+ import ts from 'typescript-eslint';
5
+
6
+ export default [
7
+ { languageOptions: { globals: globals.browser } },
8
+ js.configs.recommended,
9
+ ...ts.configs.recommended,
10
+ ...vue.configs['flat/essential'],
11
+ { ignores: ['dist/'] },
12
+ ];
@@ -0,0 +1,12 @@
1
+ {
2
+ "scripts": {
3
+ "lint": "eslint ."
4
+ },
5
+ "devDependencies": {
6
+ "@eslint/js": "^9.4.0",
7
+ "eslint": "9.x",
8
+ "eslint-plugin-vue": "^9.26.0",
9
+ "globals": "^15.4.0",
10
+ "typescript-eslint": "^7.12.0"
11
+ }
12
+ }
@@ -1,4 +1,7 @@
1
1
  import { render } from 'preact';
2
2
  import App from './App';
3
3
 
4
- render(<App />, document.getElementById('root')!);
4
+ const root = document.getElementById('root');
5
+ if (root) {
6
+ render(<App />, root);
7
+ }
@@ -0,0 +1,4 @@
1
+ # Lock files
2
+ package-lock.json
3
+ pnpm-lock.yaml
4
+ yarn.lock
@@ -0,0 +1,3 @@
1
+ {
2
+ "singleQuote": true
3
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "scripts": {
3
+ "format": "prettier --write ."
4
+ },
5
+ "devDependencies": {
6
+ "prettier": "^3.1.1"
7
+ }
8
+ }
@@ -2,9 +2,12 @@ import React from 'react';
2
2
  import ReactDOM from 'react-dom/client';
3
3
  import App from './App';
4
4
 
5
- const root = ReactDOM.createRoot(document.getElementById('root')!);
6
- root.render(
7
- <React.StrictMode>
8
- <App />
9
- </React.StrictMode>,
10
- );
5
+ const rootEl = document.getElementById('root');
6
+ if (rootEl) {
7
+ const root = ReactDOM.createRoot(rootEl);
8
+ root.render(
9
+ <React.StrictMode>
10
+ <App />
11
+ </React.StrictMode>,
12
+ );
13
+ }
@@ -1,4 +1,7 @@
1
1
  import { render } from 'solid-js/web';
2
2
  import App from './App';
3
3
 
4
- render(() => <App />, document.getElementById('root')!);
4
+ const root = document.getElementById('root');
5
+ if (root) {
6
+ render(() => <App />, root);
7
+ }
@@ -3,9 +3,6 @@ import './index.css';
3
3
 
4
4
  const app = new App({
5
5
  target: document.body,
6
- props: {
7
- name: 'world',
8
- },
9
6
  });
10
7
 
11
8
  export default app;
@@ -5,7 +5,8 @@
5
5
  "scripts": {
6
6
  "dev": "rsbuild dev --open",
7
7
  "build": "rsbuild build",
8
- "preview": "rsbuild preview"
8
+ "preview": "rsbuild preview",
9
+ "svelte-check": "svelte-check --tsconfig ./tsconfig.json"
9
10
  },
10
11
  "dependencies": {
11
12
  "svelte": "^4.2.17"
@@ -13,6 +14,7 @@
13
14
  "devDependencies": {
14
15
  "@rsbuild/core": "workspace:*",
15
16
  "@rsbuild/plugin-svelte": "workspace:*",
17
+ "svelte-check": "^3.8.0",
16
18
  "typescript": "^5.4.2"
17
19
  }
18
20
  }
@@ -3,9 +3,6 @@ import './index.css';
3
3
 
4
4
  const app = new App({
5
5
  target: document.body,
6
- props: {
7
- name: 'world',
8
- },
9
6
  });
10
7
 
11
8
  export default app;