@lessonkit/cli 0.1.1 → 0.2.1

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
@@ -1,5 +1,9 @@
1
1
  # `@lessonkit/cli`
2
2
 
3
+ [![CI](https://github.com/eddiethedean/lessonkit/actions/workflows/checks.yml/badge.svg)](https://github.com/eddiethedean/lessonkit/actions/workflows/checks.yml)
4
+ [![npm](https://img.shields.io/npm/v/@lessonkit/cli.svg)](https://www.npmjs.com/package/@lessonkit/cli)
5
+ [![License](https://img.shields.io/github/license/eddiethedean/lessonkit)](../../LICENSE)
6
+
3
7
  LessonKit CLI (early stub).
4
8
 
5
9
  ## Install
@@ -8,7 +12,7 @@ LessonKit CLI (early stub).
8
12
  npm install -g @lessonkit/cli
9
13
  ```
10
14
 
11
- ## Commands (0.1.x stubs)
15
+ ## Commands (0.2.1 stubs)
12
16
 
13
17
  ```bash
14
18
  lessonkit init
package/dist/bin.js ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/index.ts
4
+ import { createRequire } from "module";
5
+ import { Command } from "commander";
6
+ var require2 = createRequire(import.meta.url);
7
+ var { version } = require2("../package.json");
8
+ function createProgram(logger = console) {
9
+ const program = new Command();
10
+ program.name("lessonkit").description("LessonKit CLI").version(version);
11
+ program.command("init").description("Initialize a LessonKit project (stub)").action(() => {
12
+ logger.log("lessonkit init (coming soon)");
13
+ });
14
+ program.command("dev").description("Run a LessonKit project in dev mode (stub)").action(() => {
15
+ logger.log("lessonkit dev (coming soon)");
16
+ });
17
+ program.command("build").description("Build a LessonKit project (stub)").action(() => {
18
+ logger.log("lessonkit build (coming soon)");
19
+ });
20
+ program.command("package").description("Package to SCORM/xAPI formats (stub)").action(() => {
21
+ logger.log("lessonkit package (coming soon)");
22
+ });
23
+ program.command("publish").description("Publish package artifacts (stub)").action(() => {
24
+ logger.log("lessonkit publish (coming soon)");
25
+ });
26
+ return program;
27
+ }
28
+ async function run(argv = process.argv, logger = console) {
29
+ const program = createProgram(logger);
30
+ await program.parseAsync(argv);
31
+ }
32
+
33
+ // src/bin.ts
34
+ void run(process.argv);
package/dist/index.js CHANGED
@@ -1,22 +1,33 @@
1
- #!/usr/bin/env node
2
-
3
1
  // src/index.ts
2
+ import { createRequire } from "module";
4
3
  import { Command } from "commander";
5
- var program = new Command();
6
- program.name("lessonkit").description("LessonKit CLI").version("0.1.0");
7
- program.command("init").description("Initialize a LessonKit project (stub)").action(() => {
8
- console.log("lessonkit init (coming soon)");
9
- });
10
- program.command("dev").description("Run a LessonKit project in dev mode (stub)").action(() => {
11
- console.log("lessonkit dev (coming soon)");
12
- });
13
- program.command("build").description("Build a LessonKit project (stub)").action(() => {
14
- console.log("lessonkit build (coming soon)");
15
- });
16
- program.command("package").description("Package to SCORM/xAPI formats (stub)").action(() => {
17
- console.log("lessonkit package (coming soon)");
18
- });
19
- program.command("publish").description("Publish package artifacts (stub)").action(() => {
20
- console.log("lessonkit publish (coming soon)");
21
- });
22
- program.parse(process.argv);
4
+ var require2 = createRequire(import.meta.url);
5
+ var { version } = require2("../package.json");
6
+ function createProgram(logger = console) {
7
+ const program = new Command();
8
+ program.name("lessonkit").description("LessonKit CLI").version(version);
9
+ program.command("init").description("Initialize a LessonKit project (stub)").action(() => {
10
+ logger.log("lessonkit init (coming soon)");
11
+ });
12
+ program.command("dev").description("Run a LessonKit project in dev mode (stub)").action(() => {
13
+ logger.log("lessonkit dev (coming soon)");
14
+ });
15
+ program.command("build").description("Build a LessonKit project (stub)").action(() => {
16
+ logger.log("lessonkit build (coming soon)");
17
+ });
18
+ program.command("package").description("Package to SCORM/xAPI formats (stub)").action(() => {
19
+ logger.log("lessonkit package (coming soon)");
20
+ });
21
+ program.command("publish").description("Publish package artifacts (stub)").action(() => {
22
+ logger.log("lessonkit publish (coming soon)");
23
+ });
24
+ return program;
25
+ }
26
+ async function run(argv = process.argv, logger = console) {
27
+ const program = createProgram(logger);
28
+ await program.parseAsync(argv);
29
+ }
30
+ export {
31
+ createProgram,
32
+ run
33
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lessonkit/cli",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "private": false,
5
5
  "description": "LessonKit CLI (early stub).",
6
6
  "license": "Apache-2.0",
@@ -22,7 +22,7 @@
22
22
  ],
23
23
  "type": "module",
24
24
  "bin": {
25
- "lessonkit": "./dist/index.js"
25
+ "lessonkit": "./dist/bin.js"
26
26
  },
27
27
  "exports": {
28
28
  ".": "./dist/index.js"
@@ -31,11 +31,12 @@
31
31
  "dist"
32
32
  ],
33
33
  "scripts": {
34
- "build": "tsup src/index.ts --format esm --splitting=false --platform node --target node18",
35
- "dev": "tsup src/index.ts --format esm --watch --splitting=false --platform node --target node18",
34
+ "build": "tsup src/index.ts src/bin.ts --format esm --splitting=false --platform node --target node18",
35
+ "dev": "tsup src/index.ts src/bin.ts --format esm --watch --splitting=false --platform node --target node18",
36
36
  "prepublishOnly": "npm run build",
37
37
  "typecheck": "tsc -p tsconfig.json",
38
38
  "test": "vitest run --passWithNoTests",
39
+ "test:coverage": "vitest run --coverage --passWithNoTests=false",
39
40
  "lint": "echo \"(no lint configured yet)\""
40
41
  },
41
42
  "dependencies": {