@citolab/tspci-tao 2.3.0-alpha-5 → 2.3.0-alpha.1
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/src/init.mjs +13 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@citolab/tspci-tao",
|
|
3
|
-
"version": "2.3.0-alpha
|
|
3
|
+
"version": "2.3.0-alpha.1",
|
|
4
4
|
"description": "create a zip file that can be imported into TAO",
|
|
5
5
|
"author": "patrick <patrick.deklein@cito.nl>, Marcel Hoekstra <marcel.hoekstra@cito.nl>",
|
|
6
6
|
"repository": "",
|
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
"inquirer": "9.2.0"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {},
|
|
15
|
-
"gitHead": "
|
|
15
|
+
"gitHead": "478292d5b580061e989a3a16a933081d23970962"
|
|
16
16
|
}
|
package/src/init.mjs
CHANGED
|
@@ -3,9 +3,6 @@ import path from "path";
|
|
|
3
3
|
import readline from "readline";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import inquirer from "inquirer";
|
|
6
|
-
|
|
7
|
-
const PACKAGER_PATH = path.join(PACKAGE_ROOT_PATH + "/node_modules/@citolab/tspci-tao");
|
|
8
|
-
|
|
9
6
|
function askOption(prompt) {
|
|
10
7
|
const rl = readline.createInterface({
|
|
11
8
|
input: process.stdin,
|
|
@@ -62,16 +59,6 @@ export const init = async () => {
|
|
|
62
59
|
packageData.config.tspci.typeIdentifier = typeIdentifer;
|
|
63
60
|
packageData.config.tspci.score = scoreMethodArray;
|
|
64
61
|
|
|
65
|
-
packageData.devDependencies = packageData.devDependencies || {};
|
|
66
|
-
|
|
67
|
-
// get package.json from PACKAGER_PATH
|
|
68
|
-
const packagerPackageData = JSON.parse(fs.readFileSync(path.join(PACKAGER_PATH, "package.json"), "utf8"));
|
|
69
|
-
// add devDependencies from packagerPackageData to packageData
|
|
70
|
-
Object.keys(packagerPackageData.devDependencies).forEach((key) => {
|
|
71
|
-
packageData.devDependencies[key] = packagerPackageData.devDependencies[key];
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
packageData.dependencies["@citolab/tspci"] = "^1.0.0";
|
|
75
62
|
packageData.scripts = packageData.scripts || {};
|
|
76
63
|
packageData.scripts["package:tao"] = "tspci --target tao";
|
|
77
64
|
// store packageData
|
|
@@ -98,19 +85,19 @@ export const init = async () => {
|
|
|
98
85
|
newSourceFile = `import { QtiVariableJSON } from "@citolab/tspci";\r\n${newSourceFile}`;
|
|
99
86
|
}
|
|
100
87
|
const defaultImplementation = `
|
|
101
|
-
off = () => {}; // called when setting correct response in tao
|
|
102
|
-
on = (val) => {};
|
|
103
|
-
trigger = (event: string, value: any) => {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
};
|
|
107
|
-
resetResponse = () => {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
};
|
|
111
|
-
setResponse = (response: QtiVariableJSON) => {
|
|
112
|
-
|
|
113
|
-
};
|
|
88
|
+
off = () => {}; // called when setting correct response in tao
|
|
89
|
+
on = (val) => {};
|
|
90
|
+
trigger = (event: string, value: any) => {
|
|
91
|
+
this.config.properties[event] = value;
|
|
92
|
+
this.render();
|
|
93
|
+
};
|
|
94
|
+
resetResponse = () => {
|
|
95
|
+
// used in tao to reset the response. clean-up and re-render the PCI would be best.
|
|
96
|
+
// this.render();
|
|
97
|
+
};
|
|
98
|
+
setResponse = (response: QtiVariableJSON) => {
|
|
99
|
+
// used to set the response in tao. E.g. when the item author has set a correct response. And you refresh TAO it will call this method to set the response in the PCI in the score-editor.
|
|
100
|
+
};
|
|
114
101
|
`
|
|
115
102
|
const lastBracket = newSourceFile.lastIndexOf("}");
|
|
116
103
|
newSourceFile = newSourceFile.substring(0, lastBracket) + defaultImplementation + newSourceFile.substring(lastBracket);
|