copan-ui 1.0.0 → 1.0.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/dist/index.js +82 -1
- package/package.json +13 -3
- package/src/index.ts +48 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,84 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
const fs = __importStar(require("fs"));
|
|
47
|
+
const path = __importStar(require("path"));
|
|
48
|
+
// Function to print a simple greeting message
|
|
49
|
+
const printGreeting = () => {
|
|
50
|
+
console.log("Welcome to copan-ui initialization!");
|
|
51
|
+
console.log("This command will create a 'cui.json' file with the default settings.");
|
|
52
|
+
console.log("You can later modify the installation location and components.\n");
|
|
53
|
+
};
|
|
54
|
+
// Define the `init` command function
|
|
55
|
+
const initCommand = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
+
// Print the greeting message
|
|
57
|
+
printGreeting();
|
|
58
|
+
// Provide a description of the changes happening
|
|
59
|
+
console.log("\nThe following changes will occur:");
|
|
60
|
+
console.log("- A 'cui.json' configuration file will be created.");
|
|
61
|
+
console.log("- The default location for components will be set to 'default'.");
|
|
62
|
+
console.log("- The components will include 'button' and 'banner' (for now).\n");
|
|
63
|
+
// Define the default config object
|
|
64
|
+
const cuiJson = {
|
|
65
|
+
version: '0.0.2', // Version of the script
|
|
66
|
+
location: 'default', // Default location for components
|
|
67
|
+
components: [] // Default components
|
|
68
|
+
};
|
|
69
|
+
// Define the path for cui.json
|
|
70
|
+
const filePath = path.resolve(process.cwd(), 'cui.json');
|
|
71
|
+
// Write the cui.json file
|
|
72
|
+
fs.writeFileSync(filePath, JSON.stringify(cuiJson, null, 2));
|
|
73
|
+
// Confirmation message
|
|
74
|
+
console.log(`\nThe 'cui.json' file has been created at: ${filePath}`);
|
|
75
|
+
console.log("You can change the location and components later when the installation script is ready.\n");
|
|
76
|
+
});
|
|
77
|
+
// Command to handle `copan-ui init`
|
|
78
|
+
const command = process.argv[2];
|
|
79
|
+
if (command === 'init') {
|
|
80
|
+
initCommand();
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
console.log("Welcome to copan-ui! Use 'copan-ui init' to initialize your setup.");
|
|
84
|
+
}
|
package/package.json
CHANGED
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "copan-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "ui-library of copan consultancy services",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "thecopengineer",
|
|
7
7
|
"type": "commonjs",
|
|
8
|
-
"main": "index.js",
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
9
|
"scripts": {
|
|
10
|
-
"
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"start": "tsc && node dist/index.js",
|
|
12
|
+
"prepare": "husky"
|
|
11
13
|
},
|
|
12
14
|
"bin": {
|
|
13
15
|
"copan-ui": "./dist/index.js"
|
|
14
16
|
},
|
|
15
17
|
"devDependencies": {
|
|
16
18
|
"@types/node": "^25.2.3",
|
|
19
|
+
"husky": "^9.1.7",
|
|
20
|
+
"lint-staged": "^16.2.7",
|
|
17
21
|
"ts-node": "^10.9.2",
|
|
18
22
|
"typescript": "^5.9.3"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"react": "19.2.0"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"inquirer": "^13.2.2"
|
|
19
29
|
}
|
|
20
30
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,49 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
import inquirer from 'inquirer';
|
|
5
|
+
|
|
6
|
+
// Function to print a simple greeting message
|
|
7
|
+
const printGreeting = () => {
|
|
8
|
+
console.log("Welcome to copan-ui initialization!");
|
|
9
|
+
console.log("This command will create a 'cui.json' file with the default settings.");
|
|
10
|
+
console.log("You can later modify the installation location and components.\n");
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// Define the `init` command function
|
|
14
|
+
const initCommand = async () => {
|
|
15
|
+
// Print the greeting message
|
|
16
|
+
printGreeting();
|
|
17
|
+
|
|
18
|
+
// Provide a description of the changes happening
|
|
19
|
+
console.log("\nThe following changes will occur:");
|
|
20
|
+
console.log("- A 'cui.json' configuration file will be created.");
|
|
21
|
+
console.log("- The default location for components will be set to 'default'.");
|
|
22
|
+
console.log("- The components will include 'button' and 'banner' (for now).\n");
|
|
23
|
+
|
|
24
|
+
// Define the default config object
|
|
25
|
+
const cuiJson = {
|
|
26
|
+
version: '0.0.2', // Version of the script
|
|
27
|
+
location: 'default', // Default location for components
|
|
28
|
+
components: [] // Default components
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Define the path for cui.json
|
|
32
|
+
const filePath = path.resolve(process.cwd(), 'cui.json');
|
|
33
|
+
|
|
34
|
+
// Write the cui.json file
|
|
35
|
+
fs.writeFileSync(filePath, JSON.stringify(cuiJson, null, 2));
|
|
36
|
+
|
|
37
|
+
// Confirmation message
|
|
38
|
+
console.log(`\nThe 'cui.json' file has been created at: ${filePath}`);
|
|
39
|
+
console.log("You can change the location and components later when the installation script is ready.\n");
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Command to handle `copan-ui init`
|
|
43
|
+
const command = process.argv[2];
|
|
44
|
+
|
|
45
|
+
if (command === 'init') {
|
|
46
|
+
initCommand();
|
|
47
|
+
} else {
|
|
48
|
+
console.log("Welcome to copan-ui! Use 'copan-ui init' to initialize your setup.");
|
|
49
|
+
}
|