@apps-in-toss/web-framework 3.0.0-beta.973c8c3 → 3.0.0-beta.b36d7b5

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/cli.js CHANGED
@@ -4,12 +4,13 @@
4
4
  import { Cli, Builtins } from "clipanion";
5
5
 
6
6
  // src/cli/commands/build/index.ts
7
- import * as p from "@clack/prompts";
7
+ import * as p2 from "@clack/prompts";
8
8
  import { Command } from "clipanion";
9
9
  import path3 from "path";
10
10
 
11
11
  // src/cli/commands/build/buildArtifact.ts
12
12
  import { AppsInTossBundle, PlatformType } from "@apps-in-toss/ait-format";
13
+ import * as p from "@clack/prompts";
13
14
  import { cosmiconfig } from "cosmiconfig";
14
15
  import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
15
16
  import path2 from "path";
@@ -61,6 +62,10 @@ async function buildArtifact() {
61
62
  appsInTossConfig.webBundleDir
62
63
  );
63
64
  const webBundleFiles = await getWebBundleFiles(webBundleDir);
65
+ if (webBundleFiles.find((file) => file.name === "index.html") == null) {
66
+ p.log.error("\uC6F9 \uBE4C\uB4DC \uB514\uB809\uD1A0\uB9AC\uC5D0 index.html\uC774 \uC874\uC7AC\uD574\uC57C \uD569\uB2C8\uB2E4.");
67
+ process.exit(1);
68
+ }
64
69
  for (const file of webBundleFiles) {
65
70
  writer.addFile("sources/" + file.name, file.data);
66
71
  }
@@ -131,7 +136,7 @@ async function getWebBundleFiles(webBundleDir) {
131
136
  const filePaths = await getFilePathsInDir(webBundleDir);
132
137
  const files = [];
133
138
  for (const filePath of filePaths) {
134
- const name = filePath.replace(webBundleDir + "/", "");
139
+ const name = path2.relative(webBundleDir, filePath);
135
140
  const data = new Uint8Array(await readFile(filePath));
136
141
  files.push({ name, data });
137
142
  }
@@ -158,10 +163,10 @@ var BuildCommand = class extends Command {
158
163
  });
159
164
  async execute() {
160
165
  const buildResult = await buildArtifact();
161
- p.log.success(
166
+ p2.log.success(
162
167
  `\uC571\uC778\uD1A0\uC2A4 \uBE4C\uB4DC\uAC00 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4. (${path3.basename(buildResult.outPath)})`
163
168
  );
164
- p.log.info(`deploymentId: ${buildResult.deploymentId}`);
169
+ p2.log.info(`deploymentId: ${buildResult.deploymentId}`);
165
170
  }
166
171
  };
167
172
 
@@ -170,7 +175,7 @@ import assert from "assert";
170
175
  import fs4 from "fs";
171
176
  import path5 from "path";
172
177
  import { AppsInTossBundle as AppsInTossBundle2 } from "@apps-in-toss/ait-format";
173
- import * as p2 from "@clack/prompts";
178
+ import * as p3 from "@clack/prompts";
174
179
  import { Command as Command2, Option } from "clipanion";
175
180
 
176
181
  // src/cli/utils/colors.ts
