Skip to content
Open
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
108 changes: 108 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"overrides": [
{
"extends": ["plugin:jsonc/recommended-with-jsonc"],
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"jsonc/sort-keys": ["warn"]
}
},
{
"extends": ["plugin:jsonc/recommended-with-jsonc"],
"files": ["package.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"jsonc/sort-keys": [
"warn",
{
"hasProperties": ["type"],
"order": [
"$schema",
"name",
"version",
"private",
"description",
"license",
"author",
"maintainers",
"contributors",
"homepage",
"repository",
"bugs",
"type",
"exports",
"main",
"module",
"browser",
"man",
"preferGlobal",
"bin",
"files",
"directories",
"scripts",
"config",
"sideEffects",
"types",
"typings",
"workspaces",
"resolutions",
"dependencies",
"bundleDependencies",
"bundledDependencies",
"peerDependencies",
"peerDependenciesMeta",
"optionalDependencies",
"devDependencies",
"keywords",
"engines",
"engineStrict",
"os",
"cpu",
"publishConfig"
],
"pathPattern": "^$"
},
{
"order": { "type": "asc" },
"pathPattern": "^(?!exports\\[).*"
}
]
}
},
{
"extends": ["./first-gen/.eslintrc.json"],
"files": ["first-gen/**/*"]
},
{
"extends": ["./second-gen/.eslintrc.json"],
"files": ["second-gen/**/*"]
}
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"root": true,
"rules": {
"no-console": [
"error",
{
"allow": ["warn", "error"]
}
],
"no-debugger": 2
}
}
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ jobs:
level: error
reporter: github-pr-review
filter_mode: diff_context
eslint_flags: '${{ needs.changed_files.outputs.eslint_added_files }} ${{ needs.changed_files.outputs.eslint_modified_files }}'
eslint_flags: '--config .eslintrc.json ${{ needs.changed_files.outputs.eslint_added_files }} ${{ needs.changed_files.outputs.eslint_modified_files }}'
12 changes: 12 additions & 0 deletions first-gen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"scripts": {
"analyze": "lit-analyzer \"{packages,tools}/*/src/**/!(*.css).ts\"",
"build": "wireit",
"prebuild": "wireit",
"build:clear-cache": "rimraf packages/*/tsconfig.tsbuildinfo && rimraf tools/*/tsconfig.tsbuildinfo",
"build:confirm": "node ./scripts/confirm-build.js",
"build:css": "wireit",
Expand Down Expand Up @@ -221,10 +222,21 @@
"wireit": {
"build": {
"dependencies": [
"prebuild",
"build:ts",
"build:types"
]
},
"prebuild": {
"command": "yarn workspace @swc/core build",
"files": [
"../second-gen/packages/core/components/**/*",
"../second-gen/packages/core/shared/**/*",
"../second-gen/packages/core/package.json",
"../second-gen/packages/core/vite.config.js",
"../second-gen/packages/core/tsconfig.json"
]
},
"build:css": {
"clean": "if-file-deleted",
"command": "node ./scripts/build-css.js",
Expand Down
16 changes: 12 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,18 @@
},
"type": "module",
"scripts": {
"build": "yarn workspace @adobe/spectrum-web-components build",
"test": "yarn workspace @adobe/spectrum-web-components test",
"start": "yarn workspace @adobe/spectrum-web-components storybook",
"lint": "yarn workspace @adobe/spectrum-web-components lint",
"build-first-gen": "yarn workspace @adobe/spectrum-web-components build",
"build-second-gen": "yarn workspace @adobe/swc build",
"build": "yarn build-first-gen && yarn build-second-gen",
Comment on lines +18 to +20
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is strictly a curiosity I had: can you explain why you chose build-first-gen over something like build:first-gen? I've just seen the colon syntax more often, that's all.

Sort of along these lines, if we went with the colon syntax instead, could we do something like:

"build": "yarn build:*",

Does the order of building first-gen or second-gen matter? I honestly don't know what order something like yarn build:* would build each project, so maybe this is not even a good idea! 😆

"test-first-gen": "yarn workspace @adobe/spectrum-web-components test",
"test-second-gen": "yarn workspace @adobe/swc test",
"test": "yarn test-first-gen && yarn test-second-gen",
"start-first-gen": "yarn workspace @adobe/spectrum-web-components start",
"start-second-gen": "yarn workspace @adobe/swc start",
"start": "yarn start-first-gen & yarn start-second-gen",
"lint-first-gen": "yarn workspace @adobe/spectrum-web-components lint",
"lint-second-gen": "yarn workspace @adobe/swc lint",
"lint": "yarn lint-first-gen & yarn lint-second-gen",
"postinstall": "husky || true && patch-package"
},
"workspaces": [
Expand Down
8 changes: 4 additions & 4 deletions second-gen/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@adobe/spectrum-web-components-2nd-gen",
"name": "@adobe/swc",
"version": "0.0.1",
"private": true,
"description": "Second generation Spectrum Web Components with modern tooling and architecture",
Expand All @@ -16,10 +16,10 @@
},
"type": "module",
"scripts": {
"build": "yarn workspaces foreach --from '@swc/*' run build",
"clean": "yarn workspaces foreach --from '@swc/*' run clean",
"build": "yarn workspaces foreach --from '@swc/*' --recursive run build",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will force Yarn to traverse downstream dependents, rebuilding or cleaning even when nothing changed. Is this what we need? We can do caching or parallelisation here too. Let me know your setup

"clean": "yarn workspaces foreach --from '@swc/*' --recursive run clean",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you just want to delete the SWC output you can avoid the cascading clean. You can just run this?

yarn workspaces foreach --from '@swc/*' run clean

"lint": "eslint . --ext .ts,.js,.json",
"storybook": "yarn workspace @swc/components storybook",
"start": "yarn workspace @swc/components storybook",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, wouldn't this also depend on core running in dev mode?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yarn start needs yarn build and yarn build will build the core as well as the second-gen/first-gen depending on what is required and that's enough to run the storybook

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but without core running with HMR, it means changes made to any core file won't be hot-reloaded in Storybook.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may also want to get the CEM analyzer to run in --watch mode, because we will want getStorybookHelpers to automatically reflect the changes to the component.

"storybook:build": "yarn workspace @swc/components storybook:build",
"test": "yarn workspace @swc/components test"
},
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,6 @@ __metadata:
languageName: node
linkType: hard

"@adobe/spectrum-web-components-2nd-gen@workspace:second-gen":
version: 0.0.0-use.local
resolution: "@adobe/spectrum-web-components-2nd-gen@workspace:second-gen"
dependencies:
eslint-plugin-simple-import-sort: "npm:^12.1.1"
languageName: unknown
linkType: soft

"@adobe/spectrum-web-components-monorepo@workspace:.":
version: 0.0.0-use.local
resolution: "@adobe/spectrum-web-components-monorepo@workspace:."
Expand Down Expand Up @@ -308,6 +300,14 @@ __metadata:
languageName: unknown
linkType: soft

"@adobe/swc@workspace:second-gen":
version: 0.0.0-use.local
resolution: "@adobe/swc@workspace:second-gen"
dependencies:
eslint-plugin-simple-import-sort: "npm:^12.1.1"
languageName: unknown
linkType: soft

"@ampproject/remapping@npm:^2.3.0":
version: 2.3.0
resolution: "@ampproject/remapping@npm:2.3.0"
Expand Down
Loading