Skip to content

Commit 8674c80

Browse files
committed
version stamp dist files
1 parent c28fc7c commit 8674c80

File tree

6 files changed

+44
-3
lines changed

6 files changed

+44
-3
lines changed

build/updateVersion.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,37 @@ const files = fs.readdirSync(directoryPath);
66
console.log("Files in the directory:", files);
77

88
const oldText = "<VERSION>";
9-
const newText = package.VERSION;
9+
const version = package.version;
1010

11-
console.log("Updating to version " + package.version);
11+
console.log("Updating to version " + version);
12+
13+
// Get current daytime in ISO format 2025-10-24
14+
const timestamp = new Date().toISOString().split('T')[0];
1215

1316
files.forEach((file) => {
1417
const filePath = `${directoryPath}/${file}`;
1518
let content = fs.readFileSync(filePath, "utf8");
1619
let updated = false;
1720
while(content.includes(oldText)) {
1821
updated = true
19-
content = content.replace(oldText, package.version);
22+
content = content.replace(oldText, version);
2023
}
2124
if(updated) {
2225
// content = content.replace(new RegExp(oldText, "g"), newText);
2326
fs.writeFileSync(filePath, content, "utf8");
2427
console.log(`Replaced text in ${file}`);
28+
}
29+
// Minified files won't have the placeholder in a readable format, so we them to first line
30+
// also check that the version is not already there
31+
const banner = `/**\n` +
32+
` * File: ${file}\n` +
33+
` * Version: ${version}\n` +
34+
` * Generated: ${timestamp}\n` +
35+
` */\n`;
36+
if(content.startsWith(banner)) {
37+
return;
2538
}
39+
content = banner + content
40+
fs.writeFileSync(filePath, content, "utf8");
41+
console.log(`Added banner to ${file}`);
2642
});

dist/nosql-ts.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* File: nosql-ts.js
3+
* Version: 0.0.7
4+
* Generated: 2025-10-24
5+
*/
16
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
27

38
},{}],2:[function(require,module,exports){

dist/nosql-ts.min.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/nosql.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* File: nosql.js
3+
* Version: 0.0.7
4+
* Generated: 2025-10-24
5+
*/
16
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
27
"use strict";
38
Object.defineProperty(exports, "__esModule", { value: true });

dist/nosql.min.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/sql.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* File: sql.js
3+
* Version: 0.0.7
4+
* Generated: 2025-10-24
5+
*/
16
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
27
"use strict";
38
Object.defineProperty(exports, "__esModule", { value: true });

0 commit comments

Comments
 (0)