coursecode 0.1.55 → 0.1.56

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 CHANGED
@@ -235,7 +235,7 @@ coursecode preview --export
235
235
 
236
236
  | Command | Description |
237
237
  |---------|-------------|
238
- | `coursecode create <name>` | Create a new course project; use `.` to initialize the current directory |
238
+ | `coursecode create <name>` | Create a new course project; `create .` derives a title-cased course title and hyphenated npm name from the current folder |
239
239
  | `coursecode init [name]` | Initialize the current directory, optionally with a course title |
240
240
  | `coursecode preview` | Preview your course locally |
241
241
  | `coursecode convert` | Convert PDFs, Word, PowerPoint to markdown |
package/bin/cli.js CHANGED
@@ -97,7 +97,7 @@ program
97
97
  .option('--start', 'Auto-start dev server after creation (skip prompt)')
98
98
  .action(async (name, options) => {
99
99
  const { create } = await import('../lib/create.js');
100
- await create(name || path.basename(process.cwd()), { ...options, currentDirectory: true });
100
+ await create(name || '.', { ...options, currentDirectory: true });
101
101
  });
102
102
 
103
103
  // Dev command
@@ -16,7 +16,7 @@
16
16
  |---------|-------------|
17
17
  | `coursecode create <name>` | Create a new course project (includes example slides) |
18
18
  | `coursecode create <name> --blank` | Create a blank project (no example content) |
19
- | `coursecode create .` | Initialize the current directory using its folder name as the course title |
19
+ | `coursecode create .` | Initialize the current directory; `client-manager-course` becomes title `Client Manager Course` and package name `client-manager-course` |
20
20
  | `coursecode init [name]` | Initialize the current directory, optionally with a specific course title |
21
21
  | `coursecode clean` | Remove example files and reset config to minimal starter |
22
22
  | `coursecode new slide <id>` | Create a new slide file in `course/slides/` |
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.55",
2
+ "version": "0.1.56",
3
3
  "name": "CourseCode Framework",
4
4
  "description": "Multi-format course authoring and learner runtime framework",
5
5
  "released": "2026-07-11",
package/lib/create.js CHANGED
@@ -21,6 +21,32 @@ export function toProjectDirectoryName(name) {
21
21
  .replace(/^_+|_+$/g, '');
22
22
  }
23
23
 
24
+ function directoryNameWords(name) {
25
+ return String(name || '')
26
+ .trim()
27
+ .normalize('NFKD')
28
+ .replace(/[\u0300-\u036f]/g, '')
29
+ .replace(/([a-z0-9])([A-Z])/g, '$1 $2')
30
+ .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')
31
+ .replace(/['’]/g, '')
32
+ .replace(/[^a-zA-Z0-9]+/g, ' ')
33
+ .trim()
34
+ .split(/\s+/)
35
+ .filter(Boolean);
36
+ }
37
+
38
+ export function toCurrentDirectoryCourseTitle(name) {
39
+ return directoryNameWords(name)
40
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
41
+ .join(' ');
42
+ }
43
+
44
+ export function toCurrentDirectoryPackageName(name) {
45
+ return directoryNameWords(name)
46
+ .map(word => word.toLowerCase())
47
+ .join('-');
48
+ }
49
+
24
50
  function escapeSingleQuotedValue(value) {
25
51
  return String(value).replace(/\\/g, '\\\\').replace(/'/g, "\\'");
26
52
  }
@@ -161,9 +187,14 @@ function gitInit(cwd) {
161
187
  export async function create(name, options = {}) {
162
188
  const requestedName = String(name || '').trim();
163
189
  const currentDirectory = options.currentDirectory === true || requestedName === '.';
164
- const inferredName = path.basename(process.cwd()).replace(/[-_]+/g, ' ');
165
- const displayName = currentDirectory && requestedName === '.' ? inferredName : requestedName;
166
- const directoryName = toProjectDirectoryName(displayName);
190
+ const inferFromCurrentDirectory = currentDirectory && requestedName === '.';
191
+ const currentDirectoryName = path.basename(process.cwd());
192
+ const displayName = inferFromCurrentDirectory
193
+ ? toCurrentDirectoryCourseTitle(currentDirectoryName)
194
+ : requestedName;
195
+ const directoryName = inferFromCurrentDirectory
196
+ ? toCurrentDirectoryPackageName(currentDirectoryName)
197
+ : toProjectDirectoryName(displayName);
167
198
 
168
199
  if (!displayName) {
169
200
  console.error('\n❌ Course name is required.\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coursecode",
3
- "version": "0.1.55",
3
+ "version": "0.1.56",
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": {