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

TypeScript Rollout Tier 1 #319

Merged
merged 39 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4c4b81b
chore(lib): install TypeScript dependencies
kikuomax Nov 29, 2023
fd76d0d
chore(lib): remove src/types folder
kikuomax Jan 18, 2024
9050e2e
chore(lib): minimum configuration for TypeScript
kikuomax Nov 29, 2023
79196e9
chore(lib): import App type from vue
kikuomax Nov 29, 2023
5b9c272
test(lib): introduce Vitest
kikuomax Nov 30, 2023
5a44670
test(lib): include spec files in type-check
kikuomax Nov 30, 2023
5deeece
feat(lib): generate type declaration
kikuomax Dec 4, 2023
ce58ab7
chore: enable ESLint for TypeScript
kikuomax Dec 4, 2023
14b511a
chore(docs): configure Vite for TypeScript (dev)
kikuomax Dec 4, 2023
ea2e346
chore(docs): rename main.js to main.ts
kikuomax Dec 4, 2023
442bc5b
chore(docs): add type-check script
kikuomax Dec 4, 2023
1205714
fix(docs): fix type errors in main.ts
kikuomax Dec 5, 2023
aa1cf4a
chore(docs): build and type-check in parallel
kikuomax Dec 5, 2023
912d083
chore: hoist common dependencies
kikuomax Dec 5, 2023
b8492eb
chore(docs): install docs type dependencies
kikuomax Feb 12, 2024
85907d0
chore: use TypeScript project reference
kikuomax Jan 17, 2024
eb16a54
chore(lib): update api-extractor config
kikuomax Jan 18, 2024
4c72e75
chore(docs): update tsconfig for Vite
kikuomax Jan 18, 2024
61f0fbd
fix(lib): components type error
kikuomax Jan 18, 2024
035ec1d
feat(lib): export individual components
kikuomax Jan 18, 2024
4645c03
chore(lib): ignore temp-dts folder
kikuomax Jan 18, 2024
2c0e5c7
feat(lib): add Vue module augmentation
kikuomax Jan 29, 2024
80fd6a2
chore(lib): distribute bundled ESM module
kikuomax Feb 12, 2024
4be6041
REVERT_THIS(lib): vetur workaround for TS API
kikuomax Jan 18, 2024
3e2e017
chore(docs): datepicker type error workaround
kikuomax Jan 18, 2024
2d490c6
test(lib): add tests for matchWithGroups
kikuomax Feb 2, 2024
7d48125
test(lib): add tests for toCssWidth
kikuomax Feb 2, 2024
7a2af73
chore(lib): change extension of utils/helper.js → .ts
kikuomax Feb 1, 2024
f67bf82
feat(lib): rewrite utils/helper in TS
kikuomax Feb 2, 2024
ac186b9
test(lib): rewrite tests for utils/helpers in TS
kikuomax Feb 2, 2024
0463be4
chore(lib): update test and unit scripts
kikuomax Oct 16, 2024
3b128d9
chore: bump version to 0.2.0
kikuomax Dec 24, 2024
4ece5f9
feat(gha): add workflow for lint, type-check, and unit test
kikuomax Oct 16, 2024
3c21d6a
feat(gha): verify docs package
kikuomax Dec 24, 2024
c3278c6
chore(gha): remove migrate-to-typescript from the trigger
kikuomax Dec 25, 2024
eeca716
chore(gha): skip linting until TypeScript migration complete
kikuomax Dec 28, 2024
0441c4c
chore(gha): remove unit_testing.yml
kikuomax Dec 28, 2024
3863456
docs(.github): update development guideline
kikuomax Oct 19, 2024
b34a54e
chore(lib): make rollup handle .ts files
kikuomax Feb 12, 2024
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
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
// http://eslint.org/docs/user-guide/configuring

