Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repo: share eslint, typescript, & prettier configs, & format code #50

Merged
merged 3 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
LICENSE.md
.vscode
pkg/
14 changes: 0 additions & 14 deletions .vscode/settings.json

This file was deleted.

13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Then this project may be for you!

**Demos:** We are currently racing toward our first demo release, [V0.0.1](https://github.com/orgs/CADmium-Co/projects/1?pane=info). This is a good first exercise for us to decide on build and release processes.

After that we will do a few more demo (V0.0.*) releases, aggregating features until it feels pretty usable.
After that we will do a few more demo (V0.0.\*) releases, aggregating features until it feels pretty usable.

**Alpha:** When it feels like we've reached an MVP that people might actually want to use, it's time to release an Alpha version (V0.1.0) and actively solicit feedback from users. We'll use that feedback to make more improvements, re-inventing things if necessary to achieve a great workflow.

Expand Down Expand Up @@ -109,17 +109,20 @@ We are actively seeking contributors! Please join the [Discord](https://discord.
Most especially, we need help in the following areas:

**Design:** The tool must look and feel good and we are not designers. We would love contributions in the form of:

- Advice, mockups, or tailwindcss examples of how to make different elements look and behave better
- In particular, help picking a color palette that works well and is unique
- Help figuring out how to implement dark mode

**Rust:** This is our first project in Rust. We need help from experienced Rustaceans to:
- Figure out how to better lay out the rust code
- Point out any glaring issues with how I'm using the language (We've thus far completely avoided Lifetimes, Traits, Rc, RefCell, etc and that may be hampering things)

- Figure out how to better lay out the rust code
- Point out any glaring issues with how I'm using the language (We've thus far completely avoided Lifetimes, Traits, Rc, RefCell, etc and that may be hampering things)

**Svelte:** This is our first project using Svelte. We'd love an experienced set of eyes to:
- Look over the basic structure and tell us if we're making any big mistakes
- Help us migrate to Svelte 5 when it comes out

- Look over the basic structure and tell us if we're making any big mistakes
- Help us migrate to Svelte 5 when it comes out

If you feel like you would be willing and able to help, please join [our discord](https://discord.gg/qJCsKJeyZv)!

Expand Down
23 changes: 11 additions & 12 deletions applications/web/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
extends: ["eslint:recommended", "plugin:svelte/recommended", "prettier"],
parserOptions: {
sourceType: "module",
ecmaVersion: 2020,
extraFileExtensions: [".svelte"]
},
env: {
browser: true,
es2017: true,
node: true
}
root: true,
extends: ["@repo/config-eslint/index.js", "plugin:svelte/recommended"],
parserOptions: {
extraFileExtensions: [".svelte"],
},
env: {
browser: true,
es2017: true,
node: true,
},
}
22 changes: 0 additions & 22 deletions applications/web/.prettierrc

This file was deleted.

1 change: 1 addition & 0 deletions applications/web/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"@repo/config-prettier"
105 changes: 53 additions & 52 deletions applications/web/package.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,55 @@
{
"name": "cadmium-web",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev --host",
"build": "vite build",
"preview": "vite preview",
"test": "pnpm test:integration && pnpm test:unit",
"lint": "prettier --check . && eslint .",
"format": "prettier . --write .",
"check": "svelte-check --tsconfig ./tsconfig.json",
"test:integration": "playwright test",
"test:unit": "vitest",
"types:guard": "ts-auto-guard --export-all src/types.d.ts"
},
"devDependencies": {
"@playwright/test": "^1.44.1",
"@sveltejs/vite-plugin-svelte": "^3.1.0",
"@tsconfig/svelte": "^5.0.4",
"autoprefixer": "^10.4.19",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.35.1",
"phosphor-svelte": "^1.4.2",
"postcss": "^8.4.38",
"postcss-load-config": "^5.1.0",
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.2.3",
"svelte": "5.0.0-next.141",
"svelte-check": "^3.7.1",
"tailwindcss": "^3.4.3",
"ts-auto-guard": "^4.2.0",
"vite": "^5.2.11",
"vitest": "^1.6.0",
"vite-plugin-top-level-await": "^1.4.1",
"vite-plugin-wasm": "^3.3.0"
},
"type": "module",
"dependencies": {
"@fontsource-variable/manrope": "^5.0.20",
"@threlte/core": "8.0.0-next.4",
"@threlte/extras": "9.0.0-next.5",
"@types/three": "^0.164.1",
"cadmium": "workspace:*",
"camera-controls": "^2.8.3",
"gsap": "^3.12.5",
"js-file-download": "^0.4.12",
"nurbs": "^1.1.1",
"shared": "workspace:*",
"three": "^0.164.1",
"troika-three-text": "^0.49.1"
}
"name": "cadmium-web",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"test": "pnpm test:integration && pnpm test:unit",
"lint": "prettier --check . && eslint \"src/**/*.ts\"",
"format": "prettier . --write .",
"check": "svelte-check --tsconfig ./tsconfig.json",
"test:integration": "playwright test",
"test:unit": "vitest",
"types:guard": "ts-auto-guard --export-all src/types.d.ts"
},
"devDependencies": {
"@playwright/test": "^1.44.1",
"@repo/config-typescript": "workspace:*",
"@sveltejs/vite-plugin-svelte": "^3.1.0",
"@tsconfig/svelte": "^5.0.4",
"autoprefixer": "^10.4.19",
"eslint": "^9.3.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.39.0",
"phosphor-svelte": "^1.4.2",
"postcss": "^8.4.38",
"postcss-load-config": "^5.1.0",
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.2.3",
"svelte": "5.0.0-next.141",
"svelte-check": "^3.7.1",
"tailwindcss": "^3.4.3",
"ts-auto-guard": "^4.2.0",
"vite": "^5.2.11",
"vitest": "^1.6.0",
"vite-plugin-top-level-await": "^1.4.1",
"vite-plugin-wasm": "^3.3.0"
},
"type": "module",
"dependencies": {
"@fontsource-variable/manrope": "^5.0.20",
"@threlte/core": "8.0.0-next.4",
"@threlte/extras": "9.0.0-next.5",
"@types/three": "^0.164.1",
"cadmium": "workspace:*",
"camera-controls": "^2.8.3",
"gsap": "^3.12.5",
"js-file-download": "^0.4.12",
"nurbs": "^1.1.1",
"shared": "workspace:*",
"three": "^0.164.1",
"troika-three-text": "^0.49.1"
}
}
12 changes: 6 additions & 6 deletions applications/web/playwright.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/** @type {import('@playwright/test').PlaywrightTestConfig} */
const config = {
webServer: {
command: "npm run build && npm run preview",
port: 4173
},
testDir: "tests",
testMatch: /(.+\.)?(test|spec)\.[jt]s/
webServer: {
command: "npm run build && npm run preview",
port: 4173,
},
testDir: "tests",
testMatch: /(.+\.)?(test|spec)\.[jt]s/,
}

