@valbuild/cli 0.50.0 → 0.51.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.
@@ -17,8 +17,8 @@ var path__default = /*#__PURE__*/_interopDefault(path);
17
17
  var picocolors__default = /*#__PURE__*/_interopDefault(picocolors);
18
18
  var fs__default = /*#__PURE__*/_interopDefault(fs);
19
19
 
20
- function error(...message) {
21
- console.error(chalk__default["default"].red(...message));
20
+ function error(message) {
21
+ console.error(chalk__default["default"].red("❌Error: ") + message);
22
22
  }
23
23
 
24
24
  async function validate({
@@ -152,12 +152,10 @@ async function main() {
152
152
  Usage
153
153
  $ val [command]
154
154
  Commands
155
- serve Run val development server
156
155
  validate val-idate val modules
157
156
 
158
157
  Options
159
158
  --help Show this message
160
- --port [port], -p [port] Set server port (default 4123)
161
159
  --root [root], -r [root] Set project root directory (default process.cwd())
162
160
  --cfg [cfg], -c [cfg] Set path to config relative to root (default ./val.config)
163
161
  --fix [fix] Attempt to fix validation errors
@@ -17,8 +17,8 @@ var path__default = /*#__PURE__*/_interopDefault(path);
17
17
  var picocolors__default = /*#__PURE__*/_interopDefault(picocolors);
18
18
  var fs__default = /*#__PURE__*/_interopDefault(fs);
19
19
 
20
- function error(...message) {
21
- console.error(chalk__default["default"].red(...message));
20
+ function error(message) {
21
+ console.error(chalk__default["default"].red("❌Error: ") + message);
22
22
  }
23
23
 
24
24
  async function validate({
@@ -152,12 +152,10 @@ async function main() {
152
152
  Usage
153
153
  $ val [command]
154
154
  Commands
155
- serve Run val development server
156
155
  validate val-idate val modules
157
156
 
158
157
  Options
159
158
  --help Show this message
160
- --port [port], -p [port] Set server port (default 4123)
161
159
  --root [root], -r [root] Set project root directory (default process.cwd())
162
160
  --cfg [cfg], -c [cfg] Set path to config relative to root (default ./val.config)
163
161
  --fix [fix] Attempt to fix validation errors
@@ -7,8 +7,8 @@ import picocolors from 'picocolors';
7
7
  import { ESLint } from 'eslint';
8
8
  import fs from 'fs/promises';
9
9
 
10
- function error(...message) {
11
- console.error(chalk.red(...message));
10
+ function error(message) {
11
+ console.error(chalk.red("❌Error: ") + message);
12
12
  }
13
13
 
14
14
  async function validate({
@@ -142,12 +142,10 @@ async function main() {
142
142
  Usage
143
143
  $ val [command]
144
144
  Commands
145
- serve Run val development server
146
145
  validate val-idate val modules
147
146
 
148
147
  Options
149
148
  --help Show this message
150
- --port [port], -p [port] Set server port (default 4123)
151
149
  --root [root], -r [root] Set project root directory (default process.cwd())
152
150
  --cfg [cfg], -c [cfg] Set path to config relative to root (default ./val.config)
153
151
  --fix [fix] Attempt to fix validation errors
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@valbuild/cli",
3
3
  "private": false,
4
- "version": "0.50.0",
4
+ "version": "0.51.0",
5
5
  "description": "Val CLI tools",
6
6
  "bin": {
7
7
  "val": "./bin.js"
@@ -14,18 +14,23 @@
14
14
  "./package.json": "./package.json"
15
15
  },
16
16
  "scripts": {
17
+ "start": "tsx src/cli.ts --",
17
18
  "typecheck": "tsc --noEmit"
18
19
  },
19
20
  "dependencies": {
20
- "@valbuild/server": "~0.50.0",
21
- "@valbuild/eslint-plugin": "~0.50.0",
21
+ "@valbuild/server": "~0.51.0",
22
+ "@valbuild/eslint-plugin": "~0.51.0",
22
23
  "eslint": "^8.31.0",
24
+ "@inquirer/confirm": "^2.0.15",
25
+ "@inquirer/prompts": "^3.0.2",
23
26
  "chalk": "^4.1.2",
24
27
  "cors": "^2.8.5",
25
28
  "express": "^4.18.2",
26
29
  "fast-glob": "^3.3.1",
27
30
  "meow": "^9.0.0",
28
- "picocolors": "^1.0.0"
31
+ "open": "^9.1.0",
32
+ "picocolors": "^1.0.0",
33
+ "zod": "^3.22.4"
29
34
  },
30
35
  "preconstruct": {
31
36
  "entrypoints": [
package/src/cli.ts CHANGED
@@ -8,12 +8,10 @@ async function main(): Promise<void> {
8
8
  Usage
9
9
  $ val [command]
10
10
  Commands
11
- serve Run val development server
12
11
  validate val-idate val modules
13
12
 
14
13
  Options
15
14
  --help Show this message
16
- --port [port], -p [port] Set server port (default 4123)
17
15
  --root [root], -r [root] Set project root directory (default process.cwd())
18
16
  --cfg [cfg], -c [cfg] Set path to config relative to root (default ./val.config)
19
17
  --fix [fix] Attempt to fix validation errors
package/src/logger.ts CHANGED
@@ -1,9 +1,34 @@
1
1
  import chalk from "chalk";
2
2
 
3
- export function error(...message: string[]) {
4
- console.error(chalk.red(...message));
3
+ export function error(message: string) {
4
+ console.error(chalk.red("❌Error: ") + message);
5
5
  }
6
6
 
7
- export function info(...message: string[]) {
8
- console.log(...message);
7
+ export function info(
8
+ message: string,
9
+ opts: { isCodeSnippet?: true; isGood?: true } = {}
10
+ ) {
11
+ if (opts.isCodeSnippet) {
12
+ console.log(chalk.cyanBright("$ > ") + chalk.cyan(message));
13
+ return;
14
+ }
15
+ if (opts.isGood) {
16
+ console.log(chalk.green("✅: ") + message);
17
+ return;
18
+ }
19
+ console.log(chalk.blue("️ℹ️ : ") + message);
20
+ }
21
+
22
+ export function debugPrint(str: string) {
23
+ /*eslint-disable no-constant-condition */
24
+ if (process.env["DEBUG"] || true) {
25
+ // TODO: remove true
26
+ console.log(`DEBUG: ${str}`);
27
+ }
28
+ }
29
+
30
+ export function printDebuggingHelp() {
31
+ info(
32
+ `If you're having trouble, please follow the debugging steps\n🌐: https://val.build/docs/troubleshooting`
33
+ );
9
34
  }
@@ -0,0 +1,20 @@
1
+ // this will probably change
2
+ const fileContent = `
3
+ import { createRequestListener } from "@valbuild/server";
4
+ import { NextApiHandler } from "next";
5
+
6
+ const handler: NextApiHandler = createRequestListener("/api/val", {
7
+ valConfigPath: "./val.config",
8
+ mode: "proxy",
9
+ });
10
+
11
+ export default handler;
12
+
13
+ export const config = {
14
+ api: {
15
+ bodyParser: false,
16
+ externalResolver: true,
17
+ },
18
+ };
19
+ `;
20
+ export default fileContent;
package/tsconfig.json CHANGED
@@ -3,10 +3,10 @@
3
3
  "lib": ["es2020", "DOM"],
4
4
  "strict": true,
5
5
  "isolatedModules": true,
6
- "noEmit": true,
7
6
  "esModuleInterop": true,
8
7
  "module": "esnext",
9
8
  "moduleResolution": "node",
10
- "skipLibCheck": true
9
+ "skipLibCheck": true,
10
+ "target": "ESNext"
11
11
  }
12
12
  }