@akanjs/cli 0.0.78 → 0.0.80
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/index.js +65 -22
- package/package.json +1 -1
- package/pkgs/@akanjs/cli/src/application/application.command.d.ts +4 -3
- package/pkgs/@akanjs/cli/src/application/application.runner.d.ts +3 -2
- package/pkgs/@akanjs/cli/src/application/application.script.d.ts +5 -3
- package/pkgs/@akanjs/cli/src/library/library.runner.d.ts +1 -0
- package/pkgs/@akanjs/cli/src/library/library.script.d.ts +1 -0
- package/src/templates/app/jest.config.js +1 -1
- package/src/templates/libRoot/jest.config.js +1 -1
package/index.js
CHANGED
|
@@ -1932,14 +1932,22 @@ var getArgumentValue = async (argMeta, value, workspace) => {
|
|
|
1932
1932
|
const sysType = argMeta.type.toLowerCase();
|
|
1933
1933
|
const [appNames, libNames] = await workspace.getSyss();
|
|
1934
1934
|
if (sysType === "sys") {
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1935
|
+
if (value && appNames.includes(value))
|
|
1936
|
+
return AppExecutor.from(workspace, value);
|
|
1937
|
+
else if (value && libNames.includes(value))
|
|
1938
|
+
return LibExecutor.from(workspace, value);
|
|
1939
|
+
else {
|
|
1940
|
+
const sysName = await (0, import_prompts3.select)({
|
|
1941
|
+
message: `Select the App or Lib name`,
|
|
1942
|
+
choices: [...appNames, ...libNames]
|
|
1943
|
+
});
|
|
1944
|
+
if (appNames.includes(sysName))
|
|
1945
|
+
return AppExecutor.from(workspace, sysName);
|
|
1946
|
+
else if (libNames.includes(sysName))
|
|
1947
|
+
return LibExecutor.from(workspace, sysName);
|
|
1948
|
+
else
|
|
1949
|
+
throw new Error(`Invalid system name: ${sysName}`);
|
|
1950
|
+
}
|
|
1943
1951
|
} else if (sysType === "app") {
|
|
1944
1952
|
if (value && appNames.includes(value))
|
|
1945
1953
|
return AppExecutor.from(workspace, value);
|
|
@@ -2128,6 +2136,14 @@ var LibraryRunner = class {
|
|
|
2128
2136
|
);
|
|
2129
2137
|
lib.logger.log(`${lib.name} library pulled from ${branch} branch`);
|
|
2130
2138
|
}
|
|
2139
|
+
async testLibrary(lib) {
|
|
2140
|
+
await lib.workspace.spawn("node", [
|
|
2141
|
+
"node_modules/jest/bin/jest.js",
|
|
2142
|
+
`libs/${lib.name}`,
|
|
2143
|
+
"-c",
|
|
2144
|
+
`libs/${lib.name}/jest.config.ts`
|
|
2145
|
+
]);
|
|
2146
|
+
}
|
|
2131
2147
|
};
|
|
2132
2148
|
|
|
2133
2149
|
// pkgs/@akanjs/cli/src/library/library.script.ts
|
|
@@ -2158,6 +2174,9 @@ var LibraryScript = class {
|
|
|
2158
2174
|
await this.#runner.pullLibrary(lib, branch);
|
|
2159
2175
|
await this.#runner.mergeLibraryDependencies(lib);
|
|
2160
2176
|
}
|
|
2177
|
+
async testLibrary(lib) {
|
|
2178
|
+
await this.#runner.testLibrary(lib);
|
|
2179
|
+
}
|
|
2161
2180
|
};
|
|
2162
2181
|
|
|
2163
2182
|
// pkgs/@akanjs/cli/src/application/application.runner.ts
|
|
@@ -3433,11 +3452,11 @@ var ApplicationRunner = class {
|
|
|
3433
3452
|
`./dump/${app.name}-${source}`
|
|
3434
3453
|
]);
|
|
3435
3454
|
}
|
|
3436
|
-
async
|
|
3455
|
+
async dbup(workspace) {
|
|
3437
3456
|
await workspace.applyTemplate({ basePath: "local", template: "localDev", dict: { repoName: workspace.repoName } });
|
|
3438
3457
|
await workspace.spawn(`docker`, ["compose", "up", "-d"], { cwd: `${workspace.workspaceRoot}/local` });
|
|
3439
3458
|
}
|
|
3440
|
-
async
|
|
3459
|
+
async dbdown(workspace) {
|
|
3441
3460
|
await workspace.spawn(`docker`, ["compose", "down"], { cwd: `${workspace.workspaceRoot}/local` });
|
|
3442
3461
|
}
|
|
3443
3462
|
async configureApp(app) {
|
|
@@ -3616,6 +3635,14 @@ var ApplicationRunner = class {
|
|
|
3616
3635
|
template: ""
|
|
3617
3636
|
};
|
|
3618
3637
|
}
|
|
3638
|
+
async testApplication(app) {
|
|
3639
|
+
await app.workspace.spawn("node", [
|
|
3640
|
+
"node_modules/jest/bin/jest.js",
|
|
3641
|
+
`apps/${app.name}`,
|
|
3642
|
+
"-c",
|
|
3643
|
+
`apps/${app.name}/jest.config.ts`
|
|
3644
|
+
]);
|
|
3645
|
+
}
|
|
3619
3646
|
};
|
|
3620
3647
|
|
|
3621
3648
|
// pkgs/@akanjs/cli/src/application/application.script.ts
|
|
@@ -3703,11 +3730,11 @@ var ApplicationScript = class {
|
|
|
3703
3730
|
await this.#runner.restoreDatabase(app, source, target);
|
|
3704
3731
|
}
|
|
3705
3732
|
async pullDatabase(app, environment, dump) {
|
|
3706
|
-
await this.
|
|
3733
|
+
await this.dbdown(app.workspace);
|
|
3707
3734
|
const hasDump = app.workspace.exists(`dump/${app.name}-${environment}`);
|
|
3708
3735
|
if (dump || !hasDump)
|
|
3709
3736
|
await this.dumpDatabase(app, environment);
|
|
3710
|
-
await this.
|
|
3737
|
+
await this.dbup(app.workspace);
|
|
3711
3738
|
await this.restoreDatabase(app, environment, "local");
|
|
3712
3739
|
}
|
|
3713
3740
|
async configureApp(app) {
|
|
@@ -3716,11 +3743,20 @@ var ApplicationScript = class {
|
|
|
3716
3743
|
async releaseSource(app, options) {
|
|
3717
3744
|
await this.#runner.releaseSource(app, options);
|
|
3718
3745
|
}
|
|
3719
|
-
async
|
|
3720
|
-
await this.#runner.
|
|
3746
|
+
async dbup(workspace) {
|
|
3747
|
+
await this.#runner.dbup(workspace);
|
|
3721
3748
|
}
|
|
3722
|
-
async
|
|
3723
|
-
await this.#runner.
|
|
3749
|
+
async dbdown(workspace) {
|
|
3750
|
+
await this.#runner.dbdown(workspace);
|
|
3751
|
+
}
|
|
3752
|
+
async testSys(sys2) {
|
|
3753
|
+
if (sys2.type === "app")
|
|
3754
|
+
await this.testApplication(sys2);
|
|
3755
|
+
else
|
|
3756
|
+
await this.libraryScript.testLibrary(sys2);
|
|
3757
|
+
}
|
|
3758
|
+
async testApplication(app) {
|
|
3759
|
+
await this.#runner.testApplication(app);
|
|
3724
3760
|
}
|
|
3725
3761
|
};
|
|
3726
3762
|
|
|
@@ -3786,11 +3822,11 @@ var ApplicationCommand = class {
|
|
|
3786
3822
|
async restoreDatabase(app, source, target) {
|
|
3787
3823
|
await this.applicationScript.restoreDatabase(app, source, target);
|
|
3788
3824
|
}
|
|
3789
|
-
async
|
|
3790
|
-
await this.applicationScript.
|
|
3825
|
+
async dbup(workspace) {
|
|
3826
|
+
await this.applicationScript.dbup(workspace);
|
|
3791
3827
|
}
|
|
3792
|
-
async
|
|
3793
|
-
await this.applicationScript.
|
|
3828
|
+
async dbdown(workspace) {
|
|
3829
|
+
await this.applicationScript.dbdown(workspace);
|
|
3794
3830
|
}
|
|
3795
3831
|
async pullDatabase(app, env, dump) {
|
|
3796
3832
|
await this.applicationScript.pullDatabase(app, env, dump);
|
|
@@ -3798,6 +3834,9 @@ var ApplicationCommand = class {
|
|
|
3798
3834
|
async configureApp(app) {
|
|
3799
3835
|
await this.applicationScript.configureApp(app);
|
|
3800
3836
|
}
|
|
3837
|
+
async test(sys2) {
|
|
3838
|
+
await this.applicationScript.testSys(sys2);
|
|
3839
|
+
}
|
|
3801
3840
|
};
|
|
3802
3841
|
__decorateClass([
|
|
3803
3842
|
Target.Public(),
|
|
@@ -3908,11 +3947,11 @@ __decorateClass([
|
|
|
3908
3947
|
__decorateClass([
|
|
3909
3948
|
Target.Public(),
|
|
3910
3949
|
__decorateParam(0, Workspace())
|
|
3911
|
-
], ApplicationCommand.prototype, "
|
|
3950
|
+
], ApplicationCommand.prototype, "dbup", 1);
|
|
3912
3951
|
__decorateClass([
|
|
3913
3952
|
Target.Public(),
|
|
3914
3953
|
__decorateParam(0, Workspace())
|
|
3915
|
-
], ApplicationCommand.prototype, "
|
|
3954
|
+
], ApplicationCommand.prototype, "dbdown", 1);
|
|
3916
3955
|
__decorateClass([
|
|
3917
3956
|
Target.Public(),
|
|
3918
3957
|
__decorateParam(0, App()),
|
|
@@ -3923,6 +3962,10 @@ __decorateClass([
|
|
|
3923
3962
|
Target.Public(),
|
|
3924
3963
|
__decorateParam(0, App())
|
|
3925
3964
|
], ApplicationCommand.prototype, "configureApp", 1);
|
|
3965
|
+
__decorateClass([
|
|
3966
|
+
Target.Public(),
|
|
3967
|
+
__decorateParam(0, Sys())
|
|
3968
|
+
], ApplicationCommand.prototype, "test", 1);
|
|
3926
3969
|
ApplicationCommand = __decorateClass([
|
|
3927
3970
|
Commands()
|
|
3928
3971
|
], ApplicationCommand);
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { App, Workspace } from "@akanjs/devkit";
|
|
1
|
+
import { App, Sys, Workspace } from "@akanjs/devkit";
|
|
2
2
|
import { ApplicationScript } from "./application.script";
|
|
3
3
|
export declare class ApplicationCommand {
|
|
4
4
|
applicationScript: ApplicationScript;
|
|
@@ -22,8 +22,9 @@ export declare class ApplicationCommand {
|
|
|
22
22
|
releaseSource(app: App, rebuild: boolean, buildNum: number, environment: string, local: boolean): Promise<void>;
|
|
23
23
|
dumpDatabase(app: App, environment: string): Promise<void>;
|
|
24
24
|
restoreDatabase(app: App, source: string, target: string): Promise<void>;
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
dbup(workspace: Workspace): Promise<void>;
|
|
26
|
+
dbdown(workspace: Workspace): Promise<void>;
|
|
27
27
|
pullDatabase(app: App, env: string, dump: boolean): Promise<void>;
|
|
28
28
|
configureApp(app: App): Promise<void>;
|
|
29
|
+
test(sys: Sys): Promise<void>;
|
|
29
30
|
}
|
|
@@ -29,10 +29,11 @@ export declare class ApplicationRunner {
|
|
|
29
29
|
releaseAndroid(app: App): Promise<void>;
|
|
30
30
|
dumpDatabase(app: App, environment: string): Promise<void>;
|
|
31
31
|
restoreDatabase(app: App, source: string, target: string): Promise<void>;
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
dbup(workspace: Workspace): Promise<void>;
|
|
33
|
+
dbdown(workspace: Workspace): Promise<void>;
|
|
34
34
|
configureApp(app: App): Promise<void>;
|
|
35
35
|
releaseSource(app: App, { rebuild, buildNum, environment, local }?: ReleaseSourceOptions): Promise<void>;
|
|
36
36
|
createApplicationTemplate(workspace: Workspace, appName: string): Promise<void>;
|
|
37
37
|
generateApplicationTemplate(app: App): Promise<void>;
|
|
38
|
+
testApplication(app: App): Promise<void>;
|
|
38
39
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { App, Workspace } from "@akanjs/devkit";
|
|
1
|
+
import type { App, Sys, Workspace } from "@akanjs/devkit";
|
|
2
2
|
import { DistAppExecutor } from "@akanjs/devkit";
|
|
3
3
|
import { LibraryScript } from "../library/library.script";
|
|
4
4
|
import { type ReleaseSourceOptions } from "./application.runner";
|
|
@@ -35,6 +35,8 @@ export declare class ApplicationScript {
|
|
|
35
35
|
pullDatabase(app: App, environment: string, dump?: boolean): Promise<void>;
|
|
36
36
|
configureApp(app: App): Promise<void>;
|
|
37
37
|
releaseSource(app: App, options: ReleaseSourceOptions): Promise<void>;
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
dbup(workspace: Workspace): Promise<void>;
|
|
39
|
+
dbdown(workspace: Workspace): Promise<void>;
|
|
40
|
+
testSys(sys: Sys): Promise<void>;
|
|
41
|
+
testApplication(app: App): Promise<void>;
|
|
40
42
|
}
|
|
@@ -25,7 +25,7 @@ function getContent(scanResult, dict) {
|
|
|
25
25
|
//! will be replaced with akan.config.ts
|
|
26
26
|
import "tsconfig-paths/register";
|
|
27
27
|
|
|
28
|
-
import { withBase } from "@akanjs/test/
|
|
28
|
+
import { withBase } from "@akanjs/test/jest.config.base";
|
|
29
29
|
|
|
30
30
|
const config = withBase("${dict.appName}");
|
|
31
31
|
|
|
@@ -25,7 +25,7 @@ function getContent(scanResult, dict) {
|
|
|
25
25
|
//! will be replaced with akan.config.ts
|
|
26
26
|
import "tsconfig-paths/register";
|
|
27
27
|
|
|
28
|
-
import { withBase } from "@akanjs/test/
|
|
28
|
+
import { withBase } from "@akanjs/test/jest.config.base";
|
|
29
29
|
|
|
30
30
|
const config = withBase("${dict.appName}");
|
|
31
31
|
|