@citolab/tspci-tao 2.3.0-alpha.6 → 2.3.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/readme-images/tspci-tao-console.png +0 -0
- package/readme.md +49 -1
- package/release-notes.md +3 -0
- package/src/init.mjs +6 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@citolab/tspci-tao",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.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": "32377e27a791cc3198b1fdf35b9680b35c5814f0"
|
|
16
16
|
}
|
|
Binary file
|
package/readme.md
CHANGED
|
@@ -17,15 +17,49 @@ Configuration of a PCI can be done by the author because this packager reads the
|
|
|
17
17
|
If scoring can be done with a MATCH_CORRECT (single string comparison) the item author can provide the correct answer in TAO by interaction with the PCI.
|
|
18
18
|
This way one PCI can be re-used in different configurations supporting multiple items.
|
|
19
19
|
|
|
20
|
+
## Cli
|
|
21
|
+
To add TAO support to an existing tspci PCI you can run:
|
|
22
|
+
|
|
23
|
+
``` sh
|
|
24
|
+
tspci add --target tao
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This command and all the TAO specific changes that are needed to build importable TAO zip file. This will work for a new project created by ``` tspci init ```. For PCI's that are modified, it will do best effort to fully implement TAO specific changes. Please read the rest of this file in case ``` tspci init ``` fails on your PCI.
|
|
28
|
+
|
|
29
|
+
<p align="center">
|
|
30
|
+
<img src="https://github.com/Citolab/tspci/blob/main/lib/tspci-tao/readme-images/tspci-tao-console.png" alt="cli in console">
|
|
31
|
+
</p>
|
|
32
|
+
|
|
33
|
+
The cli will ask a few things before the script is executed:
|
|
34
|
+
|
|
35
|
+
- short: name on the interaction icon in TAO.
|
|
36
|
+
- label: label of the interaction
|
|
37
|
+
- scoringMethod: the MATCH CORRECT scoring can be applied on the PCI. The user can interacted with the PCI to provide the correct response. To be able to show the correct response in the author system after the author provided the correct response; the setResponse function of the TAO interface should be implemented. Scoring can (for now) only be done using a string comparison. But sinces the PCI developer implement the getResponse method, as string comparison can be done to compare JSON of formatted numbers.
|
|
38
|
+
|
|
39
|
+
## Changes
|
|
40
|
+
|
|
20
41
|
To be able to add an IMS-PCI to the TAO authoring system properties are added to the `package.json`
|
|
21
42
|
and implemented lifecycle events that should be implemented in the PCI.
|
|
22
43
|
|
|
23
|
-
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
or
|
|
47
|
+
|
|
48
|
+
``` sh
|
|
49
|
+
npm run tspci -- add --target tao
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
To create the zip file that can be added in TAO run:
|
|
24
53
|
|
|
25
54
|
``` sh
|
|
26
55
|
tspci --target tao
|
|
27
56
|
```
|
|
28
57
|
|
|
58
|
+
or
|
|
59
|
+
|
|
60
|
+
``` sh
|
|
61
|
+
npm run tspci -- --target tao
|
|
62
|
+
```
|
|
29
63
|
## life cycle methods
|
|
30
64
|
|
|
31
65
|
To be TAO compliant the TAOpci interface should be implemented:
|
|
@@ -68,6 +102,20 @@ class App implements IMSpci<PropTypes>, TAOpci {
|
|
|
68
102
|
|
|
69
103
|
|
|
70
104
|
### package.json
|
|
105
|
+
|
|
106
|
+
The version and description fields of the package.json are used while creating the zip file and are mandatory.
|
|
107
|
+
|
|
108
|
+
Other config properties should be placed under: config -> tspci:
|
|
109
|
+
|
|
110
|
+
``` json
|
|
111
|
+
"config": {
|
|
112
|
+
"tspci": {
|
|
113
|
+
"typeIdentifier": "myPci",
|
|
114
|
+
...
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
71
119
|
- typeIdentifier: a field 'typeIdentifier' should be added. This should match the 'typeIdentifier' value in the PCI entry file (The one that implements IMSPci). Only (alpha)numeric values are allowed. This because a hyphen in the identifier causes an error in TAO. To be sure, only alphanumeric are allowed.
|
|
72
120
|
- label: used as label in TAO
|
|
73
121
|
- short: short name used in TAO to label the PCI where you can drag it in an item.
|
package/release-notes.md
CHANGED
package/src/init.mjs
CHANGED
|
@@ -42,12 +42,12 @@ export const init = async () => {
|
|
|
42
42
|
// get first 5 chars of identifier
|
|
43
43
|
const defaultShort = typeIdentifer.length > 5 ? typeIdentifer.substring(0, 5) : typeIdentifer;
|
|
44
44
|
const short = (await askOption(
|
|
45
|
-
`Enter a short name for the PCI: (default: ${defaultShort})`
|
|
45
|
+
`Enter a short name for the PCI: (default: ${defaultShort}) `
|
|
46
46
|
)) || defaultShort;
|
|
47
47
|
|
|
48
48
|
const defaultLabel = typeIdentifer.length > 5 ? typeIdentifer.substring(0, 5) : typeIdentifer;
|
|
49
49
|
const label = (await askOption(
|
|
50
|
-
`Enter the label of the PCI: (default: ${defaultLabel})`
|
|
50
|
+
`Enter the label of the PCI: (default: ${defaultLabel}) `
|
|
51
51
|
)) || defaultLabel;
|
|
52
52
|
const scoringsMethods = await selectOptions("Which scoring methods do you want to support?", [
|
|
53
53
|
"MATCH_CORRECT", "NONE"
|
|
@@ -70,12 +70,12 @@ export const init = async () => {
|
|
|
70
70
|
packageData.devDependencies[key] = packagerPackageData.devDependencies[key];
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
-
packageData.dependencies["@citolab/tspci"] = "^1.0.0";
|
|
74
73
|
packageData.scripts = packageData.scripts || {};
|
|
75
74
|
packageData.scripts["package:tao"] = "tspci --target tao";
|
|
76
75
|
// store packageData
|
|
77
76
|
fs.writeFileSync(path.join(PACKAGE_ROOT_PATH, "package.json"), JSON.stringify(packageData, null, 2), "utf8");
|
|
78
|
-
|
|
77
|
+
console.log(chalk.green("📦 Installing dependencies"));
|
|
78
|
+
execSync("npm install", { cwd: destinationFolder, stdio: [0, 1, 2] });
|
|
79
79
|
console.log("Adding TAO interface to PCI");
|
|
80
80
|
if (!packageData.source) {
|
|
81
81
|
console.error("Failed implementing TAO interface; No source property found in package.json.");
|
|
@@ -115,10 +115,11 @@ setResponse = (response: QtiVariableJSON) => {
|
|
|
115
115
|
newSourceFile = newSourceFile.substring(0, lastBracket) + defaultImplementation + newSourceFile.substring(lastBracket);
|
|
116
116
|
|
|
117
117
|
fs.writeFileSync(path.join(PACKAGE_ROOT_PATH, packageData.source), newSourceFile, "utf8");
|
|
118
|
-
console.log("TAO interface implemented");
|
|
118
|
+
console.log(chalk.green("TAO interface implemented"));
|
|
119
119
|
}
|
|
120
120
|
} else {
|
|
121
121
|
console.log("TAO interface already implemented");
|
|
122
122
|
}
|
|
123
|
+
console.log(chalk.green("Done!"));
|
|
123
124
|
};
|
|
124
125
|
|