create-akan-workspace 0.0.32
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 +11 -0
- package/index.js +185 -0
- package/package.json +24 -0
package/README.md
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
|
|
25
|
+
// pkgs/@akanjs/common/src/isDayjs.ts
|
|
26
|
+
var import_dayjs = require("dayjs");
|
|
27
|
+
|
|
28
|
+
// pkgs/@akanjs/common/src/isQueryEqual.ts
|
|
29
|
+
var import_dayjs2 = __toESM(require("dayjs"));
|
|
30
|
+
|
|
31
|
+
// pkgs/@akanjs/common/src/isValidDate.ts
|
|
32
|
+
var import_dayjs3 = __toESM(require("dayjs"));
|
|
33
|
+
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
34
|
+
import_dayjs3.default.extend(import_customParseFormat.default);
|
|
35
|
+
|
|
36
|
+
// pkgs/@akanjs/common/src/pluralize.ts
|
|
37
|
+
var import_pluralize = __toESM(require("pluralize"));
|
|
38
|
+
|
|
39
|
+
// pkgs/@akanjs/common/src/Logger.ts
|
|
40
|
+
var import_dayjs4 = __toESM(require("dayjs"));
|
|
41
|
+
var logLevels = ["trace", "verbose", "debug", "log", "info", "warn", "error"];
|
|
42
|
+
var clc = {
|
|
43
|
+
bold: (text) => `\x1B[1m${text}\x1B[0m`,
|
|
44
|
+
green: (text) => `\x1B[32m${text}\x1B[39m`,
|
|
45
|
+
yellow: (text) => `\x1B[33m${text}\x1B[39m`,
|
|
46
|
+
red: (text) => `\x1B[31m${text}\x1B[39m`,
|
|
47
|
+
magentaBright: (text) => `\x1B[95m${text}\x1B[39m`,
|
|
48
|
+
cyanBright: (text) => `\x1B[96m${text}\x1B[39m`
|
|
49
|
+
};
|
|
50
|
+
var colorizeMap = {
|
|
51
|
+
trace: clc.bold,
|
|
52
|
+
verbose: clc.cyanBright,
|
|
53
|
+
debug: clc.magentaBright,
|
|
54
|
+
log: clc.green,
|
|
55
|
+
info: clc.green,
|
|
56
|
+
warn: clc.yellow,
|
|
57
|
+
error: clc.red
|
|
58
|
+
};
|
|
59
|
+
var Logger = class _Logger {
|
|
60
|
+
static #ignoreCtxSet = /* @__PURE__ */ new Set([
|
|
61
|
+
"InstanceLoader",
|
|
62
|
+
"RoutesResolver",
|
|
63
|
+
"RouterExplorer",
|
|
64
|
+
"NestFactory",
|
|
65
|
+
"WebSocketsController",
|
|
66
|
+
"GraphQLModule",
|
|
67
|
+
"NestApplication"
|
|
68
|
+
]);
|
|
69
|
+
static level = process.env.NEXT_PUBLIC_LOG_LEVEL ?? "log";
|
|
70
|
+
static #levelIdx = logLevels.findIndex((l) => l === process.env.NEXT_PUBLIC_LOG_LEVEL);
|
|
71
|
+
static #startAt = (0, import_dayjs4.default)();
|
|
72
|
+
static setLevel(level) {
|
|
73
|
+
this.level = level;
|
|
74
|
+
this.#levelIdx = logLevels.findIndex((l) => l === level);
|
|
75
|
+
}
|
|
76
|
+
name;
|
|
77
|
+
constructor(name) {
|
|
78
|
+
this.name = name;
|
|
79
|
+
}
|
|
80
|
+
trace(msg, context = "") {
|
|
81
|
+
if (_Logger.#levelIdx <= 0)
|
|
82
|
+
_Logger.#printMessages(this.name ?? "App", msg, context, "trace");
|
|
83
|
+
}
|
|
84
|
+
verbose(msg, context = "") {
|
|
85
|
+
if (_Logger.#levelIdx <= 1)
|
|
86
|
+
_Logger.#printMessages(this.name ?? "App", msg, context, "verbose");
|
|
87
|
+
}
|
|
88
|
+
debug(msg, context = "") {
|
|
89
|
+
if (_Logger.#levelIdx <= 2)
|
|
90
|
+
_Logger.#printMessages(this.name ?? "App", msg, context, "debug");
|
|
91
|
+
}
|
|
92
|
+
log(msg, context = "") {
|
|
93
|
+
if (_Logger.#levelIdx <= 3)
|
|
94
|
+
_Logger.#printMessages(this.name ?? "App", msg, context, "log");
|
|
95
|
+
}
|
|
96
|
+
info(msg, context = "") {
|
|
97
|
+
if (_Logger.#levelIdx <= 4)
|
|
98
|
+
_Logger.#printMessages(this.name ?? "App", msg, context, "info");
|
|
99
|
+
}
|
|
100
|
+
warn(msg, context = "") {
|
|
101
|
+
if (_Logger.#levelIdx <= 5)
|
|
102
|
+
_Logger.#printMessages(this.name ?? "App", msg, context, "warn");
|
|
103
|
+
}
|
|
104
|
+
error(msg, context = "") {
|
|
105
|
+
if (_Logger.#levelIdx <= 6)
|
|
106
|
+
_Logger.#printMessages(this.name ?? "App", msg, context, "error");
|
|
107
|
+
}
|
|
108
|
+
rawLog(msg, method) {
|
|
109
|
+
_Logger.rawLog(msg, method);
|
|
110
|
+
}
|
|
111
|
+
static trace(msg, context = "") {
|
|
112
|
+
if (_Logger.#levelIdx <= 0)
|
|
113
|
+
_Logger.#printMessages("App", msg, context, "trace");
|
|
114
|
+
}
|
|
115
|
+
static verbose(msg, context = "") {
|
|
116
|
+
if (_Logger.#levelIdx <= 1)
|
|
117
|
+
_Logger.#printMessages("App", msg, context, "verbose");
|
|
118
|
+
}
|
|
119
|
+
static debug(msg, context = "") {
|
|
120
|
+
if (_Logger.#levelIdx <= 2)
|
|
121
|
+
_Logger.#printMessages("App", msg, context, "debug");
|
|
122
|
+
}
|
|
123
|
+
static log(msg, context = "") {
|
|
124
|
+
if (_Logger.#levelIdx <= 3)
|
|
125
|
+
_Logger.#printMessages("App", msg, context, "log");
|
|
126
|
+
}
|
|
127
|
+
static info(msg, context = "") {
|
|
128
|
+
if (_Logger.#levelIdx <= 4)
|
|
129
|
+
_Logger.#printMessages("App", msg, context, "info");
|
|
130
|
+
}
|
|
131
|
+
static warn(msg, context = "") {
|
|
132
|
+
if (_Logger.#levelIdx <= 5)
|
|
133
|
+
_Logger.#printMessages("App", msg, context, "warn");
|
|
134
|
+
}
|
|
135
|
+
static error(msg, context = "") {
|
|
136
|
+
if (_Logger.#levelIdx <= 6)
|
|
137
|
+
_Logger.#printMessages("App", msg, context, "error");
|
|
138
|
+
}
|
|
139
|
+
static #colorize(msg, logLevel) {
|
|
140
|
+
return colorizeMap[logLevel](msg);
|
|
141
|
+
}
|
|
142
|
+
static #printMessages(name, content, context, logLevel, writeStreamType = logLevel === "error" ? "stderr" : "stdout") {
|
|
143
|
+
if (this.#ignoreCtxSet.has(context))
|
|
144
|
+
return;
|
|
145
|
+
const now = (0, import_dayjs4.default)();
|
|
146
|
+
const processMsg = this.#colorize(
|
|
147
|
+
`[${name ?? "App"}] ${global.process?.pid ?? "window"} -`,
|
|
148
|
+
logLevel
|
|
149
|
+
);
|
|
150
|
+
const timestampMsg = now.format("MM/DD/YYYY, HH:mm:ss A");
|
|
151
|
+
const logLevelMsg = this.#colorize(logLevel.toUpperCase().padStart(7, " "), logLevel);
|
|
152
|
+
const contextMsg = context ? clc.yellow(`[${context}] `) : "";
|
|
153
|
+
const contentMsg = this.#colorize(content, logLevel);
|
|
154
|
+
const timeDiffMsg = clc.yellow(`+${now.diff(_Logger.#startAt, "ms")}ms`);
|
|
155
|
+
if (typeof window === "undefined")
|
|
156
|
+
process[writeStreamType].write(
|
|
157
|
+
`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
|
|
158
|
+
`
|
|
159
|
+
);
|
|
160
|
+
else
|
|
161
|
+
console.log(`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
|
|
162
|
+
`);
|
|
163
|
+
}
|
|
164
|
+
static rawLog(msg, method) {
|
|
165
|
+
if (typeof window === "undefined" && method !== "console" && global.process)
|
|
166
|
+
global.process.stdout.write(msg);
|
|
167
|
+
else
|
|
168
|
+
console.log(msg);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// pkgs/create-akan-workspace/index.ts
|
|
173
|
+
var import_prompts = require("@inquirer/prompts");
|
|
174
|
+
var import_commander = require("commander");
|
|
175
|
+
import_commander.program.name("create-akan-workspace").version("0.0.1").description("An example CLI for managing a directory");
|
|
176
|
+
import_commander.program.option("-n, --name <type>", "application name", "blue").action(async (options, command) => {
|
|
177
|
+
Logger.log("create akan workspace");
|
|
178
|
+
const orgName = options.orgName ?? await (0, import_prompts.input)({ message: "Enter the organization name" });
|
|
179
|
+
const projectName = options.projectName ?? await (0, import_prompts.input)({ message: "Enter the project name" });
|
|
180
|
+
const deployOnCloud = options.deployOnCloud ?? await (0, import_prompts.confirm)({ message: "Deploy on cloud?" });
|
|
181
|
+
});
|
|
182
|
+
var run = async () => {
|
|
183
|
+
await import_commander.program.parseAsync(process.argv);
|
|
184
|
+
};
|
|
185
|
+
void run();
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "commonjs",
|
|
3
|
+
"name": "create-akan-workspace",
|
|
4
|
+
"version": "0.0.32",
|
|
5
|
+
"bin": {
|
|
6
|
+
"create-akan-workspace": "index.js"
|
|
7
|
+
},
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/akan-team/akanjs.git",
|
|
14
|
+
"directory": "pkgs/@akanjs/cli"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@inquirer/prompts": "^7.2.1",
|
|
18
|
+
"@urql/core": "^5.1.0",
|
|
19
|
+
"commander": "^13.1.0",
|
|
20
|
+
"dayjs": "^1.11.13",
|
|
21
|
+
"pluralize": "^8.0.0"
|
|
22
|
+
},
|
|
23
|
+
"main": "./index.js"
|
|
24
|
+
}
|