@inseefr/lunatic 2.7.0-rc.3 → 2.7.0-rc.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inseefr/lunatic",
|
|
3
|
-
"version": "2.7.0-rc.
|
|
3
|
+
"version": "2.7.0-rc.4",
|
|
4
4
|
"workersVersion": "0.3.0-experimental",
|
|
5
5
|
"description": "Library of questionnaire components",
|
|
6
6
|
"repository": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"postbuild": "yarn build-workers",
|
|
50
50
|
"postinstall": "yarn build-workers && node ./scripts/build/add-workers-to-public.js",
|
|
51
51
|
"storybook": "storybook dev -p 9999 --no-open",
|
|
52
|
-
"build-storybook": "storybook build"
|
|
52
|
+
"build-storybook": "yarn postinstall && storybook build"
|
|
53
53
|
},
|
|
54
54
|
"bin": {
|
|
55
55
|
"add-lunatic-workers": "./scripts/build/add-workers-to-public.js"
|
|
@@ -1,26 +1,43 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const fs = require('fs');
|
|
3
|
-
const {
|
|
3
|
+
const { currentPublicFolder, workersPath } = require('./workers-paths');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Copy worker only if not exists
|
|
7
7
|
*/
|
|
8
8
|
const copyWorkerToPublicFolder = () => {
|
|
9
|
-
if (!fs.existsSync(
|
|
10
|
-
fs.mkdirSync(
|
|
9
|
+
if (!fs.existsSync(currentPublicFolder)) {
|
|
10
|
+
fs.mkdirSync(currentPublicFolder, { recursive: true });
|
|
11
11
|
}
|
|
12
12
|
const isAppendWorkerExists = fs.existsSync(workersPath.append.dest);
|
|
13
13
|
const isLabelWorkerExists = fs.existsSync(workersPath.label.dest);
|
|
14
14
|
const isSearchingWorkerExists = fs.existsSync(workersPath.searching.dest);
|
|
15
15
|
|
|
16
16
|
if (!isAppendWorkerExists) {
|
|
17
|
+
console.log(`Copy : ${workersPath.append.name} to ${currentPublicFolder}`);
|
|
17
18
|
fs.copyFileSync(workersPath.append.source, workersPath.append.dest);
|
|
19
|
+
} else {
|
|
20
|
+
console.log(
|
|
21
|
+
`${workersPath.append.name} is already in ${currentPublicFolder} -> Skipped`
|
|
22
|
+
);
|
|
18
23
|
}
|
|
19
24
|
if (!isLabelWorkerExists) {
|
|
25
|
+
console.log(`Copy : ${workersPath.label.name} to ${currentPublicFolder}`);
|
|
20
26
|
fs.copyFileSync(workersPath.label.source, workersPath.label.dest);
|
|
27
|
+
} else {
|
|
28
|
+
console.log(
|
|
29
|
+
`${workersPath.label.name} is already in ${currentPublicFolder} -> Skipped`
|
|
30
|
+
);
|
|
21
31
|
}
|
|
22
32
|
if (!isSearchingWorkerExists) {
|
|
33
|
+
console.log(
|
|
34
|
+
`Copy : ${workersPath.searching.name} to ${currentPublicFolder}`
|
|
35
|
+
);
|
|
23
36
|
fs.copyFileSync(workersPath.searching.source, workersPath.searching.dest);
|
|
37
|
+
} else {
|
|
38
|
+
console.log(
|
|
39
|
+
`${workersPath.searching.name} is already in ${currentPublicFolder} -> Skipped`
|
|
40
|
+
);
|
|
24
41
|
}
|
|
25
42
|
};
|
|
26
43
|
|
|
@@ -4,27 +4,24 @@ const path = require('path');
|
|
|
4
4
|
var version = PACKAGE.workersVersion;
|
|
5
5
|
|
|
6
6
|
const currentPublicFolder = path.resolve(`${process.cwd()}/public/workers`);
|
|
7
|
-
const
|
|
8
|
-
__dirname,
|
|
9
|
-
'../../workers-release'
|
|
10
|
-
);
|
|
7
|
+
const workersReleaseFolder = path.resolve(__dirname, '../../workers-release');
|
|
11
8
|
|
|
12
9
|
const workersPath = {
|
|
13
10
|
append: {
|
|
14
11
|
name: 'Append worker',
|
|
15
|
-
source: `${
|
|
12
|
+
source: `${workersReleaseFolder}/lunatic-append-worker-${version}.js`,
|
|
16
13
|
dest: `${currentPublicFolder}/lunatic-append-worker-${version}.js`,
|
|
17
14
|
webpack: `${path.resolve(__dirname)}/webpack-append-worker.config.js`,
|
|
18
15
|
},
|
|
19
16
|
label: {
|
|
20
17
|
name: 'Label worker',
|
|
21
|
-
source: `${
|
|
18
|
+
source: `${workersReleaseFolder}/lunatic-label-worker-${version}.js`,
|
|
22
19
|
dest: `${currentPublicFolder}/lunatic-label-worker-${version}.js`,
|
|
23
20
|
webpack: `${path.resolve(__dirname)}/webpack-label-worker.config.js`,
|
|
24
21
|
},
|
|
25
22
|
searching: {
|
|
26
23
|
name: 'Searching worker',
|
|
27
|
-
source: `${
|
|
24
|
+
source: `${workersReleaseFolder}/lunatic-searching-worker-${version}.js`,
|
|
28
25
|
dest: `${currentPublicFolder}/lunatic-searching-worker-${version}.js`,
|
|
29
26
|
webpack: `${path.resolve(__dirname)}/webpack-searching-worker.config.js`,
|
|
30
27
|
},
|
|
@@ -32,6 +29,6 @@ const workersPath = {
|
|
|
32
29
|
|
|
33
30
|
module.exports = {
|
|
34
31
|
currentPublicFolder: currentPublicFolder,
|
|
35
|
-
|
|
32
|
+
workersReleaseFolder: workersReleaseFolder,
|
|
36
33
|
workersPath: workersPath,
|
|
37
34
|
};
|