@apps-in-toss/cli 3.0.2 → 3.1.0-beta.0
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/dist/index.js +33 -4
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createRequire } from "node:module";
|
|
|
3
3
|
import { Builtins, Cli, Command, Option } from "clipanion";
|
|
4
4
|
import * as p from "@clack/prompts";
|
|
5
5
|
import path from "path";
|
|
6
|
-
import { appendFile, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
|
|
6
|
+
import { appendFile, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
7
7
|
import path$1, { basename, dirname, extname, join, parse, resolve } from "node:path";
|
|
8
8
|
import { AppsInTossBundle, PlatformType } from "@apps-in-toss/ait-format";
|
|
9
9
|
import { loadConfig } from "c12";
|
|
@@ -49,7 +49,12 @@ async function buildArtifact() {
|
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
appsInTossConfig.permissions.forEach(({ name, access }) => writer.addPermission(name, access));
|
|
52
|
-
const
|
|
52
|
+
const webBundleDir = path$1.resolve(projectRoot, appsInTossConfig.webBundleDir);
|
|
53
|
+
if ((await stat(webBundleDir).catch(() => null))?.isDirectory() !== true) {
|
|
54
|
+
p.log.error(`웹 빌드 디렉토리(${appsInTossConfig.webBundleDir})가 존재하지 않습니다. 웹 빌드를 먼저 실행해주세요.`);
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
const webBundleFiles = await getWebBundleFiles(webBundleDir);
|
|
53
58
|
if (webBundleFiles.find((file) => file.name === "index.html") == null) {
|
|
54
59
|
p.log.error("웹 빌드 디렉토리에 index.html이 존재해야 합니다.");
|
|
55
60
|
process.exit(1);
|
|
@@ -74,8 +79,16 @@ async function buildArtifact() {
|
|
|
74
79
|
outPath
|
|
75
80
|
};
|
|
76
81
|
}
|
|
82
|
+
const SDK_PACKAGE_NAME = "@apps-in-toss/web-framework";
|
|
77
83
|
async function getSDKPackageJson() {
|
|
78
|
-
const
|
|
84
|
+
const projectRequire = createRequire(path$1.resolve(getPackageRoot(process.cwd()), "package.json"));
|
|
85
|
+
let packageJsonPath;
|
|
86
|
+
try {
|
|
87
|
+
packageJsonPath = projectRequire.resolve(`${SDK_PACKAGE_NAME}/package.json`);
|
|
88
|
+
} catch {
|
|
89
|
+
packageJsonPath = path$1.resolve(getPackageRoot(import.meta.dirname), "package.json");
|
|
90
|
+
}
|
|
91
|
+
const packageJsonString = (await readFile(packageJsonPath)).toString();
|
|
79
92
|
return JSON.parse(packageJsonString);
|
|
80
93
|
}
|
|
81
94
|
async function getAppsInTossConfig() {
|
|
@@ -87,7 +100,23 @@ async function getAppsInTossConfig() {
|
|
|
87
100
|
packageJson: false
|
|
88
101
|
});
|
|
89
102
|
if (configFile == null) throw new Error("Config 파일을 찾을 수 없습니다.");
|
|
90
|
-
|
|
103
|
+
if (typeof config.appName !== "string" || config.appName.trim() === "") {
|
|
104
|
+
p.log.error("apps-in-toss.config에 appName이 설정되어야 합니다. (예: appName: 'my-app')");
|
|
105
|
+
process.exit(1);
|
|
106
|
+
}
|
|
107
|
+
if (typeof config.brand?.primaryColor !== "string" || config.brand.primaryColor.trim() === "") {
|
|
108
|
+
p.log.error("apps-in-toss.config에 brand.primaryColor가 설정되어야 합니다. (예: brand: { primaryColor: '#3182F6' })");
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
111
|
+
const webBundleDir = config.webBundleDir ?? "dist";
|
|
112
|
+
if (typeof webBundleDir !== "string" || webBundleDir.trim() === "") {
|
|
113
|
+
p.log.error("apps-in-toss.config의 webBundleDir이 올바르지 않습니다.");
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
...config,
|
|
118
|
+
webBundleDir
|
|
119
|
+
};
|
|
91
120
|
}
|
|
92
121
|
function getUnityMetadata() {
|
|
93
122
|
const unityMetadataString = process.env.UNITY_METADATA;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apps-in-toss/cli",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.1.0-beta.0",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"bin": {
|
|
6
6
|
"ait": "dist/index.js"
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"typecheck": "tsc --noEmit"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@apps-in-toss/ait-format": "
|
|
21
|
+
"@apps-in-toss/ait-format": "1.0.0",
|
|
22
22
|
"@clack/prompts": "^1.3.0",
|
|
23
|
-
"c12": "
|
|
23
|
+
"c12": "3.3.4",
|
|
24
24
|
"clipanion": "^4.0.0-rc.4",
|
|
25
25
|
"jscodeshift": "^17.1.2",
|
|
26
26
|
"uuidv7": "^1.2.1"
|