@inlang/paraglide-js 1.3.6 → 1.3.7
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.
- package/README.md +66 -70
- package/dist/cli/commands/init/command.d.ts +9 -3
- package/dist/cli/commands/init/defaults.d.ts +1 -0
- package/dist/index.js +37 -11
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,33 +1,44 @@
|
|
|
1
|
-
[<img src="https://cdn.
|
|
1
|
+
[<img src="https://cdn.jsdelivr.net/gh/opral/monorepo@latest/inlang/source-code/paraglide/paraglide-js/assets/header.png" alt="Dead Simple i18n. Typesafe, Small Footprint, Treeshsakeable Messages, IDE Integration, Framework Agnostic" width="10000000px" />](https://www.youtube.com/watch?v=-YES3CCAG90)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# Why Paraglide?
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<doc-features>
|
|
6
|
+
<doc-feature title="Tiny Runtime" image="https://cdn.jsdelivr.net/gh/opral/monorepo@latest/inlang/source-code/paraglide/paraglide-js/assets/bundlesize-feature.png"></doc-feature>
|
|
7
|
+
<doc-feature title="Fully Typesafe" image="https://cdn.jsdelivr.net/gh/opral/monorepo@latest/inlang/source-code/paraglide/paraglide-js/assets/typesafety-feature.png"></doc-feature>
|
|
8
|
+
<doc-feature title="Only Ship Used Messages" image="https://cdn.jsdelivr.net/gh/opral/monorepo@latest/inlang/source-code/paraglide/paraglide-js/assets/unused-translations.png"></doc-feature>
|
|
9
|
+
<doc-feature title="Sherlock VsCode Extension" image="https://cdn.jsdelivr.net/gh/opral/monorepo@latest/inlang/source-code/paraglide/paraglide-js/assets/sherlock-preview.png"></doc-feature>
|
|
10
|
+
</doc-features>
|
|
6
11
|
|
|
7
|
-
```bash
|
|
8
|
-
npx @inlang/paraglide-js@latest init
|
|
9
|
-
```
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
With Paraglide's Treeshsakeable messages, each page only loads the messages it actually uses. Incremental loading like this would usually take forever to get right, with Paraglide you get it for free.
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
<doc-feature title="Only used translations are shipped" image="https://cdn.jsdelivr.net/gh/opral/monorepo@latest/inlang/source-code/paraglide/paraglide-js/assets/unused-translations.png"></doc-feature>
|
|
15
|
-
<doc-feature title="Tiny Bundle-Size" image="https://cdn.jsdelivr.net/gh/opral/monorepo@latest/inlang/source-code/paraglide/paraglide-js/assets/reduced-payload.png"></doc-feature>
|
|
16
|
-
<doc-feature title="Typesafe" image="https://cdn.jsdelivr.net/gh/opral/monorepo@latest/inlang/source-code/paraglide/paraglide-js/assets/typesafe.png"></doc-feature>
|
|
17
|
-
</doc-features>
|
|
15
|
+
# Use it with your Favorite Framework
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
Paraglide is framework agnostic, but it's even better if you pair it with a framework specific library. If you are using one of these frameworks you will want to follow the framework specific documentation instead. If you aren't, that's fine too! You can read on.
|
|
20
18
|
|
|
21
|
-
<doc-
|
|
22
|
-
|
|
19
|
+
<doc-links>
|
|
20
|
+
<doc-link title="Adapter for NextJS" icon="tabler:brand-nextjs" href="/m/osslbuzt/paraglide-next-i18n" description="Go to Library"></doc-link>
|
|
21
|
+
<doc-link title="Adapter for SvelteKit" icon="simple-icons:svelte" href="/m/dxnzrydw/paraglide-sveltekit-i18n" description="Go to Library"></doc-link>
|
|
22
|
+
<doc-link title="Adapter for Astro" icon="devicon-plain:astro" href="/m/iljlwzfs/paraglide-astro-i18n" description="Go to Library"></doc-link>
|
|
23
|
+
<doc-link title="Adapter for SolidJS" icon="tabler:brand-solidjs" href="/m/n860p17j/paraglide-solidstart-i18n" description="Go to Library"></doc-link>
|
|
24
|
+
<doc-link title="Adapter for Remix" icon="simple-icons:remix" href="/m/fnhuwzrx/paraglide-remix-i18n" description="Go to Library"></doc-link>
|
|
25
|
+
<doc-link title="Or write your own" icon="ph:sparkle-fill" href="#writing-an-adapter" description="Learn How"></doc-link>
|
|
26
|
+
</doc-links>
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
# People Love It
|
|
25
29
|
|
|
26
|
-
|
|
30
|
+
Here are a few comments we've received recently.
|
|
31
|
+
|
|
32
|
+
<doc-comments>
|
|
33
|
+
<doc-comment text="Just tried Paraglide JS from @inlangHQ. This is how i18n should be done! Totally new level of DX for both implementation and managing translations! Superb support for SvelteKit as well ⭐" author="Patrik Engborg" icon="mdi:twitter" data-source="https://twitter.com/patrikengborg/status/1747260930873053674"></doc-comment>
|
|
34
|
+
<doc-comment text="I was messing with various i18n frameworks and tools in combination with Astro, and i must say that Paraglide was the smoothest experience. I have migrated my website from i18next and it was a breeze. SSG and SSR worked out of the box (which was the first one for me), and overall DX is great. Thanks for your work!" author="Dalibor Hon" icon="mdi:discord" data-source="https://discord.com/channels/897438559458430986/1096039983116202034/1220796380772307004"></doc-comment>
|
|
35
|
+
<doc-comment text="The lib is great guys!" author="ktarmyshov" icon="mdi:github"></doc-comment>
|
|
36
|
+
<doc-comment text="Thank you for that huge work you have done and still doing!" author="ZerdoX-x" icon="mdi:github"></doc-comment>
|
|
37
|
+
</doc-comments>
|
|
27
38
|
|
|
28
|
-
|
|
39
|
+
# Getting started
|
|
29
40
|
|
|
30
|
-
|
|
41
|
+
To use Paraglide stanadlone without a framework, run the following command:
|
|
31
42
|
|
|
32
43
|
```bash
|
|
33
44
|
npx @inlang/paraglide-js@latest init
|
|
@@ -35,41 +46,36 @@ npx @inlang/paraglide-js@latest init
|
|
|
35
46
|
|
|
36
47
|
This will:
|
|
37
48
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
### 2. Set up an adapter (optional)
|
|
43
|
-
|
|
44
|
-
Adapters are framework-integrations for Paraglide. If you are using a framework, using an adapter is recommended , but not required.
|
|
45
|
-
|
|
46
|
-
<doc-links>
|
|
47
|
-
<doc-link title="Adapter for NextJS" icon="tabler:brand-nextjs" href="/m/osslbuzt/paraglide-next-i18n" description="Go to Library"></doc-link>
|
|
48
|
-
<doc-link title="Adapter for SvelteKit" icon="simple-icons:svelte" href="/m/dxnzrydw/paraglide-sveltekit-i18n" description="Go to Library"></doc-link>
|
|
49
|
-
<doc-link title="Adapter for Astro" icon="devicon-plain:astro" href="/m/iljlwzfs/paraglide-astro-i18n" description="Go to Library"></doc-link>
|
|
50
|
-
<doc-link title="Adapter for SolidJS" icon="tabler:brand-solidjs" href="/m/n860p17j/paraglide-solidstart-i18n" description="Go to Library"></doc-link>
|
|
51
|
-
</doc-links>
|
|
52
|
-
|
|
53
|
-
#### Alternatively, [you can write your own adapter](#writing-an-adapter)
|
|
54
|
-
|
|
55
|
-
# Usage
|
|
49
|
+
- Install necessary dependencies
|
|
50
|
+
- Generate a `messages/` folder where your translation files live
|
|
51
|
+
- Add the Paraglide compiler to your `build` script
|
|
52
|
+
- Create necessary configuration files
|
|
56
53
|
|
|
57
|
-
Running
|
|
54
|
+
Running the paraglide compiler will generate a `src/paraglide` folder. This folder contains all the code that you need to use paraglide-js.
|
|
58
55
|
|
|
59
|
-
## Adding Messages
|
|
56
|
+
## Adding and Editing Messages
|
|
60
57
|
|
|
61
|
-
|
|
58
|
+
Messages are stored in `messages/{lang}.json`. To add a message simply add a key-value pair. You can add parameters with curly braces.
|
|
62
59
|
|
|
63
|
-
```
|
|
60
|
+
```diff
|
|
61
|
+
// messages/en.json
|
|
64
62
|
{
|
|
65
|
-
"
|
|
66
|
-
|
|
63
|
+
"$schema": "https://inlang.com/schema/inlang-message-format",
|
|
64
|
+
+ "greeting": "Hello {name}!"
|
|
67
65
|
}
|
|
68
66
|
```
|
|
69
67
|
|
|
70
|
-
|
|
68
|
+
Make sure to re-run the paraglide compiler after editing your messages.
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
npx @inlang/paraglide-js compile --project ./project.inlang
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
If you are using Vite, you can instead use the [paraglide vite-plugin](https://github.com/opral/monorepo/tree/main/inlang/source-code/paraglide/paraglide-js-adapter-vite) to do this automatically.
|
|
71
75
|
|
|
72
|
-
|
|
76
|
+
## Using Messages in Code
|
|
77
|
+
|
|
78
|
+
After running the compiler, you can import messages with `import * as m from "./paraglide/messages"`.
|
|
73
79
|
|
|
74
80
|
```js
|
|
75
81
|
import * as m from "./paraglide/messages.js"
|
|
@@ -79,7 +85,7 @@ m.hello() // Hello world!
|
|
|
79
85
|
m.loginHeader({ name: "Samuel" }) // Hello Samuel, please login to continue.
|
|
80
86
|
```
|
|
81
87
|
|
|
82
|
-
|
|
88
|
+
To choose between messages at runtime create a map of messages and index into it.
|
|
83
89
|
|
|
84
90
|
```ts
|
|
85
91
|
import * as m from "./paraglide/messages.js"
|
|
@@ -94,15 +100,14 @@ const season = {
|
|
|
94
100
|
const msg = season["spring"]() // Hello spring!
|
|
95
101
|
```
|
|
96
102
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
[Sherlock](https://inlang.com/m/r7kp499g/app-inlang-ideExtension) integrates with paraglide to give you the optimal dev-experience.
|
|
103
|
+
## Configuration
|
|
100
104
|
|
|
101
|
-
|
|
105
|
+
You can configure the languages you intend to support
|
|
102
106
|
|
|
103
|
-
|
|
107
|
+
### Languages
|
|
104
108
|
|
|
105
109
|
You can declare which languages you support in `./project.inlang/settings.json`.
|
|
110
|
+
|
|
106
111
|
```json
|
|
107
112
|
// project.inlang/settings.json
|
|
108
113
|
{
|
|
@@ -268,21 +273,25 @@ An "Adapter" is a library that integrates with a framework's liefcycle and does
|
|
|
268
273
|
This example adapts Paraglide to a fictitious fullstack framework.
|
|
269
274
|
|
|
270
275
|
```tsx
|
|
271
|
-
import {
|
|
276
|
+
import {
|
|
277
|
+
setLanguageTag,
|
|
278
|
+
onSetLanguageTag,
|
|
279
|
+
type AvailableLanguageTag,
|
|
280
|
+
} from "../paraglide/runtime.js"
|
|
272
281
|
import { isServer, isClient, request, render } from "@example/framework"
|
|
273
282
|
import { detectLanguage } from "./utils.js"
|
|
274
283
|
|
|
275
284
|
if (isServer) {
|
|
276
|
-
// On the server the language tag needs to be resolved on a per-request basis.
|
|
285
|
+
// On the server the language tag needs to be resolved on a per-request basis.
|
|
277
286
|
// Pass a getter function that resolves the language from the correct request
|
|
278
287
|
|
|
279
|
-
const detectLanguage = (request: Request)
|
|
288
|
+
const detectLanguage = (request: Request): AvailableLanguageTag => {
|
|
280
289
|
//your logic ...
|
|
281
290
|
}
|
|
282
291
|
setLanguageTag(() => detectLanguage(request))
|
|
283
292
|
}
|
|
284
293
|
|
|
285
|
-
if(isClient) {
|
|
294
|
+
if (isClient) {
|
|
286
295
|
// On the client, the language tag can be resolved from
|
|
287
296
|
// the document's html lang tag.
|
|
288
297
|
setLanguageTag(() => document.documentElement.lang)
|
|
@@ -304,20 +313,6 @@ render((page) => (
|
|
|
304
313
|
))
|
|
305
314
|
```
|
|
306
315
|
|
|
307
|
-
# Community
|
|
308
|
-
|
|
309
|
-
We are grateful for all the support we get from the community. Here are a few comments we've received recently.
|
|
310
|
-
|
|
311
|
-
If you have any feedback / problems, please let us know on [GitHub](https://github.com/opral/inlang-paraglide-js/issues/new)
|
|
312
|
-
|
|
313
|
-
<doc-comments>
|
|
314
|
-
<doc-comment text="Just tried Paraglide JS from @inlangHQ. This is how i18n should be done! Totally new level of DX for both implementation and managing translations! Superb support for SvelteKit as well ⭐" author="Patrik Engborg" icon="mdi:twitter" data-source="https://twitter.com/patrikengborg/status/1747260930873053674"></doc-comment>
|
|
315
|
-
<doc-comment text="I was messing with various i18n frameworks and tools in combination with Astro, and i must say that Paraglide was the smoothest experience. I have migrated my website from i18next and it was a breeze. SSG and SSR worked out of the box (which was the first one for me), and overall DX is great. Thanks for your work!" author="Dally H" icon="mdi:discord" data-source="https://discord.com/channels/897438559458430986/1096039983116202034/1220796380772307004"></doc-comment>
|
|
316
|
-
<doc-comment text="The lib is great guys!" author="ktarmyshov" icon="mdi:github"></doc-comment>
|
|
317
|
-
<doc-comment text="Thank you for that huge work you have done and still doing!" author="ZerdoX-x" icon="mdi:github"></doc-comment>
|
|
318
|
-
<doc-comment text="Thanks for all the great work @Samuel Stroschein" author="Willem" icon="mdi:discord"></doc-comment>
|
|
319
|
-
</doc-comments>
|
|
320
|
-
|
|
321
316
|
# Roadmap
|
|
322
317
|
|
|
323
318
|
Of course, we're not done yet! We plan on adding the following features to Paraglide JS soon:
|
|
@@ -325,6 +320,7 @@ Of course, we're not done yet! We plan on adding the following features to Parag
|
|
|
325
320
|
- [ ] Pluralization ([Join the Discussion](https://github.com/opral/monorepo/discussions/2025))
|
|
326
321
|
- [ ] Formatting of numbers and dates ([Join the Discussion](https://github.com/opral/monorepo/discussions/992))
|
|
327
322
|
- [ ] Markup Placeholders ([Join the Discussion](https://github.com/opral/monorepo/discussions/913))
|
|
323
|
+
- [ ] Even Smaller Output
|
|
328
324
|
|
|
329
325
|
# Talks
|
|
330
326
|
|
|
@@ -337,7 +333,7 @@ Of course, we're not done yet! We plan on adding the following features to Parag
|
|
|
337
333
|
|
|
338
334
|
Paraglide JS is part of the Inlang ecosystem and integrates nicely with all the other Inlang compatible tools.
|
|
339
335
|
|
|
340
|
-
As a developer, you will love the [Sherlock
|
|
336
|
+
As a developer, you will love the [Sherlock VsCode extension](https://inlang.com/m/r7kp499g/app-inlang-ideExtension).
|
|
341
337
|
|
|
342
338
|
If you are working with translators or designers you will find these tools useful:
|
|
343
339
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
+
import { type InlangProject } from "@inlang/sdk";
|
|
2
3
|
import { Logger } from "../../../services/logger/index.js";
|
|
3
4
|
import { type Repository } from "@lix-js/client";
|
|
4
5
|
type Context = {
|
|
@@ -6,7 +7,11 @@ type Context = {
|
|
|
6
7
|
repo: Repository;
|
|
7
8
|
};
|
|
8
9
|
export declare const initCommand: Command;
|
|
9
|
-
export declare const initializeInlangProject: (ctx: Context) => Promise<
|
|
10
|
+
export declare const initializeInlangProject: (ctx: Context) => Promise<{
|
|
11
|
+
project: InlangProject;
|
|
12
|
+
/** Relative path to the project */
|
|
13
|
+
projectPath: string;
|
|
14
|
+
}>;
|
|
10
15
|
export declare const maybeAddVsCodeExtension: (args: {
|
|
11
16
|
projectPath: string;
|
|
12
17
|
}, ctx: Context) => Promise<void>;
|
|
@@ -14,12 +19,13 @@ export declare const addParaglideJsToDevDependencies: (ctx: Context) => Promise<
|
|
|
14
19
|
export declare const findExistingInlangProjectPath: (ctx: Context) => Promise<string | undefined>;
|
|
15
20
|
export declare const existingProjectFlow: (args: {
|
|
16
21
|
existingProjectPath: string;
|
|
17
|
-
}, ctx: Context) => Promise<
|
|
18
|
-
export declare const createNewProjectFlow: (ctx: Context) => Promise<
|
|
22
|
+
}, ctx: Context) => Promise<InlangProject>;
|
|
23
|
+
export declare const createNewProjectFlow: (ctx: Context) => Promise<InlangProject>;
|
|
19
24
|
export declare const checkIfPackageJsonExists: (ctx: Context) => Promise<undefined>;
|
|
20
25
|
export declare const checkIfUncommittedChanges: (ctx: Context) => Promise<void>;
|
|
21
26
|
export declare const addCompileStepToPackageJSON: (args: {
|
|
22
27
|
projectPath: string;
|
|
28
|
+
outdir: string;
|
|
23
29
|
}, ctx: Context) => Promise<undefined>;
|
|
24
30
|
/**
|
|
25
31
|
* Ensures that the moduleResolution compiler option is set to "bundler" or similar in the tsconfig.json.
|
package/dist/index.js
CHANGED
|
@@ -57179,6 +57179,7 @@ function getNewProjectTemplate() {
|
|
|
57179
57179
|
return structuredClone(newProjectTemplate);
|
|
57180
57180
|
}
|
|
57181
57181
|
var DEFAULT_PROJECT_PATH = "./project.inlang";
|
|
57182
|
+
var DEFAULT_OUTDIR = "./src/paraglide";
|
|
57182
57183
|
|
|
57183
57184
|
// src/cli/commands/init/command.ts
|
|
57184
57185
|
var ADAPTER_LINKS = {
|
|
@@ -57204,15 +57205,23 @@ var initCommand = new Command2().name("init").summary("Initializes inlang Paragl
|
|
|
57204
57205
|
telemetry.capture({ event: "PARAGLIDE-JS init started" });
|
|
57205
57206
|
await checkIfUncommittedChanges(ctx);
|
|
57206
57207
|
await checkIfPackageJsonExists(ctx);
|
|
57207
|
-
const projectPath = await initializeInlangProject(ctx);
|
|
57208
|
+
const { projectPath, project } = await initializeInlangProject(ctx);
|
|
57208
57209
|
telemetry.capture({ event: "PARAGLIDE-JS init project initialized" });
|
|
57209
57210
|
await addParaglideJsToDevDependencies(ctx);
|
|
57210
57211
|
telemetry.capture({ event: "PARAGLIDE-JS init added to devDependencies" });
|
|
57211
|
-
await addCompileStepToPackageJSON({ projectPath }, ctx);
|
|
57212
|
+
await addCompileStepToPackageJSON({ projectPath, outdir: DEFAULT_OUTDIR }, ctx);
|
|
57212
57213
|
telemetry.capture({ event: "PARAGLIDE-JS init added compile commands" });
|
|
57213
57214
|
await maybeChangeTsConfigModuleResolution(ctx);
|
|
57214
57215
|
await maybeChangeTsConfigAllowJs(ctx);
|
|
57215
57216
|
await maybeAddVsCodeExtension({ projectPath }, ctx);
|
|
57217
|
+
try {
|
|
57218
|
+
await executeCompilation2(project, DEFAULT_OUTDIR, ctx.repo.nodeishFs);
|
|
57219
|
+
ctx.logger.success("Run paraglide compiler");
|
|
57220
|
+
} catch (e) {
|
|
57221
|
+
ctx.logger.warn(
|
|
57222
|
+
"Failed to compile project automatically. You will need to run the compiler manually"
|
|
57223
|
+
);
|
|
57224
|
+
}
|
|
57216
57225
|
telemetry.capture({ event: "PARAGLIDE-JS init finished" });
|
|
57217
57226
|
const absoluteSettingsPath = nodePath.resolve(projectPath, "settings.json");
|
|
57218
57227
|
const relativeSettingsFilePath = absoluteSettingsPath.replace(process.cwd(), ".");
|
|
@@ -57239,18 +57248,25 @@ var initCommand = new Command2().name("init").summary("Initializes inlang Paragl
|
|
|
57239
57248
|
}
|
|
57240
57249
|
successMessage += "\n\n";
|
|
57241
57250
|
successMessage += dedent2`
|
|
57242
|
-
For questions and feedback, visit
|
|
57251
|
+
For questions and feedback, visit
|
|
57252
|
+
https://github.com/opral/monorepo/discussions.
|
|
57243
57253
|
`;
|
|
57244
57254
|
ctx.logger.box(successMessage);
|
|
57245
57255
|
});
|
|
57246
57256
|
var initializeInlangProject = async (ctx) => {
|
|
57247
57257
|
const existingProjectPath = await findExistingInlangProjectPath(ctx);
|
|
57248
57258
|
if (existingProjectPath) {
|
|
57249
|
-
await existingProjectFlow({ existingProjectPath }, ctx);
|
|
57250
|
-
return
|
|
57259
|
+
const project = await existingProjectFlow({ existingProjectPath }, ctx);
|
|
57260
|
+
return {
|
|
57261
|
+
project,
|
|
57262
|
+
projectPath: existingProjectPath
|
|
57263
|
+
};
|
|
57251
57264
|
} else {
|
|
57252
|
-
await createNewProjectFlow(ctx);
|
|
57253
|
-
return
|
|
57265
|
+
const project = await createNewProjectFlow(ctx);
|
|
57266
|
+
return {
|
|
57267
|
+
project,
|
|
57268
|
+
projectPath: DEFAULT_PROJECT_PATH
|
|
57269
|
+
};
|
|
57254
57270
|
}
|
|
57255
57271
|
};
|
|
57256
57272
|
var maybeAddVsCodeExtension = async (args, ctx) => {
|
|
@@ -57342,6 +57358,7 @@ var existingProjectFlow = async (args, ctx) => {
|
|
|
57342
57358
|
}
|
|
57343
57359
|
process.exit(1);
|
|
57344
57360
|
}
|
|
57361
|
+
return project;
|
|
57345
57362
|
};
|
|
57346
57363
|
function parseLanguageTagInput(input) {
|
|
57347
57364
|
const languageTags = input.replaceAll(/[,:\s]/g, " ").split(" ").filter(Boolean).map((tag2) => tag2.toLowerCase());
|
|
@@ -57419,6 +57436,7 @@ var createNewProjectFlow = async (ctx) => {
|
|
|
57419
57436
|
} else {
|
|
57420
57437
|
ctx.logger.success("Successfully created a new inlang project.");
|
|
57421
57438
|
}
|
|
57439
|
+
return project;
|
|
57422
57440
|
};
|
|
57423
57441
|
var checkIfPackageJsonExists = async (ctx) => {
|
|
57424
57442
|
const packageJsonPath = await findPackageJson(ctx.repo.nodeishFs, process.cwd());
|
|
@@ -57464,14 +57482,14 @@ var addCompileStepToPackageJSON = async (args, ctx) => {
|
|
|
57464
57482
|
pkg2.scripts = {};
|
|
57465
57483
|
}
|
|
57466
57484
|
if (!pkg2.scripts.postinstall) {
|
|
57467
|
-
pkg2.scripts.postinstall = `paraglide-js compile --project ${args.projectPath}`;
|
|
57485
|
+
pkg2.scripts.postinstall = `paraglide-js compile --project ${args.projectPath} --outdir ${args.outdir}`;
|
|
57468
57486
|
} else if (pkg2.scripts.postinstall.includes("paraglide-js compile") === false) {
|
|
57469
|
-
pkg2.scripts.postinstall = `paraglide-js compile --project ${args.projectPath} && ${pkg2.scripts.postinstall}`;
|
|
57487
|
+
pkg2.scripts.postinstall = `paraglide-js compile --project ${args.projectPath} --outdir ${args.outdir} && ${pkg2.scripts.postinstall}`;
|
|
57470
57488
|
}
|
|
57471
57489
|
if (((_a = pkg2 == null ? void 0 : pkg2.scripts) == null ? void 0 : _a.build) === void 0) {
|
|
57472
|
-
pkg2.scripts.build = `paraglide-js compile --project ${args.projectPath}`;
|
|
57490
|
+
pkg2.scripts.build = `paraglide-js compile --project ${args.projectPath} --outdir ${args.outdir}`;
|
|
57473
57491
|
} else if (((_b = pkg2 == null ? void 0 : pkg2.scripts) == null ? void 0 : _b.build.includes("paraglide-js compile")) === false) {
|
|
57474
|
-
pkg2.scripts.build = `paraglide-js compile --project ${args.projectPath} && ${pkg2.scripts.build}`;
|
|
57492
|
+
pkg2.scripts.build = `paraglide-js compile --project ${args.projectPath} --outdir ${args.outdir} && ${pkg2.scripts.build}`;
|
|
57475
57493
|
} else {
|
|
57476
57494
|
ctx.logger.warn(`The "build" script in the \`package.json\` already contains a "paraglide-js compile" command.
|
|
57477
57495
|
|
|
@@ -57600,6 +57618,14 @@ var maybeChangeTsConfigAllowJs = async (ctx) => {
|
|
|
57600
57618
|
}
|
|
57601
57619
|
}
|
|
57602
57620
|
};
|
|
57621
|
+
async function executeCompilation2(project, outputDirectory, fs3) {
|
|
57622
|
+
const output = await compile({
|
|
57623
|
+
messages: project.query.messages.getAll(),
|
|
57624
|
+
settings: project.settings(),
|
|
57625
|
+
projectId: project.id
|
|
57626
|
+
});
|
|
57627
|
+
await writeOutput(outputDirectory, output, fs3);
|
|
57628
|
+
}
|
|
57603
57629
|
async function promtStack() {
|
|
57604
57630
|
return await promptSelection("Which tech stack are you using?", {
|
|
57605
57631
|
options: [
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inlang/paraglide-js",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.7",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"vitest": "0.34.3",
|
|
64
64
|
"@inlang/env-variables": "0.2.0",
|
|
65
65
|
"@inlang/cross-sell-sherlock": "0.0.4",
|
|
66
|
-
"@inlang/sdk": "0.28.3",
|
|
67
66
|
"@inlang/language-tag": "1.5.1",
|
|
67
|
+
"@inlang/sdk": "0.28.3",
|
|
68
68
|
"@inlang/telemetry": "0.3.18",
|
|
69
69
|
"@lix-js/client": "1.2.0",
|
|
70
70
|
"@lix-js/fs": "1.0.0",
|