Skip to content

Commit

Permalink
chore: 替换构建工具
Browse files Browse the repository at this point in the history
  • Loading branch information
aooiuu committed Jun 3, 2024
1 parent 26f901a commit d6c9bee
Show file tree
Hide file tree
Showing 29 changed files with 1,276 additions and 1,032 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@ jobs:
- name: pnpm install
run: pnpm install

- name: build core
run: pnpm run core:build

- name: build shared
run: pnpm run shared:build
- name: build libs
run: pnpm run build

- name: build vscode template
run: pnpm run vscode:build-tpl
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/vsx-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ jobs:
- name: pnpm install
run: pnpm install

- name: build core
run: pnpm run core:build

- name: build shared
run: pnpm run shared:build
- name: build libs
run: pnpm run build

- name: build vscode template
run: pnpm run vscode:build-tpl
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,4 @@ dist
.idea

packages/core/index.d.ts
packages/shared/index.d.ts
packages/server/index.d.ts
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ COPY --parents packages/*/package.json /app/
RUN pnpm install

COPY . /app
RUN pnpm core:build && pnpm shared:build
RUN pnpm build

EXPOSE 8899
CMD ["pnpm", "web:dev"]
15 changes: 11 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
"*.d.ts"
],
"scripts": {
"clean": "rimraf packages/*/node_modules --glob",
"clean": "rimraf packages/*/node_modules --glob && rimraf node_modules",
"run:core": "npm -C packages/core run start",
"core:build": "npm -C packages/core run build",
"shared:build": "npm -C packages/shared run build",
"build": "npm-run-all core:build shared:build build:web",
"epub:build": "npm -C packages/epub run build",
"build": "npm-run-all core:build shared:build epub:build",
"build:web": "npm -C packages/web run build",
"build:web-w": "npm -C packages/web run build:w",
"run:vsc": "npm-run-all core:build build:web-w",
Expand All @@ -47,7 +48,8 @@
"vscode:server": "npm -C packages/web run vscode:dev",
"vscode:dev": "npm-run-all core:build shared:build --parallel vscode:server server",
"vscode:build-tpl": "npm -C packages/web run vscode:build",
"vscode:build": "npm -C packages/vscode run build",
"vscode:build-vsx": "npm -C packages/vscode run build",
"vscode:build": "npm-run-all vscode:build-tpl vscode:build-vsx",
"server:build": "npm -C packages/server run build",
"cli:build-tpl": "npm -C packages/web run cli:build",
"cli:build-js": "npm -C packages/cli run build",
Expand All @@ -60,6 +62,11 @@
"@types/mime": "3.0.4",
"@types/uuid": "^9.0.8",
"husky": "^8.0.0",
"npm-run-all": "^4.1.5"
"npm-run-all": "^4.1.5",
"unbuild": "^2.0.0"
},
"optionalDependencies": {
"bufferutil": "^4.0.8",
"utf-8-validate": "^6.0.4"
}
}
3 changes: 3 additions & 0 deletions packages/cli/bin/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node
'use strict'
import('../dist/index.mjs')
16 changes: 16 additions & 0 deletions packages/cli/build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
entries: [
'src/index',
],
clean: true,
declaration: true,
rollup: {
// inlineDependencies: true,
emitCJS: true,
esbuild: {
minify: true,
},
},
})
18 changes: 7 additions & 11 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,19 @@
"public"
],
"bin": {
"any-reader": "./dist/index.js"
"any-reader": "./bin/index.mjs"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "rollup -c",
"dev": "esno watch src/index.ts"
"build": "esno ./scripts/publish.cjs && unbuild"
},
"keywords": [],
"author": "",
"license": "GPL3",
"devDependencies": {
"dependencies": {
"@any-reader/server": "workspace:^",
"open": "^10.1.0",
"@rollup/plugin-alias": "^5.0.0",
"@rollup/plugin-commonjs": "^25.0.2",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.1.0",
"rollup-plugin-esbuild": "^5.0.0"
"open": "^10.1.0"
},
"devDependencies": {
"fs-extra": "^11.1.1"
}
}
48 changes: 0 additions & 48 deletions packages/cli/rollup.config.mjs

