-
Notifications
You must be signed in to change notification settings - Fork 31
/
package.json
88 lines (88 loc) · 5.71 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
{
"devDependencies": {
"@babel/core": "^7.14.5",
"@babel/plugin-transform-react-jsx": "^7.14.5",
"@babel/plugin-transform-runtime": "^7.14.5",
"@babel/plugin-transform-typescript": "^7.14.5",
"@babel/runtime": "^7.14.5",
"@parcel/babel-plugin-transform-runtime": "^2.0.1",
"@parcel/babel-preset-env": "^2.0.1",
"@parcel/transformer-sass": "^2.0.1",
"@playwright/test": "^1.12.2",
"@types/mime-types": "^2.1.0",
"@types/node": "^16.6.1",
"@types/react": "^17.0.11",
"@types/react-dom": "^17.0.7",
"@types/react-router-dom": "^5.1.7",
"babel-eslint": "^10.1.0",
"eslint": "^7.28.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"husky": "^6.0.0",
"mime-types": "^2.1.31",
"octokit": "^3.1.2",
"parcel": "^2.0.1",
"playwright": "^1.12.2",
"posthtml": "^0.16.5",
"posthtml-expressions": "^1.8.1",
"prettier": "^2.3.1",
"process": "^0.11.10",
"ts-node": "^10.0.0"
},
"dependencies": {
"i18next": "^20.4.0",
"lint-staged": "^11.0.0",
"react": "17.0.2",
"react-dom": "^17.0.2",
"react-i18next": "^11.11.4",
"react-router-dom": "^5.2.0",
"sass": "^1.34.1",
"typescript": "^4.3.2"
},
"scripts": {
"clean": "rm -rf dist .parcel-cache",
"lo_ln": "ln -sfn config/localhost.1234.json src/config/config.json",
"mirrorz_ln": "ln -sfn config/mirrorz.org.json src/config/config.json",
"cernet_ln": "ln -sfn config/mirrors.cernet.edu.cn.json src/config/config.json",
"other_ln": "ln -sfn ../config/config.json src/parser/config.json && ln -sfn ../config/config.json src/i18n/config.json",
"dev_env": "yarn lo_ln && yarn other_ln",
"mirrorz_env": "yarn mirrorz_ln && yarn other_ln",
"cernet_env": "yarn cernet_ln && yarn other_ln",
"legacy_env": "ln -sfn ../ legacy/mirrorz && ln -sfn ../src/config/config.json legacy/config.json && ln -sfn ../src/i18n legacy/i18n && ln -sfn ../static/json/legacy legacy/json-legacy",
"check_config": "node -e 'console.log(require(\"./src/config/config.json\").about.includes(process.argv[1]))'",
"debug_build": "yarn dev_env && parcel build --no-optimize --no-content-hash index.html && yarn run -s gen_ver > dist/version",
"build": "parcel build --no-source-maps index.html && yarn run -s gen_ver > dist/version",
"postbuild": "rsync -rL --exclude=.git static robots.txt CNAME dist/ && cp dist/index.html dist/404.html && cp -L src/config/config.json dist/static/json/config.json && node scripts/legacy-pack.js > dist/static/json/legacy-pack.json",
"legacy_build": "[ \"$(yarn run --silent check_config legacy)\" = \"true\" ] && cd legacy && node ./generator.js && cd ../ && cp -ar legacy/dist/_ dist/ || echo No legacy config",
"ohmymirrorz_date": "sed -i \"s/^VERSION.*/VERSION = '$(date +'%Y%m%d')'/g\" dist/oh-my-mirrorz.py",
"ohmymirrorz_ua_url": "sed -i \"s|^UA_URL.*|UA_URL = '$(node -e 'console.log(require(\"./src/config/config.json\").url)')'|g\" dist/oh-my-mirrorz.py",
"ohmymirrorz_mirrors": "sed -i \"s^mirrors = \\[\\]^mirrors = $(node -e 'console.log(JSON.stringify(require(\"./src/config/mirrors\")))')^\" dist/oh-my-mirrorz.py",
"ohmymirrorz_build": "[ \"$(yarn run --silent check_config oh-my-mirrorz)\" = \"true\" ] && cp scripts/oh-my-mirrorz/oh-my-mirrorz.py dist/ && yarn ohmymirrorz_date && yarn ohmymirrorz_ua_url && yarn ohmymirrorz_mirrors || echo No oh-my-mirrorz config",
"full_build": "yarn clean && yarn build && yarn legacy_build && yarn ohmymirrorz_build",
"half_start": "(yarn debug_build && yarn postbuild && cd dist && python3 ../scripts/gh-cors.py 1234)",
"full_start": "(yarn debug_build && yarn legacy_env && yarn legacy_build && yarn postbuild && cd dist && python3 ../scripts/gh-cors.py 1234)",
"test": "playwright test --config=tests/playwright.config.ts",
"download-snapshot-baseline": "ts-node tests/download-snapshot-baseline.ts",
"lint:fix": "eslint --fix ./src --ignore-path .gitignore",
"ver": "git log --oneline -1 --abbrev-commit",
"config_ver": "(cd src/config; git log --oneline -1 --abbrev-commit)",
"parser_ver": "(cd src/parser; git log --oneline -1 --abbrev-commit)",
"i18n_ver": "(cd src/i18n; git log --oneline -1 --abbrev-commit)",
"json_site_ver": "(cd static/json/site && git log --oneline -1 --abbrev-commit)",
"json_legacy_ver": "cat static/json/legacy/lastupdate",
"legacy_ver": "[ \"$(yarn run --silent check_config legacy)\" = \"true\" ] && (cd legacy/ ; git log --oneline -1 --abbrev-commit) || true",
"ohmymirrorz_ver": "[ \"$(yarn run --silent check_config oh-my-mirrorz)\" = \"true\" ] && (cd scripts/oh-my-mirrorz; git log --oneline -1 --abbrev-commit) || true",
"gen_ver": "echo frontend: $(yarn run -s ver); echo config: $(yarn run -s config_ver); echo parser: $(yarn run -s parser_ver); echo i18n: $(yarn run -s i18n_ver); echo json_site: $(yarn run -s json_site_ver); echo json_legacy: $(yarn run -s json_legacy_ver); echo legacy: $(yarn run -s legacy_ver); echo ohmymirrorz: $(yarn run -s ohmymirrorz_ver)",
"config_pull": "(cd src/config; git pull)",
"parser_pull": "(cd src/parser; git pull)",
"i18n_pull": "(cd src/i18n; git pull)",
"json_site_pull": "(cd static/json/site; git pull)",
"json_legacy_pull": "(cd static/json/legacy; git pull)",
"legacy_pull": "(cd legacy; git pull)",
"ohmymirrorz_pull": "[ \"$(yarn run --silent check_config oh-my-mirrorz)\" = \"true\" ] && (cd scripts/oh-my-mirrorz; git pull) || true",
"pull": "git pull; yarn config_pull; yarn parser_pull; yarn i18n_pull; yarn json_site_pull; yarn json_legacy_pull; yarn legacy_pull; yarn ohmymirrorz_pull",
"start": "parcel serve index.html"
}
}