acebase-server 1.16.0 → 1.16.1

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.
package/build-vars.js ADDED
@@ -0,0 +1,16 @@
1
+ // Executed by npm "version" hook
2
+ const { readFileSync, writeFileSync } = require('fs');
3
+ const { execSync } = require('child_process');
4
+ const packageInfo = require('./package.json');
5
+
6
+ const files = ['./dist/cjs/routes/meta-info.js', './dist/esm/routes/meta-info.js'];
7
+ files.forEach(file => {
8
+ const originalContent = readFileSync(file, 'utf8');
9
+ content = originalContent.replace(/%SERVER_VERSION%/g, packageInfo.version);
10
+ if (content !== originalContent) {
11
+ writeFileSync(file, content, 'utf8');
12
+ console.log(`Replaced variable %SERVER_VERSION% with ${packageInfo.version} in ${file}`);
13
+ }
14
+ });
15
+
16
+ execSync(`git add dist`);
@@ -2,14 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addRoute = void 0;
4
4
  const os = require("os");
5
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
6
- // @ts-ignore path to package.json is different in builds
7
- const package_json_1 = require("../../../package.json");
5
+ const SERVER_VERSION = '1.16.1'; // Loaded from package.json by npm scripts
8
6
  const addRoute = (env) => {
9
7
  // Add info endpoint
10
8
  env.app.get(`/info/${env.db.name}`, (req, res) => {
11
9
  const info = {
12
- version: package_json_1.default.version,
10
+ version: SERVER_VERSION,
13
11
  time: Date.now(),
14
12
  process: process.pid,
15
13
  };
@@ -1,12 +1,10 @@
1
1
  import * as os from 'os';
2
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3
- // @ts-ignore path to package.json is different in builds
4
- import meta from '../../../package.json' assert { type: 'json' };
2
+ const SERVER_VERSION = '1.16.1'; // Loaded from package.json by npm scripts
5
3
  export const addRoute = (env) => {
6
4
  // Add info endpoint
7
5
  env.app.get(`/info/${env.db.name}`, (req, res) => {
8
6
  const info = {
9
- version: meta.version,
7
+ version: SERVER_VERSION,
10
8
  time: Date.now(),
11
9
  process: process.pid,
12
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "acebase-server",
3
- "version": "1.16.0",
3
+ "version": "1.16.1",
4
4
  "description": "AceBase realtime database server (webserver endpoint to allow remote connections)",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -24,7 +24,8 @@
24
24
  "build:esm": "tsc -p tsconfig.json && npx tsc-esm-fix ---target='dist/esm'",
25
25
  "build:cjs": "tsc -p tsconfig-cjs.json",
26
26
  "build:packages": "bash ./create-package-files",
27
- "npmfix": "echo 'Regenerating package-lock.json...' && npm i --package-lock-only"
27
+ "preversion": "npm run build",
28
+ "version": "node ./build-vars.js"
28
29
  },
29
30
  "keywords": [
30
31
  "database",