Skip to content

Commit

Permalink
fix: new file structure
Browse files Browse the repository at this point in the history
  • Loading branch information
nobkd committed Mar 30, 2023
1 parent 2abbf49 commit df611d8
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node_modules
web-ext-artifacts
dist
out
public/leaflet.css
public/images
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package-lock.json
*.md
dist
out
public/leaflet.css
public/images
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
"url": "git+https://github.com/nobkd/replace-maps.git"
},
"scripts": {
"leaflet": "cp ./node_modules/leaflet/dist/leaflet.css ./public/leaflet.css && cp -r ./node_modules/leaflet/dist/images ./public/images",
"leaflet": "cp node_modules/leaflet/dist/leaflet.css public/leaflet.css && cp -r node_modules/leaflet/dist/images public",
"icons": "svgexport icons/plain.svg public/icons/48.png 48:48 && svgexport icons/plain.svg public/icons/96.png 96:96",
"format": "prettier . --write",
"build": "nr leaflet && tsc && vite build",
"watch": "nr leaflet && vite build --watch --mode development --minify false",
"dev": "nr leaflet && vite",
"serve:firefox": "web-ext run -s ./dist/",
"serve:chrome": "web-ext run -t chromium -s ./dist/"
"serve:chrome": "web-ext run -t chromium -s dist",
"bundle": "web-ext build -s dist -a out"
},
"devDependencies": {
"@antfu/ni": "^0.21.2",
Expand Down
4 changes: 2 additions & 2 deletions public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"https://*/maps*?*output=embed*"
],
"background": {
"page": "background.html"
"page": "bg.html"
},
"web_accessible_resources": ["res/map.html"]
"web_accessible_resources": ["map.html"]
}
2 changes: 1 addition & 1 deletion src/background.html → src/bg.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<head>
<meta charset="UTF-8" />
<script src="background.ts" type="module"></script>
<script src="bg/bg.ts" type="module"></script>
</head>
2 changes: 1 addition & 1 deletion src/background.ts → src/bg/bg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function redirect(
): browser.WebRequest.BlockingResponse {
if (req.url.match(matcher)) {
return {
redirectUrl: browser.runtime.getURL('res/map.html?' + req.url.split('?')[1]),
redirectUrl: browser.runtime.getURL('map.html?' + req.url.split('?')[1]),
};
}
return {};
Expand Down
2 changes: 1 addition & 1 deletion src/res/map.html → src/map.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@

<body>
<div id="map"></div>
<script src="map.ts" type="module"></script>
<script src="map/map.ts" type="module"></script>
</body>
</html>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export default defineConfig({
emptyOutDir: true,
rollupOptions: {
input: {
bg: resolve(__dirname, 'src/background.html'),
map: resolve(__dirname, 'src/res/map.html'),
bg: resolve(__dirname, 'src/bg.html'),
map: resolve(__dirname, 'src/map.html'),
},
},
},
Expand Down

0 comments on commit df611d8

Please sign in to comment.