coursecode 0.1.56 → 0.1.57
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/framework/version.json +1 -1
- package/lib/build-packaging.js +2 -2
- package/lib/create.js +23 -0
- package/package.json +2 -2
- package/template/package.json +1 -1
package/framework/version.json
CHANGED
package/lib/build-packaging.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import fs from 'fs';
|
|
11
11
|
import path from 'path';
|
|
12
|
-
import
|
|
12
|
+
import { ZipArchive } from 'archiver';
|
|
13
13
|
import { fileURLToPath } from 'url';
|
|
14
14
|
import { generateManifest } from './manifest/manifest-factory.js';
|
|
15
15
|
|
|
@@ -35,7 +35,7 @@ function withClientCredentials(externalUrl, clientId, token) {
|
|
|
35
35
|
function zipDirectory(sourceDir, zipFilePath) {
|
|
36
36
|
return new Promise((resolve, reject) => {
|
|
37
37
|
const output = fs.createWriteStream(zipFilePath);
|
|
38
|
-
const archive =
|
|
38
|
+
const archive = new ZipArchive({ zlib: { level: 9 } });
|
|
39
39
|
|
|
40
40
|
output.on('close', () => resolve(archive.pointer()));
|
|
41
41
|
archive.on('error', reject);
|
package/lib/create.js
CHANGED
|
@@ -9,6 +9,16 @@ import { spawn } from 'child_process';
|
|
|
9
9
|
|
|
10
10
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
11
11
|
const PACKAGE_ROOT = path.join(__dirname, '..');
|
|
12
|
+
const REQUIRED_PROJECT_DIRECTORIES = [
|
|
13
|
+
{
|
|
14
|
+
path: path.join('course', 'references'),
|
|
15
|
+
placeholder: '# Place source documents here (docx, pptx, pdf)\n# Run `coursecode convert` to convert them to markdown\n'
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
path: path.join('course', 'references', 'converted'),
|
|
19
|
+
placeholder: '# Converted markdown files will be placed here\n# These can be used as source material for AI-assisted course creation\n'
|
|
20
|
+
}
|
|
21
|
+
];
|
|
12
22
|
|
|
13
23
|
export function toProjectDirectoryName(name) {
|
|
14
24
|
return String(name || '')
|
|
@@ -103,6 +113,18 @@ function copyDir(src, dest, options = {}) {
|
|
|
103
113
|
}
|
|
104
114
|
}
|
|
105
115
|
|
|
116
|
+
function ensureRequiredProjectDirectories(projectDir) {
|
|
117
|
+
for (const directory of REQUIRED_PROJECT_DIRECTORIES) {
|
|
118
|
+
const directoryPath = path.join(projectDir, directory.path);
|
|
119
|
+
const placeholderPath = path.join(directoryPath, '.gitkeep');
|
|
120
|
+
fs.mkdirSync(directoryPath, { recursive: true });
|
|
121
|
+
|
|
122
|
+
if (!fs.existsSync(placeholderPath)) {
|
|
123
|
+
fs.writeFileSync(placeholderPath, directory.placeholder, 'utf-8');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
106
128
|
function mergeProjectControlFile(sourcePath, destinationPath) {
|
|
107
129
|
const source = fs.readFileSync(sourcePath, 'utf-8').trimEnd();
|
|
108
130
|
if (!fs.existsSync(destinationPath)) {
|
|
@@ -231,6 +253,7 @@ export async function create(name, options = {}) {
|
|
|
231
253
|
});
|
|
232
254
|
mergeProjectControlFile(path.join(templateDir, 'gitignore'), path.join(targetDir, '.gitignore'));
|
|
233
255
|
mergeProjectControlFile(path.join(templateDir, 'gitattributes'), path.join(targetDir, '.gitattributes'));
|
|
256
|
+
ensureRequiredProjectDirectories(targetDir);
|
|
234
257
|
|
|
235
258
|
// Copy framework
|
|
236
259
|
const frameworkSrc = path.join(PACKAGE_ROOT, 'framework');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coursecode",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.57",
|
|
4
4
|
"description": "Multi-format course authoring framework with CLI tools (SCORM 2004, SCORM 1.2, cmi5, LTI 1.3)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"dependencies": {
|
|
105
105
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
106
106
|
"acorn": "^8.17.0",
|
|
107
|
-
"archiver": "^
|
|
107
|
+
"archiver": "^8.0.0",
|
|
108
108
|
"commander": "^14.0.3",
|
|
109
109
|
"lz-string": "^1.5.0",
|
|
110
110
|
"mammoth": "^1.12.0",
|