Skip to content

Commit

Permalink
Dependencies upgrade (#360)
Browse files Browse the repository at this point in the history
* Upgrade dependencies

* Add demo link to README

* Upgrade linter, provide consistent cross-platform env
  • Loading branch information
adanski authored Dec 11, 2023
1 parent fffd47c commit 6fb03a4
Show file tree
Hide file tree
Showing 24 changed files with 118 additions and 115 deletions.
1 change: 1 addition & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ rules:
- ignoreRestSiblings: true
argsIgnorePattern: '^_'
'@typescript-eslint/no-explicit-any': 'error'
'prettier/prettier': 'error'
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
packages/jquery-textcomplete/dist/* linguist-vendored
packages/jquery-textcomplete/src/vendor/* linguist-vendored

* text=auto eol=lf
7 changes: 3 additions & 4 deletions .github/workflows/gh-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 12.x
node-version: 18.x
- run: yarn install --no-lockfile
- run: yarn lerna bootstrap
- run: yarn build
- uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 12.x
node-version: 18.x
registry-url: https://registry.npmjs.org
- run: yarn install --no-lockfile
- run: yarn lerna bootstrap
- run: yarn build:packages
- run: yarn lerna publish from-git --yes --no-push --no-git-tag-version
env:
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 14.x
node-version: 18.x
- run: yarn install
- run: yarn lerna bootstrap
- run: yarn build
- run: yarn lint
- run: yarn test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ yarn.lock
package-lock.json
.vscode/*
!.vscode/textcomplete.code-workspace
.idea
docs/.cache
lerna-debug.log
2 changes: 2 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
trailingComma: 'es5'
semi: false
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
# Textcomplete

> Autocomplete for HTMLTextAreaElement and more.
Autocomplete for HTMLTextAreaElement and more.

![Publish](https://github.com/yuku/textcomplete/workflows/Publish/badge.svg)
![Test](https://github.com/yuku/textcomplete/workflows/Test/badge.svg)
![GitHub pages](https://github.com/yuku/textcomplete/workflows/GitHub%20pages/badge.svg)

![](./docs/images/demo.gif)

[Document](https://yuku.takahashi.coffee/textcomplete/).
See more at [yuku.takahashi.coffee/textcomplete](https://yuku.takahashi.coffee/textcomplete/)

## Packages

Textcomplete consists of subpackages:

Name | Description
------------------------------|-------------------------------------------
@textcomplete/core | Core of Textcomplete.
@textcomplete/textarea | Editor for HTMLTextAreaElement.
@textcomplete/contenteditable | Editor for contenteditable. (Experimental)
@textcomplete/codemirror | Editor for CodeMirror. (Experimental)
@textcomplete/utils | Utility functions for editors.
| Name | Description |
|-------------------------------|--------------------------------------------|
| @textcomplete/core | Core of Textcomplete. |
| @textcomplete/textarea | Editor for HTMLTextAreaElement. |
| @textcomplete/contenteditable | Editor for contenteditable. (Experimental) |
| @textcomplete/codemirror | Editor for CodeMirror. (Experimental) |
| @textcomplete/utils | Utility functions for editors. |

## Development

### View Document
### View documentation

```bash
yarn install
yarn lerna bootstrap
yarn docs
```

Expand Down
20 changes: 10 additions & 10 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
"private": true,
"version": "0.1.12",
"scripts": {
"build": "rm -fr dist cache && parcel build index.pug --public-url /textcomplete",
"format:eslint": "eslint --fix '**/*.ts' '**/*.tsx'",
"format:prettier": "prettier --write '**/*.ts' '**/*.tsx'",
"build": "rimraf dist .cache && parcel build index.pug --public-url /textcomplete",
"format:eslint": "eslint --fix **/*.ts **/*.tsx",
"format:prettier": "prettier --write **/*.ts **/*.tsx",
"format": "run-s format:eslint format:prettier",
"lint": "eslint '**/*.ts' '**/*.tsx'",
"lint": "eslint **/*.ts **/*.tsx",
"start": "parcel index.pug"
},
"dependencies": {
"@textcomplete/codemirror": "^0.1.11",
"@textcomplete/codemirror": "^0.1.12",
"@textcomplete/contenteditable": "^0.1.12",
"@textcomplete/core": "^0.1.11",
"@textcomplete/textarea": "^0.1.11",
"@textcomplete/core": "^0.1.12",
"@textcomplete/textarea": "^0.1.12",
"codemirror": "^5.54.0",
"prism-react-renderer": "^1.1.1",
"react": "^17.0.2",
Expand All @@ -23,9 +23,9 @@
"devDependencies": {
"@types/react": "^17.0.3",
"@types/react-dom": "^17.0.2",
"eslint": "^7.21.0",
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-hooks": "^4.0.4",
"eslint": "^8.55.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"parcel-bundler": "1.12.5",
"pug": "^3.0.2",
"sass": "^1.32.8"
Expand Down
2 changes: 1 addition & 1 deletion docs/sections/Editors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const Editors: FC<Props> = ({ id }) => (
/>
</section>
<section>
<h2>Contenteditable</h2>
<h2 id="textcomplete-contenteditable">Contenteditable</h2>
<p>
<code>@textcomplete/contenteditable</code> provides a textcomplete
editor implementation for a contenteditable element. This package is
Expand Down
4 changes: 2 additions & 2 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"version": "0.1.12",
"npmClient": "yarn",
"useWorkspaces": true,
"command": {
"version": {
"ignoreChanges": [
Expand All @@ -14,5 +13,6 @@
"packages": [
"packages/textcomplete-*",
"docs"
]
],
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
27 changes: 13 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,19 @@
"test": "lerna run test --parallel"
},
"devDependencies": {
"@types/jest": "^27.0.1",
"@typescript-eslint/eslint-plugin": "^4.17.0",
"@typescript-eslint/parser": "^4.17.0",
"eslint": "^7.21.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^27.2.0",
"lerna": "^3.22.1",
"@types/jest": "^29.5.10",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.0.1",
"jest": "^29.7.0",
"jest-environment-jsdom": "~29.7.0",
"lerna": "^8.0.0",
"rimraf": "^5.0.5",
"npm-run-all": "^4.1.5",
"prettier": "^2.0.5",
"ts-jest": "^27.0.5",
"typescript": "^4.4.3"
},
"prettier": {
"semi": false
"prettier": "^3.1.0",
"ts-jest": "^29.1.1",
"typescript": "^5.3.2"
}
}
4 changes: 3 additions & 1 deletion packages/textcomplete-codemirror/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# @textcomplete/codemirror

> Textcomplete editor for CodeMirror. (Experimental)
Textcomplete editor for CodeMirror. (Experimental)

[![npm version](https://badge.fury.io/js/@textcomplete%2Fcodemirror.svg)](http://badge.fury.io/js/@textcomplete%2Fcodemirror)

Check the live demo [here](https://yuku.takahashi.coffee/textcomplete/#textcomplete-codemirror).

## Install

```bash
Expand Down
12 changes: 6 additions & 6 deletions packages/textcomplete-codemirror/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
"author": "Yuku Takahashi",
"license": "MIT",
"scripts": {
"build": "rm -fr dist && tsc",
"format:eslint": "eslint --fix 'src/**/*.ts'",
"format:prettier": "prettier --write 'src/**/*.ts'",
"build": "rimraf dist && tsc",
"format:eslint": "eslint --fix src/**/*.ts",
"format:prettier": "prettier --write src/**/*.ts",
"format": "run-s format:eslint format:prettier",
"lint": "eslint 'src/**/*.ts'"
"lint": "eslint src/**/*.ts"
},
"devDependencies": {
"@textcomplete/core": "^0.1.11",
"@textcomplete/core": "^0.1.12",
"@types/codemirror": "^5.60.2",
"codemirror": "^5.54"
},
"peerDependencies": {
"@textcomplete/core": "^0.1.9",
"@textcomplete/core": "^0.1.12",
"codemirror": "^5.54"
},
"publishConfig": {
Expand Down
3 changes: 2 additions & 1 deletion packages/textcomplete-contenteditable/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# @textcomplete/contenteditable

> Textcomplete editor for contenteditable. (Experimental)
Textcomplete editor for contenteditable. (Experimental)

[![npm version](https://badge.fury.io/js/@textcomplete%2Fcontenteditable.svg)](http://badge.fury.io/js/@textcomplete%2Fcontenteditable)

Check the live demo [here](https://yuku.takahashi.coffee/textcomplete/#textcomplete-contenteditable).

## Install

Expand Down
14 changes: 7 additions & 7 deletions packages/textcomplete-contenteditable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
"author": "Yuku Takahashi",
"license": "MIT",
"scripts": {
"build": "rm -fr dist && tsc",
"format:eslint": "eslint --fix 'src/**/*.ts'",
"format:prettier": "prettier --write 'src/**/*.ts'",
"build": "rimraf dist && tsc",
"format:eslint": "eslint --fix src/**/*.ts",
"format:prettier": "prettier --write src/**/*.ts",
"format": "run-s format:eslint format:prettier",
"lint": "eslint 'src/**/*.ts'"
"lint": "eslint src/**/*.ts"
},
"dependencies": {
"@textcomplete/utils": "^0.1.11"
"@textcomplete/utils": "^0.1.12"
},
"devDependencies": {
"@textcomplete/core": "^0.1.11"
"@textcomplete/core": "^0.1.12"
},
"peerDependencies": {
"@textcomplete/core": "^0.1.9"
"@textcomplete/core": "^0.1.12"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 3 additions & 1 deletion packages/textcomplete-core/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# @textcomplete/core

> Core of Textcomplete
Core of Textcomplete

[![npm version](https://badge.fury.io/js/@textcomplete%2Fcore.svg)](http://badge.fury.io/js/@textcomplete%2Fcore)

Read more and check the live demo at [yuku.takahashi.coffee/textcomplete](https://yuku.takahashi.coffee/textcomplete/)

## License

&copy; Yuku Takahashi - This software is licensed under the MIT license.
10 changes: 5 additions & 5 deletions packages/textcomplete-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
"author": "Yuku Takahashi",
"license": "MIT",
"scripts": {
"build": "rm -fr dist && tsc",
"format:eslint": "eslint --fix 'src/**/*.ts'",
"format:prettier": "prettier --write 'src/**/*.ts'",
"build": "rimraf dist && tsc",
"format:eslint": "eslint --fix src/**/*.ts",
"format:prettier": "prettier --write src/**/*.ts",
"format": "run-s format:eslint format:prettier",
"lint": "eslint 'src/**/*.ts'",
"lint": "eslint src/**/*.ts",
"test": "jest"
},
"dependencies": {
"eventemitter3": "^4.0.4"
"eventemitter3": "^5.0.1"
},
"publishConfig": {
"access": "public"
Expand Down
8 changes: 4 additions & 4 deletions packages/textcomplete-core/src/Dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,17 +248,17 @@ export class Dropdown extends EventEmitter {
return this.activeIndex < this.items.length - 1
? this.activeIndex + 1
: this.option.rotate
? 0
: null
? 0
: null
}

private getPrevActiveIndex(): number | null {
if (this.activeIndex == null) throw new Error()
return this.activeIndex !== 0
? this.activeIndex - 1
: this.option.rotate
? this.items.length - 1
: null
? this.items.length - 1
: null
}

private renderItems(): this {
Expand Down
33 changes: 18 additions & 15 deletions packages/textcomplete-core/src/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,23 @@ export abstract class Editor extends EventEmitter {
* @see {@link Textarea} for live example.
*/
protected getCode(e: KeyboardEvent): KeyCode {
return e.keyCode === 9 // tab
? "ENTER"
: e.keyCode === 13 // enter
? "ENTER"
: e.keyCode === 27 // esc
? "ESC"
: e.keyCode === 38 // up
? "UP"
: e.keyCode === 40 // down
? "DOWN"
: e.keyCode === 78 && e.ctrlKey // ctrl-n
? "DOWN"
: e.keyCode === 80 && e.ctrlKey // ctrl-p
? "UP"
: "OTHER"
switch (e.keyCode) {
case 9: // tab
case 13: // enter
return "ENTER"
case 27: // esc
return "ESC"
case 38: // up
return "UP"
case 40: // down
return "DOWN"
case 78: // ctrl-n
if (e.ctrlKey) return "DOWN"
break
case 80: // ctrl-p
if (e.ctrlKey) return "UP"
break
}
return "OTHER"
}
}
4 changes: 3 additions & 1 deletion packages/textcomplete-textarea/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# @textcomplete/textarea

> Textcomplete editor for HTMLTextAreaElement.
Textcomplete editor for HTMLTextAreaElement.

[![npm version](https://badge.fury.io/js/@textcomplete%2Ftextarea.svg)](http://badge.fury.io/js/@textcomplete%2Ftextarea)

Check the live demo [here](https://yuku.takahashi.coffee/textcomplete/#textcomplete-textarea).

## Install

```bash
Expand Down
Loading

0 comments on commit 6fb03a4

Please sign in to comment.