Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
holo-web
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xinkong
holo-web
Commits
127ea07c
Commit
127ea07c
authored
Aug 10, 2023
by
ninglx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
本地引入 取消unistrong node-file-util依赖
parent
a0df6db4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
94 additions
and
6 deletions
+94
-6
package.json
build-tools/package.json
+0
-1
build.js
build-tools/tool/build.js
+1
-1
package.json
cdn/package.json
+1
-3
build.js
cdn/tool/build.js
+1
-1
node-file-util.js
cdn/tool/node-file-util.js
+91
-0
No files found.
build-tools/package.json
View file @
127ea07c
...
...
@@ -11,7 +11,6 @@
"author"
:
""
,
"license"
:
"ISC"
,
"dependencies"
:
{
"@unistrong/node-file-util"
:
"^0.1.0"
,
"chalk"
:
"^4.1.0"
,
"express"
:
"^4.17.1"
,
"http-proxy-middleware"
:
"^1.0.4"
,
...
...
build-tools/tool/build.js
View file @
127ea07c
const
shell
=
require
(
"
shelljs
"
);
const
chalk
=
require
(
"
chalk
"
);
const
systemMap
=
require
(
"
../system
"
);
const
util
=
require
(
"
@unistrong
/node-file-util
"
);
const
util
=
require
(
"
.
/node-file-util
"
);
let
system
=
process
.
argv
.
splice
(
2
);
!
system
.
length
&&
(
system
=
Object
.
keys
(
systemMap
));
...
...
cdn/package.json
View file @
127ea07c
...
...
@@ -5,7 +5,5 @@
"scripts"
:
{
"build"
:
"node ./tool/build.js"
},
"dependencies"
:
{
"@unistrong/node-file-util"
:
"^0.1.0"
}
"dependencies"
:
{}
}
cdn/tool/build.js
View file @
127ea07c
const
util
=
require
(
"
@unistrong
/node-file-util
"
);
const
util
=
require
(
"
.
/node-file-util
"
);
util
.
delete
(
"
./dist
"
);
util
.
copy
(
"
./src
"
,
"
./dist
"
);
cdn/tool/node-file-util.js
0 → 100644
View file @
127ea07c
const
fs
=
require
(
"
fs
"
);
const
path
=
require
(
"
path
"
);
module
.
exports
=
{
isExists
(
url
)
{
return
fs
.
existsSync
(
url
);
},
getDir
(
url
)
{
return
fs
.
readdirSync
(
url
);
},
isDirectory
(
url
)
{
return
fs
.
statSync
(
url
).
isDirectory
();
},
forEachFolder
(
url
,
callback
)
{
if
(
this
.
isExists
(
url
))
{
callback
(
"
folderBefore
"
,
url
);
const
files
=
this
.
getDir
(
url
);
files
.
forEach
((
file
)
=>
{
const
curUrl
=
path
.
join
(
url
,
file
);
if
(
this
.
isDirectory
(
curUrl
))
{
this
.
forEachFolder
(
curUrl
,
callback
);
}
else
{
callback
(
"
file
"
,
curUrl
,
file
);
}
});
callback
(
"
folderAfter
"
,
url
);
}
},
deleteFile
(
url
)
{
fs
.
unlinkSync
(
url
);
},
deleteFolder
(
url
)
{
fs
.
rmdirSync
(
url
);
},
deleteCatalog
(
url
)
{
this
.
forEachFolder
(
url
,
(
type
,
urlname
,
filename
)
=>
{
if
(
type
===
"
file
"
)
{
this
.
deleteFile
(
urlname
);
}
if
(
type
===
"
folderAfter
"
)
{
this
.
deleteFolder
(
urlname
);
}
});
},
delete
(
url
)
{
if
(
this
.
isExists
(
url
))
{
if
(
this
.
isDirectory
(
url
))
{
this
.
deleteCatalog
(
url
);
}
else
{
this
.
deleteFile
(
url
);
}
}
},
copyFile
(
src
,
tar
)
{
if
(
this
.
isExists
(
src
))
{
fs
.
copyFileSync
(
src
,
tar
);
}
},
copyCatalog
(
src
,
tar
)
{
if
(
this
.
isExists
(
src
))
{
if
(
!
this
.
isExists
(
tar
))
{
this
.
createFolder
(
tar
);
}
const
files
=
this
.
getDir
(
src
);
files
.
forEach
((
file
)
=>
{
const
srcUrl
=
path
.
join
(
src
,
file
);
const
tarUrl
=
path
.
join
(
tar
,
file
);
if
(
this
.
isDirectory
(
srcUrl
))
{
this
.
copyCatalog
(
srcUrl
,
tarUrl
);
}
else
{
this
.
copyFile
(
srcUrl
,
tarUrl
);
}
});
}
},
copy
(
src
,
tar
)
{
if
(
this
.
isExists
(
src
))
{
if
(
this
.
isDirectory
(
src
))
{
this
.
copyCatalog
(
src
,
tar
);
}
else
{
this
.
copyFile
(
src
,
tar
);
}
}
},
createFolder
(
url
)
{
fs
.
mkdirSync
(
url
);
},
createFile
(
url
,
data
)
{
fs
.
writeFileSync
(
url
,
data
);
},
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment