@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.
Files changed (65) hide show
  1. package/dist/assets/capacitor/{index.7c29f1f8.js → index.77092ea5.js} +2 -2
  2. package/dist/assets/capacitor/{index.ac58c346.js → index.7c990c90.js} +2 -2
  3. package/dist/assets/{scorm2004/index.3855b56a.css → capacitor/index.d32274ee.css} +1 -1
  4. package/dist/assets/capacitor/index.html +1 -1
  5. package/dist/assets/indexeddb/index.338caa69.js +1 -0
  6. package/dist/assets/{xapi/index.d1b052a6.js → indexeddb/index.37fff01c.js} +1 -1
  7. package/dist/assets/{capacitor/index.3855b56a.css → indexeddb/index.d32274ee.css} +1 -1
  8. package/dist/assets/indexeddb/index.html +1 -1
  9. package/dist/assets/indexeddb/{jszip.min.63142cc8.js → jszip.min.4fbcc13f.js} +1 -1
  10. package/dist/assets/pdf/index.2a155247.js +1 -0
  11. package/dist/assets/pdf/{index.c81a848e.css → index.d4376f7a.css} +1 -1
  12. package/dist/assets/pdf/index.f1056b07.js +1 -0
  13. package/dist/assets/pdf/index.html +1 -1
  14. package/dist/assets/scorm1.2/index.4459769d.js +1 -0
  15. package/dist/assets/scorm1.2/index.472f9b84.js +1 -0
  16. package/dist/assets/scorm1.2/{index.3855b56a.css → index.d32274ee.css} +1 -1
  17. package/dist/assets/scorm1.2/index.html +1 -1
  18. package/dist/assets/{web/jszip.min.63142cc8.js → scorm1.2/jszip.min.4fbcc13f.js} +1 -1
  19. package/dist/assets/scorm2004/index.88bf9b7c.js +1 -0
  20. package/dist/assets/scorm2004/index.93c61dcb.js +1 -0
  21. package/dist/assets/{indexeddb/index.3855b56a.css → scorm2004/index.d32274ee.css} +1 -1
  22. package/dist/assets/scorm2004/index.html +1 -1
  23. package/dist/assets/web/index.2d3e116d.js +1 -0
  24. package/dist/assets/web/index.99fe9bd1.js +1 -0
  25. package/dist/assets/web/index.d32274ee.css +1 -0
  26. package/dist/assets/web/index.html +1 -1
  27. package/dist/assets/{scorm1.2/jszip.min.63142cc8.js → web/jszip.min.4fbcc13f.js} +1 -1
  28. package/dist/assets/web/{jszip.min.19c66d77.js → jszip.min.eaecf580.js} +1 -1
  29. package/dist/assets/xapi/index.bceeb4a9.js +1 -0
  30. package/dist/assets/xapi/index.cdc6535a.js +1 -0
  31. package/dist/assets/xapi/index.d32274ee.css +1 -0
  32. package/dist/assets/xapi/index.html +1 -1
  33. package/dist/index.js +1 -1
  34. package/package.json +1 -1
  35. package/src/index.ts +1 -1
  36. package/.github/workflows/test-action.yml +0 -231
  37. package/action/README.md +0 -263
  38. package/action/dist/action.js +0 -293
  39. package/action/dist/index.js +0 -28372
  40. package/action/dist/inputs.js +0 -173
  41. package/action/dist/utils.js +0 -320
  42. package/action/examples/matrix-build.yml +0 -64
  43. package/action/examples/multi-course.yml +0 -39
  44. package/action/examples/single-course.yml +0 -42
  45. package/action/package-lock.json +0 -5286
  46. package/action/package.json +0 -32
  47. package/action/src/action.ts +0 -306
  48. package/action/src/inputs.ts +0 -237
  49. package/action/src/utils.ts +0 -314
  50. package/action/tsconfig.json +0 -32
  51. package/dist/assets/indexeddb/index.08d2ff9e.js +0 -1
  52. package/dist/assets/indexeddb/index.0b473014.js +0 -1
  53. package/dist/assets/pdf/index.736768e2.js +0 -1
  54. package/dist/assets/pdf/index.7c8f0682.js +0 -1
  55. package/dist/assets/scorm1.2/index.c9f06556.js +0 -1
  56. package/dist/assets/scorm1.2/index.f31e5689.js +0 -1
  57. package/dist/assets/scorm2004/index.42e8223c.js +0 -1
  58. package/dist/assets/scorm2004/index.773e56c6.js +0 -1
  59. package/dist/assets/web/index.2913fc8a.js +0 -1
  60. package/dist/assets/web/index.3855b56a.css +0 -1
  61. package/dist/assets/web/index.4b421cf7.js +0 -1
  62. package/dist/assets/xapi/index.0ef29ba3.js +0 -1
  63. package/dist/assets/xapi/index.3855b56a.css +0 -1
  64. /package/dist/assets/{scorm1.2 → capacitor}/jszip.min.eaecf580.js +0 -0
  65. /package/dist/assets/{capacitor → scorm1.2}/jszip.min.19c66d77.js +0 -0
@@ -1,314 +0,0 @@
1
- import * as path from 'path';
2
- import * as fs from 'fs';
3
- import * as core from '@actions/core';
4
- import { LiaScriptExporterArgs } from './inputs';
5
-
6
- /**
7
- * Check if a string is a URL
8
- */
9
- export function isURL(input: string): boolean {
10
- try {
11
- new URL(input);
12
- return true;
13
- } catch {
14
- return false;
15
- }
16
- }
17
-
18
- /**
19
- * Resolve file paths and set up the working directory structure
20
- */
21
- export function resolvePaths(args: LiaScriptExporterArgs): LiaScriptExporterArgs {
22
- const resolvedArgs = { ...args };
23
-
24
- // Convert input file to absolute path
25
- if (!path.isAbsolute(args.input) && !isURL(args.input)) {
26
- resolvedArgs.input = path.resolve(process.cwd(), args.input);
27
- }
28
-
29
- // Set course path if not provided
30
- if (!args.path && !isURL(args.input)) {
31
- resolvedArgs.path = path.dirname(resolvedArgs.input);
32
- } else if (args.path && !path.isAbsolute(args.path)) {
33
- resolvedArgs.path = path.resolve(process.cwd(), args.path);
34
- }
35
-
36
- // Set readme path relative to course path
37
- if (resolvedArgs.path && !isURL(resolvedArgs.input)) {
38
- resolvedArgs.readme = path.relative(resolvedArgs.path, resolvedArgs.input);
39
- if (resolvedArgs.readme.startsWith('../')) {
40
- // If input file is outside course path, use the full path
41
- resolvedArgs.readme = resolvedArgs.input;
42
- } else {
43
- resolvedArgs.readme = './' + resolvedArgs.readme;
44
- }
45
- }
46
-
47
- return resolvedArgs;
48
- }
49
-
50
- /**
51
- * Validate that required files exist
52
- */
53
- export function validateFiles(args: LiaScriptExporterArgs): void {
54
- if (!isURL(args.input)) {
55
- if (!fs.existsSync(args.input)) {
56
- throw new Error(`Input file does not exist: ${args.input}`);
57
- }
58
-
59
- const stat = fs.statSync(args.input);
60
- if (!stat.isFile()) {
61
- throw new Error(`Input path is not a file: ${args.input}`);
62
- }
63
- }
64
-
65
- // Validate course path if provided
66
- if (args.path && !fs.existsSync(args.path)) {
67
- throw new Error(`Course path does not exist: ${args.path}`);
68
- }
69
-
70
- // Validate PDF stylesheet if provided
71
- if (args['pdf-stylesheet']) {
72
- const stylesheetPath = path.isAbsolute(args['pdf-stylesheet'])
73
- ? args['pdf-stylesheet']
74
- : path.resolve(args.path || path.dirname(args.input), args['pdf-stylesheet']);
75
-
76
- if (!fs.existsSync(stylesheetPath)) {
77
- throw new Error(`PDF stylesheet does not exist: ${stylesheetPath}`);
78
- }
79
-
80
- // Update with resolved path
81
- (args as any)['pdf-stylesheet'] = stylesheetPath;
82
- }
83
- }
84
-
85
- /**
86
- * Get file size in bytes
87
- */
88
- export function getFileSize(filePath: string): number {
89
- try {
90
- const stats = fs.statSync(filePath);
91
- return stats.size;
92
- } catch (error) {
93
- core.warning(`Could not get file size for ${filePath}: ${error}`);
94
- return 0;
95
- }
96
- }
97
-
98
- /**
99
- * Find output files based on format and output name
100
- */
101
- export function findOutputFiles(args: LiaScriptExporterArgs): string[] {
102
- // The CLI creates output files in the current working directory
103
- const outputDir = process.cwd();
104
- const outputName = args.output;
105
- const outputFiles: string[] = [];
106
-
107
- core.info(`Looking for output files in: ${outputDir}`);
108
-
109
- let expectedFile: string;
110
- let description: string;
111
-
112
- switch (args.format) {
113
- case 'scorm1.2':
114
- expectedFile = path.join(outputDir, `${outputName}.zip`);
115
- description = 'SCORM 1.2';
116
- break;
117
-
118
- case 'scorm2004':
119
- expectedFile = path.join(outputDir, `${outputName}.zip`);
120
- description = 'SCORM 2004';
121
- break;
122
-
123
- case 'pdf':
124
- expectedFile = path.join(outputDir, `${outputName}.pdf`);
125
- description = 'PDF';
126
- break;
127
-
128
- case 'web':
129
- // Web format can be either a directory or zip file depending on web-zip option
130
- if (args['web-zip']) {
131
- expectedFile = path.join(outputDir, `${outputName}.zip`);
132
- description = 'web ZIP';
133
- } else {
134
- expectedFile = path.join(outputDir, outputName);
135
- description = 'web directory';
136
- }
137
- break;
138
-
139
- case 'ims':
140
- expectedFile = path.join(outputDir, `${outputName}.zip`);
141
- description = 'IMS';
142
- break;
143
-
144
- case 'xapi':
145
- expectedFile = path.join(outputDir, `${outputName}.zip`);
146
- description = 'xAPI';
147
- break;
148
-
149
- case 'rdf':
150
- // RDF format has multiple possible extensions
151
- const rdfPatterns = getRdfOutputPatterns(args);
152
- for (const pattern of rdfPatterns) {
153
- const rdfFile = path.join(outputDir, pattern);
154
- if (fs.existsSync(rdfFile)) {
155
- outputFiles.push(rdfFile);
156
- core.info(`Found RDF file: ${rdfFile}`);
157
- return outputFiles;
158
- }
159
- }
160
- core.warning(`No RDF files found with patterns: ${rdfPatterns.join(', ')}`);
161
- return outputFiles;
162
-
163
- case 'project':
164
- // Project format can generate multiple files
165
- const projectFiles = findProjectOutputFiles(args, outputDir);
166
- if (projectFiles.length > 0) {
167
- outputFiles.push(...projectFiles);
168
- for (const file of projectFiles) {
169
- core.info(`Found project file: ${file}`);
170
- }
171
- } else {
172
- core.warning(`No project files found in ${outputDir}`);
173
- }
174
- return outputFiles;
175
-
176
- default:
177
- expectedFile = path.join(outputDir, `${outputName}.json`);
178
- description = 'JSON';
179
- break;
180
- }
181
-
182
- // Check for the expected file
183
- if (fs.existsSync(expectedFile)) {
184
- // For web format, handle both directory and zip cases
185
- if (args.format === 'web') {
186
- if (args['web-zip']) {
187
- // Web ZIP format - expect a file
188
- if (fs.statSync(expectedFile).isFile()) {
189
- outputFiles.push(expectedFile);
190
- core.info(`Found ${description}: ${expectedFile}`);
191
- } else {
192
- core.warning(`Expected web ZIP file but found directory: ${expectedFile}`);
193
- }
194
- } else {
195
- // Web directory format - expect a directory
196
- if (fs.statSync(expectedFile).isDirectory()) {
197
- outputFiles.push(expectedFile);
198
- core.info(`Found ${description}: ${expectedFile}`);
199
- } else {
200
- core.warning(`Expected web directory but found file: ${expectedFile}`);
201
- }
202
- }
203
- } else {
204
- outputFiles.push(expectedFile);
205
- core.info(`Found ${description} file: ${expectedFile}`);
206
- }
207
- } else {
208
- core.warning(`Expected ${description} file not found: ${expectedFile}`);
209
-
210
- // List what files are actually in the directory for debugging
211
- try {
212
- const actualFiles = fs.readdirSync(outputDir);
213
- core.info(`Files in output directory: ${actualFiles.slice(0, 10).join(', ')}${actualFiles.length > 10 ? '...' : ''}`);
214
- } catch (error) {
215
- core.warning(`Could not list output directory: ${error}`);
216
- }
217
- }
218
-
219
- return outputFiles;
220
- }
221
-
222
- /**
223
- * Get RDF output patterns based on format setting
224
- */
225
- function getRdfOutputPatterns(args: LiaScriptExporterArgs): string[] {
226
- const format = args['rdf-format'] || 'json-ld';
227
- switch (format) {
228
- case 'json-ld':
229
- return [`${args.output}.jsonld`, `${args.output}.json`];
230
- case 'n-quads':
231
- return [`${args.output}.nq`, `${args.output}.txt`];
232
- default:
233
- return [`${args.output}.json`, `${args.output}.jsonld`, `${args.output}.nq`];
234
- }
235
- }
236
-
237
- /**
238
- * Find project format output files (complex logic for project exports)
239
- */
240
- function findProjectOutputFiles(args: LiaScriptExporterArgs, baseDir: string): string[] {
241
- const projectFiles: string[] = [];
242
-
243
- // Project format can generate multiple files based on settings
244
- const possibleExtensions = ['.zip', '.pdf', '.json', '.jsonld'];
245
- const possiblePrefixes = [args.output, 'project', 'course'];
246
-
247
- for (const prefix of possiblePrefixes) {
248
- for (const ext of possibleExtensions) {
249
- const file = path.join(baseDir, prefix + ext);
250
- if (fs.existsSync(file)) {
251
- projectFiles.push(file);
252
- }
253
- }
254
- }
255
-
256
- // Also look for directories
257
- const possibleDirs = [`${args.output}/`, 'project/', 'courses/'];
258
- for (const dir of possibleDirs) {
259
- const dirPath = path.join(baseDir, dir);
260
- if (fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory()) {
261
- projectFiles.push(dirPath);
262
- }
263
- }
264
-
265
- return projectFiles;
266
- }
267
-
268
- /**
269
- * Generate output filename based on input file and format if not specified
270
- */
271
- export function generateOutputName(args: LiaScriptExporterArgs): string {
272
- if (args.output !== 'output') {
273
- return args.output; // User specified output name
274
- }
275
-
276
- // Generate from input file
277
- let baseName: string;
278
-
279
- if (isURL(args.input)) {
280
- baseName = 'course'; // Simple fallback for URLs
281
- } else {
282
- // Extract from file path
283
- baseName = path.basename(args.input, path.extname(args.input));
284
- if (baseName.toLowerCase() === 'readme') {
285
- // Use parent directory name for README files
286
- baseName = path.basename(path.dirname(args.input));
287
- }
288
- }
289
-
290
- // Basic sanitization
291
- baseName = baseName.replace(/[^a-zA-Z0-9-_]/g, '-').replace(/-+/g, '-');
292
-
293
- return baseName || 'course';
294
- }
295
-
296
- /**
297
- * Log system information for debugging
298
- */
299
- export function logEnvironmentInfo(): void {
300
- core.info(`Node.js version: ${process.version}`);
301
- core.info(`Platform: ${process.platform}`);
302
- core.info(`Architecture: ${process.arch}`);
303
- core.info(`Working directory: ${process.cwd()}`);
304
- }
305
-
306
- /**
307
- * Ensure output directory exists
308
- */
309
- export function ensureOutputDirectory(): void {
310
- const outputDir = process.cwd();
311
- if (!fs.existsSync(outputDir)) {
312
- fs.mkdirSync(outputDir, { recursive: true });
313
- }
314
- }
@@ -1,32 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "commonjs",
5
- "lib": ["ES2020"],
6
- "outDir": "./dist",
7
- "rootDir": "./src",
8
- "strict": true,
9
- "esModuleInterop": true,
10
- "skipLibCheck": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "declaration": true,
13
- "declarationMap": true,
14
- "sourceMap": true,
15
- "moduleResolution": "node",
16
- "allowSyntheticDefaultImports": true,
17
- "resolveJsonModule": true,
18
- "noImplicitAny": true,
19
- "noImplicitReturns": true,
20
- "noFallthroughCasesInSwitch": true,
21
- "noUncheckedIndexedAccess": false
22
- },
23
- "include": [
24
- "src/**/*"
25
- ],
26
- "exclude": [
27
- "node_modules",
28
- "dist",
29
- "**/*.test.ts",
30
- "**/*.spec.ts"
31
- ]
32
- }