create-cn-extension 1.0.0

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 (3) hide show
  1. package/bin/index.js +76 -0
  2. package/package.json +20 -0
  3. package/readme.md +22 -0
package/bin/index.js ADDED
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from 'fs-extra';
4
+ import path from 'path';
5
+ import inquirer from 'inquirer';
6
+ import chalk from 'chalk';
7
+
8
+ async function main() {
9
+ console.log(chalk.green.bold('\nCnos Extension Creator\n'));
10
+
11
+ const { extName, extType } = await inquirer.prompt([
12
+ {
13
+ type: 'input',
14
+ name: 'extName',
15
+ message: 'Enter extension name (no spaces, e.g., my-extension):',
16
+ validate: input => /^[a-z0-9-_]+$/.test(input) ? true : 'Only lowercase letters, numbers, - or _ allowed'
17
+ },
18
+ {
19
+ type: 'list',
20
+ name: 'extType',
21
+ message: 'Select extension type:',
22
+ choices: ['connector', 'extension', 'integration', 'widget', 'plugin', 'tool']
23
+ }
24
+ ]);
25
+
26
+ const extPath = path.resolve(process.cwd(), extName);
27
+
28
+ if (fs.existsSync(extPath)) {
29
+ console.log(chalk.red(`\nError: Folder ${extName} already exists!`));
30
+ process.exit(1);
31
+ }
32
+
33
+ fs.ensureDirSync(extPath);
34
+
35
+ // Create basic index.js
36
+ fs.writeFileSync(
37
+ path.join(extPath, 'index.js'),
38
+ `// ${extName} extension entry point\n\nmodule.exports = () => {\n console.log('Hello from ${extName}');\n};\n`
39
+ );
40
+
41
+ // Create cnix.manifest.json
42
+ const manifest = {
43
+ name: extName,
44
+ version: "0.1.0",
45
+ type: extType,
46
+ main: "index.js",
47
+ description: `${extType} extension for Cnos`,
48
+ author: "",
49
+ license: "MIT"
50
+ };
51
+ fs.writeFileSync(
52
+ path.join(extPath, 'cnix.manifest.json'),
53
+ JSON.stringify(manifest, null, 2)
54
+ );
55
+
56
+ // Optional package.json
57
+ const pkgJson = {
58
+ name: extName,
59
+ version: "0.1.0",
60
+ main: "index.js",
61
+ license: "MIT"
62
+ };
63
+ fs.writeFileSync(
64
+ path.join(extPath, 'package.json'),
65
+ JSON.stringify(pkgJson, null, 2)
66
+ );
67
+
68
+ console.log(chalk.blue(`\nExtension "${extName}" created successfully at:`));
69
+ console.log(chalk.yellow(extPath));
70
+ console.log(chalk.green('\nNext steps:'));
71
+ console.log(` cd ${extName}`);
72
+ console.log(' npm install (if you need dependencies)');
73
+ console.log(` npx cnos build or integrate into your workspace\n`);
74
+ }
75
+
76
+ main();
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "create-cn-extension",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "description": "Scaffold a new Cnos extension",
6
+ "bin": {
7
+ "create-cn-extension": "./bin/index.js"
8
+ },
9
+ "preferGlobal": true,
10
+ "author": "Your Name",
11
+ "license": "MIT",
12
+ "engines": {
13
+ "node": ">=18"
14
+ },
15
+ "dependencies": {
16
+ "chalk": "^4.1.2",
17
+ "fs-extra": "^11.1.1",
18
+ "inquirer": "^9.2.8"
19
+ }
20
+ }
package/readme.md ADDED
@@ -0,0 +1,22 @@
1
+ # create-cn-extension
2
+
3
+ **Package Status:** Reserved for Future Use
4
+
5
+ ---
6
+
7
+ This NPM package is currently **reserved for future development** and is not intended for public use at this time.
8
+
9
+ ## Overview
10
+
11
+ create-cn-extension is planned to serve as a **Cloud Native Installation eXtension** format for distributing components and extensions in the CNOS ecosystem. This package acts as a placeholder to reserve the namespace and will eventually provide tools, manifest schemas, and distribution utilities for CNOS components.
12
+
13
+ ## Current Status
14
+
15
+ - No functionality is implemented yet.
16
+ - The package is **not production-ready**.
17
+ - All attempts to install or use this package will have **no effect**.
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install create-cn-extension