create-akan-workspace 0.0.34 → 0.0.141

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/cjs/index.js ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env node
2
+ var import_child_process = require("child_process");
3
+ var import_commander = require("commander");
4
+ import_commander.program.name("create-akan-workspace");
5
+ const spawnProcess = (command, args, options = {}) => {
6
+ const proc = (0, import_child_process.spawn)(command, args, { cwd: process.cwd(), stdio: "inherit", ...options });
7
+ return new Promise((resolve, reject) => {
8
+ proc.on("exit", (code, signal) => {
9
+ if (!!code || signal)
10
+ reject({ code, signal });
11
+ else
12
+ resolve({ code, signal });
13
+ });
14
+ });
15
+ };
16
+ import_commander.program.argument("[org]", "organization name").option("-a, --app <string>", "application name").option("-d, --dir <string>", "directory").action(async (org, options, command) => {
17
+ await spawnProcess("npm", ["install", "-g", "@akanjs/cli", "--latest"]);
18
+ await spawnProcess("akan", [
19
+ "create-workspace",
20
+ ...org ? [org] : [],
21
+ ...options.app ? [`--app=${options.app}`] : [],
22
+ ...options.dir ? [`--dir=${options.dir}`] : []
23
+ ]);
24
+ });
25
+ const run = async () => {
26
+ await import_commander.program.parseAsync(process.argv);
27
+ };
28
+ void run();
package/esm/index.js ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env node
2
+ import { spawn } from "child_process";
3
+ import { program } from "commander";
4
+ program.name("create-akan-workspace");
5
+ const spawnProcess = (command, args, options = {}) => {
6
+ const proc = spawn(command, args, { cwd: process.cwd(), stdio: "inherit", ...options });
7
+ return new Promise((resolve, reject) => {
8
+ proc.on("exit", (code, signal) => {
9
+ if (!!code || signal)
10
+ reject({ code, signal });
11
+ else
12
+ resolve({ code, signal });
13
+ });
14
+ });
15
+ };
16
+ program.argument("[org]", "organization name").option("-a, --app <string>", "application name").option("-d, --dir <string>", "directory").action(async (org, options, command) => {
17
+ await spawnProcess("npm", ["install", "-g", "@akanjs/cli", "--latest"]);
18
+ await spawnProcess("akan", [
19
+ "create-workspace",
20
+ ...org ? [org] : [],
21
+ ...options.app ? [`--app=${options.app}`] : [],
22
+ ...options.dir ? [`--dir=${options.dir}`] : []
23
+ ]);
24
+ });
25
+ const run = async () => {
26
+ await program.parseAsync(process.argv);
27
+ };
28
+ void run();
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
- "type": "commonjs",
2
+ "sourceType": "module",
3
3
  "name": "create-akan-workspace",
4
- "version": "0.0.34",
4
+ "version": "0.0.141",
5
5
  "bin": {
6
- "create-akan-workspace": "index.js"
6
+ "create-akan-workspace": "cjs/index.js"
7
7
  },
8
8
  "publishConfig": {
9
9
  "access": "public"
@@ -13,12 +13,18 @@
13
13
  "url": "https://github.com/akan-team/akanjs.git",
14
14
  "directory": "pkgs/@akanjs/cli"
15
15
  },
16
+ "main": "./index.js",
17
+ "engines": {
18
+ "node": ">=22"
19
+ },
16
20
  "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"
21
+ "commander": "^13.1.0"
22
22
  },
23
- "main": "./index.js"
24
- }
23
+ "exports": {
24
+ ".": {
25
+ "require": "./cjs/index.js",
26
+ "import": "./esm/index.js",
27
+ "types": "./index.d.ts"
28
+ }
29
+ }
30
+ }
package/index.js DELETED
@@ -1,185 +0,0 @@
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();