@vocoder/cli 0.12.1 → 0.12.3
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/bin.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
readAuthData,
|
|
14
14
|
verifyStoredAuth,
|
|
15
15
|
writeAuthData
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-2Q3JPWWV.mjs";
|
|
17
17
|
|
|
18
18
|
// src/bin.ts
|
|
19
19
|
import { Command } from "commander";
|
|
@@ -41,29 +41,19 @@ function writeVocoderConfig(options) {
|
|
|
41
41
|
const {
|
|
42
42
|
targetBranches = ["main"],
|
|
43
43
|
useTypeScript = true,
|
|
44
|
-
cwd = process.cwd()
|
|
45
|
-
appDir
|
|
44
|
+
cwd = process.cwd()
|
|
46
45
|
} = options;
|
|
47
46
|
if (findExistingConfig(cwd)) return null;
|
|
48
47
|
const ext = useTypeScript ? "ts" : "js";
|
|
49
48
|
const configPath = join(cwd, `vocoder.config.${ext}`);
|
|
50
49
|
const branchesStr = targetBranches.map((b) => `'${b}'`).join(", ");
|
|
51
|
-
const
|
|
52
|
-
const includes = appDir ? defaultIncludes.map((p14) => `${appDir}/${p14}`) : defaultIncludes;
|
|
50
|
+
const includes = ["**/*.{tsx,jsx,ts,js}"];
|
|
53
51
|
const includesStr = includes.map((p14) => `'${p14}'`).join(", ");
|
|
54
52
|
const content = `import { defineConfig } from '@vocoder/config'
|
|
55
53
|
|
|
56
54
|
export default defineConfig({
|
|
57
55
|
targetBranches: [${branchesStr}],
|
|
58
56
|
include: [${includesStr}],
|
|
59
|
-
exclude: [
|
|
60
|
-
'**/node_modules/**',
|
|
61
|
-
'**/.next/**',
|
|
62
|
-
'**/dist/**',
|
|
63
|
-
'**/build/**',
|
|
64
|
-
'**/*.test.*',
|
|
65
|
-
'**/*.spec.*',
|
|
66
|
-
],
|
|
67
57
|
})
|
|
68
58
|
`;
|
|
69
59
|
try {
|
|
@@ -1345,7 +1335,7 @@ function runScaffold(params) {
|
|
|
1345
1335
|
printCodeBlock(step.code);
|
|
1346
1336
|
if (i < steps.length - 1) p5.log.message("");
|
|
1347
1337
|
}
|
|
1348
|
-
const written = writeVocoderConfig({ targetBranches, useTypeScript
|
|
1338
|
+
const written = writeVocoderConfig({ targetBranches, useTypeScript });
|
|
1349
1339
|
if (written) {
|
|
1350
1340
|
p5.log.success(`Created ${chalk6.cyan(written)}`);
|
|
1351
1341
|
} else if (!findExistingConfig(process.cwd())) {
|
|
@@ -1963,12 +1953,11 @@ async function init(options = {}) {
|
|
|
1963
1953
|
p5.log.warn(
|
|
1964
1954
|
`Project limit reached \u2014 ${ws.projectCount}/${ws.maxProjects} on your ${chalk6.bold(ws.planId)} plan.`
|
|
1965
1955
|
);
|
|
1966
|
-
const hasRepoContext = !!identity?.repoCanonical;
|
|
1967
1956
|
const options2 = [];
|
|
1968
|
-
if (
|
|
1957
|
+
if (repoProjectId) {
|
|
1969
1958
|
options2.push({
|
|
1970
1959
|
value: "connect",
|
|
1971
|
-
label:
|
|
1960
|
+
label: `Reconnect this repo to ${chalk6.bold(repoProjectName ?? "existing project")}`
|
|
1972
1961
|
});
|
|
1973
1962
|
}
|
|
1974
1963
|
options2.push({ value: "upgrade", label: "Upgrade plan" });
|
|
@@ -1992,41 +1981,34 @@ async function init(options = {}) {
|
|
|
1992
1981
|
userToken,
|
|
1993
1982
|
selectedWorkspaceId
|
|
1994
1983
|
);
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
message: "Which project should this repo be connected to?",
|
|
2001
|
-
options: existingProjects.map((proj) => ({
|
|
2002
|
-
value: proj.id,
|
|
2003
|
-
label: proj.name
|
|
2004
|
-
}))
|
|
2005
|
-
});
|
|
2006
|
-
if (p5.isCancel(chosenId)) {
|
|
2007
|
-
p5.cancel("Setup cancelled.");
|
|
1984
|
+
const chosenProject = existingProjects.find(
|
|
1985
|
+
(proj) => proj.id === repoProjectId
|
|
1986
|
+
);
|
|
1987
|
+
if (!chosenProject) {
|
|
1988
|
+
p5.log.error("Could not find the project. Try again.");
|
|
2008
1989
|
return 1;
|
|
2009
1990
|
}
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
1991
|
+
try {
|
|
1992
|
+
const appResult = await api.createApp(userToken, {
|
|
1993
|
+
projectId: chosenProject.id,
|
|
1994
|
+
appDir: identity?.repoAppDir ?? "",
|
|
1995
|
+
sourceLocale: chosenProject.sourceLocale,
|
|
1996
|
+
targetLocales: chosenProject.targetLocales,
|
|
1997
|
+
targetBranches: chosenProject.targetBranches,
|
|
1998
|
+
repoCanonical: identity?.repoCanonical ?? ""
|
|
1999
|
+
});
|
|
2000
|
+
p5.log.success(`Connected to project: ${chalk6.bold(chosenProject.name)}`);
|
|
2001
|
+
printApiKey(appResult.apiKey);
|
|
2002
|
+
runScaffold({
|
|
2003
|
+
sourceLocale: chosenProject.sourceLocale,
|
|
2004
|
+
targetBranches: chosenProject.targetBranches,
|
|
2005
|
+
appDir: identity?.repoAppDir
|
|
2006
|
+
});
|
|
2007
|
+
} catch (err) {
|
|
2008
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
2009
|
+
p5.log.error(`Failed to create app binding: ${msg}`);
|
|
2023
2010
|
return 1;
|
|
2024
2011
|
}
|
|
2025
|
-
runScaffold({
|
|
2026
|
-
sourceLocale: appResult.sourceLocale,
|
|
2027
|
-
targetBranches: appResult.targetBranches,
|
|
2028
|
-
appDir: identity?.repoAppDir
|
|
2029
|
-
});
|
|
2030
2012
|
p5.outro("You're all set.");
|
|
2031
2013
|
return 0;
|
|
2032
2014
|
}
|