module.exports = {
root: true, // this is the root ESLint config file
env: {
jest: true,
browser: true
},
extends: [
'standard',
'plugin:vue/vue3-recommended'
'plugin:vue/vue3-recommended',
'plugin:@typescript-eslint/recommended'
],
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 'latest'
},
rules: {
Expand Down
105 changes: 93 additions & 12 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* The ``master`` branch is a snapshot of the latest release. **Submit your PR in the ``dev`` branch**
* Include **screenshots** or animated GIFs in your pull request whenever needed (if visual changes)
* It's OK to have multiple small commits as you work on the PR - we will let GitHub automatically squash it before merging
* Make sure all the unit tests pass by running `npm test` both in the library and documentation
* Make sure your code style is consistent by running `npm run lint:fix` both in the libary and documentation
* **DO NOT** commit the ``lib`` and ``dist`` folder, use it only for testing on your end
* If adding new feature:
* Provide convincing reason to add this feature. Ideally you should open a suggestion issue first and have it greenlighted before working on it
Expand Down Expand Up @@ -44,7 +46,8 @@ And here is one about the FLIP technique (which ``<transition-group>`` uses inte

## Buefy Javascript styleguide

Add comments if method is too complex and/or whenever you judge necessary.
* Follow the [ESLint](https://eslint.vuejs.org) rules: `npm run lint`
* Add comments if method is too complex and/or whenever you judge necessary.

## Buefy Sass styleguide

Expand Down Expand Up @@ -100,26 +103,104 @@ Sass example:

# Development Setup

You need [Node.js](http://nodejs.org/) **version >= 6 and <= 11**.
You need [Node.js](https://nodejs.org/) **version >= 16**.

After cloning the repo, run:

```bash
$ npm install
npm install
```

Common used NPM scripts:
## Buefy core library

The core source files of Buefy are in the [`packages/buefy-next`](../packages/buefy-next/) folder.

```bash
cd packages/buefy-next
```

### Checking types

```bash
npm run type-check
```

### Running unit tests

```bash
# serve docs with hot reload at localhost:8080
$ npm run dev
npm test
```

# build lib in /dist folder
$ npm run build:lib
### Checking the code style and formatting

# build docs in /dist-docs folder
$ npm run build:docs
```bash
npm run lint
```

You can apply the automatic fixes by running:

# build docs and lib
$ npm run build
```bash
npm run lint:fix
```

### Bundling the library

```bash
npm run build
```

You can find the bundled files in the `dist` folder.

## Buefy documentation

The source files of the Buefy documentation are in the [`packages/docs`](../packages/docs/) folder.

```bash
cd packages/docs
```

### Starting a development server

```bash
npm run dev
```

The documentation will be served at <https://localhost:5173/>.

### Checking types

```bash
npm run type-check
```

### Checking the code style and formatting

```bash
npm run lint
```

You can apply the automatic fixes by running:

```bash
npm run lint:fix
```

### Bundling the documentation

Prerequisite: [Bundling the library](#bundling-the-library)

```bash
npm run build
```

You can preview the production build by running:

```bash
npm run preview
```

As some type errors may be detected only in the production build, you should also perform type checking for the production build:

```bash
npm run build:type-check
```
30 changes: 0 additions & 30 deletions .github/workflows/unit_testing.yml

This file was deleted.

88 changes: 88 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: "Lint, type check, and unit test"

on:
push:
branches:
- dev
- main

pull_request:
branches:
- dev
- main

jobs:
verify:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [18, 20, 22]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm

- run: npm ci

- name: Lint
# skips until the TypeScript migration is complete
run: exit 0
# run: npm -w @ntohq/buefy-next run lint
id: lint
continue-on-error: true

- name: Type check
run: npm -w @ntohq/buefy-next run type-check
id: type-check
continue-on-error: true

- name: Unit test
run: npm -w @ntohq/buefy-next run unit
id: unit
continue-on-error: true

- name: Fail if any of the previous steps failed
if: ${{ steps.lint.outcome == 'failure' || steps.type-check.outcome == 'failure' || steps.unit.outcome == 'failure' }}
run: echo "Lint=${{ steps.lint.outcome }} Type-check=${{ steps.type-check.outcome }} Unit=${{ steps.unit.outcome }}" && exit 1

verify-docs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [18, 20, 22]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm

- run: npm ci

- name: Lint docs
# skips until the TypeScript migration is complete
run: exit 0
# run: npm -w docs run lint
id: lint
continue-on-error: true

- name: Type check docs
run: npm -w docs run type-check
id: type-check
continue-on-error: true

- name: Fail if any of the previous steps failed
if: ${{ steps.lint.outcome == 'failure' || steps.type-check.outcome == 'failure' }}
run: echo "Lint=${{ steps.lint.outcome }} Type-check=${{ steps.type-check.outcome }}" && exit 1
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ debug.log*
.idea/
cypress/videos/
cypress/screenshots/
.vscode/
.vscode/
*.tsbuildinfo
Loading
Loading