Skip to content

Commit bb939c6

Browse files
authored
refactor(build): move to internal package (element-plus#6585)
* refactor(build): move to internal package * ci: fix * chore: fix * fix: docs * chore: add fast-glob to root package * chore: fix PR comments * build: add tsx * refactor: re-organize * refactor: improve log
1 parent 2d3d09b commit bb939c6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+787
-1338
lines changed

build/.eslintrc.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

build/plugins/size-reporter.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

build/utils/log.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.

docs/.vitepress/build/.eslintrc.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/.vitepress/build/crowdin-credentials.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import path from 'path'
22
import fs from 'fs/promises'
33
import chalk from 'chalk'
4-
import { errorAndExit } from '../../../build/utils/log'
5-
import { docRoot } from '../utils/paths'
4+
import consola from 'consola'
5+
import { errorAndExit, docRoot } from '@element-plus/build'
66

77
const credentialPlaceholder = 'API_TOKEN_PLACEHOLDER'
88

@@ -12,7 +12,7 @@ if (!CREDENTIAL) {
1212
}
1313

1414
;(async () => {
15-
console.info(chalk.cyan('Fetching Crowdin credential'))
15+
consola.debug(chalk.cyan('Fetching Crowdin credential'))
1616
const configPath = path.resolve(docRoot, 'crowdin.yml')
1717
try {
1818
const file = await fs.readFile(configPath, {
@@ -22,7 +22,7 @@ if (!CREDENTIAL) {
2222
configPath,
2323
file.replace(credentialPlaceholder, CREDENTIAL)
2424
)
25-
console.info(chalk.green('Crowdin credential update successfully'))
25+
consola.success(chalk.green('Crowdin credential update successfully'))
2626
} catch (e: any) {
2727
errorAndExit(e)
2828
}

docs/.vitepress/build/crowdin-generate.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import fs from 'fs'
22
import path from 'path'
33
import chalk from 'chalk'
4-
5-
import { docRoot } from '../utils/paths'
6-
import { errorAndExit } from '../../../build/utils/log'
4+
import consola from 'consola'
5+
import { errorAndExit, docRoot } from '@element-plus/build'
76

87
// NB: this file is only for generating files that enables developers to develop the website.
98
const componentLocaleRoot = path.resolve(docRoot, '.vitepress/crowdin')
@@ -16,7 +15,7 @@ async function main() {
1615
throw new Error(exists)
1716
}
1817

19-
console.log(chalk.cyan('Starting for build doc for developing'))
18+
consola.trace(chalk.cyan('Starting for build doc for developing'))
2019
// all language should be identical since it is mirrored from crowdin.
2120
const dirs = await fs.promises.readdir(componentLocaleRoot, {
2221
withFileTypes: true,
@@ -44,7 +43,7 @@ async function main() {
4443
}
4544
})
4645

47-
console.log(languagePaths)
46+
consola.debug(languagePaths)
4847
await traverseDir(enUS, languagePaths, localeOutput)
4948
}
5049

@@ -103,7 +102,7 @@ async function traverseDir(
103102

104103
main()
105104
.then(() => {
106-
console.log(chalk.green('Locale for website development generated'))
105+
consola.success(chalk.green('Locale for website development generated'))
107106
})
108107
.catch((err) => {
109108
if (err.message === exists) {

docs/.vitepress/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import consola from 'consola'
12
import { languages } from './utils/lang'
23
import { head } from './config/head'
34
import { sidebars } from './config/sidebars'
@@ -32,8 +33,7 @@ const buildTransformers = () => {
3233
return transformers
3334
}
3435

35-
// eslint-disable-next-line no-console
36-
console.log(`DOC_ENV: ${process.env.DOC_ENV}`)
36+
consola.debug(`DOC_ENV: ${process.env.DOC_ENV}`)
3737

3838
const locales = {}
3939
languages.forEach((lang) => {

docs/.vitepress/config/.eslintrc.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/.vitepress/config/head.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs from 'fs'
22
import path from 'path'
3+
import { vpRoot } from '@element-plus/build'
34
import { languages } from '../utils/lang'
4-
import { vpRoot } from '../utils/paths'
55
import { features } from './features'
66
import type { HeadConfig } from 'vitepress'
77

docs/.vitepress/config/plugins.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import path from 'path'
22
import fs from 'fs'
33
import MarkdownIt from 'markdown-it'
44
import mdContainer from 'markdown-it-container'
5+
import { docRoot } from '@element-plus/build'
56
import { highlight } from '../utils/highlight'
6-
import { docRoot } from '../utils/paths'
77
import type Token from 'markdown-it/lib/token'
88
import type Renderer from 'markdown-it/lib/renderer'
99

0 commit comments

Comments
 (0)