@inseefr/lunatic 2.7.18 → 2.7.19
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/README.md
CHANGED
|
@@ -124,7 +124,8 @@ Lunatic uses webWorkers to take the load off the main execution frame (e.g. list
|
|
|
124
124
|
|
|
125
125
|
Workers are normally installed when the library is installed (postinstall scripts). If this is not the case, you can always manually run the command `npx @inseefr/lunatic workers` at the root of your project to add Lunatic workers to your project.
|
|
126
126
|
|
|
127
|
-
Lunatic workers are added to the `public/workers` folder of the current project when the library is installed.
|
|
127
|
+
By default: Lunatic workers are added to the `public/workers` folder of the current project when the library is installed.
|
|
128
|
+
If you want to install inside another folder, just run `npx @inseefr/lunatic workers my-custom-folder`. Workers will be available to the `my-custom-folder/workers` folder of the current project.
|
|
128
129
|
|
|
129
130
|
If a new version of Lunatic offers new workers, they will be automatically updated.
|
|
130
131
|
This ensures that you always have the right version of workers for the version of Lunatic you're using.
|
|
@@ -14,7 +14,7 @@ var WorkerEnum = exports.WorkerEnum = /*#__PURE__*/function (WorkerEnum) {
|
|
|
14
14
|
return WorkerEnum;
|
|
15
15
|
}({});
|
|
16
16
|
var version = _package["default"].workersVersion;
|
|
17
|
-
var DEFAULT_BASE_PATH =
|
|
17
|
+
var DEFAULT_BASE_PATH = "".concat(window.location.origin, "/workers");
|
|
18
18
|
var WORKER_PATH = {
|
|
19
19
|
APPEND: "lunatic-append-worker-".concat(version, ".js"),
|
|
20
20
|
SEARCH: "lunatic-search-worker-".concat(version, ".js"),
|
package/package.json
CHANGED
|
@@ -3,7 +3,15 @@ const path = require('path');
|
|
|
3
3
|
|
|
4
4
|
const version = lunaticPackageJson.workersVersion;
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* process.argv return an array, for example, for this command "node ./my-script.js hello"
|
|
8
|
+
* process.argv = ["node", "./my-script.js", "hello"], process.argv[2] = "hello" (or undefined if no argument)
|
|
9
|
+
*/
|
|
10
|
+
const getPublicFolder = () => process.argv[2] || 'public';
|
|
11
|
+
|
|
12
|
+
const currentPublicFolder = path.resolve(
|
|
13
|
+
`${process.cwd()}/${getPublicFolder()}/workers`
|
|
14
|
+
);
|
|
7
15
|
const workersReleaseFolder = path.resolve(__dirname, '../../workers-release');
|
|
8
16
|
|
|
9
17
|
const workersPath = {
|