@atolis-hq/corum 0.1.56 → 0.1.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  import { printBanner } from '../banner.js';
2
2
  import express from 'express';
3
3
  import path from 'node:path';
4
+ import { createRequire } from 'node:module';
4
5
  import { existsSync, readFileSync, readdirSync, watch } from 'node:fs';
5
6
  import { readdir } from 'node:fs/promises';
6
7
  import { fileURLToPath, pathToFileURL } from 'node:url';
@@ -15,6 +16,8 @@ import { createGraphRuntimeConfig } from '../source/config.js';
15
16
  const __filename = fileURLToPath(import.meta.url);
16
17
  const __dirname = path.dirname(__filename);
17
18
  const WEB_DIR = path.join(__dirname, '..', '..', '..', 'web');
19
+ const require = createRequire(import.meta.url);
20
+ const { version } = require('../../../package.json');
18
21
  export function createMultiGraphCache(source) {
19
22
  let cache = null;
20
23
  return {
@@ -583,6 +586,13 @@ export function createApp(graph, reloadEvents = createReloadEvents(), source, mu
583
586
  }
584
587
  }
585
588
  });
589
+ const indexHtml = readFileSync(path.join(WEB_DIR, 'index.html'), 'utf8')
590
+ .replace('href="style.css"', `href="style.css?v=${encodeURIComponent(version)}"`)
591
+ .replace('src="app.jsx"', `src="app.jsx?v=${encodeURIComponent(version)}"`);
592
+ app.get(['/', '/index.html'], (_req, res) => {
593
+ res.setHeader('Cache-Control', 'no-cache');
594
+ res.type('html').send(indexHtml);
595
+ });
586
596
  app.use(express.static(WEB_DIR, {
587
597
  setHeaders(res, filePath) {
588
598
  if (filePath.endsWith('.jsx')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atolis-hq/corum",
3
- "version": "0.1.56",
3
+ "version": "0.1.57",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",