add prettier

This commit is contained in:
Harvey committed 2021-11-29 18:20:13 +08:00
1 parent f4fbd3e6c2
commit 4466e42e19
5 files changed
+1873 -1896

No files matched your search

+2 -1
View File
@@ -11,7 +11,7 @@
"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: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",
"sizereport": "npx sizereport --config"
},
@@ -67,6 +67,7 @@
"node-html-parser": "^5.1.0",
"node-sass": "^6.0.1",
"postcss": "^8.3.11",
"prettier": "^2.5.0",
"rollup": "^2.60.1",
"rollup-plugin-eslint": "^7.0.0",
"rollup-plugin-postcss": "^4.0.2",
+4 -2
View File
@@ -2,6 +2,7 @@ const fs = require('fs');
const path = require('path');
const glob = require('glob');
const { parse } = require('node-html-parser');
const prettier = require('prettier');
const htmls = glob
.sync(path.join(process.cwd(), 'docs/document/zh-cn/**/*.html'))
@@ -24,7 +25,7 @@ const htmls = glob
.flat(Infinity)
.filter((item) => item.trim().startsWith('var art'))
.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 = `
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
View File
File diff suppressed because it is too large. Load diff
+2
View File
@@ -38,8 +38,10 @@
</script>
<script src="../dist/artplayer.js"></script>
<script src="../dist/artplayer-plugin-danmuku.js"></script>
<script src="./constructor.test.js"></script>
<script src="./option.test.js"></script>
<script src="./document.test.js"></script>
<script>
mocha.checkLeaks();
mocha.run();
-34
View File
@@ -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>