@akanjs/devkit 0.0.64 → 0.0.66
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/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all) => {
|
|
6
8
|
for (var name in all)
|
|
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
18
|
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
17
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
28
|
var command_exports = {};
|
|
19
29
|
__export(command_exports, {
|
|
@@ -22,6 +32,7 @@ __export(command_exports, {
|
|
|
22
32
|
module.exports = __toCommonJS(command_exports);
|
|
23
33
|
var import_prompts = require("@inquirer/prompts");
|
|
24
34
|
var import_commander = require("commander");
|
|
35
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
25
36
|
var import_executors = require("../executors");
|
|
26
37
|
var import_argMeta = require("./argMeta");
|
|
27
38
|
var import_targetMeta = require("./targetMeta");
|
|
@@ -114,7 +125,9 @@ const getArgumentValue = async (argMeta, value, workspace) => {
|
|
|
114
125
|
throw new Error(`Invalid system type: ${argMeta.type}`);
|
|
115
126
|
};
|
|
116
127
|
const runCommands = async (...commands) => {
|
|
117
|
-
|
|
128
|
+
const hasPackageJson = import_fs.default.existsSync("package.json");
|
|
129
|
+
const version = hasPackageJson ? JSON.parse(import_fs.default.readFileSync("package.json", "utf8")).version : "0.0.1";
|
|
130
|
+
import_commander.program.version(version).description("Akan CLI");
|
|
118
131
|
for (const command of commands) {
|
|
119
132
|
const targetMetas = (0, import_targetMeta.getTargetMetas)(command);
|
|
120
133
|
for (const targetMeta of targetMetas) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { confirm, input, select } from "@inquirer/prompts";
|
|
2
2
|
import { program } from "commander";
|
|
3
|
+
import fs from "fs";
|
|
3
4
|
import { AppExecutor, LibExecutor, PkgExecutor, WorkspaceExecutor } from "../executors";
|
|
4
5
|
import { getArgMetas } from "./argMeta";
|
|
5
6
|
import { getTargetMetas } from "./targetMeta";
|
|
@@ -92,7 +93,9 @@ const getArgumentValue = async (argMeta, value, workspace) => {
|
|
|
92
93
|
throw new Error(`Invalid system type: ${argMeta.type}`);
|
|
93
94
|
};
|
|
94
95
|
const runCommands = async (...commands) => {
|
|
95
|
-
|
|
96
|
+
const hasPackageJson = fs.existsSync("package.json");
|
|
97
|
+
const version = hasPackageJson ? JSON.parse(fs.readFileSync("package.json", "utf8")).version : "0.0.1";
|
|
98
|
+
program.version(version).description("Akan CLI");
|
|
96
99
|
for (const command of commands) {
|
|
97
100
|
const targetMetas = getTargetMetas(command);
|
|
98
101
|
for (const targetMeta of targetMetas) {
|
package/src/executors.cjs
CHANGED
|
@@ -491,6 +491,25 @@ class SysExecutor extends Executor {
|
|
|
491
491
|
if (this.type === "lib")
|
|
492
492
|
await this.applyTemplate({ basePath: ".", template: "index.ts", scanResult });
|
|
493
493
|
this.writeJson(`akan.${this.type}.json`, scanResult);
|
|
494
|
+
if (this.type === "app")
|
|
495
|
+
return scanResult;
|
|
496
|
+
const libPackageJson = this.readJson("package.json");
|
|
497
|
+
const libPkgJsonWithDeps = {
|
|
498
|
+
...libPackageJson,
|
|
499
|
+
dependencies: {
|
|
500
|
+
...libPackageJson.dependencies,
|
|
501
|
+
...Object.fromEntries(
|
|
502
|
+
scanResult.dependencies.filter((dep) => rootPackageJson.dependencies?.[dep]).sort().map((dep) => [dep, rootPackageJson.dependencies?.[dep]])
|
|
503
|
+
)
|
|
504
|
+
},
|
|
505
|
+
devDependencies: {
|
|
506
|
+
...libPackageJson.devDependencies,
|
|
507
|
+
...Object.fromEntries(
|
|
508
|
+
scanResult.dependencies.filter((dep) => rootPackageJson.devDependencies?.[dep]).sort().map((dep) => [dep, rootPackageJson.devDependencies?.[dep]])
|
|
509
|
+
)
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
this.writeJson("package.json", libPkgJsonWithDeps);
|
|
494
513
|
return scanResult;
|
|
495
514
|
}
|
|
496
515
|
getLocalFile(filePath) {
|
package/src/executors.js
CHANGED
|
@@ -455,6 +455,25 @@ class SysExecutor extends Executor {
|
|
|
455
455
|
if (this.type === "lib")
|
|
456
456
|
await this.applyTemplate({ basePath: ".", template: "index.ts", scanResult });
|
|
457
457
|
this.writeJson(`akan.${this.type}.json`, scanResult);
|
|
458
|
+
if (this.type === "app")
|
|
459
|
+
return scanResult;
|
|
460
|
+
const libPackageJson = this.readJson("package.json");
|
|
461
|
+
const libPkgJsonWithDeps = {
|
|
462
|
+
...libPackageJson,
|
|
463
|
+
dependencies: {
|
|
464
|
+
...libPackageJson.dependencies,
|
|
465
|
+
...Object.fromEntries(
|
|
466
|
+
scanResult.dependencies.filter((dep) => rootPackageJson.dependencies?.[dep]).sort().map((dep) => [dep, rootPackageJson.dependencies?.[dep]])
|
|
467
|
+
)
|
|
468
|
+
},
|
|
469
|
+
devDependencies: {
|
|
470
|
+
...libPackageJson.devDependencies,
|
|
471
|
+
...Object.fromEntries(
|
|
472
|
+
scanResult.dependencies.filter((dep) => rootPackageJson.devDependencies?.[dep]).sort().map((dep) => [dep, rootPackageJson.devDependencies?.[dep]])
|
|
473
|
+
)
|
|
474
|
+
}
|
|
475
|
+
};
|
|
476
|
+
this.writeJson("package.json", libPkgJsonWithDeps);
|
|
458
477
|
return scanResult;
|
|
459
478
|
}
|
|
460
479
|
getLocalFile(filePath) {
|