diff --git a/src/index.ts b/cli/index.ts similarity index 93% rename from src/index.ts rename to cli/index.ts index 6563c95..4efe243 100644 --- a/src/index.ts +++ b/cli/index.ts @@ -4,10 +4,7 @@ import fs from 'fs/promises'; import { Command, Option } from '@commander-js/extra-typings'; -import { convertToLanguage, SupportedLanguage } from './lib'; -import { tokenize } from './tokenizer'; - -export * from './lib'; +import { convertToLanguage, SupportedLanguage, tokenize } from '../core'; const program = new Command(); diff --git a/src/__tests__/languages/julia.test.ts b/core/__tests__/languages/julia.test.ts similarity index 100% rename from src/__tests__/languages/julia.test.ts rename to core/__tests__/languages/julia.test.ts diff --git a/src/__tests__/languages/python.test.ts b/core/__tests__/languages/python.test.ts similarity index 100% rename from src/__tests__/languages/python.test.ts rename to core/__tests__/languages/python.test.ts diff --git a/src/__tests__/languages/typescript.test.ts b/core/__tests__/languages/typescript.test.ts similarity index 100% rename from src/__tests__/languages/typescript.test.ts rename to core/__tests__/languages/typescript.test.ts diff --git a/src/__tests__/tokenizer.test.ts b/core/__tests__/tokenizer.test.ts similarity index 100% rename from src/__tests__/tokenizer.test.ts rename to core/__tests__/tokenizer.test.ts diff --git a/src/lib.ts b/core/index.ts similarity index 100% rename from src/lib.ts rename to core/index.ts diff --git a/src/languages/index.ts b/core/languages/index.ts similarity index 100% rename from src/languages/index.ts rename to core/languages/index.ts diff --git a/src/languages/julia.ts b/core/languages/julia.ts similarity index 100% rename from src/languages/julia.ts rename to core/languages/julia.ts diff --git a/src/languages/python.ts b/core/languages/python.ts similarity index 100% rename from src/languages/python.ts rename to core/languages/python.ts diff --git a/src/languages/rust.ts b/core/languages/rust.ts similarity index 100% rename from src/languages/rust.ts rename to core/languages/rust.ts diff --git a/src/languages/typescript.ts b/core/languages/typescript.ts similarity index 100% rename from src/languages/typescript.ts rename to core/languages/typescript.ts diff --git a/src/tokenizer/index.ts b/core/tokenizer/index.ts similarity index 100% rename from src/tokenizer/index.ts rename to core/tokenizer/index.ts diff --git a/src/tokenizer/sorting.ts b/core/tokenizer/sorting.ts similarity index 100% rename from src/tokenizer/sorting.ts rename to core/tokenizer/sorting.ts diff --git a/package-lock.json b/package-lock.json index 90e5fd6..ce44c0f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "commander": "^10.0.0" }, "bin": { - "json2struct": "dist/cli.js" + "json2struct": "dist/cli/index.js" }, "devDependencies": { "@types/eslint": "^8.21.3", diff --git a/package.json b/package.json index e179a25..39f227d 100644 --- a/package.json +++ b/package.json @@ -2,16 +2,16 @@ "name": "json2struct", "version": "0.4.1", "description": "Easily translate JSON into type definitions", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "main": "dist/core/index.js", + "types": "dist/core/index.d.ts", "files": [ "dist" ], "bin": { - "json2struct": "./dist/cli.js" + "json2struct": "./dist/cli/index.js" }, "scripts": { - "start": "node dist/cli.js", + "start": "node dist/cli/index.js", "build": "tsc", "build:clean": "tsc --build --clean && npm run build", "format": "prettier --ignore-path .gitignore --write .", @@ -19,11 +19,11 @@ "lint": "eslint --ext \".js,.mjs,.ts,.d.ts\" --ignore-path .gitignore .", "test": "vitest --run", "test:watch": "vitest", - "local": "npm uninstall -g && npm install -g && json2struct", - "example:typescript": "node dist/cli.js ./examples/example.json --output ./examples/example.d.ts --language typescript --overwrite && prettier --write ./examples/example.d.ts", - "example:python": "node dist/cli.js ./examples/example.json --output ./examples/example.py --language python --overwrite", - "example:julia": "node dist/cli.js ./examples/example.json --output ./examples/example.jl --language julia --overwrite", - "example:rust": "node dist/cli.js ./examples/example.json --output ./examples/example.rs --language rust --overwrite" + "local": "npm uninstall -g && npm install -g && json2struct", + "example:typescript": "node dist/cli/index.js ./examples/example.json --output ./examples/example.d.ts --language typescript --overwrite && prettier --write ./examples/example.d.ts", + "example:python": "node dist/cli/index.js ./examples/example.json --output ./examples/example.py --language python --overwrite", + "example:julia": "node dist/cli/index.js ./examples/example.json --output ./examples/example.jl --language julia --overwrite", + "example:rust": "node dist/cli/index.js ./examples/example.json --output ./examples/example.rs --language rust --overwrite" }, "repository": { "type": "git", diff --git a/tsconfig.json b/tsconfig.json index 54914b7..6a6327b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "rootDir": "src", "outDir": "dist", "strict": true, "target": "es5", @@ -13,6 +12,6 @@ "resolveJsonModule": true, "skipLibCheck": true }, - "include": ["src/"], - "exclude": ["src/__tests__/**", "**/**/*.test.ts"] + "include": ["cli/", "core/"], + "exclude": ["core/__tests__/**", "**/**/*.test.ts"] }