Skip to content

Commit 8bb1a4c

Browse files
committed
Move to native glob
1 parent cddfb7e commit 8bb1a4c

File tree

5 files changed

+34
-60
lines changed

5 files changed

+34
-60
lines changed

eslint.config.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
import loguxConfig from '@logux/eslint-config'
22

33
/** @type {import('eslint').Linter.Config[]} */
4-
export default [{ ignores: ['dist/', 'design/'] }, ...loguxConfig]
4+
export default [
5+
{ ignores: ['dist/', 'design/'] },
6+
...loguxConfig,
7+
{
8+
rules: {
9+
'n/no-unsupported-features/node-builtins': [
10+
'error',
11+
{
12+
ignores: ['fs.globSync']
13+
}
14+
]
15+
}
16+
}
17+
]

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"dependencies": {
2222
"@types/node": "^22.7.4",
2323
"autoprefixer": "^10.4.20",
24-
"globby": "^14.0.2",
2524
"jstransformer-lowlight": "^0.1.0",
2625
"postcss": "^8.4.47",
2726
"postcss-hexrgba": "^2.1.0",

pnpm-lock.yaml

Lines changed: 0 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/build-api.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env node
2-
import { globby } from 'globby'
32
import childProcess from 'node:child_process'
4-
import { existsSync } from 'node:fs'
3+
import { existsSync, globSync } from 'node:fs'
54
import { mkdir, rm, writeFile } from 'node:fs/promises'
65
import { join } from 'node:path'
76
import { promisify } from 'node:util'
@@ -67,17 +66,14 @@ async function downloadProject(name) {
6766
}
6867

6968
async function readTypedoc() {
70-
let files = await globby('lib/*.d.ts', {
71-
absolute: true,
72-
cwd: join(PROJECTS, 'postcss')
73-
})
69+
let files = globSync(join(PROJECTS, 'postcss/lib/*.d.ts'))
7470

7571
let app = new TypeDoc.Application()
7672
app.bootstrap({
77-
entryPoints: files.flat(),
73+
entryPoints: files,
7874
tsconfig: join(PROJECTS, 'postcss', 'tsconfig.json')
7975
})
80-
app.options.setCompilerOptions(files.flat(), {
76+
app.options.setCompilerOptions(files, {
8177
esModuleInterop: true
8278
})
8379

@@ -281,7 +277,10 @@ function typeString(type) {
281277
'{ ' +
282278
decl.children
283279
.map(i => {
284-
if (i.kind === ReflectionKind.Function || i.kind === ReflectionKind.Method) {
280+
if (
281+
i.kind === ReflectionKind.Function ||
282+
i.kind === ReflectionKind.Method
283+
) {
285284
return i.name + ': ' + functionString(i)
286285
} else {
287286
return i.name + ': ' + typeString(i.type)
@@ -303,7 +302,7 @@ function typeHtml(nodes, type) {
303302
.replace(/<>/g, '')
304303
.replace(
305304
'DeclarationProps | Declaration | AtRule | Rule | Comment | AtRuleProps' +
306-
' | RuleProps | CommentProps',
305+
' | RuleProps | CommentProps',
307306
'ChildProps | ChildNode'
308307
)
309308
.replace(
@@ -458,9 +457,13 @@ function generateBody(nodes) {
458457
let children = type.children || []
459458
if (name === 'postcss' && node.kind === ReflectionKind.Namespace) {
460459
children = node.children
461-
} else if (!node.signatures?.length && !node.comment && !node.children?.length) {
462-
type = node.tryGetTargetReflection();
463-
children = type.children || [];
460+
} else if (
461+
!node.signatures?.length &&
462+
!node.comment &&
463+
!node.children?.length
464+
) {
465+
type = node.tryGetTargetReflection()
466+
children = type.children || []
464467
if (!children.length) return ''
465468
} else if (name !== 'postcss' && node.kind === ReflectionKind.Namespace) {
466469
return ''

scripts/build-docs.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env node
2-
import { globby } from 'globby'
32
import childProcess from 'node:child_process'
4-
import { existsSync } from 'node:fs'
3+
import { existsSync, globSync } from 'node:fs'
54
import { mkdir, readFile, rm, writeFile } from 'node:fs/promises'
65
import { join } from 'node:path'
76
import { promisify } from 'node:util'
@@ -13,7 +12,7 @@ import remarkRehype from 'remark-rehype'
1312
import { unified } from 'unified'
1413
import { build } from 'vite'
1514

16-
import { DIST, PROJECTS, ROOT, SRC } from './lib/dir.js'
15+
import { DIST, PROJECTS, SRC } from './lib/dir.js'
1716

1817
let exec = promisify(childProcess.exec)
1918

@@ -94,12 +93,12 @@ const IGNORE_FILES = [
9493
]
9594

9695
async function readDocs() {
97-
let files = await globby(join(PROJECTS, 'postcss/docs/**/*.md'))
96+
let files = globSync(join(PROJECTS, 'postcss/docs/**/*.md'))
9897
let docs = await Promise.all(
9998
files
10099
.filter(file => !IGNORE_FILES.includes(file))
101100
.map(async file => {
102-
let md = await readFile(join(ROOT, file))
101+
let md = await readFile(file)
103102
let tree = await unified()().use(remarkParse).parse(md)
104103
tree = await unified()
105104
.use(remarkRehype, { allowDangerousHtml: true })

0 commit comments

Comments
 (0)