@citolab/tspci-qbci 2.4.2 → 2.4.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 +2 -2
- package/readme.md +3 -3
- package/src/createPackage.mjs +29 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@citolab/tspci-qbci",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.4",
|
|
4
4
|
"description": "create a .ci file that can be imported into Questify",
|
|
5
5
|
"author": "patrick <patrick.deklein@cito.nl>, Marcel Hoekstra <marcel.hoekstra@cito.nl>",
|
|
6
6
|
"repository": "",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"archiver": "^5.3.0"
|
|
11
11
|
},
|
|
12
12
|
"scripts": {},
|
|
13
|
-
"gitHead": "
|
|
13
|
+
"gitHead": "d68856aaf4b354c3532cc8a9a6624d6fbe89170d",
|
|
14
14
|
"publishConfig": {
|
|
15
15
|
"access": "public"
|
|
16
16
|
}
|
package/readme.md
CHANGED
|
@@ -10,7 +10,7 @@ tspci --target qbci
|
|
|
10
10
|
## config options
|
|
11
11
|
|
|
12
12
|
In the package.json of the pci:
|
|
13
|
-
- typeIdentifier (required)
|
|
13
|
+
- config: { tspci: { typeIdentifier: 'yourpciname' }} (required)
|
|
14
14
|
- label (if empty, package name will be used)
|
|
15
|
-
- width
|
|
16
|
-
- height
|
|
15
|
+
- config: { tspci: { width: '500' }} (optional, default: 500)
|
|
16
|
+
- config: { tspci: { height: '500' }} (optional, default: 500)
|
package/src/createPackage.mjs
CHANGED
|
@@ -38,8 +38,11 @@ export const bundle = () => {
|
|
|
38
38
|
const rawMetadata = fs.readFileSync(questifyMetadata);
|
|
39
39
|
const questifyMetadataData = JSON.parse(rawMetadata);
|
|
40
40
|
|
|
41
|
-
const
|
|
42
|
-
|
|
41
|
+
const propertiesToReplace = {
|
|
42
|
+
typeIdentifier: "emptytypeIdentifier",
|
|
43
|
+
width: "500",
|
|
44
|
+
height: "500",
|
|
45
|
+
};
|
|
43
46
|
copyDirectoryRecursiveSync(path.join(PACKAGER_PATH, "questify-default"), outputDirectoryTemp, false);
|
|
44
47
|
|
|
45
48
|
const name = packageData.label
|
|
@@ -47,18 +50,30 @@ export const bundle = () => {
|
|
|
47
50
|
: packageData.name
|
|
48
51
|
? packageData.name.split("/")[packageData.name.split("/").length - 1]
|
|
49
52
|
: "ci";
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
|
|
54
|
+
for (const propertyName in propertiesToReplace) {
|
|
55
|
+
if (propertyName === "typeIdentifier") {
|
|
56
|
+
if (!packageData.config?.tspci[propertyName]) {
|
|
57
|
+
console.error(
|
|
58
|
+
"'typeIdentifier' should be added as an option in package.json and should match the typeIdentifier of the PCI code file."
|
|
59
|
+
);
|
|
60
|
+
return;
|
|
61
|
+
} else {
|
|
62
|
+
if (!packageData.config?.tspci[propertyName])
|
|
63
|
+
console.info(
|
|
64
|
+
`${propertyName} not specified in ${packageData.name} in package.json using { config: tspci: {${propertiesToReplace[propertyName]}}`
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if ( packageData.config.tspci[propertyName]) {
|
|
69
|
+
propertiesToReplace[propertyName] = packageData.config.tspci[propertyName];
|
|
60
70
|
}
|
|
61
71
|
}
|
|
72
|
+
|
|
73
|
+
for(const propertyName in propertiesToReplace) {
|
|
74
|
+
questifyMetadataData[propertyName] = propertiesToReplace[propertyName];
|
|
75
|
+
}
|
|
76
|
+
|
|
62
77
|
const metadataString = JSON.stringify(questifyMetadataData);
|
|
63
78
|
fs.writeFileSync(path.join(outputDirectoryTemp, "metadata.json"), metadataString, "utf8");
|
|
64
79
|
|
|
@@ -66,10 +81,11 @@ export const bundle = () => {
|
|
|
66
81
|
const pciFile = config.main || "/dist/index.js";
|
|
67
82
|
|
|
68
83
|
// pk: add .min. to the name else QB is gonna minify it and it BREAKS
|
|
84
|
+
const scriptPath = path.join(outputDirectoryTemp, "/ref/script");
|
|
69
85
|
if (!fs.existsSync(scriptPath)) {
|
|
70
86
|
fs.mkdirSync(scriptPath);
|
|
71
87
|
}
|
|
72
|
-
fs.copyFileSync(path.join(PACKAGE_ROOT_PATH, pciFile), path.join(
|
|
88
|
+
fs.copyFileSync(path.join(PACKAGE_ROOT_PATH, pciFile), path.join(scriptPath, "/index.min.js"));
|
|
73
89
|
|
|
74
90
|
// zip the folder
|
|
75
91
|
const zipName = `questify-ci-${name}_${packageData.version}.ci`;
|