@vocoder/cli 0.12.2 → 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
@@ -54,14 +54,6 @@ function writeVocoderConfig(options) {
54
54
  export default defineConfig({
55
55
  targetBranches: [${branchesStr}],
56
56
  include: [${includesStr}],
57
- exclude: [
58
- '**/node_modules/**',
59
- '**/.next/**',
60
- '**/dist/**',
61
- '**/build/**',
62
- '**/*.test.*',
63
- '**/*.spec.*',
64
- ],
65
57
  })
66
58
  `;
67
59
  try {
@@ -1961,12 +1953,11 @@ async function init(options = {}) {
1961
1953
  p5.log.warn(
1962
1954
  `Project limit reached \u2014 ${ws.projectCount}/${ws.maxProjects} on your ${chalk6.bold(ws.planId)} plan.`
1963
1955
  );
1964
- const hasRepoContext = !!identity?.repoCanonical;
1965
1956
  const options2 = [];
1966
- if (hasRepoContext) {
1957
+ if (repoProjectId) {
1967
1958
  options2.push({
1968
1959
  value: "connect",
1969
- label: "Connect this repo to an existing project"
1960
+ label: `Reconnect this repo to ${chalk6.bold(repoProjectName ?? "existing project")}`
1970
1961
  });
1971
1962
  }
1972
1963
  options2.push({ value: "upgrade", label: "Upgrade plan" });
@@ -1990,41 +1981,34 @@ async function init(options = {}) {
1990
1981
  userToken,
1991
1982
  selectedWorkspaceId
1992
1983
  );
1993
- if (existingProjects.length === 0) {
1994
- p5.log.error("No projects found in this workspace.");
1995
- return 1;
1996
- }
1997
- const chosenId = await p5.select({
1998
- message: "Which project should this repo be connected to?",
1999
- options: existingProjects.map((proj) => ({
2000
- value: proj.id,
2001
- label: proj.name
2002
- }))
2003
- });
2004
- if (p5.isCancel(chosenId)) {
2005
- 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.");
2006
1989
  return 1;
2007
1990
  }
2008
- const chosen = existingProjects.find((proj) => proj.id === chosenId);
2009
- const appResult = await runAppCreate({
2010
- api,
2011
- userToken,
2012
- projectId: chosen.id,
2013
- projectName: chosen.name,
2014
- organizationName: selectedWorkspaceName,
2015
- repoCanonical: identity?.repoCanonical,
2016
- defaultAppDir: identity?.repoAppDir,
2017
- existingApps: []
2018
- });
2019
- if (!appResult) {
2020
- p5.log.error("Setup failed. Run `vocoder init` again.");
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}`);
2021
2010
  return 1;
2022
2011
  }
2023
- runScaffold({
2024
- sourceLocale: appResult.sourceLocale,
2025
- targetBranches: appResult.targetBranches,
2026
- appDir: identity?.repoAppDir
2027
- });
2028
2012
  p5.outro("You're all set.");
2029
2013
  return 0;
2030
2014
  }