Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 27ffc9e7
authored
Aug 03, 2024
by
Vben
Committed by
GitHub
Aug 03, 2024
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: compatibility of fs-extra with esm (#4017)
1 parent
bf8a5ffb
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
78 additions
and
33 deletions
.github/CODEOWNERS
.github/workflows/deploy.yml
internal/node-utils/package.json
internal/node-utils/src/fs.ts
internal/node-utils/src/index.ts
internal/node-utils/src/prettier.ts
internal/tailwind-config/src/index.ts
internal/vite-config/src/plugins/inject-app-loading/index.ts
pnpm-lock.yaml
scripts/vsh/src/code-workspace/index.ts
scripts/vsh/src/publint/index.ts
.github/CODEOWNERS
View file @
27ffc9e
# default onwer
# default onwer
* anncwb
vince292007
* anncwb
@126.com vince292007@gmail.com
# vben core onwer
# vben core onwer
/.github/ anncwb
vince292007
/.github/ anncwb
@126.com vince292007@gmail.com
/.vscode/ anncwb
vince292007
/.vscode/ anncwb
@126.com vince292007@gmail.com
/packages/ anncwb
vince292007
/packages/ anncwb
@126.com vince292007@gmail.com
/packages/@core/ anncwb
vince292007
/packages/@core/ anncwb
@126.com vince292007@gmail.com
/internal/ anncwb
vince292007
/internal/ anncwb
@126.com vince292007@gmail.com
/scripts/ anncwb
vince292007
/scripts/ anncwb
@126.com vince292007@gmail.com
# vben team onwer
# vben team onwer
apps/ @vbenjs/team-v5
apps/
anncwb@126.com vince292007@gmail.com
@vbenjs/team-v5
docs/ @vbenjs/team-v5
docs/
anncwb@126.com vince292007@gmail.com
@vbenjs/team-v5
.github/workflows/deploy.yml
View file @
27ffc9e
...
@@ -26,6 +26,12 @@ jobs:
...
@@ -26,6 +26,12 @@ jobs:
sed -i "s#VITE_COMPRESS\s*=.*#VITE_COMPRESS = gzip#g" ./apps/web-antd/.env.production
sed -i "s#VITE_COMPRESS\s*=.*#VITE_COMPRESS = gzip#g" ./apps/web-antd/.env.production
sed -i "s#VITE_PWA\s*=.*#VITE_PWA = true#g" ./apps/web-antd/.env.production
sed -i "s#VITE_PWA\s*=.*#VITE_PWA = true#g" ./apps/web-antd/.env.production
cat ./apps/web-antd/.env.production
cat ./apps/web-antd/.env.production
sed -i "s#VITE_COMPRESS\s*=.*#VITE_COMPRESS = gzip#g" ./apps/web-ele/.env.production
sed -i "s#VITE_PWA\s*=.*#VITE_PWA = true#g" ./apps/web-ele/.env.production
cat ./apps/web-ele/.env.production
sed -i "s#VITE_COMPRESS\s*=.*#VITE_COMPRESS = gzip#g" ./apps/web-naive/.env.production
sed -i "s#VITE_PWA\s*=.*#VITE_PWA = true#g" ./apps/web-naive/.env.production
cat ./apps/web-naive/.env.production
-
name
:
Install pnpm
-
name
:
Install pnpm
uses
:
pnpm/action-setup@v4
uses
:
pnpm/action-setup@v4
...
...
internal/node-utils/package.json
View file @
27ffc9e
...
@@ -35,7 +35,6 @@
...
@@ -35,7 +35,6 @@
"dayjs"
:
"^1.11.12"
,
"dayjs"
:
"^1.11.12"
,
"execa"
:
"^9.3.0"
,
"execa"
:
"^9.3.0"
,
"find-up"
:
"^7.0.0"
,
"find-up"
:
"^7.0.0"
,
"fs-extra"
:
"^11.2.0"
,
"nanoid"
:
"^5.0.7"
,
"nanoid"
:
"^5.0.7"
,
"ora"
:
"^8.0.1"
,
"ora"
:
"^8.0.1"
,
"pkg-types"
:
"^1.1.3"
,
"pkg-types"
:
"^1.1.3"
,
...
@@ -43,7 +42,6 @@
...
@@ -43,7 +42,6 @@
"rimraf"
:
"^6.0.1"
"rimraf"
:
"^6.0.1"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
"@types/chalk"
:
"^2.2.0"
,
"@types/chalk"
:
"^2.2.0"
"@types/fs-extra"
:
"^11.0.4"
}
}
}
}
internal/node-utils/src/fs.ts
0 → 100644
View file @
27ffc9e
import
{
promises
as
fs
}
from
'node:fs'
;
import
{
dirname
}
from
'node:path'
;
export
async
function
outputJSON
(
filePath
:
string
,
data
:
any
,
spaces
:
number
=
2
,
)
{
try
{
const
dir
=
dirname
(
filePath
);
await
fs
.
mkdir
(
dir
,
{
recursive
:
true
});
const
jsonData
=
JSON
.
stringify
(
data
,
null
,
spaces
);
await
fs
.
writeFile
(
filePath
,
jsonData
,
'utf8'
);
console
.
log
(
`JSON data written to
${
filePath
}
`
);
}
catch
(
error
)
{
console
.
error
(
'Error writing JSON file:'
,
error
);
throw
error
;
}
}
export
async
function
ensureFile
(
filePath
:
string
)
{
try
{
const
dir
=
dirname
(
filePath
);
await
fs
.
mkdir
(
dir
,
{
recursive
:
true
});
await
fs
.
writeFile
(
filePath
,
''
,
{
flag
:
'a'
});
// 'a' flag to append if file exists, otherwise create
console
.
log
(
`File ensured:
${
filePath
}
`
);
}
catch
(
error
)
{
console
.
error
(
'Error ensuring file:'
,
error
);
throw
error
;
}
}
export
async
function
readJSON
(
filePath
:
string
)
{
try
{
const
data
=
await
fs
.
readFile
(
filePath
,
'utf8'
);
return
JSON
.
parse
(
data
);
}
catch
(
error
)
{
console
.
error
(
'Error reading JSON file:'
,
error
);
throw
error
;
}
}
internal/node-utils/src/index.ts
View file @
27ffc9e
export
*
from
'./constants'
;
export
*
from
'./constants'
;
export
*
from
'./date'
;
export
*
from
'./date'
;
export
*
from
'./fs'
;
export
*
from
'./git'
;
export
*
from
'./git'
;
export
{
add
as
gitAdd
,
getStagedFiles
}
from
'./git'
;
export
{
add
as
gitAdd
,
getStagedFiles
}
from
'./git'
;
export
{
generatorContentHash
}
from
'./hash'
;
export
{
generatorContentHash
}
from
'./hash'
;
...
@@ -12,8 +13,9 @@ export { default as colors } from 'chalk';
...
@@ -12,8 +13,9 @@ export { default as colors } from 'chalk';
export
{
consola
}
from
'consola'
;
export
{
consola
}
from
'consola'
;
export
*
from
'execa'
;
export
*
from
'execa'
;
export
*
as
fs
from
'fs-extra'
;
export
{
nanoid
}
from
'nanoid'
;
export
{
nanoid
}
from
'nanoid'
;
export
{
type
PackageJson
,
readPackageJSON
}
from
'pkg-types'
;
export
{
default
as
fs
}
from
'node:fs/promises'
;
export
{
type
PackageJson
,
readPackageJSON
}
from
'pkg-types'
;
export
{
rimraf
}
from
'rimraf'
;
export
{
rimraf
}
from
'rimraf'
;
internal/node-utils/src/prettier.ts
View file @
27ffc9e
import
fs
from
'fs-extra'
;
import
fs
from
'node:fs/promises'
;
import
{
format
,
getFileInfo
,
resolveConfig
}
from
'prettier'
;
import
{
format
,
getFileInfo
,
resolveConfig
}
from
'prettier'
;
async
function
prettierFormat
(
filepath
:
string
)
{
async
function
prettierFormat
(
filepath
:
string
)
{
...
@@ -12,7 +13,7 @@ async function prettierFormat(filepath: string) {
...
@@ -12,7 +13,7 @@ async function prettierFormat(filepath: string) {
parser
:
fileInfo
.
inferredParser
as
any
,
parser
:
fileInfo
.
inferredParser
as
any
,
});
});
if
(
output
!==
input
)
{
if
(
output
!==
input
)
{
fs
.
writeFileSync
(
filepath
,
output
,
'utf8'
);
await
fs
.
writeFile
(
filepath
,
output
,
'utf8'
);
}
}
return
output
;
return
output
;
}
}
...
...
internal/tailwind-config/src/index.ts
View file @
27ffc9e
import
type
{
Config
}
from
'tailwindcss'
;
import
type
{
Config
}
from
'tailwindcss'
;
import
fs
from
'node:fs'
;
import
path
from
'node:path'
;
import
path
from
'node:path'
;
import
{
fs
,
getPackagesSync
}
from
'@vben/node-utils'
;
import
{
getPackagesSync
}
from
'@vben/node-utils'
;
import
{
addDynamicIconSelectors
}
from
'@iconify/tailwind'
;
import
{
addDynamicIconSelectors
}
from
'@iconify/tailwind'
;
import
typographyPlugin
from
'@tailwindcss/typography'
;
import
typographyPlugin
from
'@tailwindcss/typography'
;
...
...
internal/vite-config/src/plugins/inject-app-loading/index.ts
View file @
27ffc9e
import
fs
from
'node:fs'
;
import
{
join
}
from
'node:path'
;
import
{
join
}
from
'node:path'
;
import
{
fileURLToPath
}
from
'node:url'
;
import
{
fileURLToPath
}
from
'node:url'
;
import
{
fs
,
readPackageJSON
}
from
'@vben/node-utils'
;
import
{
readPackageJSON
}
from
'@vben/node-utils'
;
import
{
type
PluginOption
}
from
'vite'
;
import
{
type
PluginOption
}
from
'vite'
;
...
@@ -61,7 +62,7 @@ async function getLoadingRawByHtmlTemplate(loadingTemplate: string) {
...
@@ -61,7 +62,7 @@ async function getLoadingRawByHtmlTemplate(loadingTemplate: string) {
return
;
return
;
}
}
const
htmlRaw
=
await
fs
.
readFile
(
loadingPath
,
'utf8'
);
const
htmlRaw
=
fs
.
readFileSync
(
loadingPath
,
'utf8'
);
return
htmlRaw
;
return
htmlRaw
;
}
}
...
...
pnpm-lock.yaml
View file @
27ffc9e
...
@@ -491,9 +491,6 @@ importers:
...
@@ -491,9 +491,6 @@ importers:
find-up
:
find-up
:
specifier
:
^7.0.0
specifier
:
^7.0.0
version
:
7.0.0
version
:
7.0.0
fs-extra
:
specifier
:
^11.2.0
version
:
11.2.0
nanoid
:
nanoid
:
specifier
:
^5.0.7
specifier
:
^5.0.7
version
:
5.0.7
version
:
5.0.7
...
@@ -513,9 +510,6 @@ importers:
...
@@ -513,9 +510,6 @@ importers:
'
@types/chalk'
:
'
@types/chalk'
:
specifier
:
^2.2.0
specifier
:
^2.2.0
version
:
2.2.0
version
:
2.2.0
'
@types/fs-extra'
:
specifier
:
^11.0.4
version
:
11.0.4
internal/tailwind-config
:
internal/tailwind-config
:
dependencies
:
dependencies
:
...
@@ -3126,7 +3120,6 @@ packages:
...
@@ -3126,7 +3120,6 @@ packages:
'
@ls-lint/ls-lint@2.2.3'
:
'
@ls-lint/ls-lint@2.2.3'
:
resolution
:
{
integrity
:
sha512-ekM12jNm/7O2I/hsRv9HvYkRdfrHpiV1epVuI2NP+eTIcEgdIdKkKCs9KgQydu/8R5YXTov9aHdOgplmCHLupw==
}
resolution
:
{
integrity
:
sha512-ekM12jNm/7O2I/hsRv9HvYkRdfrHpiV1epVuI2NP+eTIcEgdIdKkKCs9KgQydu/8R5YXTov9aHdOgplmCHLupw==
}
cpu
:
[
x64
,
arm64
,
s390x
]
os
:
[
darwin
,
linux
,
win32
]
os
:
[
darwin
,
linux
,
win32
]
hasBin
:
true
hasBin
:
true
...
...
scripts/vsh/src/code-workspace/index.ts
View file @
27ffc9e
...
@@ -6,9 +6,9 @@ import {
...
@@ -6,9 +6,9 @@ import {
colors
,
colors
,
consola
,
consola
,
findMonorepoRoot
,
findMonorepoRoot
,
fs
,
getPackages
,
getPackages
,
gitAdd
,
gitAdd
,
outputJSON
,
prettierFormat
,
prettierFormat
,
toPosixPath
,
toPosixPath
,
}
from
'@vben/node-utils'
;
}
from
'@vben/node-utils'
;
...
@@ -38,7 +38,7 @@ async function createCodeWorkspace({
...
@@ -38,7 +38,7 @@ async function createCodeWorkspace({
const
monorepoRoot
=
findMonorepoRoot
();
const
monorepoRoot
=
findMonorepoRoot
();
const
outputPath
=
join
(
monorepoRoot
,
CODE_WORKSPACE_FILE
);
const
outputPath
=
join
(
monorepoRoot
,
CODE_WORKSPACE_FILE
);
await
fs
.
outputJSON
(
outputPath
,
{
folders
},
{
encoding
:
'utf8'
,
spaces
}
);
await
outputJSON
(
outputPath
,
{
folders
},
spaces
);
await
prettierFormat
(
outputPath
);
await
prettierFormat
(
outputPath
);
if
(
autoCommit
)
{
if
(
autoCommit
)
{
...
...
scripts/vsh/src/publint/index.ts
View file @
27ffc9e
...
@@ -6,10 +6,12 @@ import { basename, dirname, join } from 'node:path';
...
@@ -6,10 +6,12 @@ import { basename, dirname, join } from 'node:path';
import
{
import
{
colors
,
colors
,
consola
,
consola
,
ensureFile
,
findMonorepoRoot
,
findMonorepoRoot
,
fs
,
generatorContentHash
,
generatorContentHash
,
getPackages
,
getPackages
,
outputJSON
,
readJSON
,
UNICODE
,
UNICODE
,
}
from
'@vben/node-utils'
;
}
from
'@vben/node-utils'
;
...
@@ -56,8 +58,8 @@ function getCacheFile() {
...
@@ -56,8 +58,8 @@ function getCacheFile() {
async
function
readCache
(
cacheFile
:
string
)
{
async
function
readCache
(
cacheFile
:
string
)
{
try
{
try
{
await
fs
.
ensureFile
(
cacheFile
);
await
ensureFile
(
cacheFile
);
return
await
fs
.
readJSON
(
cacheFile
,
{
encoding
:
'utf8'
}
);
return
await
readJSON
(
cacheFile
);
}
catch
{
}
catch
{
return
{};
return
{};
}
}
...
@@ -73,7 +75,7 @@ async function runPublint(files: string[], { check }: PubLintCommandOptions) {
...
@@ -73,7 +75,7 @@ async function runPublint(files: string[], { check }: PubLintCommandOptions) {
const
results
=
await
Promise
.
all
(
const
results
=
await
Promise
.
all
(
lintFiles
.
map
(
async
(
file
)
=>
{
lintFiles
.
map
(
async
(
file
)
=>
{
try
{
try
{
const
pkgJson
=
await
fs
.
readJSON
(
file
);
const
pkgJson
=
await
readJSON
(
file
);
if
(
pkgJson
.
private
)
{
if
(
pkgJson
.
private
)
{
return
null
;
return
null
;
...
@@ -106,7 +108,7 @@ async function runPublint(files: string[], { check }: PubLintCommandOptions) {
...
@@ -106,7 +108,7 @@ async function runPublint(files: string[], { check }: PubLintCommandOptions) {
}),
}),
);
);
await
fs
.
outputJSON
(
cacheFile
,
cache
);
await
outputJSON
(
cacheFile
,
cache
);
printResult
(
results
,
check
);
printResult
(
results
,
check
);
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment