Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[changelog]
header = """
# Changelog\n
"""
body = """
{% if version %}\
## [{{ version | trim_start_matches(pat="v") }}](https://github.com/WeBankFinTech/fes.js/compare/{{ previous.version }}...{{ version }}) ({{ timestamp | date(format="%Y-%m-%d") }})
{% else %}\
## [Unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits %}
* {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/WeBankFinTech/fes.js/commit/{{ commit.id }}))
{% endfor %}
{% endfor %}\n
"""
trim = true

[git]
conventional_commits = true
filter_unconventional = true
split_commits = false
commit_parsers = [
{ message = "^feat", group = "Features" },
{ message = "^fix", group = "Bug Fixes" },
{ message = "^perf", group = "Performance Improvements" },
{ message = "^doc", group = "Documentation" },
{ message = "^style", group = "Styles" },
{ message = "^refactor", group = "Code Refactoring" },
{ message = "^test", group = "Tests" },
{ message = "^chore", group = "Chores" },
{ message = "^revert", group = "Reverts" },
]
filter_commits = false
tag_pattern = "v[0-9].*"
sort_tags = "newest"
25 changes: 9 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,28 @@
"docs:build-pages": "BASE=fes.js vitepress build docs",
"test": "fes test",
"lint": "eslint --ignore-pattern='templates'",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"changelog": "git-cliff -o CHANGELOG.md",
"hooks:sync": "simple-git-hooks"
},
"dependencies": {
"consola": "^3.4.2",
"conventional-changelog-cli": "^5.0.0",
"execa": "^6.1.0",
"execa": "^9.6.1",
"minimist": "^1.2.6",
"picocolors": "^1.1.1",
"semver": "^7.3.6",
"tsup": "^8.5.0",
"turbo": "^2.5.6"
"turbo": "^2.9.6"
},
"devDependencies": {
"@antfu/eslint-config": "^5.2.2",
"@commitlint/cli": "^18.4.4",
"@commitlint/config-conventional": "^18.4.4",
"chokidar": "^3.5.3",
"commitizen": "^4.3.1",
"cz-conventional-changelog": "^3.3.0",
"@antfu/eslint-config": "^8.2.0",
"@commitlint/cli": "^20.5.0",
"@commitlint/config-conventional": "^20.5.0",
"chokidar": "^5.0.0",
"deepmerge": "^4.2.2",
"eslint": "^9.34.0",
"fs-extra": "^11.3.1",
"lint-staged": "^15.2.0",
"git-cliff": "^2.12.0",
"lint-staged": "^16.4.0",
"simple-git-hooks": "^2.9.0",
"typescript": "^5.9.2",
"vitepress": "1.0.0-alpha.73",
Expand All @@ -65,10 +63,5 @@
"*.{js,jsx,vue,ts}": [
"npm run lint"
]
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}
19 changes: 10 additions & 9 deletions packages/builder-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,30 @@
"dependencies": {
"@fesjs/shared": "^4.0.0-beta.0",
"@fesjs/utils": "^4.0.0-beta.0",
"@rollup/pluginutils": "^5.1.0",
"@vitejs/plugin-basic-ssl": "^2.1.0",
"@vitejs/plugin-legacy": "^7.2.1",
"@vitejs/plugin-vue": "^6.0.1",
"@vitejs/plugin-vue-jsx": "^5.1.1",
"@vitejs/plugin-basic-ssl": "^2.3.0",
"@vitejs/plugin-legacy": "^8.0.1",
"@vitejs/plugin-vue": "^6.0.6",
"@vitejs/plugin-vue-jsx": "^5.1.5",
"autoprefixer": "^10.4.21",
"colorette": "^2.0.16",
"connect-history-api-fallback": "^2.0.0",
"consola": "^3.4.2",
"dotenv": "^16.0.0",
"dotenv-expand": "^8.0.2",
"ejs": "^3.1.6",
"ejs": "^5.0.2",
"fast-glob": "^3.2.11",
"fs-extra": "^11.3.1",
"html-minifier-terser": "^7.2.0",
"less": "^4.2.0",
"minimatch": "^10.0.1",
"node-html-parser": "^5.3.3",
"pathe": "^0.2.0",
"pathe": "^2.0.3",
"picocolors": "^1.1.1",
"postcss-flexbugs-fixes": "^5.0.2",
"postcss-safe-parser": "^6.0.0",
"rollup-plugin-visualizer": "^6.0.3",
"terser": "^5.24.0",
"vite": "^7.1.4"
"vite": "^8.0.9",
"vite-bundle-analyzer": "^1.3.7"
},
"typings": "./types.d.ts"
}
10 changes: 0 additions & 10 deletions packages/builder-vite/src/commands/build/getBuildConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@ import postcssFlexbugsFixes from 'postcss-flexbugs-fixes';
import postcssSafeParser from 'postcss-safe-parser';
import { getInnerCommonConfig } from '../../common/getConfig';

