@apps-in-toss/web-framework 0.0.0-dev.1739259851263 → 0.0.0-dev.1739330319128

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.cjs CHANGED
@@ -105,7 +105,7 @@ async function build({ distDirname, cache }) {
105
105
  const config = await loadConfig();
106
106
  const rootDir = process.cwd();
107
107
  const reactNativeProjectDir = import_path.default.resolve(__dirname, "..", "react-native");
108
- const projectRootTmp = import_path.default.resolve(process.cwd(), ".apps-in-toss");
108
+ const projectRootTmp = import_path.default.resolve(process.cwd(), ".bedrock");
109
109
  await import_fs.default.promises.mkdir(projectRootTmp, { recursive: true });
110
110
  await import_fs.default.promises.writeFile(
111
111
  import_path.default.join(projectRootTmp, "metadata.json"),
@@ -155,7 +155,7 @@ async function build({ distDirname, cache }) {
155
155
  plugins: [
156
156
  [
157
157
  require.resolve("@apps-in-toss/babel-plugin-json"),
158
- { jsonPath: "./.apps-in-toss/metadata.json", identifierName: "Ait" }
158
+ { jsonPath: "./.bedrock/metadata.json", identifierName: "Ait" }
159
159
  ]
160
160
  ]
161
161
  },
@@ -173,7 +173,7 @@ async function build({ distDirname, cache }) {
173
173
  plugins: [
174
174
  [
175
175
  require.resolve("@apps-in-toss/babel-plugin-json"),
176
- { jsonPath: "./.apps-in-toss/metadata.json", identifierName: "Ait" }
176
+ { jsonPath: "./.bedrock/metadata.json", identifierName: "Ait" }
177
177
  ]
178
178
  ]
179
179
  },
@@ -393,7 +393,7 @@ var DevCommand = class extends import_clipanion3.Command {
393
393
  port: this.port ? parseInt(this.port, 10) : void 0
394
394
  };
395
395
  const cwd = import_path3.default.resolve(__dirname, "..", "react-native");
396
- const projectRootTmp = import_path3.default.resolve(process.cwd(), ".apps-in-toss");
396
+ const projectRootTmp = import_path3.default.resolve(process.cwd(), ".bedrock");
397
397
  await import_fs2.default.promises.mkdir(projectRootTmp, { recursive: true });
398
398
  await import_fs2.default.promises.writeFile(
399
399
  import_path3.default.join(projectRootTmp, "metadata.json"),
@@ -437,11 +437,12 @@ var DevCommand = class extends import_clipanion3.Command {
437
437
  };
438
438
 
439
439
  // src/InitCommand/InitCommand.ts
440
- var import_fs3 = __toESM(require("fs"), 1);
441
- var import_path4 = __toESM(require("path"), 1);
440
+ var import_fs4 = __toESM(require("fs"), 1);
441
+ var import_path5 = __toESM(require("path"), 1);
442
442
  var p2 = __toESM(require("@clack/prompts"), 1);
443
443
  var import_clipanion4 = require("clipanion");
444
444
  var import_es_toolkit = require("es-toolkit");
445
+ var import_yaml = __toESM(require("yaml"), 1);
445
446
 
446
447
  // src/InitCommand/templates/index.tsx
447
448
  var CONFIG_TEMPLATE = `import { defineConfig } from '@apps-in-toss/web-framework';
@@ -458,6 +459,21 @@ export default defineConfig({
458
459
  });
459
460
  `;
460
461
 
462
+ // src/utils/getPackageRoot.ts
463
+ var import_fs3 = __toESM(require("fs"), 1);
464
+ var import_path4 = __toESM(require("path"), 1);
465
+ function getPackageRoot() {
466
+ let cwd = process.cwd();
467
+ const root = import_path4.default.parse(cwd).root;
468
+ while (cwd !== root) {
469
+ if (import_fs3.default.existsSync(import_path4.default.join(cwd, "package.json"))) {
470
+ return cwd;
471
+ }
472
+ cwd = import_path4.default.dirname(cwd);
473
+ }
474
+ return cwd;
475
+ }
476
+
461
477
  // src/utils/transformTemplate.ts
462
478
  function transformTemplate(templateString, values) {
463
479
  let result = templateString;
@@ -472,6 +488,7 @@ function transformTemplate(templateString, values) {
472
488
  var InitCommand = class extends import_clipanion4.Command {
473
489
  static paths = [[`init`]];
474
490
  async execute() {
491
+ const cwd = getPackageRoot();
475
492
  p2.intro("\u{1F680} \uC571 \uCD08\uAE30\uD654\uB97C \uC2DC\uC791\uD569\uB2C8\uB2E4");
476
493
  const appName = await p2.text({
477
494
  message: "Enter app name",
@@ -501,7 +518,7 @@ var InitCommand = class extends import_clipanion4.Command {
501
518
  return;
502
519
  }
503
520
  p2.log.step("package.json \uC2A4\uD06C\uB9BD\uD2B8\uB97C \uC124\uC815\uD558\uB294 \uC911...");
504
- const packageJson = await import_fs3.default.promises.readFile(import_path4.default.join(process.cwd(), "package.json"), {
521
+ const packageJson = await import_fs4.default.promises.readFile(import_path5.default.join(cwd, "package.json"), {
505
522
  encoding: "utf-8"
506
523
  });
507
524
  const scripts = JSON.parse(packageJson);
@@ -512,7 +529,7 @@ var InitCommand = class extends import_clipanion4.Command {
512
529
  scripts.scripts.dev = "ait dev";
513
530
  scripts.scripts.build = "ait build";
514
531
  scripts.scripts.deploy = "ait deploy";
515
- await import_fs3.default.promises.writeFile(import_path4.default.join(process.cwd(), "package.json"), JSON.stringify(scripts, null, 2), {
532
+ await import_fs4.default.promises.writeFile(import_path5.default.join(cwd, "package.json"), JSON.stringify(scripts, null, 2), {
516
533
  encoding: "utf-8"
517
534
  });
518
535
  p2.log.step("apps-in-toss.config.web.ts \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uB294 \uC911...");
@@ -522,14 +539,14 @@ var InitCommand = class extends import_clipanion4.Command {
522
539
  webDevCommand: original.dev === "ait dev" ? "" : original.dev,
523
540
  webBuildCommand: original.build === "ait build" ? "" : original.build
524
541
  });
525
- await import_fs3.default.promises.writeFile(import_path4.default.join(process.cwd(), "apps-in-toss.config.web.ts"), config, {
542
+ await import_fs4.default.promises.writeFile(import_path5.default.join(cwd, "apps-in-toss.config.web.ts"), config, {
526
543
  encoding: "utf-8"
527
544
  });
528
545
  p2.log.step(".gitignore \uD30C\uC77C\uC744 \uC5C5\uB370\uC774\uD2B8\uD558\uB294 \uC911...");
529
- await import_fs3.default.promises.appendFile(import_path4.default.join(process.cwd(), ".gitignore"), "\n.apps-in-toss\n");
546
+ await import_fs4.default.promises.appendFile(import_path5.default.join(cwd, ".gitignore"), "\n.bedrock\n");
530
547
  p2.log.step("app.json \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uB294 \uC911...");
531
- await import_fs3.default.promises.writeFile(
532
- import_path4.default.join(process.cwd(), "app.json"),
548
+ await import_fs4.default.promises.writeFile(
549
+ import_path5.default.join(cwd, "app.json"),
533
550
  JSON.stringify({
534
551
  clientId: "",
535
552
  appName,
@@ -539,12 +556,44 @@ var InitCommand = class extends import_clipanion4.Command {
539
556
  encoding: "utf-8"
540
557
  }
541
558
  );
559
+ const isPnP = import_fs4.default.existsSync(import_path5.default.join(cwd, ".pnp.cjs"));
560
+ if (isPnP) {
561
+ const yarnrcPath = import_path5.default.join(cwd, ".yarnrc.yml");
562
+ let yarnrc = {};
563
+ try {
564
+ const yarnrcContent = await import_fs4.default.promises.readFile(yarnrcPath, { encoding: "utf-8" });
565
+ yarnrc = import_yaml.default.parse(yarnrcContent);
566
+ } catch {
567
+ p2.log.info(".yarnrc.yml \uD30C\uC77C\uC774 \uC5C6\uC5B4 \uC0C8\uB85C \uC0DD\uC131\uD569\uB2C8\uB2E4.");
568
+ }
569
+ p2.log.step(".yarnrc.yml \uD30C\uC77C\uC744 \uC5C5\uB370\uC774\uD2B8\uD558\uB294 \uC911...");
570
+ yarnrc.packageExtensions = {
571
+ ...yarnrc.packageExtensions,
572
+ "@react-native-community/cli-debugger-ui@*": {
573
+ dependencies: {
574
+ "@babel/runtime": "^7"
575
+ }
576
+ },
577
+ "react-native-video@*": {
578
+ peerDependencies: {
579
+ react: "*",
580
+ "react-native": "*"
581
+ }
582
+ },
583
+ "react-native-fast-image@*": {
584
+ dependencies: {
585
+ "@babel/runtime": "^7"
586
+ }
587
+ }
588
+ };
589
+ await import_fs4.default.promises.writeFile(yarnrcPath, import_yaml.default.stringify(yarnrc), { encoding: "utf-8" });
590
+ }
542
591
  p2.outro("\u2728 \uCD08\uAE30\uD654\uAC00 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4!");
543
592
  }
544
593
  };
545
594
 
546
595
  // package.json
547
- var version = "0.0.0-dev.1739259851263";
596
+ var version = "0.0.0-dev.1739330319128";
548
597
 
549
598
  // src/cli.ts
550
599
  var cli = new import_clipanion5.Cli({
package/dist/cli.js CHANGED
@@ -54,7 +54,7 @@ async function build({ distDirname, cache }) {
54
54
  const config = await loadConfig();
55
55
  const rootDir = process.cwd();
56
56
  const reactNativeProjectDir = path.resolve(__dirname, "..", "react-native");
57
- const projectRootTmp = path.resolve(process.cwd(), ".apps-in-toss");
57
+ const projectRootTmp = path.resolve(process.cwd(), ".bedrock");
58
58
  await fs.promises.mkdir(projectRootTmp, { recursive: true });
59
59
  await fs.promises.writeFile(
60
60
  path.join(projectRootTmp, "metadata.json"),
@@ -104,7 +104,7 @@ async function build({ distDirname, cache }) {
104
104
  plugins: [
105
105
  [
106
106
  __require.resolve("@apps-in-toss/babel-plugin-json"),
107
- { jsonPath: "./.apps-in-toss/metadata.json", identifierName: "Ait" }
107
+ { jsonPath: "./.bedrock/metadata.json", identifierName: "Ait" }
108
108
  ]
109
109
  ]
110
110
  },
@@ -122,7 +122,7 @@ async function build({ distDirname, cache }) {
122
122
  plugins: [
123
123
  [
124
124
  __require.resolve("@apps-in-toss/babel-plugin-json"),
125
- { jsonPath: "./.apps-in-toss/metadata.json", identifierName: "Ait" }
125
+ { jsonPath: "./.bedrock/metadata.json", identifierName: "Ait" }
126
126
  ]
127
127
  ]
128
128
  },
@@ -342,7 +342,7 @@ var DevCommand = class extends Command3 {
342
342
  port: this.port ? parseInt(this.port, 10) : void 0
343
343
  };
344
344
  const cwd = path3.resolve(__dirname, "..", "react-native");
345
- const projectRootTmp = path3.resolve(process.cwd(), ".apps-in-toss");
345
+ const projectRootTmp = path3.resolve(process.cwd(), ".bedrock");
346
346
  await fs3.promises.mkdir(projectRootTmp, { recursive: true });
347
347
  await fs3.promises.writeFile(
348
348
  path3.join(projectRootTmp, "metadata.json"),
@@ -386,11 +386,12 @@ var DevCommand = class extends Command3 {
386
386
  };
387
387
 
388
388
  // src/InitCommand/InitCommand.ts
389
- import fs4 from "fs";
390
- import path4 from "path";
389
+ import fs5 from "fs";
390
+ import path5 from "path";
391
391
  import * as p2 from "@clack/prompts";
392
392
  import { Command as Command4 } from "clipanion";
393
393
  import { kebabCase } from "es-toolkit";
394
+ import yaml from "yaml";
394
395
 
395
396
  // src/InitCommand/templates/index.tsx
396
397
  var CONFIG_TEMPLATE = `import { defineConfig } from '@apps-in-toss/web-framework';
@@ -407,6 +408,21 @@ export default defineConfig({
407
408
  });
408
409
  `;
409
410
 
411
+ // src/utils/getPackageRoot.ts
412
+ import fs4 from "fs";
413
+ import path4 from "path";
414
+ function getPackageRoot() {
415
+ let cwd = process.cwd();
416
+ const root = path4.parse(cwd).root;
417
+ while (cwd !== root) {
418
+ if (fs4.existsSync(path4.join(cwd, "package.json"))) {
419
+ return cwd;
420
+ }
421
+ cwd = path4.dirname(cwd);
422
+ }
423
+ return cwd;
424
+ }
425
+
410
426
  // src/utils/transformTemplate.ts
411
427
  function transformTemplate(templateString, values) {
412
428
  let result = templateString;
@@ -421,6 +437,7 @@ function transformTemplate(templateString, values) {
421
437
  var InitCommand = class extends Command4 {
422
438
  static paths = [[`init`]];
423
439
  async execute() {
440
+ const cwd = getPackageRoot();
424
441
  p2.intro("\u{1F680} \uC571 \uCD08\uAE30\uD654\uB97C \uC2DC\uC791\uD569\uB2C8\uB2E4");
425
442
  const appName = await p2.text({
426
443
  message: "Enter app name",
@@ -450,7 +467,7 @@ var InitCommand = class extends Command4 {
450
467
  return;
451
468
  }
452
469
  p2.log.step("package.json \uC2A4\uD06C\uB9BD\uD2B8\uB97C \uC124\uC815\uD558\uB294 \uC911...");
453
- const packageJson = await fs4.promises.readFile(path4.join(process.cwd(), "package.json"), {
470
+ const packageJson = await fs5.promises.readFile(path5.join(cwd, "package.json"), {
454
471
  encoding: "utf-8"
455
472
  });
456
473
  const scripts = JSON.parse(packageJson);
@@ -461,7 +478,7 @@ var InitCommand = class extends Command4 {
461
478
  scripts.scripts.dev = "ait dev";
462
479
  scripts.scripts.build = "ait build";
463
480
  scripts.scripts.deploy = "ait deploy";
464
- await fs4.promises.writeFile(path4.join(process.cwd(), "package.json"), JSON.stringify(scripts, null, 2), {
481
+ await fs5.promises.writeFile(path5.join(cwd, "package.json"), JSON.stringify(scripts, null, 2), {
465
482
  encoding: "utf-8"
466
483
  });
467
484
  p2.log.step("apps-in-toss.config.web.ts \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uB294 \uC911...");
@@ -471,14 +488,14 @@ var InitCommand = class extends Command4 {
471
488
  webDevCommand: original.dev === "ait dev" ? "" : original.dev,
472
489
  webBuildCommand: original.build === "ait build" ? "" : original.build
473
490
  });
474
- await fs4.promises.writeFile(path4.join(process.cwd(), "apps-in-toss.config.web.ts"), config, {
491
+ await fs5.promises.writeFile(path5.join(cwd, "apps-in-toss.config.web.ts"), config, {
475
492
  encoding: "utf-8"
476
493
  });
477
494
  p2.log.step(".gitignore \uD30C\uC77C\uC744 \uC5C5\uB370\uC774\uD2B8\uD558\uB294 \uC911...");
478
- await fs4.promises.appendFile(path4.join(process.cwd(), ".gitignore"), "\n.apps-in-toss\n");
495
+ await fs5.promises.appendFile(path5.join(cwd, ".gitignore"), "\n.bedrock\n");
479
496
  p2.log.step("app.json \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uB294 \uC911...");
480
- await fs4.promises.writeFile(
481
- path4.join(process.cwd(), "app.json"),
497
+ await fs5.promises.writeFile(
498
+ path5.join(cwd, "app.json"),
482
499
  JSON.stringify({
483
500
  clientId: "",
484
501
  appName,
@@ -488,12 +505,44 @@ var InitCommand = class extends Command4 {
488
505
  encoding: "utf-8"
489
506
  }
490
507
  );
508
+ const isPnP = fs5.existsSync(path5.join(cwd, ".pnp.cjs"));
509
+ if (isPnP) {
510
+ const yarnrcPath = path5.join(cwd, ".yarnrc.yml");
511
+ let yarnrc = {};
512
+ try {
513
+ const yarnrcContent = await fs5.promises.readFile(yarnrcPath, { encoding: "utf-8" });
514
+ yarnrc = yaml.parse(yarnrcContent);
515
+ } catch {
516
+ p2.log.info(".yarnrc.yml \uD30C\uC77C\uC774 \uC5C6\uC5B4 \uC0C8\uB85C \uC0DD\uC131\uD569\uB2C8\uB2E4.");
517
+ }
518
+ p2.log.step(".yarnrc.yml \uD30C\uC77C\uC744 \uC5C5\uB370\uC774\uD2B8\uD558\uB294 \uC911...");
519
+ yarnrc.packageExtensions = {
520
+ ...yarnrc.packageExtensions,
521
+ "@react-native-community/cli-debugger-ui@*": {
522
+ dependencies: {
523
+ "@babel/runtime": "^7"
524
+ }
525
+ },
526
+ "react-native-video@*": {
527
+ peerDependencies: {
528
+ react: "*",
529
+ "react-native": "*"
530
+ }
531
+ },
532
+ "react-native-fast-image@*": {
533
+ dependencies: {
534
+ "@babel/runtime": "^7"
535
+ }
536
+ }
537
+ };
538
+ await fs5.promises.writeFile(yarnrcPath, yaml.stringify(yarnrc), { encoding: "utf-8" });
539
+ }
491
540
  p2.outro("\u2728 \uCD08\uAE30\uD654\uAC00 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4!");
492
541
  }
493
542
  };
494
543
 
495
544
  // package.json
496
- var version = "0.0.0-dev.1739259851263";
545
+ var version = "0.0.0-dev.1739330319128";
497
546
 
498
547
  // src/cli.ts
499
548
  var cli = new Cli({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apps-in-toss/web-framework",
3
3
  "type": "module",
4
- "version": "0.0.0-dev.1739259851263",
4
+ "version": "0.0.0-dev.1739330319128",
5
5
  "description": "Web Framework for Apps In Toss",
6
6
  "scripts": {
7
7
  "prepack": "yarn build",
@@ -38,8 +38,8 @@
38
38
  "vitest": "^3.0.5"
39
39
  },
40
40
  "dependencies": {
41
- "@apps-in-toss/babel-plugin-json": "0.0.0-dev.1739259851263",
42
- "@apps-in-toss/framework": "0.0.0-dev.1739259851263",
41
+ "@apps-in-toss/babel-plugin-json": "0.0.0-dev.1739330319128",
42
+ "@apps-in-toss/framework": "0.0.0-dev.1739330319128",
43
43
  "@babel/core": "7.23.9",
44
44
  "@babel/plugin-proposal-class-properties": "^7.16.7",
45
45
  "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
@@ -53,8 +53,8 @@
53
53
  "@babel/preset-typescript": "^7.16.7",
54
54
  "@babel/runtime": "7.18.9",
55
55
  "@clack/prompts": "^0.10.0",
56
- "@react-native-bedrock/mpack-next": "0.0.0-dev.1739258112754",
57
- "@react-native-bedrock/native": "0.0.0-dev.1739258112754",
56
+ "@react-native-bedrock/mpack-next": "0.0.0-dev.1739330039126",
57
+ "@react-native-bedrock/native": "0.0.0-dev.1739330039126",
58
58
  "@types/react": "18.3.3",
59
59
  "clipanion": "^4.0.0-rc.4",
60
60
  "cosmiconfig": "^9.0.0",
@@ -65,12 +65,13 @@
65
65
  "picocolors": "^1.1.1",
66
66
  "react": "18.2.0",
67
67
  "react-native": "0.72.6",
68
- "react-native-bedrock": "0.0.0-dev.1739258112754",
68
+ "react-native-bedrock": "0.0.0-dev.1739330039126",
69
+ "yaml": "^2.7.0",
69
70
  "yauzl": "^3.2.0",
70
71
  "zod": "^3.24.1"
71
72
  },
72
73
  "publishConfig": {
73
74
  "access": "public"
74
75
  },
75
- "gitHead": "48af8799ab809594c216b9715ba50251325988a2"
76
+ "gitHead": "bfaa657c992f76c579fc2bfebeb47c50ebc2b793"
76
77
  }
@@ -17,7 +17,7 @@
17
17
  ]
18
18
  ],
19
19
  "plugins": [
20
- ["@apps-in-toss/babel-plugin-json", { "jsonPath": "./.apps-in-toss/metadata.json", "identifierName": "Ait" }],
20
+ ["@apps-in-toss/babel-plugin-json", { "jsonPath": "./.bedrock/metadata.json", "identifierName": "Ait" }],
21
21
  ["@babel/plugin-transform-flow-strip-types"],
22
22
  [
23
23
  "@babel/plugin-proposal-class-properties",
@@ -1,4 +0,0 @@
1
- global.__bedrock = global.__bedrock || {};
2
- global.__bedrock.shared = { buildNumber: "00000000" };
3
- global.__bedrock.apps = global.__bedrock.apps || {};
4
- global.__bedrock.apps["ping-pong"] = { buildNumber: "00000000" };