Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
npm
/
glsx-tracker-javascript
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
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 34231424
authored
Nov 28, 2023
by
杨明
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
npm
1 parent
81826afd
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
122 additions
and
19 deletions
.eslintrc.js
.vscode/settings.json
package-lock.json
package.json
public/index.html
rollup.config.js
src/main.ts
src/modules/request.ts
src/utils/helper.ts
.eslintrc.js
View file @
3423142
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-11-28 10:33:29
* @Date: 2023-11-28 10:33:29
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-11-28 1
0:33:38
* @LastEditTime: 2023-11-28 1
5:44:33
* @FilePath: \rollup_demo\.eslintrc.js
* @FilePath: \rollup_demo\.eslintrc.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
*/
...
@@ -11,6 +11,7 @@ module.exports = {
...
@@ -11,6 +11,7 @@ module.exports = {
env
:
{
env
:
{
node
:
true
node
:
true
},
},
parser
:
'babel-eslint'
,
parserOptions
:
{
parserOptions
:
{
ecmaVersion
:
7
,
ecmaVersion
:
7
,
sourceType
:
'module'
sourceType
:
'module'
...
...
.vscode/settings.json
0 → 100644
View file @
3423142
{
"liveServer.settings.port"
:
9529
}
package-lock.json
View file @
3423142
...
@@ -90,6 +90,12 @@
...
@@ -90,6 +90,12 @@
"picomatch"
:
"^2.2.2"
"picomatch"
:
"^2.2.2"
}
}
},
},
"@types/estree"
:
{
"version"
:
"1.0.5"
,
"resolved"
:
"https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz"
,
"integrity"
:
"sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw=="
,
"dev"
:
true
},
"@types/node"
:
{
"@types/node"
:
{
"version"
:
"20.10.0"
,
"version"
:
"20.10.0"
,
"resolved"
:
"https://registry.npmjs.org/@types/node/-/node-20.10.0.tgz"
,
"resolved"
:
"https://registry.npmjs.org/@types/node/-/node-20.10.0.tgz"
,
...
@@ -434,6 +440,15 @@
...
@@ -434,6 +440,15 @@
"integrity"
:
"sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="
,
"integrity"
:
"sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="
,
"dev"
:
true
"dev"
:
true
},
},
"is-reference"
:
{
"version"
:
"1.2.1"
,
"resolved"
:
"https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz"
,
"integrity"
:
"sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ=="
,
"dev"
:
true
,
"requires"
:
{
"@types/estree"
:
"*"
}
},
"isexe"
:
{
"isexe"
:
{
"version"
:
"2.0.0"
,
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz"
,
"resolved"
:
"https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz"
,
...
@@ -681,6 +696,27 @@
...
@@ -681,6 +696,27 @@
}
}
}
}
},
},
"rollup-plugin-commonjs"
:
{
"version"
:
"10.1.0"
,
"resolved"
:
"https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.1.0.tgz"
,
"integrity"
:
"sha512-jlXbjZSQg8EIeAAvepNwhJj++qJWNJw1Cl0YnOqKtP5Djx+fFGkp3WRh+W0ASCaFG5w1jhmzDxgu3SJuVxPF4Q=="
,
"dev"
:
true
,
"requires"
:
{
"estree-walker"
:
"^0.6.1"
,
"is-reference"
:
"^1.1.2"
,
"magic-string"
:
"^0.25.2"
,
"resolve"
:
"^1.11.0"
,
"rollup-pluginutils"
:
"^2.8.1"
},
"dependencies"
:
{
"estree-walker"
:
{
"version"
:
"0.6.1"
,
"resolved"
:
"https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz"
,
"integrity"
:
"sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w=="
,
"dev"
:
true
}
}
},
"rollup-plugin-livereload"
:
{
"rollup-plugin-livereload"
:
{
"version"
:
"2.0.5"
,
"version"
:
"2.0.5"
,
"resolved"
:
"https://registry.npmjs.org/rollup-plugin-livereload/-/rollup-plugin-livereload-2.0.5.tgz"
,
"resolved"
:
"https://registry.npmjs.org/rollup-plugin-livereload/-/rollup-plugin-livereload-2.0.5.tgz"
,
...
@@ -918,4 +954,4 @@
...
@@ -918,4 +954,4 @@
"dev"
:
true
"dev"
:
true
}
}
}
}
}
}
\ No newline at end of file
\ No newline at end of file
package.json
View file @
3423142
...
@@ -2,24 +2,26 @@
...
@@ -2,24 +2,26 @@
"name"
:
"glsx-tracker-javascript"
,
"name"
:
"glsx-tracker-javascript"
,
"version"
:
"1.0.0"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"description"
:
""
,
"main"
:
"index.js"
,
"main"
:
"dist/glsx-tracker-javascript.cjs.js"
,
"module"
:
"dist/glsx-tracker-javascript.es.js"
,
"scripts"
:
{
"scripts"
:
{
"
test"
:
"echo
\"
Error: no test specified
\"
&& exit 1
"
,
"
dev"
:
"rollup -c -w
"
,
"
dev"
:
"cross-env NODE_ENV=development rollup -c -w
"
,
"
build"
:
" rollup -c
"
,
"
build"
:
"cross-env NODE_ENV=produaction rollup -c
"
"
release"
:
"rollup -c && npm publish
"
},
},
"keywords"
:
[],
"keywords"
:
[],
"author"
:
""
,
"author"
:
""
,
"license"
:
"ISC"
,
"license"
:
"ISC"
,
"devDependencies"
:
{
"devDependencies"
:
{
"cross-env"
:
"^7.0.3"
,
"cross-env"
:
"^7.0.3"
,
"rollup"
:
"^2.10.9"
,
"rollup-plugin-commonjs"
:
"^10.1.0"
,
"rollup-plugin-livereload"
:
"^2.0.5"
,
"rollup-plugin-livereload"
:
"^2.0.5"
,
"rollup-plugin-node-resolve"
:
"^5.2.0"
,
"rollup-plugin-node-resolve"
:
"^5.2.0"
,
"rollup-plugin-replace"
:
"^2.2.0"
,
"rollup-plugin-replace"
:
"^2.2.0"
,
"rollup-plugin-serve"
:
"^1.1.0"
,
"rollup-plugin-serve"
:
"^1.1.0"
,
"rollup-plugin-terser"
:
"^7.0.2"
,
"rollup-plugin-terser"
:
"^7.0.2"
,
"rollup-plugin-typescript2"
:
"^0.31.2"
,
"rollup-plugin-typescript2"
:
"^0.31.2"
,
"rollup"
:
"^2.10.9"
,
"typescript"
:
"^4.9.5"
"typescript"
:
"^4.9.5"
}
}
}
}
\ No newline at end of file
\ No newline at end of file
public/index.html
View file @
3423142
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-11-24 17:29:53
* @Date: 2023-11-24 17:29:53
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-11-2
7 11:18:25
* @LastEditTime: 2023-11-2
8 16:29:42
* @FilePath: \rollup_demo\public\index.html
* @FilePath: \rollup_demo\public\index.html
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
-->
...
@@ -14,6 +14,6 @@
...
@@ -14,6 +14,6 @@
<title>
Document
</title>
<title>
Document
</title>
</head>
</head>
<body>
<body>
<script
src=
"../dist/glsx-tracker-javascript.js"
></script>
<script
src=
"../dist/glsx-tracker-javascript.
umd.
js"
></script>
</body>
</body>
</html>
</html>
rollup.config.js
View file @
3423142
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-11-24 16:44:09
* @Date: 2023-11-24 16:44:09
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-11-28 1
4:22:09
* @LastEditTime: 2023-11-28 1
6:25:44
* @FilePath: \rollup_demo\rollup.config.js
* @FilePath: \rollup_demo\rollup.config.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
*/
...
@@ -13,17 +13,24 @@ import livereload from 'rollup-plugin-livereload'
...
@@ -13,17 +13,24 @@ import livereload from 'rollup-plugin-livereload'
import
{
terser
}
from
'rollup-plugin-terser'
import
{
terser
}
from
'rollup-plugin-terser'
import
resolve
from
'rollup-plugin-node-resolve'
import
resolve
from
'rollup-plugin-node-resolve'
import
repacle
from
'rollup-plugin-replace'
import
repacle
from
'rollup-plugin-replace'
import
commonjs
from
'rollup-plugin-commonjs'
import
{
name
}
from
'./package.json'
import
{
name
}
from
'./package.json'
const
isDev
=
()
=>
{
const
isDev
=
()
=>
{
return
process
.
env
.
NODE_ENV
===
'development'
return
process
.
env
.
NODE_ENV
===
'development'
}
}
export
default
{
export
default
{
input
:
'./src/main.ts'
,
input
:
'./src/main.ts'
,
output
:
{
output
:
[
file
:
path
.
resolve
(
__dirname
,
`./dist/
${
name
}
.js`
),
{
format
:
'umd'
,
file
:
path
.
resolve
(
__dirname
,
`./dist/
${
name
}
.umd.js`
),
sourcemap
:
false
format
:
'umd'
,
},
name
},
{
file
:
path
.
resolve
(
__dirname
,
`./dist/
${
name
}
.es.js`
),
format
:
'es'
}
],
plugins
:
[
plugins
:
[
ts
(),
ts
(),
...
@@ -36,6 +43,7 @@ export default {
...
@@ -36,6 +43,7 @@ export default {
'process.env.NODE_ENV'
:
JSON
.
stringify
(
process
.
env
.
NODE_ENV
)
'process.env.NODE_ENV'
:
JSON
.
stringify
(
process
.
env
.
NODE_ENV
)
}),
}),
resolve
([
'.js'
,
'.ts'
]),
resolve
([
'.js'
,
'.ts'
]),
commonjs
(),
isDev
()
&&
livereload
(),
isDev
()
&&
livereload
(),
isDev
()
&&
isDev
()
&&
serve
({
serve
({
...
...
src/main.ts
View file @
3423142
...
@@ -2,11 +2,16 @@
...
@@ -2,11 +2,16 @@
* @Author: yangming yangming@didihu.com.cn
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-11-24 17:28:02
* @Date: 2023-11-24 17:28:02
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-11-28 1
4:14:11
* @LastEditTime: 2023-11-28 1
6:09:44
* @FilePath: \rollup_demo\src\main.ts
* @FilePath: \rollup_demo\src\main.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
*/
import
Request
from
'./modules/request'
import
Request
from
'./modules/request'
const
request
=
new
Request
(
'https://www.xxx.com'
,
'ajax'
)
const
request
=
new
Request
(
'https://www.xxx.com'
,
'ajax'
)
console
.
log
(
request
.
url
)
class
Tracker
{
init
()
{
console
.
log
(
'init'
)
}
}
export
default
Tracker
src/modules/request.ts
View file @
3423142
...
@@ -2,11 +2,12 @@
...
@@ -2,11 +2,12 @@
* @Author: yangming yangming@didihu.com.cn
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-11-27 11:13:22
* @Date: 2023-11-27 11:13:22
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-11-28 1
0:15:18
* @LastEditTime: 2023-11-28 1
5:25:36
* @FilePath: \rollup_demo\src\modules\request.ts
* @FilePath: \rollup_demo\src\modules\request.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
*/
import
{
requestType
}
from
'request'
import
{
requestType
}
from
'request'
import
utils
from
'../utils/helper'
class
Request
{
class
Request
{
public
url
:
string
public
url
:
string
public
method
:
requestType
public
method
:
requestType
...
@@ -15,4 +16,5 @@ class Request {
...
@@ -15,4 +16,5 @@ class Request {
this
.
method
=
method
this
.
method
=
method
}
}
}
}
console
.
log
(
utils
.
dateFormat
(
new
Date
()))
export
default
Request
export
default
Request
src/utils/helper.ts
View file @
3423142
/*
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-11-28 14:20:48
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-11-28 15:25:20
* @FilePath: \glsx-tracker-javascript\src\utils\helper.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
export
default
{
dateFormat
(
timestamp
:
number
|
string
|
Date
,
format
=
'YYYY-MM-DD HH:mm:ss'
):
string
{
var
date
=
new
Date
(
timestamp
)
function
fixedTwo
(
value
:
number
):
string
{
return
value
<
10
?
'0'
+
value
:
String
(
value
)
}
var
showTime
=
format
if
(
showTime
.
includes
(
'SSS'
))
{
const
S
=
date
.
getMilliseconds
()
showTime
=
showTime
.
replace
(
'SSS'
,
'0'
.
repeat
(
3
-
String
(
S
).
length
)
+
S
)
}
if
(
showTime
.
includes
(
'YY'
))
{
const
Y
=
date
.
getFullYear
()
showTime
=
showTime
.
includes
(
'YYYY'
)
?
showTime
.
replace
(
'YYYY'
,
String
(
Y
))
:
showTime
.
replace
(
'YY'
,
String
(
Y
).
slice
(
2
,
4
))
}
if
(
showTime
.
includes
(
'M'
))
{
const
M
=
date
.
getMonth
()
+
1
showTime
=
showTime
.
includes
(
'MM'
)
?
showTime
.
replace
(
'MM'
,
fixedTwo
(
M
))
:
showTime
.
replace
(
'M'
,
String
(
M
))
}
if
(
showTime
.
includes
(
'D'
))
{
const
D
=
date
.
getDate
()
showTime
=
showTime
.
includes
(
'DD'
)
?
showTime
.
replace
(
'DD'
,
fixedTwo
(
D
))
:
showTime
.
replace
(
'D'
,
String
(
D
))
}
if
(
showTime
.
includes
(
'H'
))
{
const
H
=
date
.
getHours
()
showTime
=
showTime
.
includes
(
'HH'
)
?
showTime
.
replace
(
'HH'
,
fixedTwo
(
H
))
:
showTime
.
replace
(
'H'
,
String
(
H
))
}
if
(
showTime
.
includes
(
'm'
))
{
var
m
=
date
.
getMinutes
()
showTime
=
showTime
.
includes
(
'mm'
)
?
showTime
.
replace
(
'mm'
,
fixedTwo
(
m
))
:
showTime
.
replace
(
'm'
,
String
(
m
))
}
if
(
showTime
.
includes
(
's'
))
{
var
s
=
date
.
getSeconds
()
showTime
=
showTime
.
includes
(
'ss'
)
?
showTime
.
replace
(
'ss'
,
fixedTwo
(
s
))
:
showTime
.
replace
(
's'
,
String
(
s
))
}
return
showTime
}
}
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