@inlang/paraglide-js 1.11.0 → 1.11.2
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/dist/cli/index.js +32 -59
- package/package.json +5 -5
package/dist/cli/index.js
CHANGED
|
@@ -34569,8 +34569,9 @@ const GitHubActionsWorkflow = typebox.Type.Object({
|
|
|
34569
34569
|
});
|
|
34570
34570
|
async function shouldRecommend(args) {
|
|
34571
34571
|
try {
|
|
34572
|
-
await args.fs
|
|
34573
|
-
|
|
34572
|
+
const gitConfigPath = await relativePathStringFromRoot(args.fs) + ".git/config";
|
|
34573
|
+
await args.fs.stat(gitConfigPath);
|
|
34574
|
+
const configData = await args.fs.readFile(gitConfigPath, { encoding: "utf-8" });
|
|
34574
34575
|
const match = configData.match(/url = (.+)/);
|
|
34575
34576
|
const remoteOriginUrl = match ? match[1] : void 0;
|
|
34576
34577
|
const isNinjaAdopted = await isAdopted({ fs: args.fs });
|
|
@@ -34620,10 +34621,10 @@ async function isAdopted(args) {
|
|
|
34620
34621
|
}
|
|
34621
34622
|
return false;
|
|
34622
34623
|
}
|
|
34623
|
-
return await searchWorkflowFiles(".github/workflows");
|
|
34624
|
+
return await searchWorkflowFiles(await relativePathStringFromRoot(args.fs) + ".github/workflows");
|
|
34624
34625
|
}
|
|
34625
34626
|
async function add(args) {
|
|
34626
|
-
const workflowDirPath = ".github/workflows";
|
|
34627
|
+
const workflowDirPath = await relativePathStringFromRoot(args.fs) + ".github/workflows";
|
|
34627
34628
|
const workflowFilePath = `${workflowDirPath}/ninja_i18n.yml`;
|
|
34628
34629
|
const ninjaI18nWorkflowYaml = `
|
|
34629
34630
|
name: Ninja i18n action
|
|
@@ -34664,24 +34665,34 @@ jobs:
|
|
|
34664
34665
|
}
|
|
34665
34666
|
await args.fs.writeFile(workflowFilePath, ninjaI18nWorkflowYaml);
|
|
34666
34667
|
}
|
|
34668
|
+
async function relativePathStringFromRoot(fs) {
|
|
34669
|
+
const repoRoot = await findRepoRoot({
|
|
34670
|
+
nodeishFs: fs,
|
|
34671
|
+
path: process.cwd()
|
|
34672
|
+
});
|
|
34673
|
+
const repoRootPath = (repoRoot == null ? void 0 : repoRoot.replace("file://", "")) ?? "";
|
|
34674
|
+
const currentWorkingDirectory = process.cwd();
|
|
34675
|
+
const directoriesAboveRepoRootLength = currentWorkingDirectory.replace(repoRootPath, "").split("/").length - 1;
|
|
34676
|
+
return "../".repeat(directoriesAboveRepoRootLength);
|
|
34677
|
+
}
|
|
34667
34678
|
const maybeAddNinja = async (ctx) => {
|
|
34668
|
-
|
|
34669
|
-
|
|
34670
|
-
|
|
34671
|
-
|
|
34672
|
-
|
|
34673
|
-
|
|
34674
|
-
|
|
34675
|
-
|
|
34676
|
-
|
|
34677
|
-
|
|
34678
|
-
|
|
34679
|
+
if (await shouldRecommend({ fs: ctx.repo.nodeishFs })) {
|
|
34680
|
+
const response = await prompt(
|
|
34681
|
+
"Do you want to add the 🥷 Ninja Github Action for linting translations in CI?\n\nhttps://inlang.com/m/3gk8n4n4/app-inlang-ninjaI18nAction",
|
|
34682
|
+
{
|
|
34683
|
+
type: "confirm",
|
|
34684
|
+
initial: true
|
|
34685
|
+
}
|
|
34686
|
+
);
|
|
34687
|
+
if (response !== true)
|
|
34688
|
+
return ctx;
|
|
34689
|
+
try {
|
|
34679
34690
|
await add({ fs: ctx.repo.nodeishFs });
|
|
34680
34691
|
telemetry.capture({ event: "PARAGLIDE JS init added Ninja" });
|
|
34681
34692
|
ctx.logger.success("Added the 🥷 Ninja Github Action for linting translations");
|
|
34693
|
+
} catch (error) {
|
|
34694
|
+
ctx.logger.error("Failed to add the 🥷 Ninja Github Action. Please open an issue");
|
|
34682
34695
|
}
|
|
34683
|
-
} catch (error) {
|
|
34684
|
-
ctx.logger.error("Failed to add the 🥷 Ninja Github Action. Please open an issue");
|
|
34685
34696
|
}
|
|
34686
34697
|
return ctx;
|
|
34687
34698
|
};
|
|
@@ -34698,13 +34709,6 @@ const steps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
34698
34709
|
runCompiler,
|
|
34699
34710
|
updatePackageJson
|
|
34700
34711
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
34701
|
-
const ADAPTER_LINKS = {
|
|
34702
|
-
sveltekit: "https://inlang.com/m/dxnzrydw/paraglide-sveltekit-i18n",
|
|
34703
|
-
nextjs: "https://inlang.com/m/osslbuzt/paraglide-next-i18n",
|
|
34704
|
-
astro: "https://inlang.com/m/iljlwzfs/paraglide-astro-i18n",
|
|
34705
|
-
solidstart: "https://inlang.com/m/n860p17j/paraglide-solidstart-i18n",
|
|
34706
|
-
vite: "https://github.com/opral/monorepo/tree/main/inlang/source-code/paraglide/paraglide-vite"
|
|
34707
|
-
};
|
|
34708
34712
|
const initCommand = new Command().name("init").summary("Initializes inlang Paraglide-JS.").action(async () => {
|
|
34709
34713
|
const repoRoot = await findRepoRoot({
|
|
34710
34714
|
nodeishFs: nodeFsPromises,
|
|
@@ -34745,39 +34749,22 @@ const initCommand = new Command().name("init").summary("Initializes inlang Parag
|
|
|
34745
34749
|
telemetry.capture({ event: "PARAGLIDE-JS init finished" });
|
|
34746
34750
|
const absoluteSettingsPath = nodePath.resolve(ctx9.projectPath, "settings.json");
|
|
34747
34751
|
const relativeSettingsFilePath = absoluteSettingsPath.replace(process.cwd(), ".");
|
|
34748
|
-
|
|
34752
|
+
const successMessage = dedent`inlang Paraglide-JS has been set up sucessfully.
|
|
34749
34753
|
|
|
34750
34754
|
1. Run your install command (npm i, yarn install, etc)
|
|
34751
34755
|
2. Register all your languages in ${relativeSettingsFilePath}
|
|
34752
34756
|
3. Run the build script (npm run build, or similar.)
|
|
34753
34757
|
4. Done :) Happy paragliding 🪂
|
|
34754
34758
|
|
|
34755
|
-
`;
|
|
34756
|
-
const stackChoice = await promtStack();
|
|
34757
|
-
if (Object.keys(ADAPTER_LINKS).includes(stackChoice)) {
|
|
34758
|
-
successMessage += "\n\n";
|
|
34759
|
-
successMessage += dedent`
|
|
34760
|
-
HINT:
|
|
34761
|
-
If you are using ${stackChoice} with paraglide, you will likely also want to use
|
|
34762
|
-
|
|
34763
|
-
\`@inlang/paraglide-${stackChoice}\`
|
|
34764
|
-
|
|
34765
|
-
Read the documentation at:
|
|
34766
|
-
${ADAPTER_LINKS[stackChoice]}
|
|
34767
|
-
`;
|
|
34768
|
-
}
|
|
34769
|
-
successMessage += "\n\n";
|
|
34770
|
-
successMessage += dedent`
|
|
34771
34759
|
For questions and feedback, visit
|
|
34772
|
-
https://github.com/opral/monorepo/discussions
|
|
34773
|
-
`;
|
|
34760
|
+
https://github.com/opral/monorepo/discussions`;
|
|
34774
34761
|
ctx.logger.box(successMessage);
|
|
34775
34762
|
});
|
|
34776
34763
|
const addParaglideJsToDevDependencies = async (ctx) => {
|
|
34777
34764
|
const ctx1 = await updatePackageJson({
|
|
34778
34765
|
devDependencies: async (devDeps) => ({
|
|
34779
34766
|
...devDeps,
|
|
34780
|
-
"@inlang/paraglide-js": "1.11.
|
|
34767
|
+
"@inlang/paraglide-js": "1.11.2"
|
|
34781
34768
|
})
|
|
34782
34769
|
})(ctx);
|
|
34783
34770
|
ctx.logger.success("Added @inlang/paraglide-js to the devDependencies in package.json.");
|
|
@@ -34838,21 +34825,7 @@ const addCompileStepToPackageJSON = async (ctx) => {
|
|
|
34838
34825
|
process.exit(1);
|
|
34839
34826
|
return ctx;
|
|
34840
34827
|
};
|
|
34841
|
-
|
|
34842
|
-
return await promptSelection("Which tech stack are you using?", {
|
|
34843
|
-
options: [
|
|
34844
|
-
{ label: "Other", value: "other" },
|
|
34845
|
-
{ label: "Vanilla", value: "vanilla" },
|
|
34846
|
-
{ label: "NextJS", value: "nextjs" },
|
|
34847
|
-
{ label: "SvelteKit", value: "sveltekit" },
|
|
34848
|
-
{ label: "Astro", value: "astro" },
|
|
34849
|
-
{ label: "SolidStart", value: "solidstart" },
|
|
34850
|
-
{ label: "Vite", value: "vite" }
|
|
34851
|
-
],
|
|
34852
|
-
initial: "other"
|
|
34853
|
-
});
|
|
34854
|
-
}
|
|
34855
|
-
const cli = new Command().name("paraglide-js").addCommand(compileCommand).addCommand(initCommand).showHelpAfterError().version("1.11.0");
|
|
34828
|
+
const cli = new Command().name("paraglide-js").addCommand(compileCommand).addCommand(initCommand).showHelpAfterError().version("1.11.2");
|
|
34856
34829
|
export {
|
|
34857
34830
|
defaults as Defaults,
|
|
34858
34831
|
GitPackIndex as G,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inlang/paraglide-js",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.11.
|
|
4
|
+
"version": "1.11.2",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -58,17 +58,17 @@
|
|
|
58
58
|
"memfs": "4.6.0",
|
|
59
59
|
"rollup": "3.29.1",
|
|
60
60
|
"typescript": "^5.5.2",
|
|
61
|
-
"vite": "4.5.2",
|
|
61
|
+
"vite": "^4.5.2",
|
|
62
62
|
"vite-plugin-dts": "^3.8.1",
|
|
63
63
|
"vite-tsconfig-paths": "^4.3.2",
|
|
64
64
|
"vitest": "0.34.3",
|
|
65
65
|
"@inlang/recommend-sherlock": "0.1.0",
|
|
66
|
-
"@inlang/recommend-ninja": "0.1.
|
|
66
|
+
"@inlang/recommend-ninja": "0.1.1",
|
|
67
67
|
"@inlang/plugin-message-format": "2.2.0",
|
|
68
68
|
"@inlang/sdk": "0.36.3",
|
|
69
|
-
"@inlang/language-tag": "1.5.1",
|
|
70
69
|
"@lix-js/client": "2.2.1",
|
|
71
|
-
"@lix-js/fs": "2.2.0"
|
|
70
|
+
"@lix-js/fs": "2.2.0",
|
|
71
|
+
"@inlang/language-tag": "1.5.1"
|
|
72
72
|
},
|
|
73
73
|
"exports": {
|
|
74
74
|
".": {
|