@remyar/tecdoc_client 0.0.2 → 0.0.3
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/.scripts/build.mjs +1 -0
- package/lib/api/post.js +2 -1
- package/lib/tecdoc/getAmBrands.js +7 -7
- package/package.json +10 -11
- package/rollup.config.mjs +42 -91
- package/src/api/post.js +2 -0
- package/src/tecdoc/getAmBrands.js +7 -7
package/.scripts/build.mjs
CHANGED
|
@@ -22,6 +22,7 @@ console.log(chalk.blue('Building js'))
|
|
|
22
22
|
await $`cross-env NODE_ENV=production rollup -c`
|
|
23
23
|
|
|
24
24
|
console.log(chalk.blue(`Compiling 'lib' js files`))
|
|
25
|
+
|
|
25
26
|
// build files used for overrides
|
|
26
27
|
await $`cross-env NODE_ENV=production RBC_CJS_BUILD=true babel src --out-dir lib`
|
|
27
28
|
|
package/lib/api/post.js
CHANGED
|
@@ -8,6 +8,7 @@ exports["default"] = _default;
|
|
|
8
8
|
var _regenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/regenerator"));
|
|
9
9
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _nodeFetch = _interopRequireDefault(require("node-fetch"));
|
|
11
12
|
function _default(_x, _x2) {
|
|
12
13
|
return _ref.apply(this, arguments);
|
|
13
14
|
}
|
|
@@ -35,7 +36,7 @@ function _ref() {
|
|
|
35
36
|
case 0:
|
|
36
37
|
_context.p = 0;
|
|
37
38
|
_context.n = 1;
|
|
38
|
-
return
|
|
39
|
+
return (0, _nodeFetch["default"])(url, {
|
|
39
40
|
method: 'POST',
|
|
40
41
|
body: JSON.stringify(obj),
|
|
41
42
|
headers: headers,
|
|
@@ -26,13 +26,13 @@ function _ref() {
|
|
|
26
26
|
_context.n = 1;
|
|
27
27
|
return _api["default"].post(process.env.TECDOC_API_URL, {
|
|
28
28
|
getBrands: {
|
|
29
|
-
"articleCountry":
|
|
30
|
-
"lang":
|
|
31
|
-
"provider":
|
|
32
|
-
"includeAll":
|
|
33
|
-
"includeAddressDetails":
|
|
34
|
-
"includeDataSupplierStatus":
|
|
35
|
-
"includeDataSupplierLogo":
|
|
29
|
+
"articleCountry": params.articleCountry || "FR",
|
|
30
|
+
"lang": params.lang || "FR",
|
|
31
|
+
"provider": params.provider ? params.provider : process.env.TECDOC_PROVIDER_ID,
|
|
32
|
+
"includeAll": params.includeAll || false,
|
|
33
|
+
"includeAddressDetails": params.includeAddressDetails || false,
|
|
34
|
+
"includeDataSupplierStatus": params.includeDataSupplierStatus || false,
|
|
35
|
+
"includeDataSupplierLogo": params.includeDataSupplierLogo || false
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
case 1:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remyar/tecdoc_client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Client For Tecdoc",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -22,23 +22,22 @@
|
|
|
22
22
|
"client"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@babel/cli": "^7.28.6",
|
|
26
|
-
"@rollup/plugin-commonjs": "^29.0.0",
|
|
27
25
|
"@rollup/plugin-babel": "^6.1.0",
|
|
28
|
-
"@
|
|
29
|
-
"@babel/plugin-transform-runtime": "^7.28.5",
|
|
30
|
-
"@rollup/plugin-replace": "^6.0.3",
|
|
26
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
31
27
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
32
|
-
"@
|
|
33
|
-
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
34
|
-
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
|
28
|
+
"@rollup/plugin-replace": "^6.0.3",
|
|
35
29
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
36
|
-
"rollup-plugin-clear": "^2.0.7",
|
|
37
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
38
30
|
"babel-preset-react-app": "^10.1.0",
|
|
39
31
|
"cross-env": "^10.1.0",
|
|
40
32
|
"is-ci": "^4.1.0",
|
|
33
|
+
"node-fetch": "^3.3.2",
|
|
41
34
|
"rollup": "^4.57.0",
|
|
35
|
+
"rollup-plugin-clear": "^2.0.7",
|
|
36
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
37
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
42
38
|
"zx": "^8.8.5"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@babel/cli": "^7.28.6"
|
|
43
42
|
}
|
|
44
43
|
}
|
package/rollup.config.mjs
CHANGED
|
@@ -1,94 +1,45 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import babel from '@rollup/plugin-babel';
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
|
+
import { defineConfig } from 'rollup';
|
|
3
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
5
4
|
import commonjs from '@rollup/plugin-commonjs';
|
|
6
|
-
import
|
|
7
|
-
import clear from 'rollup-plugin-clear'
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
import
|
|
5
|
+
import external from 'rollup-plugin-peer-deps-external';
|
|
6
|
+
import clear from 'rollup-plugin-clear' // Cleans the `dist` folder before each build
|
|
7
|
+
import { nodeResolve } from '@rollup/plugin-node-resolve' // Allows Rollup to resolve modules from node_modules
|
|
8
|
+
import babel from '@rollup/plugin-babel' // Transpiles modern JavaScript code
|
|
9
|
+
import { terser } from 'rollup-plugin-terser' // Minifies the final output
|
|
11
10
|
|
|
12
|
-
const
|
|
11
|
+
const packageJson = JSON.parse(readFileSync('./package.json'));
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}),
|
|
48
|
-
replace({
|
|
49
|
-
'process.env.NODE_ENV': JSON.stringify('development'),
|
|
50
|
-
preventAssignment: true,
|
|
51
|
-
}),
|
|
52
|
-
nodeResolve(),
|
|
53
|
-
commonjs(commonjsOptions),
|
|
54
|
-
babel(babelOptions),
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
input,
|
|
59
|
-
output: {
|
|
60
|
-
file: './dist/index.min.js',
|
|
61
|
-
format: 'umd',
|
|
62
|
-
name,
|
|
63
|
-
globals,
|
|
64
|
-
interop: 'auto',
|
|
65
|
-
},
|
|
66
|
-
external: Object.keys(globals).push(/@babel\/runtime/),
|
|
67
|
-
plugins: [
|
|
68
|
-
replace({
|
|
69
|
-
'process.env.NODE_ENV': JSON.stringify('production'),
|
|
70
|
-
preventAssignment: true,
|
|
71
|
-
}),
|
|
72
|
-
nodeResolve(),
|
|
73
|
-
commonjs(commonjsOptions),
|
|
74
|
-
babel(babelOptions),
|
|
75
|
-
terser(),
|
|
76
|
-
],
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
input,
|
|
80
|
-
output: {
|
|
81
|
-
file: pkg.module,
|
|
82
|
-
format: 'esm',
|
|
83
|
-
interop: 'auto',
|
|
84
|
-
},
|
|
85
|
-
// prevent bundling all dependencies
|
|
86
|
-
external: (id) => !id.startsWith('.') && !id.startsWith('/'),
|
|
87
|
-
plugins: [
|
|
88
|
-
babel({
|
|
89
|
-
...babelOptions,
|
|
90
|
-
configFile: path.join(__dirname, 'babel.config.esm.js'),
|
|
91
|
-
}),
|
|
92
|
-
],
|
|
93
|
-
},
|
|
94
|
-
]
|
|
13
|
+
export default defineConfig(
|
|
14
|
+
{
|
|
15
|
+
// CJS & ESM Bundle Configuration
|
|
16
|
+
input: 'src/index.js', // Entry point for CommonJS and ESM builds
|
|
17
|
+
output: [
|
|
18
|
+
{
|
|
19
|
+
dir: 'dist/cjs', // Output directory for CommonJS format
|
|
20
|
+
format: 'cjs', // CommonJS format (for Node.js)
|
|
21
|
+
preserveModules: true, // Keep the original module structure
|
|
22
|
+
exports: 'auto', // Auto-detect export style
|
|
23
|
+
sourcemap: true // Enable sourcemap
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
dir: 'dist/esm', // Output directory for ESM format
|
|
27
|
+
format: 'es', // ES Module format
|
|
28
|
+
preserveModules: true, // Keep the original module structure
|
|
29
|
+
exports: 'auto', // Auto-detect export style
|
|
30
|
+
sourcemap: true // Enable sourcemap
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
plugins: [
|
|
34
|
+
clear({ targets: ['dist/cjs', 'dist/esm'] }),
|
|
35
|
+
nodeResolve(),
|
|
36
|
+
commonjs(),
|
|
37
|
+
babel({
|
|
38
|
+
exclude: 'node_modules/**',
|
|
39
|
+
babelHelpers: 'runtime',
|
|
40
|
+
plugins: ['@babel/plugin-transform-runtime']
|
|
41
|
+
}),
|
|
42
|
+
terser()
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
);
|
package/src/api/post.js
CHANGED
|
@@ -5,13 +5,13 @@ export default async function ( params ) {
|
|
|
5
5
|
try {
|
|
6
6
|
let result = await api.post(process.env.TECDOC_API_URL, {
|
|
7
7
|
getBrands: {
|
|
8
|
-
"articleCountry":
|
|
9
|
-
"lang":
|
|
10
|
-
"provider":
|
|
11
|
-
"includeAll":
|
|
12
|
-
"includeAddressDetails":
|
|
13
|
-
"includeDataSupplierStatus":
|
|
14
|
-
"includeDataSupplierLogo":
|
|
8
|
+
"articleCountry": params.articleCountry || "FR",
|
|
9
|
+
"lang": params.lang || "FR",
|
|
10
|
+
"provider": params.provider ? params.provider : process.env.TECDOC_PROVIDER_ID,
|
|
11
|
+
"includeAll": params.includeAll || false,
|
|
12
|
+
"includeAddressDetails": params.includeAddressDetails || false,
|
|
13
|
+
"includeDataSupplierStatus": params.includeDataSupplierStatus || false,
|
|
14
|
+
"includeDataSupplierLogo": params.includeDataSupplierLogo || false
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
resolve(result);
|