Skip to content

Commit

Permalink
chore: update deps, fix lint, close #13
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Mar 3, 2024
1 parent 19f736a commit 106e7ee
Show file tree
Hide file tree
Showing 26 changed files with 2,281 additions and 1,609 deletions.
43 changes: 42 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
{
"unocss.root": "./playground/unocss.config.ts"
"unocss.root": "./playground/unocss.config.ts",
// Enable the ESlint flat config support
"eslint.experimental.useFlatConfig": true,

// Disable the default formatter, use eslint instead
"prettier.enable": false,
"editor.formatOnSave": false,

// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},

// Silent the stylistic rules in you IDE, but still auto fix them
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off" },
{ "rule": "format/*", "severity": "off" },
{ "rule": "*-indent", "severity": "off" },
{ "rule": "*-spacing", "severity": "off" },
{ "rule": "*-spaces", "severity": "off" },
{ "rule": "*-order", "severity": "off" },
{ "rule": "*-dangle", "severity": "off" },
{ "rule": "*-newline", "severity": "off" },
{ "rule": "*quotes", "severity": "off" },
{ "rule": "*semi", "severity": "off" }
],

// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml",
"toml"
]
}
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<br>
<p align="center">
<img src="https://user-images.githubusercontent.com/11247099/194190772-8bfba8fa-e500-494c-9a71-6a47c646ef12.svg" alt="retypewriter" height="200" width="200"/>
Expand All @@ -17,8 +16,8 @@ Replay the steps of your changes at ease.
</p>

<p align="center">
<a href="https://twitter.com/antfu7/status/1505236765447458817">Gif Demo</a> |
<a href="https://marketplace.visualstudio.com/items?itemName=antfu.retypewriter">Install VS Code Extension</a>
<a href="https://twitter.com/antfu7/status/1505236765447458817">Gif Demo</a> |
<a href="https://marketplace.visualstudio.com/items?itemName=antfu.retypewriter">Install VS Code Extension</a>
</p>

<div align="center">
Expand Down
5 changes: 5 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const antfu = require('@antfu/eslint-config').default