@@ -460,12 +465,12 @@ var DeployCommand = class extends Command2 {
460
465
  const baseUrl = this.baseUrl;
461
466
  const profile = this.profile || this.workspace || "default";
462
467
  if (this.workspace) {
463
- p2.log.warn(
468
+ p3.log.warn(
464
469
  "(deprecated) --workspace \uC635\uC158\uC740 \uC774\uC81C \uC0AC\uC6A9\uD558\uC9C0 \uC54A\uC544\uC694. \uC774 \uC635\uC158 \uB300\uC2E0 --profile \uC635\uC158\uC744 \uC0AC\uC6A9\uD574\uC8FC\uC138\uC694."
465
470
  );
466
471
  }
467
472
  const apiKey = await this.getApiKey(profile);
468
- if (p2.isCancel(apiKey)) {
473
+ if (p3.isCancel(apiKey)) {
469
474
  return;
470
475
  }
471
476
  try {
@@ -497,7 +502,7 @@ var DeployCommand = class extends Command2 {
497
502
  baseUrl
498
503
  });
499
504
  } else {
500
- await p2.tasks([
505
+ await p3.tasks([
501
506
  {
502
507
  title: `${colorAppName} \uC571 \uBC30\uD3EC \uC911...`,
503
508
  task: async () => {
@@ -536,7 +541,7 @@ var DeployCommand = class extends Command2 {
536
541
  this.context.stdout.write(`${result}
537
542
  `);
538
543
  } else {
539
- p2.note(this.decorate(result, colors.green));
544
+ p3.note(this.decorate(result, colors.green));
540
545
  }
541
546
  }
542
547
  printError(error) {
@@ -544,7 +549,7 @@ var DeployCommand = class extends Command2 {
544
549
  this.context.stdout.write(`${error.message}
545
550
  `);
546
551
  } else {
547
- p2.log.error(error.message);
552
+ p3.log.error(error.message);
548
553
  }
549
554
  }
550
555
  async getApiKey(profile) {
@@ -552,7 +557,7 @@ var DeployCommand = class extends Command2 {
552
557
  if (token) {
553
558
  return token;
554
559
  }
555
- return await p2.password({
560
+ return await p3.password({
556
561
  message: "\uC571\uC778\uD1A0\uC2A4 \uBC30\uD3EC API \uD0A4\uB97C \uC785\uB825\uD574\uC8FC\uC138\uC694",
557
562
  validate: (value) => {
558
563
  if (value == null || value.length === 0) {
@@ -581,7 +586,7 @@ var DeployCommand = class extends Command2 {
581
586
  // src/cli/commands/init/index.ts
582
587
  import { appendFile, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
583
588
  import { join } from "path";
584
- import * as p3 from "@clack/prompts";
589
+ import * as p4 from "@clack/prompts";
585
590
  import { Command as Command3, Option as Option2 } from "clipanion";
586
591
 
587
592
  // src/cli/utils/ensureSelect.ts
@@ -642,18 +647,18 @@ async function templateWebFramework({
642
647
  await writeFile2(packageJsonPath, JSON.stringify(packageJson, null, 2), {
643
648
  encoding: "utf-8"
644
649
  });
645
- p3.log.step(".gitignore \uD30C\uC77C\uC744 \uC5C5\uB370\uC774\uD2B8\uD558\uB294 \uC911...");
650
+ p4.log.step(".gitignore \uD30C\uC77C\uC744 \uC5C5\uB370\uC774\uD2B8\uD558\uB294 \uC911...");
646
651
  await appendFile(join(cwd, ".gitignore"), "\n*.ait\n");
647
- const webBundleDir = skipInput ? "dist" : await p3.text({
652
+ const webBundleDir = skipInput ? "dist" : await p4.text({
648
653
  message: "\uC6F9 \uBC88\uB4E4 \uACB0\uACFC\uBB3C\uC774 \uC704\uCE58\uD55C \uB514\uB809\uD1A0\uB9AC\uB97C \uC785\uB825\uD574\uC8FC\uC138\uC694.",
649
654
  placeholder: "dist",
650
655
  defaultValue: "dist"
651
656
  });
652
- if (p3.isCancel(webBundleDir)) {
653
- p3.cancel("\uCD08\uAE30\uD654\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4");
657
+ if (p4.isCancel(webBundleDir)) {
658
+ p4.cancel("\uCD08\uAE30\uD654\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4");
654
659
  return;
655
660
  }
656
- p3.log.step("apps-in-toss.config.ts \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uB294 \uC911...");
661
+ p4.log.step("apps-in-toss.config.ts \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uB294 \uC911...");
657
662
  const config = transformTemplate(WEB_FRAMEWORK_CONFIG_TEMPLATE, {
658
663
  appName,
659
664
  webBundleDir
@@ -679,10 +684,10 @@ var InitCommand = class extends Command3 {
679
684
  skipInput = Option2.Boolean("--skip-input", { required: false, hidden: true });
680
685
  async execute() {
681
686
  const cwd = getPackageRoot(process.cwd());
682
- p3.intro("\u{1F680} \uC571 \uCD08\uAE30\uD654\uB97C \uC2DC\uC791\uD569\uB2C8\uB2E4");
687
+ p4.intro("\u{1F680} \uC571 \uCD08\uAE30\uD654\uB97C \uC2DC\uC791\uD569\uB2C8\uB2E4");
683
688
  const appName = await ensureSelect({
684
689
  value: this.appName,
685
- prompt: async () => p3.text({
690
+ prompt: async () => p4.text({
686
691
  message: "Enter app name",
687
692
  validate: (value) => {
688
693
  if (!value) {
@@ -696,26 +701,26 @@ var InitCommand = class extends Command3 {
696
701
  }
697
702
  })
698
703
  });
699
- if (p3.isCancel(appName)) {
700
- p3.cancel("\uCD08\uAE30\uD654\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4");
704
+ if (p4.isCancel(appName)) {
705
+ p4.cancel("\uCD08\uAE30\uD654\uAC00 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4");
701
706
  return;
702
707
  }
703
- p3.log.step(`\uC571 \uC774\uB984\uC774 '${appName}'\uC73C\uB85C \uC124\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4`);
708
+ p4.log.step(`\uC571 \uC774\uB984\uC774 '${appName}'\uC73C\uB85C \uC124\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4`);
704
709
  await templateWebFramework({
705
710
  appName,
706
711
  cwd,
707
712
  skipInput: this.skipInput ?? false
708
713
  });
709
- p3.outro("\u2728 \uCD08\uAE30\uD654\uAC00 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4!");
714
+ p4.outro("\u2728 \uCD08\uAE30\uD654\uAC00 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4!");
710
715
  }
711
716
  };
712
717
 
713
718
  // src/cli/commands/migration/index.ts
714
- import * as p5 from "@clack/prompts";
719
+ import * as p6 from "@clack/prompts";
715
720
  import { Command as Command4, Option as Option3 } from "clipanion";
716
721
 
717
722
  // src/cli/commands/migration/web-framework-v3.ts
718
- import * as p4 from "@clack/prompts";
723
+ import * as p5 from "@clack/prompts";
719
724
  import { cosmiconfig as cosmiconfig2 } from "cosmiconfig";
720
725
  import { TypeScriptLoader as TypeScriptLoader2 } from "cosmiconfig-typescript-loader";
721
726
  import { readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
@@ -723,7 +728,7 @@ import { resolve } from "path";
723
728
  import jscodeshift from "jscodeshift";
724
729
  async function migrateWebFrameworkV3() {
725
730
  const projectRoot = getPackageRoot(process.cwd());
726
- p4.log.info("@apps-in-toss/web-framework V3 \uC790\uB3D9 \uB9C8\uC774\uADF8\uB808\uC774\uC158\uC744 \uC2DC\uC791\uD569\uB2C8\uB2E4.");
731
+ p5.log.info("@apps-in-toss/web-framework V3 \uC790\uB3D9 \uB9C8\uC774\uADF8\uB808\uC774\uC158\uC744 \uC2DC\uC791\uD569\uB2C8\uB2E4.");
727
732
  const { config: graniteConfig, filepath: graniteConfigPath } = await getGraniteConfig(projectRoot);
728
733
  await migrateAppsInTossConfig(
729
734
  graniteConfigPath,
@@ -737,10 +742,10 @@ async function migrateWebFrameworkV3() {
737
742
  graniteConfig.web.commands.dev,
738
743
  graniteConfig.web.commands.build
739
744
  );
740
- p4.log.success("\uB9C8\uC774\uADF8\uB808\uC774\uC158\uC774 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
745
+ p5.log.success("\uB9C8\uC774\uADF8\uB808\uC774\uC158\uC774 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
741
746
  }
742
747
  async function getGraniteConfig(projectRoot) {
743
- p4.log.info("granite.config \uD30C\uC77C \uCC3E\uB294 \uC911..");
748
+ p5.log.info("granite.config \uD30C\uC77C \uCC3E\uB294 \uC911..");
744
749
  const result = await cosmiconfig2("granite", {
745
750
  loaders: {
746
751
  ".ts": TypeScriptLoader2(),
@@ -757,13 +762,13 @@ async function getGraniteConfig(projectRoot) {
757
762
  ]
758
763
  }).search(projectRoot);
759
764
  if (result == null) {
760
- p4.log.error("granite.config \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");
765
+ p5.log.error("granite.config \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.");
761
766
  process.exit(1);
762
767
  }
763
768
  return result;
764
769
  }
765
770
  async function migrateAppsInTossConfig(configPath, outputPath) {
766
- p4.log.info("granite.config\uB97C apps-in-toss.config\uB85C \uB9C8\uC774\uADF8\uB808\uC774\uC158\uD569\uB2C8\uB2E4.");
771
+ p5.log.info("granite.config\uB97C apps-in-toss.config\uB85C \uB9C8\uC774\uADF8\uB808\uC774\uC158\uD569\uB2C8\uB2E4.");
767
772
  const root = jscodeshift((await readFile3(configPath)).toString());
768
773
  root.find(jscodeshift.ObjectExpression).forEach((path7) => {
769
774
  const obj = path7.value;
@@ -795,10 +800,10 @@ async function migrateAppsInTossConfig(configPath, outputPath) {
795
800
  });
796
801
  });
797
802
  await writeFile3(outputPath, root.toSource());
798
- p4.log.info("apps-in-toss.config\uAC00 \uC0DD\uC131\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
803
+ p5.log.info("apps-in-toss.config\uAC00 \uC0DD\uC131\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
799
804
  }
800
805
  async function migratePackageJsonScripts(packageJsonPath, dev, build) {
801
- p4.log.info("package.json\uC758 dev, build \uC2A4\uD06C\uB9BD\uD2B8\uB97C \uC218\uC815\uD569\uB2C8\uB2E4.");
806
+ p5.log.info("package.json\uC758 dev, build \uC2A4\uD06C\uB9BD\uD2B8\uB97C \uC218\uC815\uD569\uB2C8\uB2E4.");
802
807
  const packageJson = JSON.parse((await readFile3(packageJsonPath)).toString());
803
808
  if (packageJson.scripts == null) {
804
809
  packageJson.scripts = {};
@@ -806,7 +811,7 @@ async function migratePackageJsonScripts(packageJsonPath, dev, build) {
806
811
  packageJson.scripts["dev"] = dev;
807
812
  packageJson.scripts["build"] = `${build} && ait build`;
808
813
  await writeFile3(packageJsonPath, JSON.stringify(packageJson, null, 2));
809
- p4.log.info("package.json \uC218\uC815\uC774 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
814
+ p5.log.info("package.json \uC218\uC815\uC774 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
810
815
  }
811
816
 
812
817
  // src/cli/commands/migration/index.ts
@@ -826,7 +831,7 @@ var MigrationCommand = class extends Command4 {
826
831
  if (target != null) {
827
832
  await target();
828
833
  } else {
829
- p5.log.error(
834
+ p6.log.error(
830
835
  [
831
836
  "\uC798\uBABB\uB41C \uB9C8\uC774\uADF8\uB808\uC774\uC158 target \uC785\uB2C8\uB2E4. \uC544\uB798 \uC911 \uD558\uB098\uB97C \uC785\uB825\uD574\uC8FC\uC138\uC694.\n",
832
837
  ...Object.keys(MIGRATION_TARGETS)
@@ -838,7 +843,7 @@ var MigrationCommand = class extends Command4 {
838
843
  };
839
844
 
840
845
  // src/cli/commands/token/index.ts
841
- import * as p6 from "@clack/prompts";
846
+ import * as p7 from "@clack/prompts";
842
847
  import { Command as Command5, Option as Option4 } from "clipanion";
843
848
  var TokenCommand = class extends Command5 {
844
849
  static paths = [["token"]];
@@ -867,7 +872,7 @@ var TokenAddCommand = class extends Command5 {
867
872
  apiKey = Option4.String("--api-key", { required: false });
868
873
  async execute() {
869
874
  const profile = this.profile || "default";
870
- const secret = this.apiKey ? this.apiKey : await p6.password({
875
+ const secret = this.apiKey ? this.apiKey : await p7.password({
871
876
  message: "Enter secret token:",
872
877
  validate: (value) => {
873
878
  if (value == null || value.length === 0) {
@@ -876,7 +881,7 @@ var TokenAddCommand = class extends Command5 {
876
881
  return;
877
882
  }
878
883
  });
879
- if (p6.isCancel(secret)) {
884
+ if (p7.isCancel(secret)) {
880
885
  return;
881
886
  }
882
887
  TokenStorage.set(profile, secret);
package/dist/config.cjs CHANGED
@@ -41,6 +41,8 @@ function defineConfig(config) {
41
41
  navigationBar: {
42
42
  withBackButton: true,
43
43
  withHomeButton: false,
44
+ transparentBackground: false,
45
+ theme: "light",
44
46
  ...config.navigationBar
45
47
  },
46
48
  webBundleDir: config.webBundleDir ?? "dist"
package/dist/config.d.cts CHANGED
@@ -25,6 +25,8 @@ interface AppsInTossConfig {
25
25
  navigationBar?: {
26
26
  withBackButton?: boolean;
27
27
  withHomeButton?: boolean;
28
+ transparentBackground?: boolean;
29
+ theme?: "light" | "dark";
28
30
  initialAccessoryButton?: {
29
31
  id: string;
30
32
  title: string;
package/dist/config.d.ts CHANGED
@@ -25,6 +25,8 @@ interface AppsInTossConfig {
25
25
  navigationBar?: {
26
26
  withBackButton?: boolean;
27
27
  withHomeButton?: boolean;
28
+ transparentBackground?: boolean;
29
+ theme?: "light" | "dark";
28
30
  initialAccessoryButton?: {
29
31
  id: string;
30
32
  title: string;
package/dist/config.js CHANGED
@@ -17,6 +17,8 @@ function defineConfig(config) {
17
17
  navigationBar: {
18
18
  withBackButton: true,
19
19
  withHomeButton: false,
20
+ transparentBackground: false,
21
+ theme: "light",
20
22
  ...config.navigationBar
21
23
  },
22
24
  webBundleDir: config.webBundleDir ?? "dist"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apps-in-toss/web-framework",
3
3
  "type": "module",
4
- "version": "3.0.0-beta.973c8c3",
4
+ "version": "3.0.0-beta.b36d7b5",
5
5
  "exports": {
6
6
  ".": {
7
7
  "import": {
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@apps-in-toss/ait-format": "^1.0.0",
39
- "@apps-in-toss/webview-bridge": "^3.0.0-beta.973c8c3",
39
+ "@apps-in-toss/webview-bridge": "^3.0.0-beta.b36d7b5",
40
40
  "@clack/prompts": "^1.3.0",
41
41
  "clipanion": "^4.0.0-rc.4",
42
42
  "cosmiconfig": "^9.0.1",