Skip to content

Commit

Permalink
Fix Bezier-rs interactive demos and migrate its Webpack bundler to Vite
Browse files Browse the repository at this point in the history
  • Loading branch information
Keavon committed Jan 5, 2024
1 parent bbece3f commit d268afb
Show file tree
Hide file tree
Showing 27 changed files with 3,476 additions and 2,909 deletions.
12 changes: 4 additions & 8 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@
"useTabs": true,
"tabWidth": 4,
"printWidth": 200,
"plugins": ["prettier-plugin-svelte"],
"overrides": [
{
"files": ["*.yml", "*.yaml"],
"files": [
"*.yml",
"*.yaml"
],
"options": {
"useTabs": false,
"tabWidth": 2
}
},
{
"files": ["*.svelte"],
"options": {
"parser": "svelte"
}
}
]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// Configured in `.prettierrc`
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[yaml][github-actions-workflow]": {
"[json][jsonc][yaml][github-actions-workflow]": {
"editor.formatOnSave": true,
// Configured in `.prettierrc`
"editor.defaultFormatter": "esbenp.prettier-vscode"
Expand Down
10 changes: 5 additions & 5 deletions frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
],
plugins: ["import", "@typescript-eslint", "prettier"],
settings: {
"import/parsers": { "@typescript-eslint/parser": [".ts", ".tsx"] },
"import/parsers": { "@typescript-eslint/parser": [".ts"] },
"import/resolver": { typescript: true, node: true },
},
parser: "@typescript-eslint/parser",
Expand All @@ -32,16 +32,16 @@ module.exports = {
"!.*.ts",
],
overrides: [
{
files: ["*.js"],
rules: { "@typescript-eslint/explicit-function-return-type": ["off"] },
},
{
files: ["*.svelte"],
parser: "svelte-eslint-parser",
// Parse the `<script>` in `.svelte` as TypeScript by adding the following configuration.
parserOptions: { parser: "@typescript-eslint/parser" },
},
{
extends: ["plugin:@typescript-eslint/disable-type-checked"],
files: [".eslintrc.cjs"],
},
],
rules: {
// Standard ESLint config (for ordinary JS syntax linting)
Expand Down
19 changes: 19 additions & 0 deletions frontend/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"singleQuote": false,
"useTabs": true,
"tabWidth": 4,
"printWidth": 200,
"plugins": [
"prettier-plugin-svelte"
],
"overrides": [
{
"files": [
"*.svelte"
],
"options": {
"parser": "svelte"
}
}
]
}
3 changes: 1 addition & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,11 @@
"ts-node": "^10.9.1",
"typescript": "^5.0.4",
"vite": "^4.4.5",
"vite-multiple-assets": "^1.2.6"
"vite-multiple-assets": "1.2.6"
},
"optionalDependencies": {
"wasm-pack": "0.12.1"
},
"//": "Notes about dependency issues and incompatibilities should be added here when needed.",
"homepage": "https://graphite.rs",
"license": "Apache-2.0",
"repository": {
Expand Down
1 change: 0 additions & 1 deletion frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"target": "ES2020",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"experimentalDecorators": true,
Expand Down
76 changes: 76 additions & 0 deletions website/other/bezier-rs-demos/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
module.exports = {
root: true,
env: { browser: true, node: true },
extends: ["eslint:recommended", "plugin:import/recommended", "plugin:@typescript-eslint/recommended", "plugin:import/typescript", "prettier"],
plugins: ["import", "@typescript-eslint", "prettier"],
settings: {
"import/parsers": { "@typescript-eslint/parser": [".ts"] },
"import/resolver": { typescript: true, node: true },
},
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
project: "./tsconfig.json",
},
overrides: [
{
extends: ["plugin:@typescript-eslint/disable-type-checked"],
files: [".eslintrc.cjs"],
},
],
ignorePatterns: [
// Ignore generated directories
"node_modules/",
"dist/",
"pkg/",
"wasm/pkg/",
// Don't ignore JS and TS dotfiles in this folder
"!.*.js",
"!.*.ts",
],
rules: {
// Standard ESLint config (for ordinary JS syntax linting)
indent: "off",
quotes: ["error", "double", { allowTemplateLiterals: true }],
camelcase: ["error", { properties: "always" }],
"linebreak-style": ["error", "unix"],
"eol-last": ["error", "always"],
"max-len": ["error", { code: 200, tabWidth: 4 }],
"prefer-destructuring": "off",
"no-console": "warn",
"no-debugger": "warn",
"no-param-reassign": ["error", { props: false }],
"no-bitwise": "off",
"no-shadow": "off",
"no-use-before-define": "off",
"no-restricted-imports": ["error", { patterns: [".*", "!@/*"] }],

// TypeScript plugin config (for TS-specific linting)
"@typescript-eslint/indent": "off",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_", ignoreRestSiblings: true }],
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/consistent-type-assertions": ["error", { assertionStyle: "as", objectLiteralTypeAssertions: "never" }],
"@typescript-eslint/consistent-indexed-object-style": ["error", "record"],
"@typescript-eslint/consistent-generic-constructors": ["error", "constructor"],
"@typescript-eslint/ban-types": ["error", { types: { null: "Use `undefined` instead." } }],

// Prettier plugin config (for validating and fixing formatting)
"prettier/prettier": "error",

// Import plugin config (for intelligently validating module import statements)
"import/no-unresolved": "error",
"import/prefer-default-export": "off",
"import/no-relative-packages": "error",
"import/order": [
"error",
{
alphabetize: { order: "asc", caseInsensitive: true },
"newlines-between": "always-and-inside-groups",
warnOnUnassignedImports: true,
},
],
},
};
79 changes: 0 additions & 79 deletions website/other/bezier-rs-demos/.eslintrc.js

This file was deleted.

6 changes: 6 additions & 0 deletions website/other/bezier-rs-demos/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"singleQuote": false,
"useTabs": true,
"tabWidth": 4,
"printWidth": 200
}
13 changes: 1 addition & 12 deletions website/other/bezier-rs-demos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,7 @@ From this directory, first execute `npm install` to install the required Node de
```
npm start
```
- To compile an unoptimized development build (like above, but it writes the files instead of serving them):
```
npm run build
```
- To compile an optimized production build:

```
# WSL/Mac/Linux terminals:
npm run build-prod-unix
# Windows terminals:
npm run build-prod-windows
npm run build
```

When a build is compiled, the entire `./public` folder is the output containing both the static `index.html`, etc., plus the generated `build/` folder.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
</head>
<body>
<noscript>JavaScript is required</noscript>
<script>import("./build/bundle.js");</script>
<script type="module" src="src/main.ts"></script>
</body>
</html>
Loading

0 comments on commit d268afb

Please sign in to comment.