Skip to content

Commit

Permalink
add a clean method and rm public from git
Browse files Browse the repository at this point in the history
  • Loading branch information
scheibo committed Nov 6, 2023
1 parent 6ea4d2d commit cf63793
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"scripts": {
"lint": "eslint src --cache --ext ts && stylelint src/**/*.css",
"fix": "eslint src --fix --ext ts && stylelint --fix src/**/*.css",
"clean": "rm -rf public build .tsbuildinfo .eslintcache",
"compile": "tsc -p .",
"build": "npm run compile && node build/static/build",
"start": "npm run build && node build/server",
Expand Down
7 changes: 6 additions & 1 deletion src/static/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ const toHTML = (file: string) =>
});

export const build = async () => {
const icons = await favicons(path.join(PUBLIC, 'favicon.svg'), {path: PUBLIC});
fs.mkdirSync(path.join(PUBLIC), {recursive: true});

const icons = await favicons(path.join(STATIC, 'favicon.svg'), {path: PUBLIC});
for (const icon of icons.images) {
if (/(yandex|startup-image)/.test(icon.name)) continue;
fs.writeFileSync(path.join(PUBLIC, icon.name), icon.contents);
Expand All @@ -64,6 +66,9 @@ export const build = async () => {
const index = fs.readFileSync(path.join(STATIC, 'index.css'), 'utf8');
fs.writeFileSync(path.join(PUBLIC, 'index.css'), css.minify(index).styles);

fs.copyFileSync(path.join(STATIC, 'favicon.svg'), path.join(PUBLIC, 'favicon.svg'));
fs.copyFileSync(path.join(STATIC, 'github.svg'), path.join(PUBLIC, 'github.svg'));

let first = true;
fs.writeFileSync(path.join(PUBLIC, 'index.html'), html.minify(template.render(LAYOUT, {
id: 'home',
Expand Down
File renamed without changes
File renamed without changes

0 comments on commit cf63793

Please sign in to comment.