@mearie/cli 0.0.1-next.3

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/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright 2025 Bae Junehyeon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/dist/cli.cjs ADDED
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env node
2
+ //#region rolldown:runtime
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
+ value: mod,
21
+ enumerable: true
22
+ }) : target, mod));
23
+
24
+ //#endregion
25
+ let citty = require("citty");
26
+ citty = __toESM(citty);
27
+ let __mearie_config = require("@mearie/config");
28
+ __mearie_config = __toESM(__mearie_config);
29
+ let __mearie_codegen = require("@mearie/codegen");
30
+ __mearie_codegen = __toESM(__mearie_codegen);
31
+
32
+ //#region src/cli.ts
33
+ (0, citty.runMain)((0, citty.defineCommand)({
34
+ meta: {
35
+ name: "mearie",
36
+ description: "Mearie GraphQL CLI"
37
+ },
38
+ subCommands: { generate: (0, citty.defineCommand)({
39
+ meta: {
40
+ name: "generate",
41
+ description: "Generate TypeScript types from GraphQL operations"
42
+ },
43
+ args: { config: {
44
+ type: "string",
45
+ description: "Path to config file",
46
+ alias: "c"
47
+ } },
48
+ async run({ args }) {
49
+ try {
50
+ const { config, cwd } = await (0, __mearie_config.loadConfig)({ filename: args.config });
51
+ const { schema, document, exclude, scalars } = config;
52
+ const context = new __mearie_codegen.CodegenContext(cwd);
53
+ context.setConfig({ scalars });
54
+ __mearie_codegen.logger.info("Finding schema and document files...");
55
+ const schemaFiles = await (0, __mearie_codegen.findFiles)(cwd, {
56
+ include: schema,
57
+ exclude
58
+ });
59
+ const documentFiles = await (0, __mearie_codegen.findFiles)(cwd, {
60
+ include: document,
61
+ exclude
62
+ });
63
+ __mearie_codegen.logger.info(`Found ${schemaFiles.length} schema file(s)`);
64
+ __mearie_codegen.logger.info(`Found ${documentFiles.length} document file(s)`);
65
+ await Promise.all([...schemaFiles.map((file) => context.addSchema(file)), ...documentFiles.map((file) => context.addDocument(file))]);
66
+ __mearie_codegen.logger.info("Generating code...");
67
+ await context.generate();
68
+ __mearie_codegen.logger.info("✓ Code generation complete!");
69
+ } catch (error) {
70
+ (0, __mearie_codegen.report)(__mearie_codegen.logger, error);
71
+ process.exit(1);
72
+ }
73
+ }
74
+ }) }
75
+ }));
76
+
77
+ //#endregion
package/dist/cli.d.cts ADDED
@@ -0,0 +1 @@
1
+ export { };
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { };
package/dist/cli.js ADDED
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env node
2
+ import { defineCommand, runMain } from "citty";
3
+ import { loadConfig } from "@mearie/config";
4
+ import { CodegenContext, findFiles, logger, report } from "@mearie/codegen";
5
+
6
+ //#region src/cli.ts
7
+ runMain(defineCommand({
8
+ meta: {
9
+ name: "mearie",
10
+ description: "Mearie GraphQL CLI"
11
+ },
12
+ subCommands: { generate: defineCommand({
13
+ meta: {
14
+ name: "generate",
15
+ description: "Generate TypeScript types from GraphQL operations"
16
+ },
17
+ args: { config: {
18
+ type: "string",
19
+ description: "Path to config file",
20
+ alias: "c"
21
+ } },
22
+ async run({ args }) {
23
+ try {
24
+ const { config, cwd } = await loadConfig({ filename: args.config });
25
+ const { schema, document, exclude, scalars } = config;
26
+ const context = new CodegenContext(cwd);
27
+ context.setConfig({ scalars });
28
+ logger.info("Finding schema and document files...");
29
+ const schemaFiles = await findFiles(cwd, {
30
+ include: schema,
31
+ exclude
32
+ });
33
+ const documentFiles = await findFiles(cwd, {
34
+ include: document,
35
+ exclude
36
+ });
37
+ logger.info(`Found ${schemaFiles.length} schema file(s)`);
38
+ logger.info(`Found ${documentFiles.length} document file(s)`);
39
+ await Promise.all([...schemaFiles.map((file) => context.addSchema(file)), ...documentFiles.map((file) => context.addDocument(file))]);
40
+ logger.info("Generating code...");
41
+ await context.generate();
42
+ logger.info("✓ Code generation complete!");
43
+ } catch (error) {
44
+ report(logger, error);
45
+ process.exit(1);
46
+ }
47
+ }
48
+ }) }
49
+ }));
50
+
51
+ //#endregion
52
+ export { };
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@mearie/cli",
3
+ "version": "0.0.1-next.3",
4
+ "sideEffects": false,
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/cli.d.ts",
9
+ "import": "./dist/cli.js",
10
+ "require": "./dist/cli.cjs"
11
+ },
12
+ "./package.json": "./package.json"
13
+ },
14
+ "bin": {
15
+ "mearie": "./dist/cli.js"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "package.json",
20
+ "README.md"
21
+ ],
22
+ "dependencies": {
23
+ "citty": "^0.1.6",
24
+ "@mearie/codegen": "0.0.1-next.3",
25
+ "@mearie/config": "0.0.1-next.3"
26
+ },
27
+ "devDependencies": {
28
+ "@types/node": "^24.9.2",
29
+ "tsdown": "^0.15.12",
30
+ "typescript": "^5.9.3"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "scripts": {
36
+ "build": "tsdown",
37
+ "typecheck": "tsc"
38
+ },
39
+ "main": "./dist/cli.cjs",
40
+ "module": "./dist/cli.js",
41
+ "types": "./dist/cli.d.ts"
42
+ }