GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — :bug: skip cleaning non existing dir · nullstack/nullstack@439b80f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • scripts
    • index.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎scripts/index.js‎

Copy file name to clipboardExpand all lines: scripts/index.js
+14-10Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@ function getPort(port) {
4848
return port || process.env['NULLSTACK_SERVER_PORT'] || process.env['PORT'] || 3000
4949
}
5050

51+
function clearOutput(outputPath) {
52+
if (!existsSync(outputPath)) return
53+
readdir(outputPath, (err, files) => {
54+
if (err) throw err;
55+
for (const file of files) {
56+
if (file === '.cache') continue;
57+
unlink(path.join(outputPath, file), err => {
58+
if (err) throw err;
59+
});
60+
}
61+
});
62+
}
63+
5164
async function start({ input, port, env, mode = 'spa', cold, disk }) {
5265
const environment = 'development'
5366
console.log(` 🚀️ Starting your application in ${environment} mode...`);
@@ -123,16 +136,7 @@ async function start({ input, port, env, mode = 'spa', cold, disk }) {
123136
port: process.env['NULLSTACK_SERVER_PORT']
124137
};
125138
const compiler = getCompiler({ environment, input, disk });
126-
const outputPath = compiler.compilers[0].outputPath;
127-
readdir(outputPath, (err, files) => {
128-
if (err) throw err;
129-
for (const file of files) {
130-
if (file === '.cache') continue;
131-
unlink(path.join(outputPath, file), err => {
132-
if (err) throw err;
133-
});
134-
}
135-
});
139+
clearOutput(compiler.compilers[0].outputPath)
136140
const server = new WebpackDevServer(devServerOptions, compiler);
137141
const portChecker = require('express')().listen(process.env['NULLSTACK_SERVER_PORT'], () => {
138142
portChecker.close()

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.