Skip to content

Commit

Permalink
refactor: move configSchema.json
Browse files Browse the repository at this point in the history
  • Loading branch information
verytactical committed Jan 14, 2025
1 parent b567bfa commit 3d42d5d
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Tact uses the [meow](https://github.com/sindresorhus/meow) CLI arguments parser.

The main entry point for the Tact CLI is [src/node.ts](./src/node.ts) and [src/pipeline/build.ts](./src/pipeline/build.ts) is the platform-independent compiler driver which contains the high-level compiler pipeline logic described above.

The Tact CLI gets Tact settings from a `tact.config.json` file or creates a default config for a single-file compilation mode. The format of `tact.config.json` files is specified in [schemas/configSchema.json](./schemas/configSchema.json).
The Tact CLI gets Tact settings from a `tact.config.json` file or creates a default config for a single-file compilation mode. The format of `tact.config.json` files is specified in [src/config/configSchema.json](src/config/configSchema.json).

The so-called "pre-compilation" steps that include imports resolution, type-checking, building schemas for high-level Tact data structures to be serialized/deserialized as cells (this step is dubbed "allocation") are located in [src/pipeline/precompile.ts](src/pipeline/precompile.ts).

Expand Down
2 changes: 1 addition & 1 deletion bin/test/fail.config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "../../schemas/configSchema.json",
"$schema": "../../src/config/configSchema.json",
"projects": [
{
"name": "fail",
Expand Down
2 changes: 1 addition & 1 deletion bin/test/success.config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "../../schemas/configSchema.json",
"$schema": "../../src/config/configSchema.json",
"projects": [
{
"name": "success",
Expand Down
2 changes: 1 addition & 1 deletion bin/test/success.config.with.decompilation.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "../../schemas/configSchema.json",
"$schema": "../../src/config/configSchema.json",
"projects": [
{
"name": "success",
Expand Down
6 changes: 3 additions & 3 deletions docs/src/content/docs/book/config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ This page lists all the configuration options as they're structured in the [sche

## `$schema` {#schema}

A [JSON schema](https://json-schema.org/) file is available for editors to provide autocompletion and hover hints: [configSchema.json](http://raw.githubusercontent.com/tact-lang/tact/main/schemas/configSchema.json).
A [JSON schema](https://json-schema.org/) file is available for editors to provide autocompletion and hover hints: [configSchema.json](http://raw.githubusercontent.com/tact-lang/tact/main/src/config/configSchema.json).

Simply add the `$schema` field on top your configuration file:

```json filename="tact.config.json" {2}
{
"$schema": "http://raw.githubusercontent.com/tact-lang/tact/main/schemas/configSchema.json",
"$schema": "http://raw.githubusercontent.com/tact-lang/tact/main/src/config/configSchema.json",
"projects": []
}
```
Expand Down Expand Up @@ -369,7 +369,7 @@ In [Blueprint][bp], `mode` is always set to `"full"{:json}` and cannot be overwr

```json filename="tact.config.json" copy=false
{
"$schema": "http://raw.githubusercontent.com/tact-lang/tact/main/schemas/configSchema.json",
"$schema": "http://raw.githubusercontent.com/tact-lang/tact/main/src/config/configSchema.json",
"projects": [
{
"name": "basic",
Expand Down
6 changes: 3 additions & 3 deletions docs/src/content/docs/zh-cn/book/config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ title: 配置

## `$schema` {#schema}

编辑器可使用[JSON 模式](https://json-schema.org/) 文件提供自动完成和悬停提示:[configSchema.json](http://raw.githubusercontent.com/tact-lang/tact/main/schemas/configSchema.json)
编辑器可使用[JSON 模式](https://json-schema.org/) 文件提供自动完成和悬停提示:[configSchema.json](http://raw.githubusercontent.com/tact-lang/tact/main/src/config/configSchema.json)

只需在配置文件顶部添加 `$schema` 字段即可:

```json filename="tact.config.json" {2}
{
"$schema": "http://raw.githubusercontent.com/tact-lang/tact/main/schemas/configSchema.json",
"$schema": "http://raw.githubusercontent.com/tact-lang/tact/main/src/config/configSchema.json",
"projects":[]
}
```
Expand Down Expand Up @@ -372,7 +372,7 @@ Value | Description

```json filename="tact.config.json" copy=false
{
"$schema": "http://raw.githubusercontent.com/tact-lang/tact/main/schemas/configSchema.json",
"$schema": "http://raw.githubusercontent.com/tact-lang/tact/main/src/config/configSchema.json",
"projects": [
{
"name": "basic",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"release": "yarn clean && yarn build && yarn coverage && yarn release-it --npm.yarn1",
"type": "tsc --noEmit",
"lint": "yarn eslint .",
"lint:schema": "ajv validate -s schemas/configSchema.json -d tact.config.json",
"lint:schema": "ajv validate -s src/config/configSchema.json -d tact.config.json",
"fmt": "yarn prettier -l -w .",
"fmt:check": "yarn prettier --check .",
"spell": "yarn cspell --no-progress \"**\"",
Expand Down
2 changes: 1 addition & 1 deletion schemas/configSchema.json → src/config/configSchema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/schema#",
"$id": "http://raw.githubusercontent.com/tact-lang/tact/main/schemas/configSchema.json",
"$id": "http://raw.githubusercontent.com/tact-lang/tact/main/src/config/configSchema.json",
"title": "Tact configuration schema",
"description": "JSON Schema for tact.config.json",
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion src/test/compilation-failed/tact.config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://raw.githubusercontent.com/tact-lang/tact/main/schemas/configSchema.json",
"$schema": "../../config/configSchema.json",
"projects": [
{
"name": "const-eval-invalid-address",
Expand Down
2 changes: 1 addition & 1 deletion tact.config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://raw.githubusercontent.com/tact-lang/tact/main/schemas/configSchema.json",
"$schema": "./src/config/configSchema.json",
"projects": [
{
"name": "echo",
Expand Down

0 comments on commit 3d42d5d

Please sign in to comment.