Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: StoneyDSP <nathanjhood@googlemail.com>
  • Loading branch information
nathanjhood committed Oct 16, 2024
1 parent 6563839 commit 65dd6ae
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ HOST=127.0.0.1
PORT=3000
HTTPS=false
WDS_SOCKET_HOST=window.location.hostname
WDS_SOCKET_PATH=/ws
WDS_SOCKET_PATH=/esbuild
WDS_SOCKET_PORT=window.location.port
FAST_REFRESH=false
VERBOSE=false
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="icon" href="%PUBLIC_URL%favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Web site created using https://github.com/nathanjhood/web-components" />
<meta name="description" content="Web site created using https://github.com/nathanjhood/ts-web-components" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%static/png/logo192.png" />
<link rel="manifest" href="%PUBLIC_URL%.webmanifest" />
<meta name="referrer" content="no-referrer" />
Expand Down
19 changes: 11 additions & 8 deletions scripts/build.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import type Http = require('node:http');
import http = require('node:http');
import fs = require('node:fs');
import url = require('node:url');
import util = require('node:util');
import path = require('node:path');
import browsersList = require('browserslist');
import esbuild = require('esbuild');
import getClientEnv = require('./utils/getClientEnv');
import normalizePort = require('./utils/normalizePort');
import getPaths = require('./utils/getPaths');
import copyPublicFolder = require('./utils/copyPublicFolder');
import buildHtml = require('./utils/buildHtml');
Expand All @@ -34,9 +29,6 @@ if (require.main === module) {
];
const shouldUseSourceMap = proc.env.GENERATE_SOURCEMAP !== 'false';
const useTypeScript: boolean = fs.existsSync(paths.projectTsConfig);
const wdsSocketPath = proc.env['WDS_SOCKET_PATH'] || '/esbuild';
const wdsSocketHost =
proc.env['WDS_SOCKET_HOST'] || 'window.location.hostname';
copyPublicFolder({
appBuild: paths.projectBuild,
appHtml: paths.projectHtml,
Expand Down Expand Up @@ -136,6 +128,17 @@ if (require.main === module) {
appHtml: paths.projectHtml,
appBuild: paths.projectBuild,
});
const errorMessages = await esbuild.formatMessages(buildResult.errors, {
kind: 'error',
});
const warningMessages = await esbuild.formatMessages(
buildResult.warnings,
{ kind: 'warning' }
);
errorMessages.forEach((errorMessage) => console.error(errorMessage));
warningMessages.forEach((warningMessage) =>
console.warn(warningMessage)
);
return buildResult;
})
.catch((error) => {
Expand Down
13 changes: 7 additions & 6 deletions scripts/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const serve = async (
proc.on('SIGTERM', handleSigterm);
proc.on('SIGINT', handleSigint);

const warnings: Error[] = [];
// const warnings: Error[] = [];
const errors: Error[] = [];

if (proc.env['NODE_ENV'] === undefined) {
Expand Down Expand Up @@ -136,6 +136,7 @@ const serve = async (
/**
* Event listener for HTTP server "error" event.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const handleServerErrorEvent = (error: any) => {
if (error.syscall !== 'listen') {
throw error;
Expand Down Expand Up @@ -227,8 +228,8 @@ if (require.main === module) {
const paths = getPaths(proc);
const isEnvDevelopment: boolean = proc.env['NODE_ENV'] === 'development';
const isEnvProduction: boolean = proc.env['NODE_ENV'] === 'production';
const isEnvProductionProfile =
isEnvProduction && proc.argv.includes('--profile');
// const isEnvProductionProfile =
// isEnvProduction && proc.argv.includes('--profile');
const supportedTargets = [
'chrome',
'deno',
Expand All @@ -244,9 +245,9 @@ if (require.main === module) {
];
const shouldUseSourceMap = proc.env.GENERATE_SOURCEMAP !== 'false';
const useTypeScript: boolean = fs.existsSync(paths.projectTsConfig);
const wdsSocketPath = proc.env['WDS_SOCKET_PATH'] || '/esbuild';
const wdsSocketHost =
proc.env['WDS_SOCKET_HOST'] || 'window.location.hostname';
// const wdsSocketPath = proc.env['WDS_SOCKET_PATH'] || '/esbuild';
// const wdsSocketHost =
// proc.env['WDS_SOCKET_HOST'] || 'window.location.hostname';
copyPublicFolder({
appBuild: paths.projectBuild,
appHtml: paths.projectHtml,
Expand Down

0 comments on commit 65dd6ae

Please sign in to comment.