This file was deleted.

14 changes: 14 additions & 0 deletions packages/cli/scripts/publish.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const { dirname, join } = require('node:path')
const fs = require('fs-extra')

const root = dirname(__dirname)

async function publish() {
const pkgPath = join(root, 'package.json')
const rawJSON = await fs.readFile(pkgPath, 'utf-8')
const pkg = JSON.parse(rawJSON)
pkg.name = 'any-reader'
await fs.writeJSON(pkgPath, pkg, { spaces: 2 })
}

publish()
28 changes: 28 additions & 0 deletions packages/core/build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
entries: [
'src/index',
],
externals: [
'axios',
'base64-js',
'cheerio',
'compressing',
'jsonpath-plus',
'pako',
'urlencode',
'xmldom',
'xpath.js',
'puppeteer',
],
clean: true,
declaration: true,
rollup: {
inlineDependencies: true,
emitCJS: true,
esbuild: {
minify: true,
},
},
})
53 changes: 21 additions & 32 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,45 @@
"name": "@any-reader/core",
"version": "1.0.1",
"description": "",
"type": "module",
"main": "index.js",
"scripts": {
"build": "rollup -c",
"dev": "rollup -c --watch",
"lint": "eslint .",
"prepublishOnly": "npm run build",
"start": "esno src/start.ts",
"typecheck": "tsc --noEmit"
"build": "unbuild",
"stub": "unbuild --stub"
},
"keywords": [],
"type": "module",
"exports": {
".": {
"types": "./index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"files": ["dist", "index.d.ts"],
"dependencies": {
"axios": "^1.5.1",
"base64-js": "^1.5.1",
"cheerio": "1.0.0-rc.12",
"compressing": "^1.9.0",
"jsonpath-plus": "^7.2.0",
"pako": "^2.1.0",
"puppeteer": "^21.7.0",
"urlencode": "^2.0.0",
"xmldom": "^0.6.0",
"xpath.js": "^1.1.0"
},
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"devDependencies": {
"@antfu/eslint-config": "^0.39.6",
"@rollup/plugin-alias": "^5.0.0",
"@rollup/plugin-commonjs": "^25.0.2",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.1.0",
"@types/jest": "^29.5.11",
"@types/node": "^18.16.19",
"@types/xmldom": "^0.1.34",
"axios": "^1.7.2",
"base64-js": "^1.5.1",
"cheerio": "1.0.0-rc.12",
"compressing": "^1.9.0",
"eslint": "^8.44.0",
"esno": "^0.16.3",
"jest": "^29.7.0",
"rollup": "^3.26.0",
"rollup-plugin-dts": "^5.3.0",
"rollup-plugin-esbuild": "^5.0.0",
"jsonpath-plus": "^7.2.0",
"pako": "^2.1.0",
"puppeteer": "^21.7.0",
"ts-jest": "^29.1.1",
"typescript": "^5.1.6",
"urlencode": "^2.0.0",
"vite": "^4.3.9",
"vitest": "^0.32.2"
"vitest": "^0.32.2",
"xmldom": "^0.6.0",
"xpath.js": "^1.1.0"
},
"author": "aooiuu",
"license": "GPL3"
Expand Down
80 changes: 0 additions & 80 deletions packages/core/rollup.config.js

This file was deleted.

13 changes: 13 additions & 0 deletions packages/epub/build.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineBuildConfig } from "unbuild";

export default defineBuildConfig({
entries: ["src/index"],
clean: true,
rollup: {
inlineDependencies: true,
emitCJS: true,
esbuild: {
minify: true,
},
},
});
Loading

0 comments on commit d6c9bee

Please sign in to comment.