@notehub.md/cli 0.1.6

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.
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @fileoverview Notehub CLI Entry Point
4
+ *
5
+ * Command-line tool for building and packaging Notehub plugins
6
+ * into the .nhp (Notehub Plugin) format.
7
+ *
8
+ * Usage:
9
+ * nhp create <id> Create a new plugin from template
10
+ * nhp build Build and package the plugin in the current directory
11
+ * nhp --help Show help
12
+ * nhp --version Show version
13
+ *
14
+ * @module @notehub/cli
15
+ */
16
+ export {};
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;GAaG"}
package/dist/index.js ADDED
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @fileoverview Notehub CLI Entry Point
4
+ *
5
+ * Command-line tool for building and packaging Notehub plugins
6
+ * into the .nhp (Notehub Plugin) format.
7
+ *
8
+ * Usage:
9
+ * nhp create <id> Create a new plugin from template
10
+ * nhp build Build and package the plugin in the current directory
11
+ * nhp --help Show help
12
+ * nhp --version Show version
13
+ *
14
+ * @module @notehub/cli
15
+ */
16
+ import { Command } from 'commander';
17
+ import { buildCommand } from './commands/build.js';
18
+ import { createCommand } from './commands/create.js';
19
+ import { readFileSync } from 'node:fs';
20
+ import { fileURLToPath } from 'node:url';
21
+ import { dirname, join } from 'node:path';
22
+ // Read package.json for version
23
+ const __filename = fileURLToPath(import.meta.url);
24
+ const __dirname = dirname(__filename);
25
+ const packageJsonPath = join(__dirname, '..', 'package.json');
26
+ let version = '0.0.0';
27
+ try {
28
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
29
+ version = packageJson.version;
30
+ }
31
+ catch {
32
+ // Use default version if package.json can't be read
33
+ }
34
+ // Create CLI program
35
+ const program = new Command();
36
+ program
37
+ .name('nhp')
38
+ .description('Notehub Plugin CLI - Build and package plugins for Notehub.md')
39
+ .version(version);
40
+ // Register create command
41
+ program
42
+ .command('create <id>')
43
+ .description('Create a new plugin from template (e.g., nhp create ext.my-plugin)')
44
+ .option('-n, --name <name>', 'Human-readable plugin name')
45
+ .option('-s, --with-styles', 'Include styles.css template')
46
+ .action(async (id, options) => {
47
+ await createCommand({
48
+ id,
49
+ name: options.name,
50
+ withStyles: options.withStyles,
51
+ });
52
+ });
53
+ // Register build command
54
+ program
55
+ .command('build')
56
+ .description('Build and package the plugin in the current directory')
57
+ .option('-o, --output <dir>', 'Output directory for the .nhp file', '.')
58
+ .option('--no-minify', 'Disable minification')
59
+ .option('--sourcemap', 'Generate inline source maps for debugging')
60
+ .option('-w, --watch', 'Watch mode - rebuild on file changes')
61
+ .action(async (options) => {
62
+ await buildCommand({
63
+ outputDir: options.output,
64
+ minify: options.minify !== false,
65
+ sourcemap: options.sourcemap || false,
66
+ watch: options.watch || false,
67
+ });
68
+ });
69
+ // Parse arguments
70
+ program.parse();
71
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,gCAAgC;AAChC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OA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OAAO,EAAE,EAAE;IACtB,MAAM,YAAY,CAAC;QACf,SAAS,EAAE,OAAO,CAAC,MAAM;QACzB,MAAM,EAAE,OAAO,CAAC,MAAM,KAAK,KAAK;QAChC,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,KAAK;QACrC,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,KAAK;KAChC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEP,kBAAkB;AAClB,OAAO,CAAC,KAAK,EAAE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@notehub.md/cli",
3
+ "version": "0.1.6",
4
+ "description": "CLI tool for building Notehub plugins",
5
+ "type": "module",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/khton-tech/notehub.md.git",
9
+ "directory": "packages/cli"
10
+ },
11
+ "homepage": "https://github.com/khton-tech/notehub.md/tree/main/docs/forPluginMakers",
12
+ "bugs": "https://github.com/khton-tech/notehub.md/issues",
13
+ "keywords": [
14
+ "notehub",
15
+ "plugin",
16
+ "markdown",
17
+ "cli",
18
+ "nhp",
19
+ "note-taking"
20
+ ],
21
+ "author": "khton-tech",
22
+ "license": "AGPL-3.0",
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "bin": {
27
+ "nhp": "./dist/index.js"
28
+ },
29
+ "main": "./dist/index.js",
30
+ "types": "./dist/index.d.ts",
31
+ "files": [
32
+ "dist",
33
+ "templates"
34
+ ],
35
+ "scripts": {
36
+ "build": "tsc",
37
+ "dev": "tsc --watch",
38
+ "clean": "rimraf dist"
39
+ },
40
+ "dependencies": {
41
+ "archiver": "^7.0.1",
42
+ "chalk": "^5.3.0",
43
+ "commander": "^12.1.0",
44
+ "vite": "^5.4.0"
45
+ },
46
+ "devDependencies": {
47
+ "@types/archiver": "^6.0.3",
48
+ "@types/node": "^20.0.0",
49
+ "rimraf": "^5.0.0",
50
+ "typescript": "^5.3.0"
51
+ },
52
+ "engines": {
53
+ "node": ">=18.0.0"
54
+ }
55
+ }