Skip to content

Commit

Permalink
Update build process to keep everything correctly in src
Browse files Browse the repository at this point in the history
  • Loading branch information
danthedeckie committed Mar 19, 2024
1 parent 5447870 commit 2eada64
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules/
dist/css/
dist/js/
dist/
dist/
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ format-check:

lint:
npm run lint src/

clean:
rm -rf dist/*
10 changes: 9 additions & 1 deletion esbuild.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,22 @@ const pwd = dirname(fileURLToPath(import.meta.url));
const [command, ...args] = process.argv.slice(2);

const config = {
entryPoints: ["src/js/main.js", "src/css/main.css", "src/js/debug.js"],
entryPoints: [
"src/js/main.js",
"src/css/main.css",
"src/js/debug.js",
"src/index.html",
"src/debug.html",
"src/manifest.json",
],
outdir: "dist",
// Stuff you shouldn't need to edit:
target: ["chrome58", "firefox57", "safari11", "edge19"],
bundle: true,
sourcemap: true,
outExtension: { ".js": ".js" },
logLevel: "info",
loader: { ".html": "copy", ".json": "copy" },
};

switch (command) {
Expand Down
55 changes: 55 additions & 0 deletions src/debug.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="manifest" href="manifest.json" />
<title>Fuzzy list-of-names matcher - Debugging tool</title>
<link rel="stylesheet" href="css/main.css" />
</head>
<body>
<h1>Name finder - debugging</h1>
<div class="intro">
<p>
The tools on this page are to help visualise &amp; interactively
experiment with the underlying functions used in the main
<a href="/">Fuzzy list-of-names matcher</a>.<br />
Ideally use the unit tests to drive development for real feature
building, but sometimes interactive playing with feature changes is
quicker.
</p>
</div>
<div class="entry">
<label>
normalise
<input type="text" id="normaliseInput" /><br />
<span id="normaliseOutput"></span>
</label>
<label>
makeStemmed
<input type="text" id="makeStemmedInput" /><br />
<span id="makeStemmedOutput"></span>
</label>
<label>
makeVariations
<input type="text" id="makeVariationsInput" /><br />
<span id="makeVariationsOutput"></span>
</label>
</div>
<div class="entry">
<label>
getScore
<input type="text" id="getScoreInput" /><br />
</label>
<label>
getScore search list:
<textarea id="getScoreSearchInput"></textarea>
</label>
<span id="getScoreOutput"></span>
</div>
<script src="js/debug.js"></script>
<script>
new EventSource("/esbuild").addEventListener("change", () =>
location.reload()
);
</script>
</body>
</html>
97 changes: 97 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="manifest" href="manifest.json" />
<title>Fuzzy list-of-names matcher</title>
<link rel="stylesheet" href="css/main.css" />
</head>
<body>
<h1>Name finder</h1>
<div class="intro">
<p>
Select the columns of data from your spreadsheet.<br />
(If you have 2 columns for first &amp; last names, select both columns
together)<br />
Press "Copy", and paste into the boxes here.<br />
</p>
</div>
<div class="entry">
<label>
Our names:
<textarea id="listOne"></textarea><br />
<span id="listOne-count"></span>
</label>
<label>
Where we want to find them:
<textarea id="listTwo"></textarea><br />
<span id="listTwo-count"></span>
</label>
</div>
<div class="buttons">
<button type="button" id="findMatchesButton" aria-live="polite">
Search
</button>
<br />
</div>
<table>
<thead>
<td>Original Name</td>
<td>Possible Matches</td>
<td>Score</td>
</thead>
<tbody id="matchesOutput" aria-live="polite">
<tr class="certain">
<td>Example almost certain match</td>
<td>...</td>
<td>100</td>
</tr>
<tr class="possible">
<td>Example possible match</td>
<td>
Possible match
<span class="joiner" aria-label="or" role="separator"></span>
Similarly possible match
<span class="joiner" aria-label="or" role="separator"></span>
<span class="less-likely">Less Likely match</span>
</td>
<td>33</td>
</tr>
<tr>
<td>Example probable miss</td>
<td>...</td>
<td>2.5</td>
</tr>
<tr class="nothing">
<td>Example almost certain miss</td>
<td>...</td>
<td>0</td>
</tr>
</tbody>
</table>
<div class="options">
<h2>Options</h2>
<label>
Cut-off below:
<input
id="cutoffValue"
value="3.5"
type="number"
max="99"
min="0"
placeholder="between 0 and 99"
step=".1"
/> </label
><br />
<label>
Possible match separator:
<input id="possibleMatchSeparator" value="" autocomplete="off" />
</label>
</div>
<script src="js/main.js"></script>
<script>
new EventSource("/esbuild").addEventListener("change", () =>
location.reload()
);
</script>
</body>
</html>
File renamed without changes.

0 comments on commit 2eada64

Please sign in to comment.