@axa-fr/react-oidc 6.25.3-alpha950 → 6.25.4-alpha.967

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.
@@ -0,0 +1,58 @@
1
+ import path from 'path';
2
+ import fs from 'fs';
3
+
4
+ try {
5
+
6
+ /**
7
+ * Script to run after npm install
8
+ *
9
+ * Copy selected files to user's directory
10
+ */
11
+ const script_prefix= 'oidc-client';
12
+
13
+ const copyFile = async (src, dest, overwrite) => {
14
+ if(!fileExists(src)) {
15
+ console.log(`[${script_prefix}:skip] file does not exist ${src}`);
16
+ return;
17
+ }
18
+ if (!overwrite) {
19
+ if (fileExists(dest)) {
20
+ console.log(`[${script_prefix}:skip] file exists not overwriting ${dest}`);
21
+ return;
22
+ }
23
+ }
24
+ await fs.promises.copyFile(src, dest);
25
+ console.log(`[${script_prefix}:copy] ${dest}`);
26
+ };
27
+
28
+ const fileExists = (path) => {
29
+ return !!fs.existsSync(path);
30
+ };
31
+
32
+ const initPath = process.env.INIT_CWD;
33
+
34
+ const srcDir = '../oidc-client-service-worker/dist/';
35
+ const destinationDir = path.join(initPath, 'public');
36
+
37
+ const files = [
38
+ {
39
+ fileName: 'OidcServiceWorker.js',
40
+ overwrite: true,
41
+ },
42
+ {
43
+ fileName: 'OidcTrustedDomains.js',
44
+ overwrite: false,
45
+ },
46
+ ];
47
+
48
+ for await (const file of files) {
49
+ await copyFile(
50
+ path.join(srcDir, file.fileName),
51
+ path.join(destinationDir, file.fileName),
52
+ file.overwrite
53
+ );
54
+ }
55
+
56
+ } catch (err) {
57
+ console.warn(err);
58
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axa-fr/react-oidc",
3
- "version": "6.25.3-alpha950",
3
+ "version": "6.25.4-alpha.967",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.cjs",
@@ -35,13 +35,13 @@
35
35
  "serve": "vite preview",
36
36
  "test": "vitest --root . --coverage",
37
37
  "clean": "rimraf dist",
38
- "postinstall": "node ./bin/post-install.js",
38
+ "postinstall": "node ./bin/post-install.mjs",
39
39
  "prepare": "pnpm run clean && pnpm run copy-service-worker && pnpm run build",
40
40
  "lint": "eslint src"
41
41
  },
42
42
  "dependencies": {
43
- "@axa-fr/oidc-client-service-worker": "6.25.3-alpha950",
44
- "@axa-fr/vanilla-oidc": "6.25.3-alpha950",
43
+ "@axa-fr/oidc-client-service-worker": "6.25.4-alpha.967",
44
+ "@axa-fr/vanilla-oidc": "6.25.4-alpha.967",
45
45
  "base64-js": "1.5.1"
46
46
  },
47
47
  "peerDependencies": {
@@ -1,35 +0,0 @@
1
- import cpy from 'cpy';
2
- import path from 'path';
3
-
4
- /**
5
- * Script to run after npm install
6
- *
7
- * Copy selected files to user's directory
8
- */
9
-
10
- const initPath = process.env.INIT_CWD;
11
- // console.log('currentdir:', process.cwd());
12
- // console.log('userPath:', initPath);
13
-
14
- function copyProgress(progress) {
15
- console.log('✓ [react-oidc:copy] ', progress.destinationPath);
16
- }
17
-
18
- const srcDir = '../oidc-client-service-worker/dist/';
19
- const destinationDir = path.join(initPath, 'public');
20
-
21
- await cpy([path.join(srcDir,'OidcServiceWorker.js')], destinationDir, {
22
- overwrite: true,
23
- }).on('progress', copyProgress);
24
-
25
- try {
26
- await cpy([path.join(srcDir,'OidcTrustedDomains.js')], destinationDir, {
27
- overwrite: false,
28
- }).on('progress', copyProgress);
29
- } catch (e) {
30
- if (e.code === 'EEXIST') { //file exists
31
- console.log(
32
- `✗ [react-oidc:skip] OidcTrustedDomains.js not copied, already exists in ${destinationDir}`
33
- );
34
- } else throw e;
35
- }