use prettier to fmt.

This commit is contained in:
AsukaMinato 2022-06-18 06:37:06 +00:00 committed by GitHub
parent 83cf3e7091
commit 7b5350f719
4 changed files with 82 additions and 80 deletions

View File

@ -1,11 +1,11 @@
import svelte from 'rollup-plugin-svelte';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import livereload from 'rollup-plugin-livereload';
import { terser } from 'rollup-plugin-terser';
import sveltePreprocess from 'svelte-preprocess';
import typescript from '@rollup/plugin-typescript';
import css from 'rollup-plugin-css-only';
import svelte from "rollup-plugin-svelte";
import commonjs from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import livereload from "rollup-plugin-livereload";
import { terser } from "rollup-plugin-terser";
import sveltePreprocess from "svelte-preprocess";
import typescript from "@rollup/plugin-typescript";
import css from "rollup-plugin-css-only";
const production = !process.env.ROLLUP_WATCH;
@ -19,36 +19,40 @@ function serve() {
return {
writeBundle() {
if (server) return;
server = require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], {
server = require("child_process").spawn(
"npm",
["run", "start", "--", "--dev"],
{
// stdio: ['ignore', 'inherit', 'inherit'],
// shell: true
});
process.on('SIGTERM', toExit);
process.on('exit', toExit);
}
);
process.on("SIGTERM", toExit);
process.on("exit", toExit);
},
};
}
export default {
input: 'src/main.ts',
input: "src/main.ts",
output: {
sourcemap: true,
format: 'iife',
name: 'app',
file: 'public/build/bundle.js'
format: "iife",
name: "app",
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
css({ output: 'bundle.css' }),
css({ output: "bundle.css" }),
// If you have external dependencies installed from
// npm, you'll most likely need these plugins. In
@ -57,13 +61,13 @@ export default {
// https://github.com/rollup/plugins/tree/master/packages/commonjs
resolve({
browser: true,
dedupe: ['svelte']
dedupe: ["svelte"],
}),
commonjs(),
typescript({
sourceMap: true,
//sourceMap: !production,
inlineSources: !production
inlineSources: !production,
}),
// In dev mode, call `npm run start` once
@ -72,14 +76,14 @@ export default {
// Watch the `public` directory and refresh the
// browser on changes when not in production
!production && livereload('public'),
!production && livereload("public"),
// If we're building for production (npm run build
// instead of npm run dev), minify
production && terser()
production && terser(),
],
watch: {
buildDelay: 500,
clearScreen: false
}
clearScreen: false,
},
};

View File

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

View File

@ -1,8 +0,0 @@
'use strict'
export function sleep(ms) {
const p = new Promise((resolve, reject) => {
setTimeout(resolve, ms)
})
return p
}

6
src/util.ts Normal file
View File

@ -0,0 +1,6 @@
export function sleep(ms: number) {
const p = new Promise((resolve, reject) => {
setTimeout(resolve, ms);
});
return p;
}