프로젝트 설정: kscript.json
kscript serve, kscript check, kscript fmt, kscript make 및 편집기는 작업하는 폴더 또는 상위 폴더에서 가장 가까운 kscript.json를 읽으므로, 프로젝트의 어느 위치에서 실행하든 동일하게 동작합니다. 모든 설정은 선택 사항입니다.
{
"name": "my-site",
"kscript": "0.51.0", // the KScript release the project is written for (see below)
"timezone": "Europe/London", // the zone stored dates are in (see docs/data.md); this is the default
"standard": "kscript:recommended", // lint rules and format settings to start from (see Standards)
"packages": ["KScript.Terminal", "KScript.IO"], // imported by every script in the project
"extensions": ["extensions", "shared/**/*.kscript"], // where the project's extend files are (default: extensions/)
"natives": ["natives"], // where the project's native types are, used without an import (default: natives/)
"serve": {
"root": ".", // the site folder, relative to kscript.json
"port": 8080, // --port and --host on the command line still win
"host": "localhost",
"docs": true // also serve the docs, with a page about this project (see docs/web.md)
},
"http": {
"middleware": ["log"], // routes, middleware and their settings (see docs/http.md)
"groups": { "api": ["cors", "throttle"] }
},
"lint": {
"include": ["**/*.html", "**/*.md", "**/*.kscript"], // what `kscript check` looks at
"exclude": ["_templates", "node_modules", "drafts/**"], // never checked, on the command line or in the editor
"rules": { "KS3003": "off", "KS4*": "error" }, // off, hint, info, warning or error, by code or prefix
"warnings_as_errors": false // same as kscript check --warnings-as-errors
},
"test": {
"include": ["tests/**/*.test.kscript"], // what `kscript test` runs (default: **/*.test.kscript and **/*.test.ks.xml)
"exclude": ["tests/slow"],
"timeout": 10, // seconds per test, 0 for no limit
"packages": ["KScript.Terminal"], // imported by test files only
"env": "test" // the environment tests run in, so kscript.test.json applies
},
"format": {
"indent": 2, // spaces per level, or "tab"; used by kscript fmt and Format Document
"print_width": 80, // the longest a line should be; longer lines are wrapped
"rules": { "statement_per_line": false }, // any rule can be turned off
"exclude": ["vendor"] // see docs/formatting.md for every format setting
},
"app": {
"main": "app.kscript", // what `kscript run` and `kscript compile` start from (default: main.kscript, then index.kscript)
"name": "My App", // shown in the Dock, Start menu or launcher (default: the project's name)
"id": "com.example.myapp", // the macOS bundle id
"version": "1.0.0",
"icon": "icon.png", // a .png, .ico or .icns, used for every platform
"user_config": true // lay the person's own config.json (KScript.Storage) over $config
},
"types": {
"uuid": { "v": 4 }, // arguments for every use of a built-in type (see Types and validation)
"password": { "min": 12 }
},
"config": {
"app": { "name": "Shop" }, // the app's own settings: $config.app.name
"database": { "connections": { "main": { "url": "sqlite:data/shop.sqlite" } } }
}
}/가 없는 패턴(예:_templates또는*.draft.html)은 그 이름의 파일이나 폴더를 어디에서든 찾습니다. 그 외에는kscript.json부터의 경로와 비교합니다.*는 한 폴더 안에만 해당하고,**는 여러 폴더에 걸쳐 일치하며, 폴더 이름은 그 안의 모든 항목과 일치합니다.kscriptnames the KScript release the project is written for: an exact release such as"0.51.0", or"0.51"for the newest 0.51.x. Editors that fetch KScript for you, such as FlowIDE, run the project with that release; without it they use the latest one.standard는 프로젝트의lint와format설정이 시작점으로 삼는 표준을 고릅니다. 값은kscript:recommended(기본값),kscript:strict, 또는 여러 프로젝트에서 공유할 수 있는 나만의 표준 파일 중에서 고를 수 있습니다.kscript.json에 직접 설정한 값은 표준보다 우선합니다.kscript check --print-config는 최종 결과와 각 설정이 어디에서 왔는지 보여 줍니다.rules는 진단 메시지의 심각도를 바꿉니다(코드 목록 참고). 가장 긴 일치 규칙이 우선하므로,"KS3*": "warning"와"KS3001": "error"를 함께 쓰면 알 수 없는 요소는 계속 오류로 표시됩니다.- 주석과 끝에 오는 쉼표는 허용됩니다. 알 수 없는 설정은 조용히 무시하지 않고 경고로 표시됩니다. VS Code 확장 프로그램은 파일을 검증하고, 입력하는 동안 설정을 자동으로 완성해 줍니다.
format는kscript fmt와 편집기의 문서 서식 지정(Format Document)에 쓰이는 스타일을 설정하고,format.rules는 개별 규칙을 끌 때 사용해요. 모든 설정과 무시 주석은 서식 지정에서 확인해 보세요.- 프로젝트 안에서 하위 폴더에서 실행하더라도
kscript make page about은 사이트 루트에 페이지를 만듭니다. config는 앱 자체 설정을 담고 있으며,$config로 읽힙니다.kscript.json옆의kscript.<env>.json와config.kscript는 그 위에 덮어씌워집니다 (설정 참조).kscript serve은kscript.json,kscript.<env>.json,.env파일이나config.*JSON 파일을 절대 제공하지 않아요.http는 KScript.Http의 라우트 파일, 미들웨어, CORS, 인증, 요청 제한을 설정해요 (라우트, 컨트롤러, 미들웨어 참고).types는 프로젝트 전체에서uuid,email,password같은 기본 제공 타입에 동일한 인수를 적용해요. 타입을 사용하는 곳에 직접 쓴 인수(예:uuid(v: 8))가 우선 적용돼요(타입과 유효성 검사 참조).app.name(또는name)은 앱 자체의 설정, 데이터, 캐시 폴더 이름이기도 해요 (앱 폴더 참고).queue은 작업이 기다리는 연결, 워커가 확인하는 큐, 그리고 실패한 작업을 보관하는 기간을 지정합니다 (큐와 작업 참조).app는kscript compile가 읽고, 스크립트(주로 데스크톱 앱)를 macOS, Windows, Linux용 프로그램으로 빌드합니다(프로그램 참조).