add prettier

This commit is contained in:
2022-10-10 17:01:31 +02:00
parent 868b46317d
commit 63478aa887
21 changed files with 152 additions and 93 deletions

22
www/package-lock.json generated
View File

@ -18,6 +18,7 @@
"@rollup/plugin-typescript": "^8.0.0",
"@tsconfig/svelte": "^2.0.0",
"@types/three": "^0.144.0",
"prettier": "^2.7.1",
"rollup": "^2.3.4",
"rollup-plugin-css-only": "^3.1.0",
"rollup-plugin-livereload": "^2.0.0",
@ -1011,6 +1012,21 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/prettier": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz",
"integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==",
"dev": true,
"bin": {
"prettier": "bin-prettier.js"
},
"engines": {
"node": ">=10.13.0"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/queue-microtask": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
@ -2359,6 +2375,12 @@
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true
},
"prettier": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz",
"integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==",
"dev": true
},
"queue-microtask": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",

View File

@ -8,7 +8,8 @@
"build": "rollup -c",
"dev": "rollup -c -w ",
"start": "sirv public --no-clear --host",
"check": "svelte-check --tsconfig ./tsconfig.json"
"check": "svelte-check --tsconfig ./tsconfig.json",
"prettier": "prettier -w ./src"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^17.0.0",
@ -16,6 +17,7 @@
"@rollup/plugin-typescript": "^8.0.0",
"@tsconfig/svelte": "^2.0.0",
"@types/three": "^0.144.0",
"prettier": "^2.7.1",
"rollup": "^2.3.4",
"rollup-plugin-css-only": "^3.1.0",
"rollup-plugin-livereload": "^2.0.0",

View File

@ -19,14 +19,18 @@ function serve() {
return {
writeBundle() {
if (server) return;
server = require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], {
stdio: ['ignore', 'inherit', 'inherit'],
shell: true
});
server = require('child_process').spawn(
'npm',
['run', 'start', '--', '--dev'],
{
stdio: ['ignore', 'inherit', 'inherit'],
shell: true,
},
);
process.on('SIGTERM', toExit);
process.on('exit', toExit);
}
},
};
}
@ -36,15 +40,15 @@ export default {
sourcemap: true,
format: 'iife',
name: 'app',
file: 'public/build/bundle.js'
file: 'public/build/bundle.js',
},
plugins: [
svelte({
preprocess: sveltePreprocess({ sourceMap: !production }),
compilerOptions: {
// enable run-time checks when not in production
dev: !production
}
dev: !production,
},
}),
// we'll extract any component CSS out into
// a separate file - better for performance
@ -58,12 +62,12 @@ export default {
resolve({
main: true,
browser: true,
dedupe: ['svelte']
dedupe: ['svelte'],
}),
commonjs(),
typescript({
sourceMap: !production,
inlineSources: !production
inlineSources: !production,
}),
// In dev mode, call `npm run start` once
@ -76,9 +80,9 @@ export default {
// If we're building for production (npm run build
// instead of npm run dev), minify
production && terser()
production && terser(),
],
watch: {
clearScreen: false
}
clearScreen: false,
},
};

View File

@ -2,7 +2,7 @@ import App from './App.svelte';
const app = new App({
target: document.body,
props: {}
props: {},
});
export default app;

View File

@ -3,21 +3,14 @@
"compilerOptions": {
"sourceMap": false,
"paths": {
"@core": [
"../core/src"
]
"@core": ["../core/src"]
}
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules/*",
"public/*"
],
"include": ["src/**/*"],
"exclude": ["node_modules/*", "public/*"],
"references": [
{
"path": "../core"
}
]
}
}