Skip to content

Commit

Permalink
refactor: upgrade dependencies & transfer to Vitest (#17)
Browse files Browse the repository at this point in the history
* refactor: update directory setup to the current Hilla setup

* refactor: setup Vitest as test runner

* refactor: configure Vitest to run in Chrome

* chore: adjust Github Actions workflow

* chore: add manual triggering for the workflow

* chore: add generic registration

* chore: fix Eslint issues

* chore: use registrations in tests too

* chore: improve structure

* chore: fix path
  • Loading branch information
Lodin authored Jan 23, 2025
1 parent 8b61950 commit 068b973
Show file tree
Hide file tree
Showing 47 changed files with 12,952 additions and 18,019 deletions.
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# http://editorconfig.org

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{java,xml}]
indent_size = 4

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false

[*.kt]
indent_size = 4

[*.gradle]
indent_size = 4
File renamed without changes.
4 changes: 2 additions & 2 deletions frontend/.eslintrc → .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"vaadin/prettier"
],
"ignorePatterns": ["packages/ts/*/test/**/*.snap.ts"],
"plugins": ["mocha", "tsdoc"],
"plugins": ["tsdoc"],
"rules": {
"@typescript-eslint/no-useless-template-literals": "off",
"@typescript-eslint/class-methods-use-this": "off",
"@typescript-eslint/no-invalid-void-type": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
Expand All @@ -19,7 +20,6 @@
"import/prefer-default-export": "off",
"max-params": "off",
"max-classes-per-file": "off",
"mocha/no-exclusive-tests": "error",
"tsdoc/syntax": "error"
}
}
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug, fusion
labels: bug, hilla
assignees: ''

---
Expand All @@ -11,7 +11,7 @@ assignees: ''
Please READ these instructions & USE the issue template below, Thank You!
Only use GitHub issues for bugs and feature requests.
For general support from the community, use Vaadin discord chat https://vaad.in/fusion instead.
For general support from the community, use Vaadin discord chat https://vaad.in/hilla instead.
NOTE: Issues concerning certain UI components should go to the components repository https://github.com/vaadin/web-components .
Expand All @@ -26,7 +26,7 @@ Good quality bug report increases the likelihood to get the bug fixed. A bad qua
### Actual behavior
<!-- What actually happens, attach server/browser logs when there are errors/exceptions -->
### Versions:
- Vaadin / Fusion version:
- Vaadin / Hilla version:
- Node version:
- Java version:
- OS version:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement, fusion
labels: enhancement, hilla
assignees: ''

---
Expand Down
51 changes: 0 additions & 51 deletions .github/workflows/frontend-release.yml

This file was deleted.

29 changes: 17 additions & 12 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,37 @@ on:
- '.github/workflows/frontend.yml'
- 'frontend/**/*'
- '!frontend/.simple-git-hooks.json'
- '!frontend/.lintstagedrc.json'
- '!frontend/.lintstagedrc.js'
pull_request:
paths:
- '.github/workflows/frontend.yml'
- 'frontend/**/*'
- '!frontend/.simple-git-hooks.json'
- '!frontend/.lintstagedrc.json'

defaults:
run:
working-directory: frontend
- '!frontend/.lintstagedrc.js'
workflow_dispatch:

jobs:
testing:
name: Test & Analysis
runs-on: ubuntu-20.04
timeout-minutes: 5
env:
NX_SKIP_NX_CACHE: true

steps:
- name: Install Chrome
id: setup-chrome
uses: browser-actions/setup-chrome@v1
- run: |
${{ steps.setup-chrome.outputs.chrome-path }} --version
- name: Checkout Project Code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use NodeJS LTS
uses: actions/setup-node@v1
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 'lts/*'
- name: Install
run: npm ci
- name: Build
Expand All @@ -44,15 +48,16 @@ jobs:
run: npm run test:coverage
env:
CI: true
CHROME_BIN: ${{ steps.setup-chrome.outputs.chrome-path }}
- name: Collect Coverage
run: |
COVFILES=$(find packages -wholename '*/.coverage/lcov.info' | tr '\n' ',' | sed '$s/,$//')
echo "COVFILES=$COVFILES" >> $GITHUB_ENV
- name: Send Coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ env.COVFILES }}
flags: unittests
fail_ci_if_error: true
root_dir: ${{ github.workspace }}/frontend
root_dir: ${{ github.workspace }}
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,21 @@
**/dist
node_modules

# NX files
.nx

# Testing files
.vite
.coverage

# Generated Code
packages/ts/*/*.d.ts
packages/ts/*/*.d.ts.map
packages/ts/*/*.js
packages/ts/*/*.js.map
packages/ts/*/*.module.css
packages/ts/*/*.css
packages/ts/*/.coverage
packages/ts/*/.vite
packages/ts/*/types/**
*.swp
18 changes: 18 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import micromatch from 'micromatch';

const excludePatterns = ['**/node_modules/**/*', '**/*.snap.{ts,js}'];

function createExcludeCallback(command) {
return (files) => {
const matched = micromatch.not(files, excludePatterns);

return matched.length > 0 ? [`${command} ${matched.map((filename) => `"${filename}"`).join(' ')}`] : [];
};
}

export const extensions = ['ts', 'js', 'tsx'].join(',');
export const commands = [createExcludeCallback('eslint --fix'), createExcludeCallback('prettier --write')];

export default {
[`./*.{${extensions}}`]: commands,
};
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions .simple-git-hooks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"pre-commit": "npx lint-staged"
}
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
# flow-hilla-common
# Flow & Hilla Common Utilities

![Frontend CI](https://github.com/vaadin/hilla/actions/workflows/frontend.yml/badge.svg)
[![codecov](https://codecov.io/gh/vaadin/hilla/branch/main/graph/badge.svg?token=PQMTMS8ECC)](https://codecov.io/gh/vaadin/hilla)

The collection of common utilities used by Vaadin Flow and Hilla.

| Package | Status |
|-------------------------|--------|
| [@vaadin/common-frontend](packages/ts/common-frontend) | [![Latest Stable Version](https://img.shields.io/npm/v/@vaadin/common-frontend.svg)](https://www.npmjs.com/package/@vaadin/common-frontend) |

## Contribution

You can download the project and run tests using the following commands:
```bash
$ git clone https://github.com/vaadin/flow-hilla-common.git
$ cd flow-hilla-common
$ npm install
$ npm run build
$ npm test
```

## Requirements

To work with this project as a developer, you need the following versions of `node` and `npm`:

- **NodeJS**: `^12.20.0 || ^14.13.1 || >=16.0.0` (native support for ES Modules),
- **npm**: `^7` (`package-lock.json` is of version 2; also, `lerna` is unable to bootstrap this project correctly with lower `npm`)



5 changes: 0 additions & 5 deletions frontend/.gitignore

This file was deleted.

4 changes: 0 additions & 4 deletions frontend/.lintstagedrc.json

This file was deleted.

3 changes: 0 additions & 3 deletions frontend/.simple-git-hooks.json

This file was deleted.

31 changes: 0 additions & 31 deletions frontend/README.md

This file was deleted.

5 changes: 0 additions & 5 deletions frontend/lerna.json

This file was deleted.

Loading

0 comments on commit 068b973

Please sign in to comment.