export default config
12 changes: 6 additions & 6 deletions applications/web/postcss.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ const tailwindcss = require("tailwindcss")
const autoprefixer = require("autoprefixer")

const config = {
plugins: [
//Some plugins, like tailwindcss/nesting, need to run before Tailwind,
tailwindcss(),
//But others, like autoprefixer, need to run after,
autoprefixer
]
plugins: [
//Some plugins, like tailwindcss/nesting, need to run before Tailwind,
tailwindcss(),
//But others, like autoprefixer, need to run after,
autoprefixer,
],
}

module.exports = config
78 changes: 39 additions & 39 deletions applications/web/src/App.svelte
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
<script lang="ts">
// import { browser } from "$app/environment"
import { onMount } from "svelte"
import { default as init, Project as WasmProject } from "cadmium"
import AppBar from "./components/AppBar.svelte"
import BottomBar from "./components/BottomBar.svelte"
import MainDisplay from "./components/MainDisplay.svelte"
import ToolBar from "./components/ToolBar.svelte"
import { workbenchIsStale, wasmProject, project, projectIsStale, featureIndex } from "shared/stores"
// import { browser } from "$app/environment"
import {onMount} from "svelte"
import {default as init, Project as WasmProject} from "cadmium"
import AppBar from "./components/AppBar.svelte"
import BottomBar from "./components/BottomBar.svelte"
import MainDisplay from "./components/MainDisplay.svelte"
import ToolBar from "./components/ToolBar.svelte"
import {workbenchIsStale, wasmProject, project, projectIsStale, featureIndex} from "shared/stores"

// prettier-ignore
const log = (function () { const context = "[+page.svelte]"; const color="gray"; return Function.prototype.bind.call(console.log, console, `%c${context}`, `font-weight:bold;color:${color};`)})()
// prettier-ignore
const log = (function () { const context = "[+page.svelte]"; const color="gray"; return Function.prototype.bind.call(console.log, console, `%c${context}`, `font-weight:bold;color:${color};`)})()

const userName = "mattferraro.dev"
let newFileContent: string | null = null
const userName = "mattferraro.dev"
let newFileContent: string | null = null

// if (browser) {
onMount(() => {
init().then(() => {
wasmProject.set(new WasmProject("First Project"))
// log('made a new project')
projectIsStale.set(true)
})
})
// }
// if (browser) {
onMount(() => {
init().then(() => {
wasmProject.set(new WasmProject("First Project"))
// log('made a new project')
projectIsStale.set(true)
})
})
// }

// $: $wasmProject, log("[$wasmProject]", $wasmProject)
// $: $project, log("[$project]", $project)
// $: $wasmProject, log("[$wasmProject]", $wasmProject)
// $: $project, log("[$project]", $project)

$: if (newFileContent) {
log("[newFileContent] received new file", newFileContent)
const newWasmProject = WasmProject.from_json(newFileContent)
wasmProject.set(newWasmProject)
projectIsStale.set(true)
newFileContent = null
}
$: if (newFileContent) {
log("[newFileContent] received new file", newFileContent)
const newWasmProject = WasmProject.from_json(newFileContent)
wasmProject.set(newWasmProject)
projectIsStale.set(true)
newFileContent = null
}

// log('featureIndex changed to', val)
// refresh workbench when featureIndex mutates
featureIndex.subscribe((val) => $wasmProject["get_workbench"] && workbenchIsStale.set(true))
// log('featureIndex changed to', val)
// refresh workbench when featureIndex mutates
featureIndex.subscribe(val => $wasmProject["get_workbench"] && workbenchIsStale.set(true))
</script>

<div class="w-[100vw] h-[100vh] block" style="overflow: hidden;">
<AppBar {userName} project={$project} bind:newFileContent />
<ToolBar />
<div class="flex">
<MainDisplay />
</div>
<BottomBar />
<AppBar {userName} project={$project} bind:newFileContent />
<ToolBar />
<div class="flex">
<MainDisplay />
</div>
<BottomBar />
</div>
Loading
Loading