function getEsbuildTarget(targets: any): string[] {
const result: string[] = [];
['chrome', 'edge', 'firefox', 'hermes', 'ios', 'node', 'opera', 'rhino', 'safari'].forEach((key) => {
if (targets[key]) {
result.push(`${key}${targets[key]}`);
}
});
return result;
}

export default async (api: IPluginAPI<ViteBuildConfig>): Promise<InlineConfig> => {
const { deepmerge, getTargetsAndBrowsersList } = api.utils;

Expand Down
5 changes: 3 additions & 2 deletions packages/builder-vite/src/commands/dev/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { IPluginAPI } from '@fesjs/shared';
import type { ViteDevServer } from 'vite';
import process from 'node:process';
import { createServer } from 'vite';
import pc from 'picocolors';
import getDevConfig from './getDevConfig';

interface Args {
Expand All @@ -14,7 +15,7 @@ interface Args {
export default (api: IPluginAPI) => {
const {
paths,
utils: { chalk, rimraf },
utils: { rimraf },
} = api;

let server: ViteDevServer | undefined;
Expand Down Expand Up @@ -63,7 +64,7 @@ export default (api: IPluginAPI) => {
name: 'restartServer',
fn() {
// eslint-disable-next-line no-console
console.log(chalk.gray('Try to restart dev server...'));
console.log(pc.gray('Try to restart dev server...'));
destroy();
if (typeof process !== 'undefined' && process.send) {
process.send({
Expand Down
12 changes: 6 additions & 6 deletions packages/builder-vite/src/common/vite-plugin-html.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { ConfigEnv, Plugin, ResolvedConfig, ViteDevServer } from 'vite';
import process from 'node:process';
import { createFilter } from '@rollup/pluginutils';
import { dim } from 'colorette';
import consola from 'consola';
import dotenv from 'dotenv';
import { expand } from 'dotenv-expand';
import { render } from 'ejs';
import ejs from 'ejs';
import fg from 'fast-glob';
import fse from 'fs-extra';
import { minify } from 'html-minifier-terser';
import { minimatch } from 'minimatch';
import { parse } from 'node-html-parser';
import path, { dirname, join } from 'pathe';
import { normalizePath } from 'vite';
Expand Down Expand Up @@ -119,7 +119,7 @@ function createPlugin(userOptions: UserOptions = {}): Plugin {
if (input) {
return {
build: {
rollupOptions: {
rolldownOptions: {
input,
},
},
Expand Down Expand Up @@ -271,7 +271,7 @@ async function renderHtml(html: string, config: any): Promise<string> {
...(env || {}),
...data,
};
let result = await render(html, ejsData, ejsOptions);
let result = await ejs.render(html, ejsData, ejsOptions);
if (entry) {
result = removeEntryScript(result, verbose);
result = result.replace(bodyInjectRE, `<script type="module" src="${normalizePath(`${entry}`)}"></script></body>`);
Expand All @@ -292,7 +292,7 @@ function getPage(userOptions: UserOptions, name: string, viteConfig: ResolvedCon
}

function isMpa(viteConfig: ResolvedConfig | undefined): boolean {
const input = viteConfig?.build?.rollupOptions?.input ?? undefined;
const input = viteConfig?.build?.rolldownOptions?.input ?? undefined;
return typeof input !== 'string' && Object.keys(input || {}).length > 1;
}

Expand Down Expand Up @@ -352,7 +352,7 @@ function createRewire(reg: string, page: Page, baseUrl: string, proxyUrlKeys: st
};
}

const htmlFilter = createFilter(['**/*.html']);
const htmlFilter = (id: string) => minimatch(id, '**/*.html');

function getOptions(_minify: boolean) {
return {
Expand Down
11 changes: 5 additions & 6 deletions packages/builder-vite/src/features/viteAnalyze.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { IPluginAPI } from '@fesjs/shared';
import process from 'node:process';
import { visualizer } from 'rollup-plugin-visualizer';
import { analyzer } from 'vite-bundle-analyzer';

export default (api: IPluginAPI<{ viteAnalyze: Record<string, any> }>) => {
api.describe({
Expand All @@ -16,11 +16,10 @@ export default (api: IPluginAPI<{ viteAnalyze: Record<string, any> }>) => {

api.modifyBundleConfig((memo: any) => {
memo.plugins.push(
visualizer({
filename: './.cache/visualizer/stats.html',
open: true,
gzipSize: true,
brotliSize: true,
analyzer({
analyzerMode: 'static',
fileName: './.cache/visualizer/stats',
openAnalyzer: true,
...api.config.viteAnalyze,
}),
);
Expand Down
4 changes: 3 additions & 1 deletion packages/builder-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@babel/preset-typescript": "^7.27.1",
"@fesjs/shared": "^4.0.0-beta.0",
"@fesjs/utils": "^4.0.0-beta.0",
"@vue/babel-plugin-jsx": "^1.5.0",
"@vue/babel-plugin-jsx": "^2.0.1",
"ajv": "^8.12.0",
"autoprefixer": "^10.4.14",
"babel-loader": "^10.0.0",
Expand All @@ -54,13 +54,15 @@
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.7.3",
"css-minimizer-webpack-plugin": "^5.0.0",
"es-toolkit": "^1.46.0",
"fs-extra": "^11.3.1",
"get-folder-size": "^5.0.0",
"html-webpack-plugin": "^5.5.0",
"html-webpack-tags-plugin": "^3.0.2",
"less": "^4.1.3",
"less-loader": "^11.1.0",
"mini-css-extract-plugin": "^2.9.4",
"picocolors": "^1.1.1",
"postcss": "^8.4.33",
"postcss-flexbugs-fixes": "^5.0.2",
"postcss-loader": "^7.1.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { WebpackBuildConfig } from '../../../shared';
import { chalk } from '@fesjs/utils';
import pc from 'picocolors';
import webpack from 'webpack';
import WebpackDevServer from 'webpack-dev-server';

Expand Down Expand Up @@ -68,13 +68,13 @@ export function startDevServer({ webpackConfig, host, port, proxy, https, before
const server = new WebpackDevServer(options, compiler);
if (options.host === '0.0.0.0') {
// eslint-disable-next-line no-console
console.log(chalk.green(' ➜ Local: '), chalk.cyan(`${options.server}://127.0.0.1:${options.port}`));
console.log(pc.green(' ➜ Local: '), pc.cyan(`${options.server}://127.0.0.1:${options.port}`));
// eslint-disable-next-line no-console
console.log(chalk.gray(' ➜ Network: '), chalk.gray(`${options.server}://${options.host}:${options.port}`));
console.log(pc.gray(' ➜ Network: '), pc.gray(`${options.server}://${options.host}:${options.port}`));
}
else {
// eslint-disable-next-line no-console
console.log(chalk.green(' ➜ :Local: '), chalk.cyan(`${options.server}://${options.host}:${options.port}`));
console.log(pc.green(' ➜ :Local: '), pc.cyan(`${options.server}://${options.host}:${options.port}`));
}
server.startCallback((err) => {
if (err) {
Expand Down
5 changes: 3 additions & 2 deletions packages/builder-webpack/src/plugins/commands/dev/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import path from 'node:path';
import process from 'node:process';
import { removeSync } from 'fs-extra/esm';
import getFolderSize from 'get-folder-size';
import pc from 'picocolors';
import { cleanTmpPathExceptCache, getBundleAndConfigs } from '../../common/buildDevUtils';
import connectHistoryMiddleware from './connectHistoryMiddleware';
import { startDevServer } from './devServer';
Expand All @@ -29,7 +30,7 @@ async function handleCacheClean(cwd: string) {
export default (api: IPluginAPI<WebpackBuildConfig>) => {
const {
paths,
utils: { chalk, getPort, getHostName, changePort, logger },
utils: { getPort, getHostName, changePort, logger },
} = api;

let port: number;
Expand Down Expand Up @@ -112,7 +113,7 @@ export default (api: IPluginAPI<WebpackBuildConfig>) => {
api.registerMethod({
name: 'restartServer',
fn() {
logger.info(chalk.gray('Try to restart dev server...'));
logger.info(pc.gray('Try to restart dev server...'));
destroy();
process.send?.({
type: 'RESTART',
Expand Down
19 changes: 10 additions & 9 deletions packages/builder-webpack/src/plugins/common/buildDevUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import type { WebpackBuildConfig } from '../../shared';
import { existsSync, readFileSync } from 'node:fs';
import { join, resolve } from 'node:path';
import zlib from 'node:zlib';
import { chalk, rimraf } from '@fesjs/utils';
import { rimraf } from '@fesjs/utils';
import pc from 'picocolors';
import UI from 'cliui';
import getConfig from './webpackConfig';

Expand Down Expand Up @@ -168,14 +169,14 @@ export function printFileSizes({ stats, dir }: PrintFileSizesOptions) {
}

ui.div(
`${makeRow(chalk.cyan.bold('File'), chalk.cyan.bold('Size'), chalk.cyan.bold('Gzipped'))}\n\n${orderedAssets
`${makeRow(pc.cyan(pc.bold('File')), pc.cyan(pc.bold('Size')), pc.cyan(pc.bold('Gzipped')))}\n\n${orderedAssets
.map((asset: any) =>
makeRow(
asset.name.endsWith('js')
? asset.suggested
? chalk.yellow(join(dir, asset.name))
: chalk.green(join(dir, asset.name))
: chalk.blue(join(dir, asset.name)),
? pc.yellow(join(dir, asset.name))
: pc.green(join(dir, asset.name))
: pc.blue(join(dir, asset.name)),
filesize(asset.size),
getGzippedSize(asset),
),
Expand All @@ -184,17 +185,17 @@ export function printFileSizes({ stats, dir }: PrintFileSizesOptions) {
);

// eslint-disable-next-line no-console
console.log(`${ui.toString()}\n\n ${chalk.gray('Images and other types of assets omitted.')}\n`);
console.log(`${ui.toString()}\n\n ${pc.gray('Images and other types of assets omitted.')}\n`);

if (orderedAssets?.some((asset: any) => asset.suggested)) {
// eslint-disable-next-line no-console
console.log();
// eslint-disable-next-line no-console
console.log(chalk.yellow('The bundle size is significantly larger than recommended.'));
console.log(pc.yellow('The bundle size is significantly larger than recommended.'));
// eslint-disable-next-line no-console
console.log(chalk.yellow('Consider reducing it with code splitting'));
console.log(pc.yellow('Consider reducing it with code splitting'));
// eslint-disable-next-line no-console
console.log(chalk.yellow('You can also analyze the project dependencies using ANALYZE=1'));
console.log(pc.yellow('You can also analyze the project dependencies using ANALYZE=1'));
// eslint-disable-next-line no-console
console.log();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const DEFAULT_EXCLUDE_NODE_MODULES = [
'core-js',
'echarts',
'@babel/runtime',
'lodash-es',
'es-toolkit',
'webpack-dev-server',
'ansi-html',
'html-entities',
Expand Down
Loading
Loading