@churchapps/helpers 1.0.42 → 1.0.43
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/dist/index.cjs +15 -0
- package/package.json +8 -3
- package/scripts/build-cjs.js +33 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Object.assign(module.exports, require("./interfaces"));
|
|
2
|
+
module.exports.ApiHelper = require("./ApiHelper").ApiHelper;
|
|
3
|
+
module.exports.AppearanceHelper = require("./AppearanceHelper").AppearanceHelper;
|
|
4
|
+
module.exports.ArrayHelper = require("./ArrayHelper").ArrayHelper;
|
|
5
|
+
module.exports.CommonEnvironmentHelper = require("./CommonEnvironmentHelper").CommonEnvironmentHelper;
|
|
6
|
+
module.exports.CurrencyHelper = require("./CurrencyHelper").CurrencyHelper;
|
|
7
|
+
module.exports.DateHelper = require("./DateHelper").DateHelper;
|
|
8
|
+
module.exports.DonationHelper = require("./DonationHelper").DonationHelper;
|
|
9
|
+
module.exports.ErrorHelper = require("./ErrorHelper").ErrorHelper;
|
|
10
|
+
module.exports.EventHelper = require("./EventHelper").EventHelper;
|
|
11
|
+
module.exports.FileHelper = require("./FileHelper").FileHelper;
|
|
12
|
+
module.exports.PersonHelper = require("./PersonHelper").PersonHelper;
|
|
13
|
+
module.exports.UserHelper = require("./UserHelper").UserHelper;
|
|
14
|
+
module.exports.UniqueIdHelper = require("./UniqueIdHelper").UniqueIdHelper;
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@churchapps/helpers",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.43",
|
|
4
4
|
"description": "Library of helper functions not specific to any one ChurchApps project or framework.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
|
-
".":
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.cjs"
|
|
13
|
+
},
|
|
11
14
|
"./interfaces": "./dist/interfaces/index.js"
|
|
12
15
|
},
|
|
13
16
|
"scripts": {
|
|
14
17
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
15
18
|
"clean": "rimraf dist",
|
|
16
19
|
"tsc": "tsc",
|
|
17
|
-
"build": "npm-run-all clean tsc",
|
|
20
|
+
"build": "npm-run-all clean tsc build-cjs",
|
|
21
|
+
"build-cjs": "node scripts/build-cjs.js",
|
|
18
22
|
"lint": "eslint src/**/*.ts",
|
|
19
23
|
"lint:fix": "eslint src/**/*.ts --fix",
|
|
20
24
|
"format": "prettier --write src/**/*.ts"
|
|
@@ -51,6 +55,7 @@
|
|
|
51
55
|
"dependencies": {
|
|
52
56
|
"date-fns": "^4.1.0",
|
|
53
57
|
"dayjs": "^1.11.13",
|
|
58
|
+
"fs-extra": "^11.3.0",
|
|
54
59
|
"react-ga4": "^2.1.0",
|
|
55
60
|
"rrule": "^2.8.1"
|
|
56
61
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = path.dirname(__filename);
|
|
7
|
+
|
|
8
|
+
async function buildCjs() {
|
|
9
|
+
try {
|
|
10
|
+
const distDir = path.join(__dirname, '..', 'dist');
|
|
11
|
+
|
|
12
|
+
// Read the ES module index
|
|
13
|
+
const esmContent = await fs.readFile(path.join(distDir, 'index.js'), 'utf8');
|
|
14
|
+
|
|
15
|
+
// Convert ES module syntax to CommonJS
|
|
16
|
+
let cjsContent = esmContent
|
|
17
|
+
.replace(/export \* from "(.+?)";/g, 'Object.assign(module.exports, require("$1"));')
|
|
18
|
+
.replace(/export \{ (.+?) \} from "(.+?)";/g, (match, exports, from) => {
|
|
19
|
+
const exportList = exports.split(',').map(e => e.trim());
|
|
20
|
+
return exportList.map(exp => `module.exports.${exp} = require("${from}").${exp};`).join('\n');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Write CommonJS version
|
|
24
|
+
await fs.writeFile(path.join(distDir, 'index.cjs'), cjsContent);
|
|
25
|
+
|
|
26
|
+
console.log('CommonJS build created successfully');
|
|
27
|
+
} catch (error) {
|
|
28
|
+
console.error('Error building CommonJS version:', error);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
buildCjs();
|