Skip to content

Commit 53ba41c

Browse files
Merge pull request #3303 from opral/parjs-213-remove-vite-in-favor-of-tsc
Parjs-213-remove-vite-in-favor-of-tsc
2 parents 936b6bc + 346c21b commit 53ba41c

22 files changed

+86
-539
lines changed

.changeset/lovely-rice-melt.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
"@inlang/paraglide-js": minor
3+
---
4+
5+
maintenance: remove path prop from tsconfig
6+
7+
```diff
8+
-"paths": {
9+
- "~/*": ["./src/*"]
10+
-}
11+
```
12+
13+
So not worth it "nice to have" "but it's better DX" thing. Breaks path resolving in JS. Vitest needed a vite config to resolve the paths because only TS knew how to resolve thep paths. Etc. Etc. Etc.

.changeset/spicy-bottles-poke.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
"@inlang/paraglide-js": minor
3+
---
4+
5+
maintenance: remove vite in favor of tsc to build paraglide js lib
6+
7+
Closes https://github.com/opral/inlang-paraglide-js/issues/208
8+
9+
```diff
10+
- "build": "vite build",
11+
+ "build": "tsc",
12+
```
13+
14+
Paraglide JS used vite to build the library. This change removes vite in favor of tsc to build the library. This change is made to simplify the build process and to make it easier to maintain the library in the future.