module.exports = antfu({

})
39 changes: 20 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@retypewriter/monorepo",
"version": "0.1.4",
"private": true,
"packageManager": "pnpm@8.6.9",
"packageManager": "pnpm@8.15.4",
"scripts": {
"build": "pnpm -r run build",
"dev": "vite playground",
Expand All @@ -15,26 +15,27 @@
"typecheck": "vue-tsc --noEmit"
},
"devDependencies": {
"@antfu/eslint-config": "^0.39.8",
"@antfu/ni": "^0.21.5",
"@babel/types": "^7.22.5",
"@antfu/eslint-config": "^2.7.0",
"@antfu/ni": "^0.21.12",
"@babel/types": "^7.24.0",
"@retypewriter/cli": "workspace:./packages/cli",
"@types/diff-match-patch": "^1.0.32",
"@types/node": "^20.4.2",
"@vscode/vsce": "^2.19.0",
"bumpp": "^9.1.1",
"c8": "^8.0.0",
"@types/diff-match-patch": "^1.0.36",
"@types/node": "^20.11.24",
"@vscode/vsce": "^2.24.0",
"@vueuse/core": "^10.9.0",
"bumpp": "^9.3.1",
"c8": "^9.1.0",
"diff-match-patch": "^1.0.5",
"eslint": "^8.45.0",
"esno": "^0.17.0",
"jiti": "^1.19.1",
"pnpm": "^8.6.9",
"eslint": "^8.57.0",
"esno": "^4.0.0",
"jiti": "^1.21.0",
"pnpm": "^8.15.4",
"retypewriter": "workspace:./packages/core",
"rimraf": "^5.0.1",
"typescript": "^5.1.6",
"unbuild": "^1.2.1",
"vite": "^4.4.5",
"vitest": "^0.33.0",
"vue-tsc": "^1.8.5"
"rimraf": "^5.0.5",
"typescript": "^5.3.3",
"unbuild": "^2.0.0",
"vite": "^5.1.4",
"vitest": "^1.3.1",
"vue-tsc": "^2.0.3"
}
}
14 changes: 7 additions & 7 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@retypewriter/cli",
"version": "0.1.4",
"packageManager": "pnpm@8.6.9",
"packageManager": "pnpm@8.15.4",
"description": "reTypewriter CLI",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
"license": "MIT",
Expand All @@ -20,8 +20,8 @@
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"main": "./dist/index.cjs",
Expand All @@ -31,8 +31,8 @@
"retypewriter": "./bin/retypewriter.mjs"
},
"files": [
"dist",
"bin"
"bin",
"dist"
],
"scripts": {
"build": "rimraf dist && unbuild",
Expand All @@ -46,8 +46,8 @@
"cac": "^6.7.14",
"cli-cursor": "^4.0.0",
"cli-highlight": "^2.1.11",
"log-update": "^5.0.1",
"log-update": "^6.0.0",
"picocolors": "^1.0.0",
"simple-git": "^3.19.1"
"simple-git": "^3.22.0"
}
}
5 changes: 3 additions & 2 deletions packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { parse as parsePath, resolve } from 'path'
import { promises as fs } from 'fs'
import { parse as parsePath, resolve } from 'node:path'
import { promises as fs } from 'node:fs'
import process from 'node:process'
import cac from 'cac'
import { Snapshots, getSnapshotPath } from 'retypewriter'
import { version } from '../package.json'
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/git.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { relative, resolve } from 'path'
import { relative, resolve } from 'node:path'
import process from 'node:process'
import { Snapshots } from 'retypewriter'
import Git from 'simple-git'
import type { Snapshot } from 'retypewriter'
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/terminal.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable no-console */
import process from 'node:process'
import type { Snapshots } from 'retypewriter'
import { highlight } from 'cli-highlight'
import { createLogUpdate } from 'log-update'
Expand Down
8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "retypewriter",
"version": "0.1.4",
"packageManager": "pnpm@8.6.9",
"packageManager": "pnpm@8.15.4",
"description": "",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
"license": "MIT",
Expand All @@ -20,8 +20,8 @@
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"main": "./dist/index.cjs",
Expand All @@ -40,7 +40,7 @@
"diff-match-patch": "^1.0.5"
},
"devDependencies": {
"@types/js-yaml": "^4.0.5",
"@types/js-yaml": "^4.0.9",
"js-yaml": "^4.1.0"
}
}
2 changes: 1 addition & 1 deletion packages/core/test/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Vitest Snapshot v1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`should > exported > delta 1`] = `
[
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/__snapshots__/parse.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Vitest Snapshot v1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`works 1`] = `
{
Expand Down
6 changes: 3 additions & 3 deletions packages/core/test/__snapshots__/snaps.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Vitest Snapshot v1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`snaps 1`] = `
"reTypewriter Snapshots v1
--01----------
--02----------
import {} from \\"vue\\"
import {} from "vue"
-----options--
pause: true
--03----------
import { createApp } from \\"vue\\"
import { createApp } from "vue"
const app = createApp()
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/__snapshots__/steps.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Vitest Snapshot v1
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`steps > steps 1`] = `
[
Expand Down
4 changes: 2 additions & 2 deletions packages/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
},
"devDependencies": {
"@antfu/utils": "0.7.5",
"@types/vscode": "^1.80.0",
"tsup": "^7.1.0"
"@types/vscode": "^1.87.0",
"tsup": "^8.0.2"
}
}
4 changes: 2 additions & 2 deletions packages/vscode/scripts/generateSyntaxes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { promises as fs } from 'fs'
import { join, resolve } from 'path'
import { promises as fs } from 'node:fs'
import { join, resolve } from 'node:path'
import { syntaxMaps } from '../src/syntaxes'

const root = resolve(__dirname, '..')
Expand Down
2 changes: 1 addition & 1 deletion packages/vscode/src/manager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { existsSync, promises as fs } from 'fs'
import { existsSync, promises as fs } from 'node:fs'
import { SnapshotManager, Snapshots, getSnapshotPath } from '../../core/src'

export const manager = new SnapshotManager({
Expand Down
8 changes: 4 additions & 4 deletions packages/vscode/src/manipulate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function manipulateSnapshotsInDocument(
if (result !== raw) {
editor = await window.showTextDocument(doc, { preview: false, preserveFocus: false })
await editor.edit((e) => {
e.replace(new Range(0, 0, Infinity, Infinity), snaps.toString())
e.replace(new Range(0, 0, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY), snaps.toString())
})
await updateAnnotation(editor)
}
Expand Down Expand Up @@ -53,21 +53,21 @@ export async function move(doc: TextDocument, index: number, delta = 1) {
export const moveUp = (doc: TextDocument, index: number) => move(doc, index, -1)
export const moveDown = (doc: TextDocument, index: number) => move(doc, index, 1)

export const remove = (doc: TextDocument, index: number) => {
export function remove(doc: TextDocument, index: number) {
return manipulateSnapshotsInDocument(
doc,
snaps => snaps.remove(index),
)
}

export const duplicate = (doc: TextDocument, index: number) => {
export function duplicate(doc: TextDocument, index: number) {
return manipulateSnapshotsInDocument(
doc,
snaps => snaps.duplicate(index),
)
}

export const reverse = (doc: TextDocument) => {
export function reverse(doc: TextDocument) {
return manipulateSnapshotsInDocument(
doc,
snaps => snaps.reverse(),
Expand Down
4 changes: 2 additions & 2 deletions packages/vscode/src/play.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export async function playStart(arg?: TextDocument | Uri) {
const spin = '$(loading~spin) '

token = new CancellationTokenSource()
status = window.createStatusBarItem(StatusBarAlignment.Left, Infinity)
status = window.createStatusBarItem(StatusBarAlignment.Left, Number.POSITIVE_INFINITY)
status.show()
updateContext()

Expand Down Expand Up @@ -144,7 +144,7 @@ export async function playStart(arg?: TextDocument | Uri) {
break

case 'init':
await editor.edit(edit => edit.replace(new Range(0, 0, Infinity, Infinity), snap.content))
await editor.edit(edit => edit.replace(new Range(0, 0, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY), snap.content))
break

case 'paste':
Expand Down
24 changes: 12 additions & 12 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
"serve": "vite preview"
},
"devDependencies": {
"@iconify-json/carbon": "^1.1.18",
"@types/codemirror": "^5.60.8",
"@unocss/reset": "^0.53.5",
"@vitejs/plugin-vue": "^4.2.3",
"@vueuse/core": "^10.2.1",
"codemirror": "^5.65.14",
"@iconify-json/carbon": "^1.1.30",
"@types/codemirror": "^5.60.15",
"@unocss/reset": "^0.58.5",
"@vitejs/plugin-vue": "^5.0.4",
"@vueuse/core": "^10.9.0",
"codemirror": "^5.65.16",
"codemirror-theme-vars": "^0.1.2",
"splitpanes": "^3.1.5",
"unocss": "^0.53.5",
"unplugin-auto-import": "^0.16.6",
"unplugin-vue-components": "^0.25.1",
"vite": "^4.4.5",
"vite-plugin-inspect": "^0.7.33",
"vue": "^3.3.4"
"unocss": "^0.58.5",
"unplugin-auto-import": "^0.17.5",
"unplugin-vue-components": "^0.26.0",
"vite": "^5.1.4",
"vite-plugin-inspect": "^0.8.3",
"vue": "^3.4.21"
}
}
Loading

0 comments on commit 106e7ee

Please sign in to comment.