@liascript/exporter 2.6.44--0.17.7 → 2.6.44--0.17.8
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/dist/assets/capacitor/{index.7c29f1f8.js → index.77092ea5.js} +2 -2
- package/dist/assets/capacitor/{index.ac58c346.js → index.7c990c90.js} +2 -2
- package/dist/assets/{scorm2004/index.3855b56a.css → capacitor/index.d32274ee.css} +1 -1
- package/dist/assets/capacitor/index.html +1 -1
- package/dist/assets/indexeddb/index.338caa69.js +1 -0
- package/dist/assets/{xapi/index.d1b052a6.js → indexeddb/index.37fff01c.js} +1 -1
- package/dist/assets/{capacitor/index.3855b56a.css → indexeddb/index.d32274ee.css} +1 -1
- package/dist/assets/indexeddb/index.html +1 -1
- package/dist/assets/indexeddb/{jszip.min.63142cc8.js → jszip.min.4fbcc13f.js} +1 -1
- package/dist/assets/pdf/index.2a155247.js +1 -0
- package/dist/assets/pdf/{index.c81a848e.css → index.d4376f7a.css} +1 -1
- package/dist/assets/pdf/index.f1056b07.js +1 -0
- package/dist/assets/pdf/index.html +1 -1
- package/dist/assets/scorm1.2/index.4459769d.js +1 -0
- package/dist/assets/scorm1.2/index.472f9b84.js +1 -0
- package/dist/assets/scorm1.2/{index.3855b56a.css → index.d32274ee.css} +1 -1
- package/dist/assets/scorm1.2/index.html +1 -1
- package/dist/assets/{web/jszip.min.63142cc8.js → scorm1.2/jszip.min.4fbcc13f.js} +1 -1
- package/dist/assets/scorm2004/index.88bf9b7c.js +1 -0
- package/dist/assets/scorm2004/index.93c61dcb.js +1 -0
- package/dist/assets/{indexeddb/index.3855b56a.css → scorm2004/index.d32274ee.css} +1 -1
- package/dist/assets/scorm2004/index.html +1 -1
- package/dist/assets/web/index.2d3e116d.js +1 -0
- package/dist/assets/web/index.99fe9bd1.js +1 -0
- package/dist/assets/web/index.d32274ee.css +1 -0
- package/dist/assets/web/index.html +1 -1
- package/dist/assets/{scorm1.2/jszip.min.63142cc8.js → web/jszip.min.4fbcc13f.js} +1 -1
- package/dist/assets/web/{jszip.min.19c66d77.js → jszip.min.eaecf580.js} +1 -1
- package/dist/assets/xapi/index.bceeb4a9.js +1 -0
- package/dist/assets/xapi/index.cdc6535a.js +1 -0
- package/dist/assets/xapi/index.d32274ee.css +1 -0
- package/dist/assets/xapi/index.html +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/.github/workflows/test-action.yml +0 -231
- package/action/README.md +0 -263
- package/action/dist/action.js +0 -293
- package/action/dist/index.js +0 -28372
- package/action/dist/inputs.js +0 -173
- package/action/dist/utils.js +0 -320
- package/action/examples/matrix-build.yml +0 -64
- package/action/examples/multi-course.yml +0 -39
- package/action/examples/single-course.yml +0 -42
- package/action/package-lock.json +0 -5286
- package/action/package.json +0 -32
- package/action/src/action.ts +0 -306
- package/action/src/inputs.ts +0 -237
- package/action/src/utils.ts +0 -314
- package/action/tsconfig.json +0 -32
- package/dist/assets/indexeddb/index.08d2ff9e.js +0 -1
- package/dist/assets/indexeddb/index.0b473014.js +0 -1
- package/dist/assets/pdf/index.736768e2.js +0 -1
- package/dist/assets/pdf/index.7c8f0682.js +0 -1
- package/dist/assets/scorm1.2/index.c9f06556.js +0 -1
- package/dist/assets/scorm1.2/index.f31e5689.js +0 -1
- package/dist/assets/scorm2004/index.42e8223c.js +0 -1
- package/dist/assets/scorm2004/index.773e56c6.js +0 -1
- package/dist/assets/web/index.2913fc8a.js +0 -1
- package/dist/assets/web/index.3855b56a.css +0 -1
- package/dist/assets/web/index.4b421cf7.js +0 -1
- package/dist/assets/xapi/index.0ef29ba3.js +0 -1
- package/dist/assets/xapi/index.3855b56a.css +0 -1
- /package/dist/assets/{scorm1.2 → capacitor}/jszip.min.eaecf580.js +0 -0
- /package/dist/assets/{capacitor → scorm1.2}/jszip.min.19c66d77.js +0 -0
package/action/package.json
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "liascript-exporter-action",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "GitHub Action for LiaScript-Exporter",
|
|
5
|
-
"private": true,
|
|
6
|
-
"main": "dist/action.js",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsc && ncc build dist/action.js -o dist --license licenses.txt",
|
|
9
|
-
"build:dev": "tsc && ncc build dist/action.js -o dist --source-map --license licenses.txt",
|
|
10
|
-
"clean": "rm -rf dist/*",
|
|
11
|
-
"test": "jest",
|
|
12
|
-
"lint": "eslint src/**/*.ts"
|
|
13
|
-
},
|
|
14
|
-
"dependencies": {
|
|
15
|
-
"@actions/core": "^1.10.1",
|
|
16
|
-
"@actions/github": "^6.0.0",
|
|
17
|
-
"@actions/io": "^1.1.3"
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@types/node": "^20.0.0",
|
|
21
|
-
"@vercel/ncc": "^0.38.1",
|
|
22
|
-
"typescript": "^4.9.5",
|
|
23
|
-
"jest": "^29.7.0",
|
|
24
|
-
"@types/jest": "^29.5.5",
|
|
25
|
-
"eslint": "^8.50.0",
|
|
26
|
-
"@typescript-eslint/parser": "^6.7.4",
|
|
27
|
-
"@typescript-eslint/eslint-plugin": "^6.7.4"
|
|
28
|
-
},
|
|
29
|
-
"engines": {
|
|
30
|
-
"node": ">=20.0.0"
|
|
31
|
-
}
|
|
32
|
-
}
|
package/action/src/action.ts
DELETED
|
@@ -1,306 +0,0 @@
|
|
|
1
|
-
import * as core from '@actions/core';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import { parseInputs, validateInputs, logInputs, LiaScriptExporterArgs } from './inputs';
|
|
4
|
-
import {
|
|
5
|
-
resolvePaths,
|
|
6
|
-
validateFiles,
|
|
7
|
-
findOutputFiles,
|
|
8
|
-
generateOutputName,
|
|
9
|
-
ensureOutputDirectory,
|
|
10
|
-
getFileSize
|
|
11
|
-
} from './utils';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Main action execution function
|
|
15
|
-
*/
|
|
16
|
-
export async function run(): Promise<void> {
|
|
17
|
-
try {
|
|
18
|
-
core.info('Starting LiaScript Exporter Action');
|
|
19
|
-
|
|
20
|
-
// Parse and validate inputs
|
|
21
|
-
core.startGroup('Parsing inputs');
|
|
22
|
-
let args = parseInputs();
|
|
23
|
-
logInputs(args);
|
|
24
|
-
validateInputs(args);
|
|
25
|
-
core.endGroup();
|
|
26
|
-
|
|
27
|
-
// Generate output name if not specified
|
|
28
|
-
if (args.output === 'output') {
|
|
29
|
-
args.output = generateOutputName(args);
|
|
30
|
-
core.info(`Generated output name: ${args.output}`);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Resolve file paths
|
|
34
|
-
core.startGroup('Resolving paths');
|
|
35
|
-
args = resolvePaths(args);
|
|
36
|
-
core.info(`Resolved input file: ${args.input}`);
|
|
37
|
-
core.info(`Resolved course path: ${args.path || 'not set'}`);
|
|
38
|
-
core.info(`Resolved readme path: ${args.readme}`);
|
|
39
|
-
validateFiles(args);
|
|
40
|
-
core.endGroup();
|
|
41
|
-
|
|
42
|
-
// Ensure output directory exists
|
|
43
|
-
ensureOutputDirectory();
|
|
44
|
-
|
|
45
|
-
// Install CLI dependencies
|
|
46
|
-
core.startGroup('Installing CLI dependencies');
|
|
47
|
-
const dependenciesInstalled = await installCliDependencies();
|
|
48
|
-
core.endGroup();
|
|
49
|
-
|
|
50
|
-
if (!dependenciesInstalled) {
|
|
51
|
-
core.setFailed('Failed to install CLI dependencies');
|
|
52
|
-
core.setOutput('success', 'false');
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Execute the export
|
|
57
|
-
core.startGroup(`Exporting to ${args.format}`);
|
|
58
|
-
const success = await executeExport(args);
|
|
59
|
-
core.endGroup();
|
|
60
|
-
|
|
61
|
-
if (success) {
|
|
62
|
-
// Find and set outputs
|
|
63
|
-
const outputFiles = findOutputFiles(args);
|
|
64
|
-
|
|
65
|
-
if (outputFiles.length > 0) {
|
|
66
|
-
const primaryOutputFile = outputFiles[0];
|
|
67
|
-
const fileSize = getFileSize(primaryOutputFile);
|
|
68
|
-
|
|
69
|
-
core.setOutput('output-file', primaryOutputFile);
|
|
70
|
-
core.setOutput('file-size', fileSize.toString());
|
|
71
|
-
core.setOutput('format', args.format);
|
|
72
|
-
core.setOutput('success', 'true');
|
|
73
|
-
|
|
74
|
-
core.info(`Successfully exported to: ${primaryOutputFile}`);
|
|
75
|
-
core.info(`File size: ${fileSize} bytes`);
|
|
76
|
-
|
|
77
|
-
if (outputFiles.length > 1) {
|
|
78
|
-
core.info(`Additional files generated: ${outputFiles.slice(1).join(', ')}`);
|
|
79
|
-
}
|
|
80
|
-
} else {
|
|
81
|
-
core.setFailed('Export completed but no output files found');
|
|
82
|
-
core.setOutput('success', 'false');
|
|
83
|
-
}
|
|
84
|
-
} else {
|
|
85
|
-
core.setFailed('Export failed');
|
|
86
|
-
core.setOutput('success', 'false');
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
} catch (error) {
|
|
90
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
91
|
-
core.setFailed(`Action failed: ${errorMessage}`);
|
|
92
|
-
core.setOutput('success', 'false');
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Install CLI dependencies in the main directory
|
|
98
|
-
*/
|
|
99
|
-
async function installCliDependencies(): Promise<boolean> {
|
|
100
|
-
try {
|
|
101
|
-
const mainDir = path.resolve(__dirname, '../../');
|
|
102
|
-
const nodeModulesPath = path.join(mainDir, 'node_modules');
|
|
103
|
-
|
|
104
|
-
// Check if node_modules already exists and has content
|
|
105
|
-
try {
|
|
106
|
-
const fs = require('fs');
|
|
107
|
-
const nodeModulesExists = fs.existsSync(nodeModulesPath);
|
|
108
|
-
if (nodeModulesExists) {
|
|
109
|
-
const nodeModulesStats = fs.readdirSync(nodeModulesPath);
|
|
110
|
-
if (nodeModulesStats.length > 0) {
|
|
111
|
-
core.info(`Dependencies already installed in ${nodeModulesPath} (${nodeModulesStats.length} packages found)`);
|
|
112
|
-
return true;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
} catch (checkError) {
|
|
116
|
-
core.info('Could not check existing node_modules, proceeding with installation');
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
core.info(`Installing CLI dependencies in: ${mainDir}`);
|
|
120
|
-
|
|
121
|
-
const { spawn } = require('child_process');
|
|
122
|
-
|
|
123
|
-
return new Promise((resolve, reject) => {
|
|
124
|
-
const child = spawn('npm', ['install', '--omit=dev', '--no-audit', '--no-fund'], {
|
|
125
|
-
cwd: mainDir,
|
|
126
|
-
stdio: ['pipe', 'pipe', 'pipe']
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
let stdout = '';
|
|
130
|
-
let stderr = '';
|
|
131
|
-
|
|
132
|
-
child.stdout?.on('data', (data: Buffer) => {
|
|
133
|
-
const output = data.toString();
|
|
134
|
-
stdout += output;
|
|
135
|
-
// Log npm install progress
|
|
136
|
-
core.info(`npm install: ${output.trim()}`);
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
child.stderr?.on('data', (data: Buffer) => {
|
|
140
|
-
const output = data.toString();
|
|
141
|
-
stderr += output;
|
|
142
|
-
// npm often sends normal output to stderr, so treat it as info unless it's clearly an error
|
|
143
|
-
if (output.toLowerCase().includes('error')) {
|
|
144
|
-
core.error(`npm install error: ${output.trim()}`);
|
|
145
|
-
} else {
|
|
146
|
-
core.info(`npm install: ${output.trim()}`);
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
child.on('close', (code: number | null) => {
|
|
151
|
-
if (code === 0) {
|
|
152
|
-
core.info('CLI dependencies installed successfully');
|
|
153
|
-
resolve(true);
|
|
154
|
-
} else {
|
|
155
|
-
core.error(`npm install exited with code ${code}`);
|
|
156
|
-
if (stderr) {
|
|
157
|
-
core.error(`npm install error output: ${stderr}`);
|
|
158
|
-
}
|
|
159
|
-
resolve(false);
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
child.on('error', (error: Error) => {
|
|
164
|
-
core.error(`Failed to run npm install: ${error.message}`);
|
|
165
|
-
reject(error);
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
} catch (error) {
|
|
170
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
171
|
-
core.error(`Failed to install CLI dependencies: ${errorMessage}`);
|
|
172
|
-
return false;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Execute the LiaScript export using the local CLI
|
|
178
|
-
*/
|
|
179
|
-
async function executeExport(args: LiaScriptExporterArgs): Promise<boolean> {
|
|
180
|
-
try {
|
|
181
|
-
// Use the local CLI from this repository
|
|
182
|
-
const cliPath = path.resolve(__dirname, '../../dist/index.js');
|
|
183
|
-
core.info(`Using local CLI from: ${cliPath}`);
|
|
184
|
-
|
|
185
|
-
// Verify CLI exists
|
|
186
|
-
if (!require('fs').existsSync(cliPath)) {
|
|
187
|
-
throw new Error(`CLI not found at ${cliPath}. Please run 'npm run build' in the main directory first.`);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// Build command arguments for the local CLI
|
|
191
|
-
const cliArgs = buildCliArguments(args);
|
|
192
|
-
core.info(`CLI command: node ${path.basename(cliPath)} [${cliArgs.length} arguments]`);
|
|
193
|
-
|
|
194
|
-
// Execute the local CLI using spawn
|
|
195
|
-
const { spawn } = require('child_process');
|
|
196
|
-
|
|
197
|
-
return new Promise((resolve, reject) => {
|
|
198
|
-
const child = spawn('node', [cliPath, ...cliArgs], {
|
|
199
|
-
stdio: ['pipe', 'pipe', 'pipe']
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
let stdout = '';
|
|
203
|
-
let stderr = '';
|
|
204
|
-
|
|
205
|
-
child.stdout?.on('data', (data: Buffer) => {
|
|
206
|
-
const output = data.toString();
|
|
207
|
-
stdout += output;
|
|
208
|
-
core.info(output.trim());
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
child.stderr?.on('data', (data: Buffer) => {
|
|
212
|
-
const output = data.toString();
|
|
213
|
-
stderr += output;
|
|
214
|
-
|
|
215
|
-
// Filter out known benign messages
|
|
216
|
-
const trimmedOutput = output.trim();
|
|
217
|
-
if (!trimmedOutput) return; // Skip empty lines
|
|
218
|
-
|
|
219
|
-
// Filter out "Error: null" and "null" messages from temporary directories (CLI internal, not actual errors)
|
|
220
|
-
if (trimmedOutput.startsWith('Error: null /tmp/lia') ||
|
|
221
|
-
trimmedOutput.startsWith('null /tmp/lia') ||
|
|
222
|
-
trimmedOutput.startsWith('Error: null /var/folders') ||
|
|
223
|
-
trimmedOutput.startsWith('null /var/folders')) {
|
|
224
|
-
core.info(`CLI temp: ${trimmedOutput}`);
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// Log warnings and debug info, but don't treat as errors
|
|
229
|
-
if (output.toLowerCase().includes('warn')) {
|
|
230
|
-
core.warning(trimmedOutput);
|
|
231
|
-
} else if (output.toLowerCase().includes('debug')) {
|
|
232
|
-
core.info(`DEBUG: ${trimmedOutput}`);
|
|
233
|
-
} else {
|
|
234
|
-
core.error(trimmedOutput);
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
child.on('close', (code: number | null) => {
|
|
239
|
-
if (code === 0) {
|
|
240
|
-
core.info('CLI execution completed successfully');
|
|
241
|
-
resolve(true);
|
|
242
|
-
} else {
|
|
243
|
-
core.error(`CLI exited with code ${code}`);
|
|
244
|
-
if (stderr) {
|
|
245
|
-
core.error(`Error output: ${stderr}`);
|
|
246
|
-
}
|
|
247
|
-
resolve(false);
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
child.on('error', (error: Error) => {
|
|
252
|
-
core.error(`Failed to spawn CLI process: ${error.message}`);
|
|
253
|
-
reject(error);
|
|
254
|
-
});
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
} catch (error) {
|
|
258
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
259
|
-
core.error(`Export execution failed: ${errorMessage}`);
|
|
260
|
-
return false;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Convert action arguments to CLI arguments
|
|
266
|
-
*/
|
|
267
|
-
function buildCliArguments(args: LiaScriptExporterArgs): string[] {
|
|
268
|
-
const cliArgs: string[] = [];
|
|
269
|
-
|
|
270
|
-
// Core arguments
|
|
271
|
-
cliArgs.push('--input', args.input);
|
|
272
|
-
cliArgs.push('--format', args.format);
|
|
273
|
-
cliArgs.push('--output', args.output);
|
|
274
|
-
|
|
275
|
-
if (args.path) {
|
|
276
|
-
cliArgs.push('--path', args.path);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
if (args.style) {
|
|
280
|
-
cliArgs.push('--style', args.style);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
if (args.key) {
|
|
284
|
-
cliArgs.push('--key', args.key);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
// Add format-specific arguments
|
|
288
|
-
Object.entries(args).forEach(([key, value]) => {
|
|
289
|
-
if (key.includes('-') && value !== undefined && value !== false && value !== '') {
|
|
290
|
-
if (typeof value === 'boolean' && value === true) {
|
|
291
|
-
cliArgs.push(`--${key}`);
|
|
292
|
-
} else if (typeof value === 'string' || typeof value === 'number') {
|
|
293
|
-
cliArgs.push(`--${key}`, String(value));
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
return cliArgs;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
// Run the action if this file is executed directly
|
|
302
|
-
if (require.main === module) {
|
|
303
|
-
run().catch(error => {
|
|
304
|
-
core.setFailed(error.message);
|
|
305
|
-
});
|
|
306
|
-
}
|
package/action/src/inputs.ts
DELETED
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
import * as core from '@actions/core';
|
|
2
|
-
|
|
3
|
-
export interface LiaScriptExporterArgs {
|
|
4
|
-
input: string;
|
|
5
|
-
readme: string;
|
|
6
|
-
output: string;
|
|
7
|
-
format: string;
|
|
8
|
-
path?: string;
|
|
9
|
-
key?: string;
|
|
10
|
-
style?: string;
|
|
11
|
-
|
|
12
|
-
// SCORM settings
|
|
13
|
-
'scorm-organization'?: string;
|
|
14
|
-
'scorm-masteryScore'?: string;
|
|
15
|
-
'scorm-typicalDuration'?: string;
|
|
16
|
-
'scorm-iframe'?: boolean;
|
|
17
|
-
'scorm-embed'?: boolean;
|
|
18
|
-
'scorm-alwaysActive'?: boolean;
|
|
19
|
-
|
|
20
|
-
// IMS settings
|
|
21
|
-
'ims-indexeddb'?: boolean;
|
|
22
|
-
|
|
23
|
-
// Web settings
|
|
24
|
-
'web-zip'?: boolean;
|
|
25
|
-
'web-indexeddb'?: boolean;
|
|
26
|
-
'web-iframe'?: boolean;
|
|
27
|
-
|
|
28
|
-
// PDF settings
|
|
29
|
-
'pdf-preview'?: boolean;
|
|
30
|
-
'pdf-scale'?: string;
|
|
31
|
-
'pdf-displayHeaderFooter'?: boolean;
|
|
32
|
-
'pdf-headerTemplate'?: string;
|
|
33
|
-
'pdf-footerTemplate'?: string;
|
|
34
|
-
'pdf-printBackground'?: boolean;
|
|
35
|
-
'pdf-landscape'?: boolean;
|
|
36
|
-
'pdf-format'?: string;
|
|
37
|
-
'pdf-width'?: string;
|
|
38
|
-
'pdf-height'?: string;
|
|
39
|
-
'pdf-margin-top'?: string;
|
|
40
|
-
'pdf-margin-bottom'?: string;
|
|
41
|
-
'pdf-margin-right'?: string;
|
|
42
|
-
'pdf-margin-left'?: string;
|
|
43
|
-
'pdf-preferCSSPageSize'?: boolean;
|
|
44
|
-
'pdf-omitBackground'?: boolean;
|
|
45
|
-
'pdf-timeout'?: string;
|
|
46
|
-
'pdf-stylesheet'?: string;
|
|
47
|
-
'pdf-theme'?: string;
|
|
48
|
-
|
|
49
|
-
// Project settings
|
|
50
|
-
'project-no-meta'?: boolean;
|
|
51
|
-
'project-no-rdf'?: boolean;
|
|
52
|
-
'project-no-categories'?: boolean;
|
|
53
|
-
'project-category-blur'?: boolean;
|
|
54
|
-
'project-generate-pdf'?: boolean;
|
|
55
|
-
'project-generate-ims'?: boolean;
|
|
56
|
-
'project-generate-scorm12'?: boolean;
|
|
57
|
-
'project-generate-scorm2004'?: boolean;
|
|
58
|
-
'project-generate-android'?: boolean;
|
|
59
|
-
'project-generate-cache'?: boolean;
|
|
60
|
-
|
|
61
|
-
// RDF settings
|
|
62
|
-
'rdf-format'?: string;
|
|
63
|
-
'rdf-preview'?: boolean;
|
|
64
|
-
'rdf-url'?: string;
|
|
65
|
-
'rdf-type'?: string;
|
|
66
|
-
'rdf-license'?: string;
|
|
67
|
-
'rdf-educationalLevel'?: string;
|
|
68
|
-
'rdf-template'?: string;
|
|
69
|
-
|
|
70
|
-
// xAPI settings
|
|
71
|
-
'xapi-endpoint'?: string;
|
|
72
|
-
'xapi-auth'?: string;
|
|
73
|
-
'xapi-actor'?: string;
|
|
74
|
-
'xapi-course-id'?: string;
|
|
75
|
-
'xapi-course-title'?: string;
|
|
76
|
-
'xapi-debug'?: boolean;
|
|
77
|
-
'xapi-zip'?: boolean;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Helper function to safely get boolean inputs, handling empty/undefined values
|
|
82
|
-
*/
|
|
83
|
-
function getBooleanInput(name: string, defaultValue: boolean = false): boolean {
|
|
84
|
-
const input = core.getInput(name);
|
|
85
|
-
return input ? core.getBooleanInput(name) : defaultValue;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Parse and validate GitHub Action inputs into LiaScript Exporter arguments
|
|
90
|
-
*/
|
|
91
|
-
export function parseInputs(): LiaScriptExporterArgs {
|
|
92
|
-
// Core required inputs
|
|
93
|
-
const inputFile = core.getInput('input-file', { required: true });
|
|
94
|
-
const format = core.getInput('format', { required: true });
|
|
95
|
-
|
|
96
|
-
// Optional core inputs
|
|
97
|
-
const outputName = core.getInput('output-name') || 'output';
|
|
98
|
-
const coursePath = core.getInput('course-path');
|
|
99
|
-
|
|
100
|
-
// Validate format
|
|
101
|
-
const validFormats = [
|
|
102
|
-
'scorm1.2', 'scorm2004', 'pdf', 'web', 'ims', 'xapi', 'rdf', 'json', 'project'
|
|
103
|
-
];
|
|
104
|
-
|
|
105
|
-
if (!validFormats.includes(format.toLowerCase())) {
|
|
106
|
-
throw new Error(`Invalid format '${format}'. Valid formats: ${validFormats.join(', ')}`);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// Build the arguments object
|
|
110
|
-
const args: LiaScriptExporterArgs = {
|
|
111
|
-
input: inputFile,
|
|
112
|
-
readme: inputFile, // Will be adjusted in path resolution
|
|
113
|
-
output: outputName,
|
|
114
|
-
format: format.toLowerCase(),
|
|
115
|
-
path: coursePath,
|
|
116
|
-
key: core.getInput('responsive-voice-key') || undefined,
|
|
117
|
-
style: core.getInput('style') || undefined,
|
|
118
|
-
|
|
119
|
-
// SCORM settings
|
|
120
|
-
'scorm-organization': core.getInput('scorm-organization') || undefined,
|
|
121
|
-
'scorm-masteryScore': core.getInput('scorm-mastery-score') || undefined,
|
|
122
|
-
'scorm-typicalDuration': core.getInput('scorm-typical-duration') || 'PT0H5M0S',
|
|
123
|
-
'scorm-iframe': getBooleanInput('scorm-iframe'),
|
|
124
|
-
'scorm-embed': getBooleanInput('scorm-embed'),
|
|
125
|
-
'scorm-alwaysActive': getBooleanInput('scorm-always-active'),
|
|
126
|
-
|
|
127
|
-
// IMS settings
|
|
128
|
-
'ims-indexeddb': getBooleanInput('ims-indexeddb'),
|
|
129
|
-
|
|
130
|
-
// Web settings
|
|
131
|
-
'web-zip': getBooleanInput('web-zip', true), // Default to true
|
|
132
|
-
'web-indexeddb': getBooleanInput('web-indexeddb'),
|
|
133
|
-
'web-iframe': getBooleanInput('web-iframe'),
|
|
134
|
-
|
|
135
|
-
// PDF settings
|
|
136
|
-
'pdf-scale': core.getInput('pdf-scale') || '1',
|
|
137
|
-
'pdf-printBackground': getBooleanInput('pdf-print-background'),
|
|
138
|
-
'pdf-landscape': getBooleanInput('pdf-landscape'),
|
|
139
|
-
'pdf-format': core.getInput('pdf-format') || 'A4',
|
|
140
|
-
'pdf-stylesheet': core.getInput('pdf-stylesheet') || undefined,
|
|
141
|
-
'pdf-theme': core.getInput('pdf-theme') || 'default',
|
|
142
|
-
|
|
143
|
-
// RDF settings
|
|
144
|
-
'rdf-format': core.getInput('rdf-format') || 'json-ld',
|
|
145
|
-
'rdf-url': core.getInput('rdf-url') || undefined,
|
|
146
|
-
'rdf-type': core.getInput('rdf-type') || 'Course',
|
|
147
|
-
'rdf-license': core.getInput('rdf-license') || undefined,
|
|
148
|
-
'rdf-educationalLevel': core.getInput('rdf-educational-level') || undefined,
|
|
149
|
-
|
|
150
|
-
// xAPI settings
|
|
151
|
-
'xapi-endpoint': core.getInput('xapi-endpoint') || undefined,
|
|
152
|
-
'xapi-auth': core.getInput('xapi-auth') || undefined,
|
|
153
|
-
'xapi-actor': core.getInput('xapi-actor') || undefined,
|
|
154
|
-
'xapi-course-id': core.getInput('xapi-course-id') || undefined,
|
|
155
|
-
'xapi-course-title': core.getInput('xapi-course-title') || undefined,
|
|
156
|
-
'xapi-debug': getBooleanInput('xapi-debug'),
|
|
157
|
-
'xapi-zip': getBooleanInput('xapi-zip'),
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
return args;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Validate required inputs based on format
|
|
165
|
-
*/
|
|
166
|
-
export function validateInputs(args: LiaScriptExporterArgs): void {
|
|
167
|
-
// Format-specific validations
|
|
168
|
-
switch (args.format) {
|
|
169
|
-
case 'xapi':
|
|
170
|
-
if (args['xapi-endpoint'] && !isValidUrl(args['xapi-endpoint'])) {
|
|
171
|
-
throw new Error('xapi-endpoint must be a valid URL');
|
|
172
|
-
}
|
|
173
|
-
break;
|
|
174
|
-
|
|
175
|
-
case 'rdf':
|
|
176
|
-
if (args['rdf-url'] && !isValidUrl(args['rdf-url'])) {
|
|
177
|
-
throw new Error('rdf-url must be a valid URL');
|
|
178
|
-
}
|
|
179
|
-
if (args['rdf-license'] && !isValidUrl(args['rdf-license'])) {
|
|
180
|
-
throw new Error('rdf-license must be a valid URL');
|
|
181
|
-
}
|
|
182
|
-
break;
|
|
183
|
-
|
|
184
|
-
case 'pdf':
|
|
185
|
-
if (args['pdf-scale']) {
|
|
186
|
-
const scale = parseFloat(args['pdf-scale']);
|
|
187
|
-
if (isNaN(scale) || scale <= 0 || scale > 2) {
|
|
188
|
-
throw new Error('pdf-scale must be a number between 0 and 2');
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
break;
|
|
192
|
-
|
|
193
|
-
case 'scorm1.2':
|
|
194
|
-
case 'scorm2004':
|
|
195
|
-
if (args['scorm-masteryScore']) {
|
|
196
|
-
const score = parseInt(args['scorm-masteryScore'], 10);
|
|
197
|
-
if (isNaN(score) || score < 0 || score > 100) {
|
|
198
|
-
throw new Error('scorm-mastery-score must be a number between 0 and 100');
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
break;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Helper function to validate URLs
|
|
207
|
-
*/
|
|
208
|
-
function isValidUrl(url: string): boolean {
|
|
209
|
-
try {
|
|
210
|
-
new URL(url);
|
|
211
|
-
return true;
|
|
212
|
-
} catch {
|
|
213
|
-
return false;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Log the parsed inputs for debugging
|
|
219
|
-
*/
|
|
220
|
-
export function logInputs(args: LiaScriptExporterArgs): void {
|
|
221
|
-
core.info(`input: ${args.input}`);
|
|
222
|
-
core.info(`format: ${args.format}`);
|
|
223
|
-
core.info(`output: ${args.output}`);
|
|
224
|
-
if (args.path) core.info(`path: ${args.path}`);
|
|
225
|
-
|
|
226
|
-
// Log non-default settings
|
|
227
|
-
Object.entries(args).forEach(([key, value]) => {
|
|
228
|
-
if (key.includes('-') && value !== undefined && value !== false && value !== '') {
|
|
229
|
-
// Simple masking for sensitive fields
|
|
230
|
-
if (key.includes('key') || key.includes('auth')) {
|
|
231
|
-
core.info(`${key}: ***`);
|
|
232
|
-
} else {
|
|
233
|
-
core.info(`${key}: ${value}`);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
}
|