packages/inlang-paraglide-js/package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"./default"
4242
],
4343
"scripts": {
44-
"dev": "vite build --mode development --watch",
45-
"build": "npm run env-variables && vite build --mode production",
44+
"dev": "tsc --watch",
45+
"build": "npm run env-variables && tsc --build",
4646
"test": "tsc --noEmit && vitest run --coverage ./src/**/*",
4747
"test:watch": "vitest --watch ./src/**/*",
4848
"env-variables": "node ./src/services/env-variables/createIndexFile.js",
@@ -74,9 +74,6 @@
7474
"memfs": "4.6.0",
7575
"rollup": "3.29.1",
7676
"typescript": "^5.5.2",
77-
"vite": "^4.5.2",
78-
"vite-plugin-dts": "^3.8.1",
79-
"vite-tsconfig-paths": "^4.3.2",
8077
"vitest": "2.0.5"
8178
},
8279
"exports": {

packages/inlang-paraglide-js/src/adapter-utils/routing/resolveUserPathDefinition.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe("resolvePathTranslations", () => {
2222

2323
it("resolves message translations", () => {
2424
const userTranslations: UserPathDefinitionTranslations<"en" | "de"> = {
25-
"/about": (_, { languageTag }: { languageTag: "en" | "de" }) => {
25+
"/about": (_: any, { languageTag }: { languageTag: "en" | "de" }) => {
2626
switch (languageTag) {
2727
case "en":
2828
return "/about";

packages/inlang-paraglide-js/src/adapter-utils/routing/resolveUserPathDefinitions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { MessageIndexFunction } from "~/index.js";
1+
import type { MessageIndexFunction } from "../../index.js";
22
import type { PathDefinitionTranslations } from "./routeDefinitions.js";
33

44
/**

packages/inlang-paraglide-js/src/cli/commands/compile/command.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { Command } from "commander";
22
import fs from "node:fs";
33
import { resolve } from "node:path";
4-
import { Logger } from "~/services/logger/index.js";
5-
import { runCompiler } from "~/cli/steps/run-compiler.js";
6-
import { DEFAULT_OUTDIR } from "~/cli/defaults.js";
4+
import { Logger } from "../../../services/logger/index.js";
5+
import { runCompiler } from "../../../cli/steps/run-compiler.js";
6+
import { DEFAULT_OUTDIR } from "../../../cli/defaults.js";
77
import { loadProjectFromDirectory } from "@inlang/sdk";
8-
import { ENV_VARIABLES } from "~/services/env-variables/index.js";
8+
import { ENV_VARIABLES } from "../../../services/env-variables/index.js";
99

1010
export const compileCommand = new Command()
1111
.name("compile")

packages/inlang-paraglide-js/src/cli/commands/init/command.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import { Command } from "commander";
22
import consola from "consola";
33
import * as nodePath from "node:path";
4-
import { Logger } from "~/services/logger/index.js";
5-
import { findPackageJson } from "~/services/environment/package.js";
6-
import { checkForUncommittedChanges } from "~/cli/steps/check-for-uncomitted-changes.js";
7-
import { initializeInlangProject } from "~/cli/steps/initialize-inlang-project.js";
8-
import { maybeAddSherlock } from "~/cli/steps/maybe-add-sherlock.js";
9-
import { maybeChangeTsConfig } from "~/cli/steps/update-ts-config.js";
10-
import { promptForOutdir } from "~/cli/steps/prompt-for-outdir.js";
11-
import { updatePackageJson } from "~/cli/steps/update-package-json.js";
12-
import { runCompiler } from "~/cli/steps/run-compiler.js";
4+
import { Logger } from "../../../services/logger/index.js";
5+
import { findPackageJson } from "../../../services/environment/package.js";
6+
import { checkForUncommittedChanges } from "../../steps/check-for-uncomitted-changes.js";
7+
import { initializeInlangProject } from "../../steps/initialize-inlang-project.js";
8+
import { maybeAddSherlock } from "../../steps/maybe-add-sherlock.js";
9+
import { maybeChangeTsConfig } from "../../steps/update-ts-config.js";
10+
import { promptForOutdir } from "../../steps/prompt-for-outdir.js";
11+
import { updatePackageJson } from "../../steps/update-package-json.js";
12+
import { runCompiler } from "../../steps/run-compiler.js";
1313
import type { CliStep } from "../../utils.js";
1414
import nodeFs from "node:fs";
15-
import type { NodeishFilesystem } from "~/services/file-handling/types.js";
16-
import { ENV_VARIABLES } from "~/services/env-variables/index.js";
15+
import type { NodeishFilesystem } from "../../../services/file-handling/types.js";
16+
import { ENV_VARIABLES } from "../../../services/env-variables/index.js";
1717

1818
export const initCommand = new Command()
1919
.name("init")

packages/inlang-paraglide-js/src/cli/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Command } from "commander";
22
import { compileCommand } from "./commands/compile/command.js";
3-
import { ENV_VARIABLES } from "~/services/env-variables/index.js";
3+
import { ENV_VARIABLES } from "../services/env-variables/index.js";
44

55
export { checkForUncommittedChanges } from "./steps/check-for-uncomitted-changes.js";
66
export { initializeInlangProject } from "./steps/initialize-inlang-project.js";

packages/inlang-paraglide-js/src/cli/steps/check-for-uncomitted-changes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { Logger } from "~/services/logger/index.js";
1+
import type { Logger } from "../../services/logger/index.js";
22
import type { CliStep } from "../utils.js";
3-
import { prompt } from "~/cli/utils.js";
3+
import { prompt } from "../utils.js";
44
import childProcess from "node:child_process";
55

66
export const checkForUncommittedChanges: CliStep<

packages/inlang-paraglide-js/src/cli/steps/initialize-inlang-project.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { loadProjectFromDirectory, type InlangProject } from "@inlang/sdk";
2-
import type { Logger } from "~/services/logger/index.js";
2+
import type { Logger } from "../../services/logger/index.js";
33
import type { CliStep } from "../utils.js";
4-
import { prompt } from "~/cli/utils.js";
5-
import { DEFAULT_PROJECT_PATH, getNewProjectTemplate } from "~/cli/defaults.js";
4+
import { prompt } from "../utils.js";
5+
import { DEFAULT_PROJECT_PATH, getNewProjectTemplate } from "../defaults.js";
66
import nodePath from "node:path";
77
import consola from "consola";
88
import fg from "fast-glob";
99
import fs from "node:fs";
10-
import { ENV_VARIABLES } from "~/services/env-variables/index.js";
10+
import { ENV_VARIABLES } from "../../services/env-variables/index.js";
1111

1212
export const initializeInlangProject: CliStep<
1313
{

0 commit comments

Comments
 (0)