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 dd69c94 commit 847db57
Show file tree
Hide file tree
Showing 32 changed files with 841 additions and 156 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ jobs:
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.OPER_TOKEN }}
ACCESS_TOKEN: ${{ secrets.GHB_TOKEN }}
BRANCH: gh-pages
FOLDER: playground/spa/dist
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ jobs:

- run: npx changelogithub
env:
GITHUB_TOKEN: ${{ secrets.OPER_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GHB_TOKEN }}
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'],
}
19 changes: 14 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@
"dev": "tsup --watch",
"build": "tsup",
"build:pages": "pnpm run build && cd playground/spa && pnpm run build",
"test:unit": "vitest run",
"test": "run-s test:unit test:serve test:build",
"test:unit": "vitest run",
"test:serve": "vitest run -c vitest.config.e2e.ts",
"test:build": "cross-env VITE_TEST_BUILD=1 vitest run -c vitest.config.e2e.ts",
"lint": "eslint . --fix",
"preinstall": "npx only-allow pnpm",
"postinstall": "simple-git-hooks",
"up": "pnpm update --i --L",
"taze": "taze -I -r -w",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
Expand All @@ -61,27 +62,35 @@
"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",
"@types/debug": "^4.1.9",
"@types/fs-extra": "^11.0.2",
"@types/mock-fs": "^4.13.2",
"@types/node": "^20.8.6",
"@vitest/coverage-v8": "^0.34.6",
"bumpp": "^9.2.0",
"conventional-changelog-cli": "^4.1.0",
"cross-env": "^7.0.3",
"eslint": "^8.51.0",
"execa": "^8.0.1",
"mock-fs": "^5.2.0",
"npm-run-all": "^4.1.5",
"playwright-chromium": "^1.39.0",
"rollup": "^4.1.4",
"simple-git-hooks": "^2.9.0",
"sirv": "^2.0.3",
"taze": "^0.11.4",
"tsup": "^7.2.0",
"typescript": "^5.2.2",
"vite": "^4.4.11",
"vitest": "^0.34.6"
},
"engines": {
"pnpm": ">=8.6.2",
"node": ">=18.0.0"
},
"simple-git-hooks": {
"commit-msg": "pnpm exec commitlint -e"
}
}
2 changes: 1 addition & 1 deletion playground/spa-file-mode/__tests__/file-mode.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { listFiles, readFile } from '~utils'
import path from 'node:path'
import { beforeAll, describe, expect, test } from 'vitest'
import { listFiles, readFile } from '~utils'

describe('file-mode', () => {
let jsFiles: string[]
Expand Down
2 changes: 1 addition & 1 deletion playground/spa-file-mode/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
import { injectScripts, publicTypescript } from 'vite-plugin-public-typescript'
import react from '@vitejs/plugin-react'
import manifest from './public-typescript/manifest.json'

// https://vitejs.dev/config/
Expand Down
4 changes: 2 additions & 2 deletions playground/spa/__tests__/spa.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import path from 'node:path'
import { beforeAll, describe, expect, test } from 'vitest'
import {
editFile,
isBuild,
Expand All @@ -13,6 +11,8 @@ import {
viteTestUrl,
withRetry,
} from '~utils'
import path from 'node:path'
import { beforeAll, describe, expect, test } from 'vitest'

const hmrOriginText = 'hmr original text'

Expand Down
2 changes: 1 addition & 1 deletion playground/spa/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
import { injectScripts, publicTypescript } from 'vite-plugin-public-typescript'
import react from '@vitejs/plugin-react'
import manifest from './public-typescript/manifest.json'

// https://vitejs.dev/config/
Expand Down
4 changes: 2 additions & 2 deletions playground/ssr/__tests__/serve.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// this is automatically detected by playground/vitestSetup.ts and will replace
// the default e2e test serve behavior

import path from 'node:path'
import { hmrPorts, isBuild, ports, rootDir } from '~utils'
import kill from 'kill-port'
import path from 'node:path'
import { type ViteDevServer } from 'vite'
import { hmrPorts, isBuild, ports, rootDir } from '~utils'

export const port = ports['ssr']

Expand Down
2 changes: 1 addition & 1 deletion playground/ssr/__tests__/ssr-react.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { page, untilBrowserLogAfter } from '~utils'
import { describe, test } from 'vitest'
import { port } from './serve'
import { page, untilBrowserLogAfter } from '~utils'

const url = `http://localhost:${port}`

Expand Down
4 changes: 2 additions & 2 deletions playground/ssr/server.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import express from 'express'
import fs from 'node:fs'
import { createRequire } from 'node:module'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { createRequire } from 'node:module'
import express from 'express'
import { injectScriptsToHtml } from 'vite-plugin-public-typescript'

const require = createRequire(import.meta.url)
Expand Down
2 changes: 1 addition & 1 deletion playground/ssr/vite.config.js
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 { publicTypescript } from 'vite-plugin-public-typescript'

export default defineConfig({
Expand Down
4 changes: 2 additions & 2 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 { type ExecaChildProcess } from 'execa'
import fs from 'node:fs'
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,9 +1,9 @@
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, beforeAll } from 'vitest'
import {
type InlineConfig,
type Logger,
Expand All @@ -17,7 +17,7 @@ import {
mergeConfig,
preview,
} from 'vite'
import type * as http from 'node:http'
import { type File, beforeAll } from 'vitest'

// #region env

Expand Down
Loading

0 comments on commit 847db57

Please sign in to comment.