Skip to content

Commit

Permalink
Shel 1858 added linting (#294)
Browse files Browse the repository at this point in the history
* added changes for testing

* added example and changesets too

* added package json too

* added changeset file

* updated  package json

* added changes as per the comments

* added changes as per the comments

* updated html file script

* made changes as per the comments

* fix package json issues

* fix folder name

* fix folder name

* added changes to include dist folder in build

* remove unused depedencies

* updated pnpm yaml

* just for testing

* fixed linting issue

* Created changeset for build

* changfed var to let

* added fix for the vite config
  • Loading branch information
harmantevo authored Oct 11, 2024
1 parent fb4a8d1 commit 2e3d208
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 51 deletions.
5 changes: 5 additions & 0 deletions .changeset/gentle-pianos-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ticketevolution/seatmaps-client": minor
---

updated files for to improve build ptrocess
72 changes: 43 additions & 29 deletions examples/vite-build-standalone/index.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,45 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<link rel="icon" href="data:,">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700" rel="stylesheet">
</head>
<body style="margin: 0;">
<div id="map" style="height: 100vh; width: 100vw;"></div>
<script src="node_modules/@ticketevolution/seatmaps-client/dist/bundle.js"></script>
<script>
window.onload = function() {
const data = {
"ticketGroups": [
{
"tevo_section_name": "upper end zone 232",
"retail_price": 100
}
]
};
<!doctype html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="UTF-8" />
<link rel="icon" href="data:," />
<link
href="https://fonts.googleapis.com/css?family=Open+Sans:400,700"
rel="stylesheet"
/>
<title>Seatmap Example</title>
</head>
<body>
<!-- Ensure this element has the correct id -->
<div id="map"></div>

<script src="node_modules/@ticketevolution/seatmaps-client/dist/bundle.js"></script>
<!-- UMD build bundle -->
<script>
window.onload = function () {
fetch("./node_modules/@-/mock-data/data/ticket-groups-1591449.json")
.then((response) => response.json())
.then((data) => {
const options = {
venueId: "896",
configurationId: "14341",
mapFontFamily: '"Open Sans", sans-serif',
ticketGroups: data,
};

window.seatmapsInstance = new window.Tevomaps({
venueId: '896',
configurationId: '14341',
mapFontFamily: '"Open Sans", sans-serif',
ticketGroups: data.ticketGroups
}).build('map');
}
</script>
</body>
// Create a new instance of SeatmapFactory
const factory = new Tevomaps.SeatmapFactory(options);

// Ensure the element exists before calling the build method
const rootElementId = "map";
if (document.getElementById(rootElementId)) {
factory.build(rootElementId);
} else {
console.error(`Element with id '${rootElementId}' not found.`);
}
});
};
</script>
</body>
</html>
1 change: 1 addition & 0 deletions examples/vite-build-standalone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"run-example": "pnpm serve ."
},
"dependencies": {
"@-/mock-data": "workspace:*",
"@ticketevolution/seatmaps-client": "workspace:*",
"serve": "^14.2.3"
},
Expand Down
4 changes: 4 additions & 0 deletions examples/vite-build-standalone/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @type {import('vite').UserConfig} */
export default {
publicDir: "./"
}
3 changes: 2 additions & 1 deletion packages/seatmaps-client/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ stats
cjs
esm
umd
node_modules
node_modules
bundle.js
15 changes: 0 additions & 15 deletions packages/seatmaps-client/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,3 @@ export class SeatmapFactory {
}

export { TicketMap };

export const Tevomaps = SeatmapFactory;
declare var define: any;

(function (root, factory) {
if (typeof define === "function" && define.amd) {
define([], factory);
} else if (typeof module === "object" && module.exports) {
module.exports = factory();
} else {
(root as any).Tevomaps = factory();
}
})(typeof self !== "undefined" ? self : this, function () {
return SeatmapFactory;
});
10 changes: 5 additions & 5 deletions packages/seatmaps-client/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ export default defineConfig({
plugins: [react()],
build: {
lib: {
entry: resolve("src/index.tsx"),
name: "Tevomaps",
fileName: () => `bundle.js`,
formats: ["umd"],
entry: resolve("src/index.tsx"), // Entry point to your main file
name: "Tevomaps", // Global variable name
fileName: () => `bundle.js`, // Output file name
formats: ["umd"], // UMD format to make it globally available
},
rollupOptions: {
external: [],
Expand All @@ -22,7 +22,7 @@ export default defineConfig({
},
plugins: [
inject({
process: "process/browser",
process: "process/browser", // Polyfill 'process' for browser environments
}),
],
},
Expand Down
5 changes: 4 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2e3d208

Please sign in to comment.