@simplysm/sd-cli 7.0.249 → 7.0.263
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 +48 -0
- package/dist/bin/sd-cli.mjs +171 -13
- package/dist/build-tool/SdCliElectron.mjs +3 -2
- package/dist/builder/SdCliClientBuilder.mjs +11 -7
- package/dist/builder/SdCliTsLibBuilder.mjs +18 -12
- package/dist/commons.d.ts +6 -1
- package/dist/entry-points/SdCliProjectGenerator.d.ts +37 -0
- package/dist/entry-points/SdCliProjectGenerator.mjs +288 -0
- package/dist/entry-points/SdCliWorkspace.d.ts +6 -6
- package/dist/entry-points/SdCliWorkspace.mjs +61 -107
- package/dist/entry-points/file/base/fc_package_eslintrc.d.ts +3 -0
- package/dist/entry-points/file/base/fc_package_eslintrc.mjs +31 -0
- package/dist/entry-points/file/base/fc_package_npmconfig.d.ts +9 -0
- package/dist/entry-points/file/base/fc_package_npmconfig.mjs +32 -0
- package/dist/entry-points/file/base/fc_package_tsconfig.d.ts +4 -0
- package/dist/entry-points/file/base/fc_package_tsconfig.mjs +12 -0
- package/dist/entry-points/file/client/fc_package_AppModule.d.ts +1 -0
- package/dist/entry-points/file/client/fc_package_AppModule.mjs +37 -0
- package/dist/entry-points/file/client/fc_package_AppPage.d.ts +1 -0
- package/dist/entry-points/file/client/fc_package_AppPage.mjs +34 -0
- package/dist/entry-points/file/client/fc_package_appicons.d.ts +1 -0
- package/dist/entry-points/file/client/fc_package_appicons.mjs +6 -0
- package/dist/entry-points/file/client/fc_package_client_main.d.ts +1 -0
- package/dist/entry-points/file/client/fc_package_client_main.mjs +19 -0
- package/dist/entry-points/file/client/fc_package_index.d.ts +3 -0
- package/dist/entry-points/file/client/fc_package_index.mjs +88 -0
- package/dist/entry-points/file/client/fc_package_manifest.d.ts +5 -0
- package/dist/entry-points/file/client/fc_package_manifest.mjs +54 -0
- package/dist/entry-points/file/client/fc_package_polyfills.d.ts +1 -0
- package/dist/entry-points/file/client/fc_package_polyfills.mjs +11 -0
- package/dist/entry-points/file/client/fc_package_styles.d.ts +1 -0
- package/dist/entry-points/file/client/fc_package_styles.mjs +7 -0
- package/dist/entry-points/file/db/fc_package_DbContext.d.ts +3 -0
- package/dist/entry-points/file/db/fc_package_DbContext.mjs +14 -0
- package/dist/entry-points/file/db/fc_package_DbModel.d.ts +4 -0
- package/dist/entry-points/file/db/fc_package_DbModel.mjs +12 -0
- package/dist/entry-points/file/project/fc_project_editor_config.d.ts +1 -0
- package/dist/entry-points/file/project/fc_project_editor_config.mjs +22 -0
- package/dist/entry-points/file/project/fc_project_eslintrc.d.ts +1 -0
- package/dist/entry-points/file/project/fc_project_eslintrc.mjs +30 -0
- package/dist/entry-points/file/project/fc_project_gitattributes.d.ts +1 -0
- package/dist/entry-points/file/project/fc_project_gitattributes.mjs +6 -0
- package/dist/entry-points/file/project/fc_project_gitignore.d.ts +1 -0
- package/dist/entry-points/file/project/fc_project_gitignore.mjs +17 -0
- package/dist/entry-points/file/project/fc_project_npmconfig.d.ts +7 -0
- package/dist/entry-points/file/project/fc_project_npmconfig.mjs +35 -0
- package/dist/entry-points/file/project/fc_project_readme.d.ts +3 -0
- package/dist/entry-points/file/project/fc_project_readme.mjs +12 -0
- package/dist/entry-points/file/project/fc_project_simplysm.d.ts +1 -0
- package/dist/entry-points/file/project/fc_project_simplysm.mjs +2 -0
- package/dist/entry-points/file/project/fc_project_tsconfig.d.ts +1 -0
- package/dist/entry-points/file/project/fc_project_tsconfig.mjs +26 -0
- package/dist/entry-points/file/server/fc_package_server_main.d.ts +4 -0
- package/dist/entry-points/file/server/fc_package_server_main.mjs +60 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.mjs +24 -1
- package/dist/packages/SdCliPackage.d.ts +1 -0
- package/dist/packages/SdCliPackage.mjs +68 -62
- package/dist/utils/SdCliBuildResultUtil.mjs +2 -2
- package/package.json +10 -8
- package/src/bin/sd-cli.ts +198 -12
- package/src/build-tool/SdCliElectron.ts +2 -1
- package/src/builder/SdCliClientBuilder.ts +13 -7
- package/src/builder/SdCliJsLibBuilder.ts +70 -70
- package/src/builder/SdCliTsLibBuilder.ts +450 -445
- package/src/commons.ts +6 -1
- package/src/entry-points/SdCliProjectGenerator.ts +353 -0
- package/src/entry-points/SdCliWorkspace.ts +74 -122
- package/src/entry-points/file/assets/assets/icons/icon-128x128.png +0 -0
- package/src/entry-points/file/assets/assets/icons/icon-144x144.png +0 -0
- package/src/entry-points/file/assets/assets/icons/icon-152x152.png +0 -0
- package/src/entry-points/file/assets/assets/icons/icon-192x192.png +0 -0
- package/src/entry-points/file/assets/assets/icons/icon-384x384.png +0 -0
- package/src/entry-points/file/assets/assets/icons/icon-512x512.png +0 -0
- package/src/entry-points/file/assets/assets/icons/icon-72x72.png +0 -0
- package/src/entry-points/file/assets/assets/icons/icon-96x96.png +0 -0
- package/src/entry-points/file/assets/favicon.ico +0 -0
- package/src/entry-points/file/base/fc_package_eslintrc.ts +30 -0
- package/src/entry-points/file/base/fc_package_npmconfig.ts +43 -0
- package/src/entry-points/file/base/fc_package_tsconfig.ts +11 -0
- package/src/entry-points/file/client/fc_package_AppModule.ts +36 -0
- package/src/entry-points/file/client/fc_package_AppPage.ts +33 -0
- package/src/entry-points/file/client/fc_package_appicons.ts +5 -0
- package/src/entry-points/file/client/fc_package_client_main.ts +18 -0
- package/src/entry-points/file/client/fc_package_index.ts +87 -0
- package/src/entry-points/file/client/fc_package_manifest.ts +53 -0
- package/src/entry-points/file/client/fc_package_polyfills.ts +10 -0
- package/src/entry-points/file/client/fc_package_styles.ts +6 -0
- package/src/entry-points/file/db/fc_package_DbContext.ts +14 -0
- package/src/entry-points/file/db/fc_package_DbModel.ts +11 -0
- package/src/entry-points/file/project/fc_project_editor_config.ts +21 -0
- package/src/entry-points/file/project/fc_project_eslintrc.ts +29 -0
- package/src/entry-points/file/project/fc_project_gitattributes.ts +5 -0
- package/src/entry-points/file/project/fc_project_gitignore.ts +16 -0
- package/src/entry-points/file/project/fc_project_npmconfig.ts +34 -0
- package/src/entry-points/file/project/fc_project_readme.ts +11 -0
- package/src/entry-points/file/project/fc_project_simplysm.ts +1 -0
- package/src/entry-points/file/project/fc_project_tsconfig.ts +25 -0
- package/src/entry-points/file/server/fc_package_server_main.ts +62 -0
- package/src/index.ts +23 -0
- package/src/packages/SdCliPackage.ts +75 -58
- package/src/utils/SdCliBuildResultUtil.ts +76 -76
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const fc_package_eslintrc = (opt: { isForAngular: boolean }): string => /* language=cjs */ `
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
overrides: [
|
|
5
|
+
{
|
|
6
|
+
files: ["*.ts"],
|
|
7
|
+
parserOptions: {
|
|
8
|
+
tsconfigRootDir: __dirname,
|
|
9
|
+
project: "tsconfig.json"
|
|
10
|
+
},
|
|
11
|
+
settings: {
|
|
12
|
+
"import/resolver": {
|
|
13
|
+
"typescript": {
|
|
14
|
+
project: require("path").resolve(__dirname, "tsconfig.json")
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
},${opt.isForAngular ? `
|
|
18
|
+
{
|
|
19
|
+
files: ["*.ts"],
|
|
20
|
+
extends: ["plugin:@simplysm/angular"]
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
files: ["*.html"],
|
|
24
|
+
extends: ["plugin:@simplysm/angular-template"]
|
|
25
|
+
}` : ""}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
`.trim();
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { INpmConfig } from "../../../commons";
|
|
2
|
+
import { FsUtil } from "@simplysm/sd-core-node";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
export const fc_package_npmconfig = (opt: {
|
|
6
|
+
projPath: string;
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
isModule: boolean;
|
|
10
|
+
main?: string;
|
|
11
|
+
types?: string;
|
|
12
|
+
dependencies: Record<string, string>;
|
|
13
|
+
}): string => {
|
|
14
|
+
const projNpmConfig = FsUtil.readJson(path.resolve(opt.projPath, "package.json")) as INpmConfig;
|
|
15
|
+
|
|
16
|
+
if (projNpmConfig.repository?.url === undefined) {
|
|
17
|
+
throw new Error("프로젝트 package.json 파일에 reposotry.url 이 설정되어있지 않습니다.");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return JSON.stringify({
|
|
21
|
+
name: `@${projNpmConfig.name}/${opt.name}`,
|
|
22
|
+
version: `${projNpmConfig.version}`,
|
|
23
|
+
description: `${projNpmConfig.description} - ${opt.description}`,
|
|
24
|
+
author: projNpmConfig.author,
|
|
25
|
+
repository: {
|
|
26
|
+
type: "git",
|
|
27
|
+
url: projNpmConfig.repository.url,
|
|
28
|
+
directory: `packages/${opt.name}`
|
|
29
|
+
},
|
|
30
|
+
license: "UNLICENSED",
|
|
31
|
+
...opt.isModule ? {
|
|
32
|
+
type: "module"
|
|
33
|
+
} : {},
|
|
34
|
+
private: true,
|
|
35
|
+
sideEffects: false,
|
|
36
|
+
engines: {
|
|
37
|
+
node: "^16"
|
|
38
|
+
},
|
|
39
|
+
...opt.types !== undefined ? { types: opt.types } : {},
|
|
40
|
+
...opt.main !== undefined ? { main: opt.main } : {},
|
|
41
|
+
...Object.keys(opt.dependencies).length > 0 ? { dependencies: opt.dependencies } : {}
|
|
42
|
+
}, undefined, 2);
|
|
43
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const fc_package_tsconfig = (opt: { isModule: boolean; useDom: boolean }): string => JSON.stringify({
|
|
2
|
+
extends: "../../tsconfig.json",
|
|
3
|
+
compilerOptions: {
|
|
4
|
+
...!opt.isModule ? { module: "CommonJS" } : {},
|
|
5
|
+
lib: [
|
|
6
|
+
"ES2020",
|
|
7
|
+
...opt.useDom ? ["DOM"] : []
|
|
8
|
+
],
|
|
9
|
+
outDir: "./dist"
|
|
10
|
+
}
|
|
11
|
+
}, undefined, 2);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export const fc_package_AppModule = (): string => /* language=ts */ `
|
|
2
|
+
|
|
3
|
+
import { ApplicationRef, DoBootstrap, NgModule } from "@angular/core";
|
|
4
|
+
import { BrowserModule } from "@angular/platform-browser";
|
|
5
|
+
import {
|
|
6
|
+
SdAngularModule,
|
|
7
|
+
SdCanDeactivateGuardModule,
|
|
8
|
+
SdToastProvider,
|
|
9
|
+
SdToastProviderModule
|
|
10
|
+
} from "@simplysm/sd-angular";
|
|
11
|
+
import { AppPageModule } from "./_modules/AppPageModule";
|
|
12
|
+
import { AppPage } from "./AppPage";
|
|
13
|
+
|
|
14
|
+
@NgModule({
|
|
15
|
+
imports: [
|
|
16
|
+
BrowserModule,
|
|
17
|
+
|
|
18
|
+
SdAngularModule.forRoot(),
|
|
19
|
+
SdToastProviderModule,
|
|
20
|
+
SdCanDeactivateGuardModule,
|
|
21
|
+
|
|
22
|
+
AppPageModule
|
|
23
|
+
]
|
|
24
|
+
})
|
|
25
|
+
export class AppModule implements DoBootstrap {
|
|
26
|
+
public constructor(private readonly _toast: SdToastProvider) {
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public async ngDoBootstrap(appRef: ApplicationRef): Promise<void> {
|
|
30
|
+
this._toast.alertThemes = ["danger"];
|
|
31
|
+
|
|
32
|
+
appRef.bootstrap(AppPage);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
`.trim();
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const fc_package_AppPage = (): string => /* language=ts */ `
|
|
2
|
+
|
|
3
|
+
import { ChangeDetectionStrategy, Component, HostListener } from "@angular/core";
|
|
4
|
+
import { DevModal } from "./modals/DevModal";
|
|
5
|
+
import { SdModalProvider } from "@simplysm/sd-angular";
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: "app-root",
|
|
9
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
10
|
+
template: \`APP_PAGE\`
|
|
11
|
+
})
|
|
12
|
+
export class AppPage {
|
|
13
|
+
public constructor(private readonly _modal: SdModalProvider) {
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@HostListener("document:keydown", ["$event"])
|
|
17
|
+
public async onKeydown(event: KeyboardEvent): Promise<void> {
|
|
18
|
+
if (
|
|
19
|
+
process.env["NODE_ENV"] !== "production"
|
|
20
|
+
&& event.ctrlKey
|
|
21
|
+
&& event.altKey
|
|
22
|
+
&& event.shiftKey
|
|
23
|
+
&& event.key === "F12"
|
|
24
|
+
) {
|
|
25
|
+
event.preventDefault();
|
|
26
|
+
event.stopPropagation();
|
|
27
|
+
|
|
28
|
+
await this._modal.showAsync(DevModal, "DEV", undefined, { key: "dev-modal" });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
`.trim();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const fc_package_client_main = (): string => /* language=ts */ `
|
|
2
|
+
|
|
3
|
+
import { enableProdMode } from "@angular/core";
|
|
4
|
+
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";
|
|
5
|
+
import { AppModule } from "./AppModule";
|
|
6
|
+
|
|
7
|
+
if (process.env["NODE_ENV"] === "production") {
|
|
8
|
+
enableProdMode();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
platformBrowserDynamic().bootstrapModule(AppModule)
|
|
12
|
+
.catch(err => {
|
|
13
|
+
// eslint-disable-next-line no-console
|
|
14
|
+
console.error(err);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
`.trim();
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export const fc_package_index = (opt: { description: string }): string => /* language=html */ `
|
|
2
|
+
|
|
3
|
+
<!doctype html>
|
|
4
|
+
<html lang="ko">
|
|
5
|
+
<head>
|
|
6
|
+
<meta charset="utf-8">
|
|
7
|
+
<title>${opt.description}</title>
|
|
8
|
+
<meta name="viewport" content="initial-scale=1, width=device-width, viewport-fit=cover">
|
|
9
|
+
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
|
|
10
|
+
<meta name="format-detection" content="telephone=no">
|
|
11
|
+
<meta name="msapplication-tap-highlight" content="no">
|
|
12
|
+
</head>
|
|
13
|
+
<body>
|
|
14
|
+
<app-root>
|
|
15
|
+
<style>
|
|
16
|
+
*,
|
|
17
|
+
*:after,
|
|
18
|
+
*:before {
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
html, body {
|
|
23
|
+
padding: 0;
|
|
24
|
+
margin: 0;
|
|
25
|
+
background: #f5f5f5;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.app-loader-bar {
|
|
29
|
+
position: fixed;
|
|
30
|
+
top: 0;
|
|
31
|
+
left: 0;
|
|
32
|
+
height: 2px;
|
|
33
|
+
width: 100%;
|
|
34
|
+
background-color: white;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.app-loader-bar > div {
|
|
38
|
+
position: fixed;
|
|
39
|
+
top: 0;
|
|
40
|
+
left: 0;
|
|
41
|
+
display: inline-block;
|
|
42
|
+
height: 2px;
|
|
43
|
+
width: 100%;
|
|
44
|
+
|
|
45
|
+
transform-origin: left;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.app-loader-bar > div:first-child {
|
|
49
|
+
background-color: #3f51b5;
|
|
50
|
+
animation: app-loader-bar-1 2s infinite ease-in;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.app-loader-bar > div:last-child {
|
|
54
|
+
background-color: white;
|
|
55
|
+
animation: app-loader-bar-2 2s infinite ease-out;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@keyframes app-loader-bar-1 {
|
|
59
|
+
0% {
|
|
60
|
+
transform: scaleX(0);
|
|
61
|
+
}
|
|
62
|
+
60%, 100% {
|
|
63
|
+
transform: scaleX(1.0);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@keyframes app-loader-bar-2 {
|
|
68
|
+
0%, 50% {
|
|
69
|
+
transform: scaleX(0);
|
|
70
|
+
}
|
|
71
|
+
100% {
|
|
72
|
+
transform: scaleX(1.0);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
</style>
|
|
76
|
+
|
|
77
|
+
<div class="app-loader-bar">
|
|
78
|
+
<div></div>
|
|
79
|
+
<div></div>
|
|
80
|
+
</div>
|
|
81
|
+
</app-root>
|
|
82
|
+
|
|
83
|
+
<noscript>Please enable JavaScript to continue using this application.</noscript>
|
|
84
|
+
</body>
|
|
85
|
+
</html>
|
|
86
|
+
|
|
87
|
+
`.trim();
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export const fc_package_manifest = (opt: { author: string; description: string; version: string }): string => JSON.stringify({
|
|
2
|
+
"name": opt.description,
|
|
3
|
+
"short_name": opt.description,
|
|
4
|
+
"version": opt.version,
|
|
5
|
+
"description": opt.description,
|
|
6
|
+
"author": opt.author,
|
|
7
|
+
"theme_color": "#263238",
|
|
8
|
+
"background_color": "#f5f5f5",
|
|
9
|
+
"display": "standalone",
|
|
10
|
+
"start_url": "index.html",
|
|
11
|
+
"icons": [
|
|
12
|
+
{
|
|
13
|
+
"src": "assets/icons/icon-72x72.png",
|
|
14
|
+
"sizes": "72x72",
|
|
15
|
+
"type": "image/png"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"src": "assets/icons/icon-96x96.png",
|
|
19
|
+
"sizes": "96x96",
|
|
20
|
+
"type": "image/png"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"src": "assets/icons/icon-128x128.png",
|
|
24
|
+
"sizes": "128x128",
|
|
25
|
+
"type": "image/png"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"src": "assets/icons/icon-144x144.png",
|
|
29
|
+
"sizes": "144x144",
|
|
30
|
+
"type": "image/png"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"src": "assets/icons/icon-152x152.png",
|
|
34
|
+
"sizes": "152x152",
|
|
35
|
+
"type": "image/png"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"src": "assets/icons/icon-192x192.png",
|
|
39
|
+
"sizes": "192x192",
|
|
40
|
+
"type": "image/png"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"src": "assets/icons/icon-384x384.png",
|
|
44
|
+
"sizes": "384x384",
|
|
45
|
+
"type": "image/png"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"src": "assets/icons/icon-512x512.png",
|
|
49
|
+
"sizes": "512x512",
|
|
50
|
+
"type": "image/png"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}, undefined, 2);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StringUtil } from "@simplysm/sd-core-common";
|
|
2
|
+
|
|
3
|
+
export const fc_package_DbContext = (opt: { name: string }): string => /* language=ts */ `
|
|
4
|
+
|
|
5
|
+
import { Type } from "@simplysm/sd-core-common";
|
|
6
|
+
import { IDbMigration, DbContext } from "@simplysm/sd-orm-common";
|
|
7
|
+
|
|
8
|
+
export class ${StringUtil.toPascalCase(opt.name)}DbContext extends DbContext {
|
|
9
|
+
public get migrations(): Type<IDbMigration>[] {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
`.trim();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const fc_package_DbModel = (opt: { name: string; description: string }): string => /* language=ts */ `
|
|
2
|
+
|
|
3
|
+
import { Column, Table } from "@simplysm/sd-orm-common";
|
|
4
|
+
|
|
5
|
+
@Table({ description: "${opt.description}" })
|
|
6
|
+
export class ${opt.name} {
|
|
7
|
+
@Column({ description: "ID", autoIncrement: true, primaryKey: 1 })
|
|
8
|
+
public id?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
`.trim();
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const fc_project_editor_config = (): string => /* language=editorconfig */ `
|
|
2
|
+
|
|
3
|
+
root = true
|
|
4
|
+
|
|
5
|
+
[*]
|
|
6
|
+
end_of_line = lf
|
|
7
|
+
insert_final_newline = true
|
|
8
|
+
|
|
9
|
+
charset = utf-8
|
|
10
|
+
indent_style = space
|
|
11
|
+
indent_size = 2
|
|
12
|
+
|
|
13
|
+
ij_any_else_on_new_line = true
|
|
14
|
+
ij_any_catch_on_new_line = true
|
|
15
|
+
ij_any_finally_on_new_line = true
|
|
16
|
+
ij_typescript_spaces_within_object_literal_braces = true
|
|
17
|
+
ij_typescript_spaces_within_imports = true
|
|
18
|
+
ij_javascript_spaces_within_object_literal_braces = true
|
|
19
|
+
ij_javascript_spaces_within_imports = true
|
|
20
|
+
|
|
21
|
+
`.trim();
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const fc_project_eslintrc = (): string => /* language=cjs */ `
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
root: true,
|
|
5
|
+
ignorePatterns: [
|
|
6
|
+
"**/node_modules/**",
|
|
7
|
+
"**/dist/**",
|
|
8
|
+
"**/.*/**"
|
|
9
|
+
],
|
|
10
|
+
overrides: [
|
|
11
|
+
{
|
|
12
|
+
files: ["*.js", "*.cjs", "*.mjs"],
|
|
13
|
+
extends: ["plugin:@simplysm/base"]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
files: ["*.mjs"],
|
|
17
|
+
parserOptions: {
|
|
18
|
+
ecmaVersion: 2020,
|
|
19
|
+
sourceType: "module"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
files: ["*.ts"],
|
|
24
|
+
extends: ["plugin:@simplysm/typescript"]
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
`.trim();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const fc_project_gitignore = (): string => /* language=gitignore */ `
|
|
2
|
+
|
|
3
|
+
.idea/**/workspace.xml
|
|
4
|
+
.idea/shelf
|
|
5
|
+
node_modules
|
|
6
|
+
tsconfig-build.json
|
|
7
|
+
dist
|
|
8
|
+
.cache
|
|
9
|
+
.cordova
|
|
10
|
+
_logs
|
|
11
|
+
_modules
|
|
12
|
+
_routes.ts
|
|
13
|
+
~$*.xlsx
|
|
14
|
+
.*
|
|
15
|
+
|
|
16
|
+
`.trim();
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const fc_project_npmconfig = (opt: { name: string; description: string; author: string; gitUrl: string; cliVersion?: string }): string => JSON.stringify({
|
|
2
|
+
name: opt.name,
|
|
3
|
+
version: "1.0.0",
|
|
4
|
+
description: opt.description,
|
|
5
|
+
author: opt.author,
|
|
6
|
+
repository: {
|
|
7
|
+
type: "git",
|
|
8
|
+
url: opt.gitUrl
|
|
9
|
+
},
|
|
10
|
+
type: "module",
|
|
11
|
+
license: "UNLICENSED",
|
|
12
|
+
private: true,
|
|
13
|
+
engines: {
|
|
14
|
+
node: "^16"
|
|
15
|
+
},
|
|
16
|
+
workspaces: [
|
|
17
|
+
"packages/*"
|
|
18
|
+
],
|
|
19
|
+
scripts: {
|
|
20
|
+
"watch": "sd-cli watch",
|
|
21
|
+
"build": "sd-cli build",
|
|
22
|
+
"publish": "sd-cli publish",
|
|
23
|
+
"----- utils": "",
|
|
24
|
+
"postinstall": "sd-cli prepare"
|
|
25
|
+
},
|
|
26
|
+
devDependencies: {
|
|
27
|
+
"@simplysm/eslint-plugin": "~7.0.0",
|
|
28
|
+
"@simplysm/sd-cli": opt.cliVersion ?? "~7.0.0",
|
|
29
|
+
"@types/node": "^17.0.12",
|
|
30
|
+
"cross-env": "^7.0.3",
|
|
31
|
+
"eslint": "^8.7.0",
|
|
32
|
+
"typescript": "~4.5.5"
|
|
33
|
+
}
|
|
34
|
+
}, undefined, 2);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const fc_project_simplysm = (): string => JSON.stringify({}, undefined, 2);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const fc_project_tsconfig = (): string => JSON.stringify({
|
|
2
|
+
compilerOptions: {
|
|
3
|
+
declaration: true,
|
|
4
|
+
downlevelIteration: true,
|
|
5
|
+
experimentalDecorators: true,
|
|
6
|
+
emitDecoratorMetadata: true,
|
|
7
|
+
module: "ES2020",
|
|
8
|
+
target: "ES2020",
|
|
9
|
+
strict: true,
|
|
10
|
+
moduleResolution: "node",
|
|
11
|
+
esModuleInterop: true,
|
|
12
|
+
noImplicitOverride: true,
|
|
13
|
+
noImplicitReturns: true,
|
|
14
|
+
noImplicitAny: false,
|
|
15
|
+
useUnknownInCatchVariables: false,
|
|
16
|
+
noFallthroughCasesInSwitch: true,
|
|
17
|
+
inlineSourceMap: true,
|
|
18
|
+
skipDefaultLibCheck: true,
|
|
19
|
+
skipLibCheck: true,
|
|
20
|
+
forceConsistentCasingInFileNames: true,
|
|
21
|
+
noPropertyAccessFromIndexSignature: true,
|
|
22
|
+
importHelpers: true,
|
|
23
|
+
noUnusedLocals: true
|
|
24
|
+
}
|
|
25
|
+
}, undefined, 2);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { INpmConfig } from "../../../commons";
|
|
3
|
+
import { FsUtil } from "@simplysm/sd-core-node";
|
|
4
|
+
|
|
5
|
+
export const fc_package_server_main = (opt: { projPath: string; pkgName: string }): string => {
|
|
6
|
+
const projNpmConfig = FsUtil.readJson(path.resolve(opt.projPath, "package.json")) as INpmConfig;
|
|
7
|
+
|
|
8
|
+
return /* language=ts */ `
|
|
9
|
+
|
|
10
|
+
import { SdServiceServer } from "@simplysm/sd-service-server";
|
|
11
|
+
import { Logger, LoggerSeverity } from "@simplysm/sd-core-node";
|
|
12
|
+
import path from "path";
|
|
13
|
+
|
|
14
|
+
Error.stackTraceLimit = Infinity;
|
|
15
|
+
|
|
16
|
+
if (process.env["NODE_ENV"] === "production") {
|
|
17
|
+
Logger.setConfig({
|
|
18
|
+
console: {
|
|
19
|
+
level: LoggerSeverity.none
|
|
20
|
+
},
|
|
21
|
+
file: {
|
|
22
|
+
level: LoggerSeverity.debug,
|
|
23
|
+
outDir: path.resolve(__dirname, "_logs")
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
else if (process.env["SD_CLI_LOGGER_SEVERITY"] === "DEBUG") {
|
|
28
|
+
Logger.setConfig({
|
|
29
|
+
console: {
|
|
30
|
+
level: LoggerSeverity.debug
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
Logger.setConfig({
|
|
36
|
+
console: {
|
|
37
|
+
level: LoggerSeverity.log,
|
|
38
|
+
},
|
|
39
|
+
file: {
|
|
40
|
+
level: LoggerSeverity.debug,
|
|
41
|
+
outDir: path.resolve(process.cwd(), "_logs")
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const server = new SdServiceServer({
|
|
47
|
+
rootPath: __dirname,
|
|
48
|
+
services: [],
|
|
49
|
+
port: 50180
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const logger = Logger.get(["${projNpmConfig.name}", "${opt.pkgName}"]);
|
|
53
|
+
|
|
54
|
+
server.listenAsync().catch((err) => {
|
|
55
|
+
logger.error(err);
|
|
56
|
+
process.exit(1);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export = server;
|
|
60
|
+
|
|
61
|
+
`.trim();
|
|
62
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -10,10 +10,33 @@ export * from "./builder/SdCliJsLibBuilder";
|
|
|
10
10
|
export * from "./builder/SdCliServerBuilder";
|
|
11
11
|
export * from "./builder/SdCliTsLibBuilder";
|
|
12
12
|
export * from "./commons";
|
|
13
|
+
export * from "./entry-points/file/base/fc_package_eslintrc";
|
|
14
|
+
export * from "./entry-points/file/base/fc_package_npmconfig";
|
|
15
|
+
export * from "./entry-points/file/base/fc_package_tsconfig";
|
|
16
|
+
export * from "./entry-points/file/client/fc_package_appicons";
|
|
17
|
+
export * from "./entry-points/file/client/fc_package_AppModule";
|
|
18
|
+
export * from "./entry-points/file/client/fc_package_AppPage";
|
|
19
|
+
export * from "./entry-points/file/client/fc_package_client_main";
|
|
20
|
+
export * from "./entry-points/file/client/fc_package_index";
|
|
21
|
+
export * from "./entry-points/file/client/fc_package_manifest";
|
|
22
|
+
export * from "./entry-points/file/client/fc_package_polyfills";
|
|
23
|
+
export * from "./entry-points/file/client/fc_package_styles";
|
|
24
|
+
export * from "./entry-points/file/db/fc_package_DbContext";
|
|
25
|
+
export * from "./entry-points/file/db/fc_package_DbModel";
|
|
26
|
+
export * from "./entry-points/file/project/fc_project_editor_config";
|
|
27
|
+
export * from "./entry-points/file/project/fc_project_eslintrc";
|
|
28
|
+
export * from "./entry-points/file/project/fc_project_gitattributes";
|
|
29
|
+
export * from "./entry-points/file/project/fc_project_gitignore";
|
|
30
|
+
export * from "./entry-points/file/project/fc_project_npmconfig";
|
|
31
|
+
export * from "./entry-points/file/project/fc_project_readme";
|
|
32
|
+
export * from "./entry-points/file/project/fc_project_simplysm";
|
|
33
|
+
export * from "./entry-points/file/project/fc_project_tsconfig";
|
|
34
|
+
export * from "./entry-points/file/server/fc_package_server_main";
|
|
13
35
|
export * from "./entry-points/SdCliFileCrypto";
|
|
14
36
|
export * from "./entry-points/SdCliLocalUpdate";
|
|
15
37
|
export * from "./entry-points/SdCliNpm";
|
|
16
38
|
export * from "./entry-points/SdCliPrepare";
|
|
39
|
+
export * from "./entry-points/SdCliProjectGenerator";
|
|
17
40
|
export * from "./entry-points/SdCliWorkspace";
|
|
18
41
|
export * from "./ng-tools/babel/SdCliBbFileMetadata";
|
|
19
42
|
export * from "./ng-tools/babel/SdCliBbRootMetadata";
|