-
Notifications
You must be signed in to change notification settings - Fork 7
Create monorepo and typeScript react base project #36
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
base: main
Are you sure you want to change the base?
Changes from all commits
d21af81
4a46493
6bca620
8860a9c
5d88dc7
d9ef232
4589f95
a5c38e2
d42a34c
cf51139
73bee7e
9181cd9
d54e9aa
f2421af
8735617
03cbc02
a1375fe
9ea42a6
a5565ac
782c8bb
0b5dd15
a9d7e6d
a4221c2
7bba5d6
0643e7d
ccc3cf1
2b38798
0a12fa8
2ec6bef
e8a95e7
02148fe
f5b7cab
f129df8
d9e470d
43fb7ab
b72507c
426b324
b05fa44
6b9fd9a
d402601
66f76e1
72bd389
75816f6
1799972
540ff17
f292588
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #!/bin/sh | ||
| # | ||
| # Copyright 2026 The Serverless Workflow Specification Authors | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
|
|
||
| pnpm exec lint-staged |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ignore-workspace-root-check=true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| .gitattributes | ||
| .npmrc | ||
| .prettierignore | ||
| .prettierrc | ||
| .rat-excludes | ||
| .rat-reports | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| repo/graph.dot | ||
| repo/repo.iml | ||
|
|
||
handreyrc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,18 +3,38 @@ | |
| "version": "0.0.0", | ||
| "private": true, | ||
| "description": "CNCF Serverless Workflow Specification Visual Editor", | ||
| "homepage": "https://github.com/serverlessworkflow/editor", | ||
| "bugs": { | ||
| "url": "https://github.com/serverlessworkflow/editor/issues" | ||
| }, | ||
| "license": "Apache-2.0", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/serverlessworkflow/editor.git" | ||
| }, | ||
| "type": "module", | ||
| "scripts": { | ||
| "format": "formatter", | ||
| "format:check": "formatter --check", | ||
| "build:prod": "pnpm -r --stream --if-present build:prod", | ||
| "build:dev": "pnpm -r --stream --if-present build:dev", | ||
| "prepare": "husky" | ||
| }, | ||
| "devDependencies": { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing root test/lint/(start) scripts?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @JBBianchi , ok for test and lint, but because this monorepo will probably host multiple packages, I think
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could, we could also have a root |
||
| "husky": "^9.1.7" | ||
| "@serverlessworkflow-toolings/linter": "workspace:*", | ||
| "husky": "catalog:", | ||
| "lint-staged": "catalog:", | ||
| "oxfmt": "catalog:", | ||
| "typescript": "catalog:" | ||
| }, | ||
| "lint-staged": { | ||
| "*.{ts,tsx,js,jsx,json,md,yml,yaml}": [ | ||
| "pnpm format" | ||
| ] | ||
handreyrc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| "engines": { | ||
| "node": ">=20" | ||
| } | ||
| "node": ">=22", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Root doesn't declare @types/node. The linter package uses ^22.10.2, diagram-editor uses ^25.3.3. These should be consistent. Consider pnpm catalogs?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I created an issue to develop a dependency consistency check CI, to have this check in our PRs:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The use of pnpm catalogs is awesome. Thanks @JBBianchi for the tip |
||
| "pnpm": "10.31.0" | ||
| }, | ||
| "packageManager": "pnpm@10.31.0" | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "$schema": "./node_modules/oxfmt/configuration_schema.json", | ||
| "ignorePatterns": [] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "$schema": "https://oxc.rs/schema/oxlintrc.json", | ||
| "plugins": ["react", "typescript", "import", "jsx-a11y"], | ||
| "rules": { | ||
| "react/react-in-jsx-scope": "off", | ||
| "typescript/no-unused-vars": "warn", | ||
| "typescript/no-explicit-any": "warn" | ||
| }, | ||
| "ignorePatterns": ["**/dist/", "**/dist-storybook/", "**/node_modules/"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| <!-- | ||
| Copyright 2021-Present The Serverless Workflow Specification Authors | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| --> | ||
|
|
||
| # @serverlessworkflow-toolings/linter | ||
|
|
||
| Shared linting and formatting configuration for the Serverless Workflow Editor monorepo. | ||
|
|
||
| ## Overview | ||
|
|
||
| This package provides centralized configuration for Oxlint and Oxfmt | ||
|
|
||
| ## Usage | ||
|
|
||
| ### In Consumer Packages | ||
|
|
||
| ```json | ||
| { | ||
| "name": "your-package-name", | ||
| "scripts": { | ||
| "lint": "linter src/ stories/" | ||
| }, | ||
| "devDependencies": { | ||
| "@serverlessworkflow-toolings/linter": "workspace:*" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Extending Configuration | ||
|
|
||
| To extend the configuration in a specific package, create a local `oxlintrc.json`: | ||
|
|
||
| ```json | ||
| { | ||
| "extends": ["node_modules/@serverlessworkflow-toolings/linter/oxlintrc.json"] | ||
handreyrc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /* | ||
| * Copyright 2021-Present The Serverless Workflow Specification Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import { spawn } from "child_process"; | ||
| import { existsSync } from "fs"; | ||
| import { fileURLToPath } from "url"; | ||
| import { dirname, join } from "path"; | ||
|
|
||
| const configFilename = ".oxfmtrc.json"; | ||
| const __dirname = dirname(fileURLToPath(import.meta.url)); | ||
| const oxfmtBin = process.platform === "win32" ? "oxfmt.cmd" : "oxfmt"; | ||
| const oxfmtPath = join(__dirname, "node_modules", ".bin", oxfmtBin); | ||
|
|
||
| // Use local configuration if exists, otherwise fallback to linter's config | ||
| const localConfigPath = join(process.cwd(), configFilename); | ||
| const configPath = join(__dirname, configFilename); | ||
| const selectedConfig = existsSync(localConfigPath) ? localConfigPath : configPath; | ||
|
|
||
| const args = ["--config", selectedConfig, ...process.argv.slice(2)]; | ||
|
|
||
| const oxfmt = spawn(oxfmtPath, args, { | ||
| cwd: process.cwd(), | ||
| stdio: "inherit", | ||
| }); | ||
|
|
||
| oxfmt.on("error", (err) => { | ||
| console.error("Failed to start oxfmt:", err.message); | ||
| process.exit(1); | ||
| }); | ||
|
|
||
| oxfmt.on("exit", (code) => { | ||
| process.exit(code ?? 0); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /* | ||
| * Copyright 2021-Present The Serverless Workflow Specification Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import { spawn } from "child_process"; | ||
| import { existsSync } from "fs"; | ||
| import { fileURLToPath } from "url"; | ||
| import { dirname, join } from "path"; | ||
|
|
||
| const configFilename = ".oxlintrc.json"; | ||
| const __dirname = dirname(fileURLToPath(import.meta.url)); | ||
| const oxlintBin = process.platform === "win32" ? "oxlint.cmd" : "oxlint"; | ||
| const oxlintPath = join(__dirname, "node_modules", ".bin", oxlintBin); | ||
|
|
||
| // Use local configuration if exists, otherwise fallback to linter's config | ||
| const localConfigPath = join(process.cwd(), configFilename); | ||
| const configPath = join(__dirname, configFilename); | ||
| const selectedConfig = existsSync(localConfigPath) ? localConfigPath : configPath; | ||
|
|
||
| const args = ["--config", selectedConfig, ...process.argv.slice(2)]; | ||
|
|
||
| const oxlint = spawn(oxlintPath, args, { | ||
handreyrc marked this conversation as resolved.
Show resolved
Hide resolved
handreyrc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| cwd: process.cwd(), | ||
| stdio: "inherit", | ||
| }); | ||
|
|
||
| oxlint.on("error", (err) => { | ||
| console.error("Failed to start oxlint:", err.message); | ||
| process.exit(1); | ||
| }); | ||
|
|
||
| oxlint.on("exit", (code) => { | ||
| process.exit(code ?? 0); | ||
| }); | ||
|
Comment on lines
+1
to
+46
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I understand the necessity of this project rather than using npm scripts.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I created this layer to have a centralised, but extensible, linter and formatter configuration. But I can remove this script and keep only
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Centralizing lint/format config in the monorepo makes sense. If this is just base configuration, I’d actually keep it at the repo root (or under a simple config/ folder) rather than under packages/, since it’s not really a consumable workspace package. I’m less convinced by the wrapper script though: switching linters is rarely just a command swap, since config/rules/CLI behavior also change. If the wrapper only forwards to oxlint, it may be unnecessary indirection; if it also handles repo-specific orchestration, then it’s easier to justify. |
||
Uh oh!
There was an error while loading. Please reload this page.