@m2c2kit/cli 0.1.1 → 0.1.6
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 +5 -0
- package/dist/.env +1 -0
- package/dist/cli.js +396 -10
- package/dist/fonts/roboto/LICENSE.txt +202 -0
- package/dist/fonts/roboto/Roboto-Regular.ttf +0 -0
- package/dist/templates/README.md.handlebars +17 -15
- package/dist/templates/index.html.handlebars +23 -23
- package/dist/templates/launch.json.handlebars +15 -15
- package/dist/templates/m2c2kit.json.handlebars +5 -0
- package/dist/templates/package.json.handlebars +23 -20
- package/dist/templates/rollup.config.js.handlebars +16 -4
- package/dist/templates/starter.ts.handlebars +377 -99
- package/package.json +22 -13
|
@@ -1,99 +1,377 @@
|
|
|
1
|
-
import {
|
|
2
|
-
WebColors,
|
|
3
|
-
Action,
|
|
4
|
-
Game,
|
|
5
|
-
Scene,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
1
|
+
import {
|
|
2
|
+
WebColors,
|
|
3
|
+
Action,
|
|
4
|
+
Game,
|
|
5
|
+
Scene,
|
|
6
|
+
Sprite,
|
|
7
|
+
Point,
|
|
8
|
+
Label,
|
|
9
|
+
LabelHorizontalAlignmentMode,
|
|
10
|
+
Shape,
|
|
11
|
+
Rect,
|
|
12
|
+
GameOptions,
|
|
13
|
+
GameParameters,
|
|
14
|
+
TrialSchema,
|
|
15
|
+
Session,
|
|
16
|
+
GameTrialEvent,
|
|
17
|
+
GameLifecycleEvent,
|
|
18
|
+
} from "@m2c2kit/core";
|
|
19
|
+
import { Button, Instructions } from "@m2c2kit/addons";
|
|
20
|
+
|
|
21
|
+
class {{className}} extends Game {
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
+
constructor(specifiedParameters?: any) {
|
|
24
|
+
const defaultParameters: GameParameters = {
|
|
25
|
+
ReadyTime: {
|
|
26
|
+
value: 1000,
|
|
27
|
+
description:
|
|
28
|
+
"How long the 'get ready' message scene is shown, milliseconds",
|
|
29
|
+
},
|
|
30
|
+
TrialNum: { value: 3, description: "How many trials to run" },
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const demoTrialSchema: TrialSchema = {
|
|
34
|
+
colorChosen: { type: "string", description: "the color that was picked" },
|
|
35
|
+
correct: { type: "boolean", description: "was the answer correct?" },
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const options: GameOptions = {
|
|
39
|
+
name: "{{appName}}",
|
|
40
|
+
version: "1.0.0",
|
|
41
|
+
uri: "https://your-repo-or-webpage-here",
|
|
42
|
+
shortDescription: "A brief couple sentence description.",
|
|
43
|
+
longDescription: "An extended, many-sentence description.",
|
|
44
|
+
showFps: true,
|
|
45
|
+
trialSchema: demoTrialSchema,
|
|
46
|
+
parameters: defaultParameters,
|
|
47
|
+
// set this color so we can see the boundaries of the game during development,
|
|
48
|
+
// but typically we would not set this
|
|
49
|
+
bodyBackgroundColor: WebColors.Wheat,
|
|
50
|
+
// note: using 2:1 aspect ratio, because that is closer to modern phones
|
|
51
|
+
width: 400,
|
|
52
|
+
height: 800,
|
|
53
|
+
// set stretch to true if you want to fill the screen on large windows
|
|
54
|
+
// (e.g., iPad, desktop browser)
|
|
55
|
+
stretch: false,
|
|
56
|
+
// Roboto is included by default. Leave fontUrls unchanged, unless you want to use different font
|
|
57
|
+
fontUrls: ["./fonts/roboto/Roboto-Regular.ttf"],
|
|
58
|
+
// for each image below, you specify either a tag of an svg in the property "svgString"
|
|
59
|
+
// or you specify a URL to an image in the property "url",
|
|
60
|
+
// such as url: 'https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/android.svg'
|
|
61
|
+
images: [
|
|
62
|
+
{
|
|
63
|
+
name: "star",
|
|
64
|
+
height: 60,
|
|
65
|
+
width: 60,
|
|
66
|
+
svgString:
|
|
67
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="304" height="290"> <path d="M2,111 h300 l-242.7,176.3 92.7,-285.3 92.7,285.3 z" style="fill:#00FF00;stroke:#0000FF;stroke-width:15;stroke-linejoin:round"/></svg>',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "smiley",
|
|
71
|
+
height: 64,
|
|
72
|
+
width: 64,
|
|
73
|
+
svgString:
|
|
74
|
+
'<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="451.451 -28.549 1657.098 1657.098" enable-background="new 451.451 -28.549 1657.098 1657.098" xml:space="preserve"><g><g><circle cx="992.682" cy="640.47" r="66.818"/></g><g><circle cx="1558.728" cy="640.47" r="66.818"/></g><g><path d="M1280,1600c-107.984,0-212.756-21.157-311.407-62.883c-95.268-40.295-180.819-97.973-254.279-171.432c-73.459-73.459-131.137-159.01-171.432-254.278C501.157,1012.757,480,907.984,480,800s21.157-212.756,62.883-311.407c40.295-95.268,97.973-180.819,171.432-254.279c73.46-73.459,159.011-131.137,254.279-171.432C1067.244,21.157,1172.016,0,1280,0s212.757,21.157,311.407,62.883c95.268,40.295,180.819,97.973,254.278,171.432c73.459,73.46,131.137,159.011,171.432,254.279C2058.843,587.244,2080,692.016,2080,800s-21.157,212.757-62.883,311.407c-40.295,95.268-97.973,180.819-171.432,254.278s-159.01,131.137-254.278,171.432C1492.757,1578.843,1387.984,1600,1280,1600z M1280,71.591c-401.646,0-728.409,326.763-728.409,728.409S878.354,1528.409,1280,1528.409S2008.409,1201.646,2008.409,800C2008.409,398.354,1681.646,71.591,1280,71.591z"/></g><g><path d="M1665.953,1071.004c-213.156,213.156-558.75,213.156-771.905,0c20.534-20.534,41.068-41.068,61.602-61.602c179.134,179.134,469.567,179.134,648.7,0C1624.884,1029.936,1645.418,1050.47,1665.953,1071.004z"/></g><g><path d="M1167.066,463.279c-96.31-96.31-252.459-96.31-348.768,0c16.971,16.971,33.941,33.941,50.912,50.912c68.192-68.192,178.753-68.192,246.945,0C1133.125,497.22,1150.096,480.249,1167.066,463.279z"/></g><g><path d="M1733.112,463.279c-96.31-96.31-252.459-96.31-348.768,0c16.971,16.971,33.941,33.941,50.912,50.912c68.192-68.192,178.753-68.192,246.945,0C1699.171,497.22,1716.142,480.249,1733.112,463.279z"/></g></g></svg>',
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
super(options, specifiedParameters);
|
|
80
|
+
// just for convenience, alias the variable game to "this"
|
|
81
|
+
// (even though eslint doesn't like it)
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
83
|
+
const game = this;
|
|
84
|
+
|
|
85
|
+
const instructionsScenes = Instructions.Create({
|
|
86
|
+
sceneNamePrefix: "instructions",
|
|
87
|
+
backgroundColor: WebColors.White,
|
|
88
|
+
nextButtonBackgroundColor: WebColors.Black,
|
|
89
|
+
backButtonBackgroundColor: WebColors.Black,
|
|
90
|
+
instructionScenes: [
|
|
91
|
+
{
|
|
92
|
+
title: "{{appName}} Demo",
|
|
93
|
+
text: "For this task, you will click the red rectangle. Open the developer console to see the trial data and other output.",
|
|
94
|
+
textFontSize: 24,
|
|
95
|
+
titleFontSize: 30,
|
|
96
|
+
image: "smiley",
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
title: "{{appName}} Demo",
|
|
100
|
+
text: "Press START to begin!",
|
|
101
|
+
textFontSize: 24,
|
|
102
|
+
titleFontSize: 30,
|
|
103
|
+
textAlignmentMode: LabelHorizontalAlignmentMode.center,
|
|
104
|
+
textVerticalBias: 0.25,
|
|
105
|
+
nextButtonText: "START",
|
|
106
|
+
nextButtonBackgroundColor: WebColors.Green,
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
// this is the name of the scene to go to after the last instructions scene
|
|
110
|
+
postInstructionsScene: "getReady",
|
|
111
|
+
});
|
|
112
|
+
game.addScenes(instructionsScenes);
|
|
113
|
+
|
|
114
|
+
const getReadyScene = new Scene({
|
|
115
|
+
// Because this is the scene after the instructions, we must give
|
|
116
|
+
// it a name and provide it to postInstructionsScene, above
|
|
117
|
+
name: "getReady",
|
|
118
|
+
backgroundColor: WebColors.White,
|
|
119
|
+
});
|
|
120
|
+
game.addScene(getReadyScene);
|
|
121
|
+
|
|
122
|
+
const getReadyMessage = new Label({
|
|
123
|
+
text: "Get Ready",
|
|
124
|
+
fontSize: 24,
|
|
125
|
+
position: new Point(200, 400),
|
|
126
|
+
});
|
|
127
|
+
getReadyScene.addChild(getReadyMessage);
|
|
128
|
+
|
|
129
|
+
// example of how to use an image. The image must be previously loaded
|
|
130
|
+
const starSprite = new Sprite({
|
|
131
|
+
imageName: "star",
|
|
132
|
+
position: new Point(200, 500),
|
|
133
|
+
});
|
|
134
|
+
getReadyScene.addChild(starSprite);
|
|
135
|
+
|
|
136
|
+
// getReadyScene.setup() has a callback that is executed each time this scene is shown
|
|
137
|
+
getReadyScene.setup(() => {
|
|
138
|
+
getReadyScene.run(
|
|
139
|
+
Action.Sequence([
|
|
140
|
+
// Get the wait duration from the default game parameters, defined above
|
|
141
|
+
Action.Wait({ duration: game.getParameter("ReadyTime") }),
|
|
142
|
+
Action.Custom({
|
|
143
|
+
callback: () => {
|
|
144
|
+
game.presentScene(chooseRectangleScene);
|
|
145
|
+
},
|
|
146
|
+
}),
|
|
147
|
+
])
|
|
148
|
+
);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// these entities before the setup() can be defined outside of a setup()
|
|
152
|
+
// because they exist through multiple trials
|
|
153
|
+
// Their position and how they respond to interactions may differ across trials,
|
|
154
|
+
// and that logic will be written within a setup()
|
|
155
|
+
const chooseRectangleScene = new Scene({
|
|
156
|
+
backgroundColor: WebColors.LightGray,
|
|
157
|
+
});
|
|
158
|
+
game.addScene(chooseRectangleScene);
|
|
159
|
+
const redRect = new Shape({
|
|
160
|
+
rect: new Rect({ width: 150, height: 100 }),
|
|
161
|
+
fillColor: WebColors.Red,
|
|
162
|
+
});
|
|
163
|
+
chooseRectangleScene.addChild(redRect);
|
|
164
|
+
const blueRect = new Shape({
|
|
165
|
+
rect: new Rect({ width: 150, height: 100 }),
|
|
166
|
+
fillColor: WebColors.Blue,
|
|
167
|
+
});
|
|
168
|
+
chooseRectangleScene.addChild(blueRect);
|
|
169
|
+
const correctMessage = new Label({
|
|
170
|
+
text: "CORRECT!",
|
|
171
|
+
position: new Point(200, 500),
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
const chooseMessage = new Label({
|
|
175
|
+
text: "Choose the red rectangle",
|
|
176
|
+
position: new Point(200, 200),
|
|
177
|
+
});
|
|
178
|
+
chooseRectangleScene.addChild(chooseMessage);
|
|
179
|
+
|
|
180
|
+
correctMessage.hidden = true;
|
|
181
|
+
chooseRectangleScene.addChild(correctMessage);
|
|
182
|
+
const wrongMessage = new Label({
|
|
183
|
+
text: "WRONG!",
|
|
184
|
+
position: new Point(200, 500),
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
wrongMessage.hidden = true;
|
|
188
|
+
chooseRectangleScene.addChild(wrongMessage);
|
|
189
|
+
|
|
190
|
+
// chooseRectangleScene.setup() is passed a callback that is executed each
|
|
191
|
+
// time this scene is shown. Within setup(), We will randomly decide on
|
|
192
|
+
// what side the red rectangle is shown
|
|
193
|
+
chooseRectangleScene.setup(() => {
|
|
194
|
+
let redOnLeft = true;
|
|
195
|
+
if (Math.random() > 0.5) {
|
|
196
|
+
redOnLeft = false;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (redOnLeft) {
|
|
200
|
+
redRect.position = new Point(100, 300);
|
|
201
|
+
blueRect.position = new Point(300, 300);
|
|
202
|
+
} else {
|
|
203
|
+
redRect.position = new Point(300, 300);
|
|
204
|
+
blueRect.position = new Point(100, 300);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// helper function to record the user's choice and
|
|
208
|
+
// decide if we are done
|
|
209
|
+
function recordUserInput(choseRedRect: boolean) {
|
|
210
|
+
game.addTrialData("correct", choseRedRect);
|
|
211
|
+
if (choseRedRect) {
|
|
212
|
+
game.addTrialData("colorChosen", "red");
|
|
213
|
+
} else {
|
|
214
|
+
game.addTrialData("colorChosen", "blue");
|
|
215
|
+
}
|
|
216
|
+
game.trialComplete();
|
|
217
|
+
// have we finished the number of trials?
|
|
218
|
+
if (game.trialIndex < game.getParameter<number>("TrialNum")) {
|
|
219
|
+
game.presentScene(getReadyScene);
|
|
220
|
+
} else {
|
|
221
|
+
game.presentScene(endScene);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
redRect.isUserInteractionEnabled = true;
|
|
226
|
+
redRect.onTapDown(() => {
|
|
227
|
+
redRect.run(
|
|
228
|
+
Action.Sequence([
|
|
229
|
+
Action.Custom({
|
|
230
|
+
callback: () => {
|
|
231
|
+
// once a choice is made, don't allow additional taps
|
|
232
|
+
redRect.isUserInteractionEnabled = false;
|
|
233
|
+
blueRect.isUserInteractionEnabled = false;
|
|
234
|
+
},
|
|
235
|
+
}),
|
|
236
|
+
// short animation to shrink and grow button
|
|
237
|
+
Action.Scale({ scale: 0.8, duration: 250 }),
|
|
238
|
+
Action.Scale({ scale: 1, duration: 250 }),
|
|
239
|
+
// Show the "CORRECT" message
|
|
240
|
+
Action.Custom({
|
|
241
|
+
callback: () => {
|
|
242
|
+
correctMessage.hidden = false;
|
|
243
|
+
},
|
|
244
|
+
}),
|
|
245
|
+
Action.Wait({ duration: 1000 }),
|
|
246
|
+
// Handle the logic of recording data, and deciding if we should
|
|
247
|
+
// do another trial in recordUserInput
|
|
248
|
+
Action.Custom({
|
|
249
|
+
callback: () => {
|
|
250
|
+
correctMessage.hidden = true;
|
|
251
|
+
recordUserInput(true);
|
|
252
|
+
},
|
|
253
|
+
}),
|
|
254
|
+
])
|
|
255
|
+
);
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
blueRect.isUserInteractionEnabled = true;
|
|
259
|
+
blueRect.onTapDown(() => {
|
|
260
|
+
blueRect.run(
|
|
261
|
+
Action.Sequence([
|
|
262
|
+
Action.Custom({
|
|
263
|
+
callback: () => {
|
|
264
|
+
redRect.isUserInteractionEnabled = false;
|
|
265
|
+
blueRect.isUserInteractionEnabled = false;
|
|
266
|
+
},
|
|
267
|
+
}),
|
|
268
|
+
Action.Scale({ scale: 0.8, duration: 250 }),
|
|
269
|
+
Action.Scale({ scale: 1, duration: 250 }),
|
|
270
|
+
Action.Custom({
|
|
271
|
+
callback: () => {
|
|
272
|
+
wrongMessage.hidden = false;
|
|
273
|
+
},
|
|
274
|
+
}),
|
|
275
|
+
Action.Wait({ duration: 1000 }),
|
|
276
|
+
Action.Custom({
|
|
277
|
+
callback: () => {
|
|
278
|
+
wrongMessage.hidden = true;
|
|
279
|
+
recordUserInput(false);
|
|
280
|
+
},
|
|
281
|
+
}),
|
|
282
|
+
])
|
|
283
|
+
);
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
const endScene = new Scene();
|
|
288
|
+
game.addScene(endScene);
|
|
289
|
+
const doneLabel = new Label({
|
|
290
|
+
text: `This will be reassigned in the setup() callback. If you see this, something went wrong!`,
|
|
291
|
+
position: new Point(200, 300),
|
|
292
|
+
});
|
|
293
|
+
endScene.addChild(doneLabel);
|
|
294
|
+
|
|
295
|
+
const startOverButton = new Button({
|
|
296
|
+
text: "Start over",
|
|
297
|
+
position: new Point(200, 600),
|
|
298
|
+
});
|
|
299
|
+
startOverButton.isUserInteractionEnabled = true;
|
|
300
|
+
startOverButton.onTapDown(() => {
|
|
301
|
+
// in the setup() for the end scene, we animate the smiley sprite with
|
|
302
|
+
// a move action. if the user taps the start over button before the
|
|
303
|
+
// animation is completed, we should remove it by calling
|
|
304
|
+
// removeAllActions()
|
|
305
|
+
smileySprite.removeAllActions();
|
|
306
|
+
game.initData();
|
|
307
|
+
game.presentScene(getReadyScene);
|
|
308
|
+
});
|
|
309
|
+
endScene.addChild(startOverButton);
|
|
310
|
+
|
|
311
|
+
const exitButton = new Button({
|
|
312
|
+
text: "Exit",
|
|
313
|
+
position: new Point(200, 675),
|
|
314
|
+
});
|
|
315
|
+
exitButton.isUserInteractionEnabled = true;
|
|
316
|
+
exitButton.onTapDown(() => {
|
|
317
|
+
// hide the start over button
|
|
318
|
+
startOverButton.hidden = true;
|
|
319
|
+
// don't allow repeated taps on exit button
|
|
320
|
+
exitButton.isUserInteractionEnabled = false;
|
|
321
|
+
game.end();
|
|
322
|
+
});
|
|
323
|
+
endScene.addChild(exitButton);
|
|
324
|
+
|
|
325
|
+
const smileySprite = new Sprite({ imageName: "smiley" });
|
|
326
|
+
endScene.addChild(smileySprite);
|
|
327
|
+
|
|
328
|
+
endScene.setup(() => {
|
|
329
|
+
doneLabel.text = `You did ${game.trialIndex} trials. You're done!`;
|
|
330
|
+
|
|
331
|
+
// example of how to position a sprite and create an action to move it
|
|
332
|
+
smileySprite.position = new Point(200, 500);
|
|
333
|
+
smileySprite.run(
|
|
334
|
+
Action.Move({ point: new Point(200, 100), duration: 3000 })
|
|
335
|
+
);
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
game.entryScene = "instructions-01";
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// default was 3 trials; this is how we can specify a different value
|
|
343
|
+
const game1 = new {{className}}({ TrialNum: 2 });
|
|
344
|
+
|
|
345
|
+
const session = new Session({
|
|
346
|
+
activities: [game1],
|
|
347
|
+
gameCallbacks: {
|
|
348
|
+
// onGameTrialComplete() is where you insert code to post data to an API
|
|
349
|
+
// or interop with a native function in the host app, if applicable
|
|
350
|
+
onGameTrialComplete: (e: GameTrialEvent) => {
|
|
351
|
+
console.log(`********** trial ${e.trialIndex} complete`);
|
|
352
|
+
console.log("data: " + JSON.stringify(e.gameData));
|
|
353
|
+
console.log("trial schema: " + JSON.stringify(e.trialSchema));
|
|
354
|
+
console.log("game parameters: " + JSON.stringify(e.gameParameters));
|
|
355
|
+
},
|
|
356
|
+
// onGameEnd() is called when the user is done
|
|
357
|
+
onGameEnd: (e: GameLifecycleEvent) => {
|
|
358
|
+
if (e.ended) {
|
|
359
|
+
console.log(`user requested exit in game ${e.gameName}`);
|
|
360
|
+
// this session has only one activity, but this is how it would go to
|
|
361
|
+
// the next activity
|
|
362
|
+
if (session.nextActivity) {
|
|
363
|
+
session.advanceToNextActivity();
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
// make session also available on window in case we want to control
|
|
371
|
+
// the session through another means
|
|
372
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
373
|
+
(window as unknown as any).session = session;
|
|
374
|
+
|
|
375
|
+
session.init().then(() => {
|
|
376
|
+
session.start();
|
|
377
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m2c2kit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "m2c2kit command line interface",
|
|
5
5
|
"module": "dist/cli.js",
|
|
6
6
|
"files": [
|
|
@@ -10,26 +10,35 @@
|
|
|
10
10
|
"bin": {
|
|
11
11
|
"m2": "./dist/cli.js"
|
|
12
12
|
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=16.0.0"
|
|
15
|
+
},
|
|
13
16
|
"scripts": {
|
|
14
|
-
"build": "npm run clean && npm run compile && npm run copy-files",
|
|
17
|
+
"build": "npm run clean && npm run compile && npm run copy-files && npm run write-dotenv",
|
|
15
18
|
"compile": "tsc",
|
|
16
19
|
"clean": "rimraf dist/ && rimraf build/",
|
|
17
|
-
"copy-files": "copyfiles -f build/src/cli.js dist && copyfiles templates/* dist/"
|
|
20
|
+
"copy-files": "copyfiles -f build/src/cli.js dist && copyfiles templates/* fonts/**/* dist/",
|
|
21
|
+
"write-dotenv": "node write-dotenv.js"
|
|
18
22
|
},
|
|
19
23
|
"author": "",
|
|
20
24
|
"license": "MIT",
|
|
21
25
|
"dependencies": {
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
+
"axios": "0.24.0",
|
|
27
|
+
"chalk": "5.0.0",
|
|
28
|
+
"conf": "10.1.1",
|
|
29
|
+
"form-data": "4.0.0",
|
|
30
|
+
"handlebars": "4.7.7",
|
|
31
|
+
"ora": "6.0.1",
|
|
32
|
+
"prompts": "2.4.2"
|
|
26
33
|
},
|
|
27
34
|
"devDependencies": {
|
|
28
|
-
"@types/node": "
|
|
29
|
-
"@types/
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
35
|
+
"@types/node": "17.0.8",
|
|
36
|
+
"@types/prompts": "2.0.14",
|
|
37
|
+
"@types/yargs": "17.0.8",
|
|
38
|
+
"copyfiles": "2.4.1",
|
|
39
|
+
"rimraf": "3.0.2",
|
|
40
|
+
"tslib": "2.3.1",
|
|
41
|
+
"typescript": "4.5.4",
|
|
42
|
+
"yargs": "17.3.1"
|
|
34
43
|
}
|
|
35
44
|
}
|