Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wfs_export
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yexing
wfs_export
Commits
41122a67
Commit
41122a67
authored
Dec 24, 2025
by
yexing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
打包测试
parent
744cab38
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
43 deletions
+41
-43
plugin/package.json
+1
-1
plugin/rollup.config.js
+32
-34
plugin/src/main.js
+8
-8
No files found.
plugin/package.json
View file @
41122a67
...
...
@@ -2,7 +2,7 @@
"type"
:
"module"
,
"scripts"
:
{
"build"
:
"rollup -c && chrome.exe --pack-extension=%cd%/dist --pack-extension-key=%cd%/dist.pem"
,
"build:test"
:
"set NODE_ENV=TEST && rollup -c
&& chrome.exe --pack-extension=%cd%/dist --pack-extension-key=%cd%/dist.test.pem
"
,
"build:test"
:
"set NODE_ENV=TEST && rollup -c"
,
"lint"
:
"eslint src/**/*.js"
},
"devDependencies"
:
{
...
...
plugin/rollup.config.js
View file @
41122a67
...
...
@@ -15,26 +15,14 @@ const changeVersion = () => {
}
const
changeManifest
=
(
others
=
{})
=>
{
let
manifest
=
JSON
.
parse
(
fs
.
readFileSync
(
"manifest.json"
,
{
encoding
:
"utf8"
}));
manifest
=
{
...
manifest
,
version
:
changeVersion
(),
...
others
}
manifest
=
{
...
manifest
,
version
:
changeVersion
(),
...
others
}
fs
.
writeFileSync
(
"dist/manifest.json"
,
JSON
.
stringify
(
manifest
));
}
const
inputs
=
[
"src/main.js"
,
"src/popup.js"
,
"src/background.js"
];
const
conf
=
[];
const
nodeEnv
=
process
.
env
.
NODE_ENV
?.
trim
()
||
'DEV'
;
console
.
log
(
`NODE_ENV:
${
nodeEnv
}
`
);
nodeEnv
==
'TEST'
?
changeManifest
({
name
:
'Test'
})
:
changeManifest
();
inputs
.
forEach
(
input
=>
{
const
fn
=
Path
.
parse
(
input
).
name
;
if
(
process
.
env
.
NODE_ENV
==
'PROD'
)
{
conf
.
push
({
input
,
output
:
{
file
:
`dist/js/
${
fn
}
.min.js`
,
format
:
"umd"
,
name
:
"G"
,
sourcemap
:
true
},
plugins
:
[
const
pack
=
(
input
,
options
=
{})
=>
{
const
fn
=
Path
.
parse
(
input
);
const
{
isProd
=
false
,
outDir
=
"dist/js/"
}
=
options
;
fs
.
mkdirSync
(
outDir
,
{
recursive
:
true
});
const
plugins
=
[
nodeResolve
({
browser
:
true
,
}),
...
...
@@ -42,26 +30,36 @@ inputs.forEach(input => {
include
:
/node_modules/
,
requireReturnsDefault
:
"auto"
,
}),
]
const
output
=
{
file
:
Path
.
join
(
outDir
,
fn
.
base
),
format
:
"iife"
,
name
:
"G"
,
}
if
(
isProd
)
{
output
.
file
=
Path
.
join
(
outDir
,
`
${
fn
.
name
}
.min.js`
);
output
.
sourcemap
=
true
;
plugins
.
push
(
babel
({
babelHelpers
:
"bundled"
,
}),
terser
()
]
});
);
}
conf
.
push
(
{
return
{
input
,
output
:
{
file
:
`dist/js/
${
fn
}
.js`
,
format
:
"iife"
,
name
:
"G"
,
},
plugins
:
[
nodeResolve
({
browser
:
true
,
}),
commonjs
(),
]
});
});
output
,
plugins
}
}
const
conf
=
[];
const
nodeEnv
=
process
.
env
.
NODE_ENV
?.
trim
()
||
'DEV'
;
console
.
log
(
`NODE_ENV:
${
nodeEnv
}
`
);
if
(
nodeEnv
==
'TEST'
)
{
conf
.
push
(
pack
(
"test/main.js"
,
{
outDir
:
"test/js"
}))
}
else
{
changeManifest
();
const
inputs
=
[
"src/main.js"
,
"src/popup.js"
,
"src/background.js"
];
inputs
.
forEach
(
input
=>
conf
.
push
(
pack
(
input
,
{
isProd
:
nodeEnv
==
'PROD'
})));
}
export
default
conf
;
plugin/src/main.js
View file @
41122a67
import
{
sleep
,
xpath
,
createZip
,
fmt0
}
from
"./util.js"
;
import
{
sleep
,
xpath
,
createZip
,
fmt0
,
downloadFile
}
from
"./util.js"
;
import
{
addLog
}
from
"./timezone.js"
;
import
{
createTasks
}
from
"./base.js"
;
import
{
Task
}
from
"./task.js"
;
...
...
@@ -16,15 +16,13 @@ async function webJump() {
).
click
();
}
};
async
function
run
(
options
=
{})
{
const
{
uri
,
plan
,
sn
}
=
options
;
export
async
function
run
(
options
=
{})
{
const
{
uri
,
plan
,
sn
,
isDownload
=
false
}
=
options
;
plan
.
period
||=
[
fmt0
(
new
Date
(),
-
10
),
fmt0
(
new
Date
(),
-
1
)];
const
[
fromDate
,
toDate
]
=
plan
.
period
;
const
[
key
,
{
name
}]
=
Object
.
entries
(
TABLE
).
find
((
item
)
=>
item
[
1
].
uri
===
uri
);
let
tasks
=
await
createTasks
(
uri
,
fromDate
,
toDate
);
tasks
=
sn
?
[
tasks
.
at
(
sn
)]
:
tasks
;
// 在季度周期过滤掉月度任务
// tasks = tasks.filter((x)=>!x.isMonthly);
let
moment
=
2000
,
idx
=
0
,
len
=
tasks
.
length
;
const
allData
=
[],
allFn
=
[],
zipFn
=
`
${
Task
.
partnerId
}
#
${
key
}
#
${
fromDate
}
_
${
toDate
}
.zip`
;
for
(
const
task
of
tasks
)
{
...
...
@@ -48,13 +46,14 @@ async function run(options = {}) {
delete
data
.
__route
;
const
headers
=
{
'Content-Type'
:
'application/json'
}
await
uploadFile
(
fn
,
data
,
{
isJson
,
headers
,
route
});
// const blob = new Blob([data], { "type": "application/json" });
// downloadFile(fn, blob);
if
(
isDownload
)
{
const
blob
=
new
Blob
([
data
],
{
"type"
:
"application/json"
});
downloadFile
(
fn
,
blob
);
}
}
else
{
fn
=
fn
.
replace
(
/
\.\w
+$/g
,
".zip"
);
allData
.
push
(
data
);
allFn
.
push
(
fn
);
// downloadFile(fn, data);
}
console
.
log
(
`
${
pf
}
end:
${
fn
}
`
);
await
sleep
(
moment
);
...
...
@@ -64,6 +63,7 @@ async function run(options = {}) {
const
form
=
new
FormData
();
form
.
append
(
"zipfile"
,
zip
,
zipFn
);
await
uploadFile
(
zipFn
,
form
);
isDownload
&&
downloadFile
(
zipFn
,
zip
);
}
addLog
(
`
${
name
}
运行完成`
);
}
...
...
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