Skip to content

Commit

Permalink
perf: improve infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
hemengke1997 committed Oct 24, 2023
1 parent d536929 commit d055c11
Show file tree
Hide file tree
Showing 14 changed files with 984 additions and 218 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x
registry-url: https://registry.npmjs.org/

- name: Install pnpm
uses: pnpm/action-setup@v2.0.1
with:
version: 6.31.0
version: 8.7.0

- name: Install Dependencies
run: pnpm install --no-frozen-lockfile
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ export default defineConfig({

### main.tsx
```tsx
import React from 'react'
import ReactDOM from 'react-dom/client'
import { setupI18n } from 'vite-plugin-i18n-detector/client'
import i18next from 'i18next'
import LanguageDetector from 'i18next-browser-languagedetector'
import React from 'react'
import ReactDOM from 'react-dom/client'
import { initReactI18next } from 'react-i18next'
import { setupI18n } from 'vite-plugin-i18n-detector/client'
import App from './App'

const root = ReactDOM.createRoot(document.querySelector('#root') as HTMLElement)
Expand Down
3 changes: 3 additions & 0 deletions commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@minko-fe'],
}
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"test:serve": "vitest run -c vitest.config.e2e.ts",
"test:build": "cross-env VITE_TEST_BUILD=1 vitest run -c vitest.config.e2e.ts",
"preinstall": "npx only-allow pnpm",
"postinstall": "simple-git-hooks",
"lint": "eslint .",
"up": "taze -I -w -r",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
Expand All @@ -75,8 +76,10 @@
"watcher": "^2.3.0"
},
"devDependencies": {
"@minko-fe/eslint-config": "^2.0.0",
"@minko-fe/tsconfig": "^2.0.0",
"@commitlint/cli": "^18.0.0",
"@minko-fe/commitlint-config": "^2.0.2",
"@minko-fe/eslint-config": "^2.0.2",
"@minko-fe/tsconfig": "^2.0.2",
"@testing-library/react": "^14.0.0",
"@types/clone-deep": "^4.0.2",
"@types/debug": "^4.1.9",
Expand All @@ -98,11 +101,15 @@
"react-dom": "^18.2.0",
"react-i18next": "^13.2.2",
"rollup": "^4.1.4",
"simple-git-hooks": "^2.9.0",
"taze": "^0.11.3",
"tsup": "^7.2.0",
"typescript": "^5.2.2",
"vite": "^4.4.11",
"vite-plugin-i18n-detector": "workspace:*",
"vitest": "^0.29.8"
"vitest": "^0.34.5"
},
"simple-git-hooks": {
"commit-msg": "pnpm exec commitlint -e"
}
}
2 changes: 1 addition & 1 deletion playground/spa/__tests__/spa.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { describe, expect, test } from 'vitest'
import {
addFile,
editFile,
Expand All @@ -12,6 +11,7 @@ import {
untilUpdated,
viteTestUrl,
} from '~utils'
import { describe, expect, test } from 'vitest'

describe('e2e', () => {
test('should render en by default', async () => {
Expand Down
8 changes: 4 additions & 4 deletions playground/spa/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import { setupI18n } from 'vite-plugin-i18n-detector/client'
import i18next from 'i18next'
import LanguageDetector from 'i18next-browser-languagedetector'
import React from 'react'
import ReactDOM from 'react-dom/client'
import { initReactI18next } from 'react-i18next'
import { setupI18n } from 'vite-plugin-i18n-detector/client'
import App from './App'
import './index.css'
import { fallbackLng, lookupTarget } from './const'
import './index.css'

const root = ReactDOM.createRoot(document.querySelector('#root') as HTMLElement)

Expand Down
2 changes: 1 addition & 1 deletion playground/spa/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
import { i18nDetector } from 'vite-plugin-i18n-detector'

// https://vitejs.dev/config/
Expand Down
6 changes: 3 additions & 3 deletions playground/test-utils.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// test utils used in e2e tests for playgrounds.
// `import { getColor } from '~utils'`

import path from 'node:path'
import { type ExecaChildProcess } from 'execa'
import fs from 'fs-extra'
import path from 'node:path'
import { type ConsoleMessage } from 'playwright-chromium'
import { type Manifest, normalizePath } from 'vite'
import { expect } from 'vitest'
import { type ConsoleMessage } from 'playwright-chromium'
import { type ExecaChildProcess } from 'execa'
import { isBuild, isWindows, page, testDir } from './vitestSetup'

export * from './vitestSetup'
Expand Down
2 changes: 1 addition & 1 deletion playground/vitestGlobalSetup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'fs-extra'
import os from 'node:os'
import path from 'node:path'
import fs from 'fs-extra'
import { type BrowserServer, chromium } from 'playwright-chromium'

const DIR = path.join(os.tmpdir(), 'vitest_playwright_global_setup')
Expand Down
8 changes: 4 additions & 4 deletions playground/vitestSetup.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable import/no-mutable-exports */
import { dirname, join, resolve } from 'node:path'
import os from 'node:os'
import type * as http from 'node:http'
import fs from 'fs-extra'
import os from 'node:os'
import { dirname, join, resolve } from 'node:path'
import { type Browser, type Page, chromium } from 'playwright-chromium'
import { type RollupError, type RollupWatcher, type RollupWatcherEvent } from 'rollup'
import { type File, afterEach, beforeAll } from 'vitest'
import {
type InlineConfig,
type Logger,
Expand All @@ -18,7 +18,7 @@ import {
mergeConfig,
preview,
} from 'vite'
import type * as http from 'node:http'
import { type File, afterEach, beforeAll } from 'vitest'

// #region env

Expand Down
Loading

0 comments on commit d055c11

Please sign in to comment.