mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 08:01:20 -08:00
add prettier
This commit is contained in:
1 parent
f4fbd3e6c2
commit
4466e42e19
5 files changed
+1873
-1896
No files matched your search
+2
-1
@@ -11,7 +11,7 @@
|
|||||||
"start": "npx cross-env NODE_ENV=development npx servor docs index.html 8081 5000",
|
"start": "npx cross-env NODE_ENV=development npx servor docs index.html 8081 5000",
|
||||||
"build": "npx cross-env NODE_ENV=production node ./scripts/build.js",
|
"build": "npx cross-env NODE_ENV=production node ./scripts/build.js",
|
||||||
"build:all": "npm run build all && git add . && git commit -m \"build all packages\" -n",
|
"build:all": "npm run build all && git add . && git commit -m \"build all packages\" -n",
|
||||||
"test": "npx cross-env NODE_ENV=test mocha-chrome ./test/index2.html --mocha '{\"ui\":\"bdd\"}'",
|
"test": "npx cross-env NODE_ENV=test mocha-chrome ./test/index.html --mocha '{\"ui\":\"bdd\"}'",
|
||||||
"lint": "npx eslint packages/*/src",
|
"lint": "npx eslint packages/*/src",
|
||||||
"sizereport": "npx sizereport --config"
|
"sizereport": "npx sizereport --config"
|
||||||
},
|
},
|
||||||
@@ -67,6 +67,7 @@
|
|||||||
"node-html-parser": "^5.1.0",
|
"node-html-parser": "^5.1.0",
|
||||||
"node-sass": "^6.0.1",
|
"node-sass": "^6.0.1",
|
||||||
"postcss": "^8.3.11",
|
"postcss": "^8.3.11",
|
||||||
|
"prettier": "^2.5.0",
|
||||||
"rollup": "^2.60.1",
|
"rollup": "^2.60.1",
|
||||||
"rollup-plugin-eslint": "^7.0.0",
|
"rollup-plugin-eslint": "^7.0.0",
|
||||||
"rollup-plugin-postcss": "^4.0.2",
|
"rollup-plugin-postcss": "^4.0.2",
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const glob = require('glob');
|
const glob = require('glob');
|
||||||
const { parse } = require('node-html-parser');
|
const { parse } = require('node-html-parser');
|
||||||
|
const prettier = require('prettier');
|
||||||
|
|
||||||
const htmls = glob
|
const htmls = glob
|
||||||
.sync(path.join(process.cwd(), 'docs/document/zh-cn/**/*.html'))
|
.sync(path.join(process.cwd(), 'docs/document/zh-cn/**/*.html'))
|
||||||
@@ -24,7 +25,7 @@ const htmls = glob
|
|||||||
.flat(Infinity)
|
.flat(Infinity)
|
||||||
.filter((item) => item.trim().startsWith('var art'))
|
.filter((item) => item.trim().startsWith('var art'))
|
||||||
.map((item) => item.replace(/\/assets/g, 'https://artplayer.org/assets'))
|
.map((item) => item.replace(/\/assets/g, 'https://artplayer.org/assets'))
|
||||||
.map((item) => item.replace(/\s{3}/g, '\n '));
|
.map((item) => item.replace(/\s{3}/g, '\n '));
|
||||||
|
|
||||||
const tests = `
|
const tests = `
|
||||||
describe('Document', function() {
|
describe('Document', function() {
|
||||||
@@ -47,4 +48,5 @@ describe('Document', function() {
|
|||||||
});
|
});
|
||||||
`;
|
`;
|
||||||
|
|
||||||
fs.writeFileSync(path.join(process.cwd(), 'test/document.test.js'), tests);
|
const format = prettier.format(tests, { semi: true, parser: 'babel' });
|
||||||
|
fs.writeFileSync(path.join(process.cwd(), 'test/document.test.js'), format);
|
||||||
+1865
-1859
File diff suppressed because it is too large.
Load diff
@@ -38,8 +38,10 @@
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script src="../dist/artplayer.js"></script>
|
<script src="../dist/artplayer.js"></script>
|
||||||
|
<script src="../dist/artplayer-plugin-danmuku.js"></script>
|
||||||
<script src="./constructor.test.js"></script>
|
<script src="./constructor.test.js"></script>
|
||||||
<script src="./option.test.js"></script>
|
<script src="./option.test.js"></script>
|
||||||
|
<script src="./document.test.js"></script>
|
||||||
<script>
|
<script>
|
||||||
mocha.checkLeaks();
|
mocha.checkLeaks();
|
||||||
mocha.run();
|
mocha.run();
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
<html>
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<title>Mocha Tests</title>
|
|
||||||
<link href="https://unpkg.com/mocha@5.2.0/mocha.css" rel="stylesheet" />
|
|
||||||
<style>
|
|
||||||
.artplayer-app {
|
|
||||||
width: 400px;
|
|
||||||
height: 300px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div class="artplayer-app"></div>
|
|
||||||
<div id="mocha"></div>
|
|
||||||
<script src="https://unpkg.com/chai/chai.js"></script>
|
|
||||||
<script src="https://unpkg.com/mocha@5.2.0/mocha.js"></script>
|
|
||||||
<script>
|
|
||||||
window.mocha.setup('bdd');
|
|
||||||
window.expect = window.chai.expect;
|
|
||||||
|
|
||||||
</script>
|
|
||||||
<script src="../dist/artplayer.js"></script>
|
|
||||||
<script src="../dist/artplayer-plugin-danmuku.js"></script>
|
|
||||||
<script src="./document.test.js"></script>
|
|
||||||
<script>
|
|
||||||
mocha.checkLeaks();
|
|
||||||
mocha.run();
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
Reference in new issue
Block a user