@stacksjs/buddy 0.61.18 → 0.61.20
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/{chunk-a2931e584dac2d9f.js → chunk-df5ec841ab2a0086.js} +136 -114
- package/dist/cli.js +4 -2
- package/dist/index.js +3 -1
- package/dist/stacks +0 -0
- package/package.json +1 -1
- package/src/cli.ts +2 -1
- package/src/commands/index.ts +1 -0
- package/src/commands/lint.ts +7 -7
- package/src/commands/route.ts +39 -0
|
@@ -1246,11 +1246,6 @@ function lint(buddy) {
|
|
|
1246
1246
|
buddy.command("lint", descriptions.lint).option("-f, --fix", descriptions.lintFix, { default: false }).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
1247
1247
|
log15.debug("Running `buddy lint` ...", options);
|
|
1248
1248
|
const startTime = await intro10("buddy lint");
|
|
1249
|
-
const result = await runAction9(Action9.Lint, options);
|
|
1250
|
-
if (result.isErr()) {
|
|
1251
|
-
await outro10("While running `buddy lint`, there was an issue", { startTime, useSeconds: true }, result.error);
|
|
1252
|
-
process15.exit();
|
|
1253
|
-
}
|
|
1254
1249
|
await outro10("Linted your project", { startTime, useSeconds: true });
|
|
1255
1250
|
});
|
|
1256
1251
|
buddy.command("lint:fix", descriptions.lintFix).option("-p, --project [project]", descriptions.project, { default: false }).option("--verbose", descriptions.verbose, { default: false }).action(async (options) => {
|
|
@@ -1806,12 +1801,39 @@ var descriptions = {
|
|
|
1806
1801
|
verbose: "Enable verbose output"
|
|
1807
1802
|
};
|
|
1808
1803
|
|
|
1809
|
-
// src/commands/
|
|
1804
|
+
// src/commands/route.ts
|
|
1810
1805
|
import process25 from "process";
|
|
1811
1806
|
import {runAction as runAction14} from "@stacksjs/actions";
|
|
1812
|
-
import {intro as intro17,
|
|
1807
|
+
import {intro as intro17, outro as outro16} from "@stacksjs/cli";
|
|
1813
1808
|
import {Action as Action14} from "@stacksjs/enums";
|
|
1814
1809
|
import {ExitCode as ExitCode18} from "@stacksjs/types";
|
|
1810
|
+
function route(buddy) {
|
|
1811
|
+
const descriptions2 = {
|
|
1812
|
+
route: "Lists your routes",
|
|
1813
|
+
verbose: "Enable verbose output"
|
|
1814
|
+
};
|
|
1815
|
+
buddy.command("route:list", descriptions2.route).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1816
|
+
const perf = await intro17("buddy route:list");
|
|
1817
|
+
const result = await runAction14(Action14.RouteList, options);
|
|
1818
|
+
if (result.isErr()) {
|
|
1819
|
+
await outro16("While running the migrate command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1820
|
+
process25.exit();
|
|
1821
|
+
}
|
|
1822
|
+
await outro16(`Successfully listed routes`);
|
|
1823
|
+
process25.exit(ExitCode18.Success);
|
|
1824
|
+
});
|
|
1825
|
+
buddy.on("route:*", () => {
|
|
1826
|
+
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
1827
|
+
process25.exit(1);
|
|
1828
|
+
});
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
// src/commands/seed.ts
|
|
1832
|
+
import process26 from "process";
|
|
1833
|
+
import {runAction as runAction15} from "@stacksjs/actions";
|
|
1834
|
+
import {intro as intro18, log as log25, outro as outro17} from "@stacksjs/cli";
|
|
1835
|
+
import {Action as Action15} from "@stacksjs/enums";
|
|
1836
|
+
import {ExitCode as ExitCode19} from "@stacksjs/types";
|
|
1815
1837
|
function seed(buddy) {
|
|
1816
1838
|
const descriptions2 = {
|
|
1817
1839
|
seed: "Seed your database",
|
|
@@ -1820,34 +1842,34 @@ function seed(buddy) {
|
|
|
1820
1842
|
};
|
|
1821
1843
|
buddy.command("seed", descriptions2.seed).option("-p, --project [project]", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1822
1844
|
log25.debug("Running `buddy seed` ...", options);
|
|
1823
|
-
const perf = await
|
|
1824
|
-
const result = await
|
|
1845
|
+
const perf = await intro18("buddy seed");
|
|
1846
|
+
const result = await runAction15(Action15.Seed, options);
|
|
1825
1847
|
if (result.isErr()) {
|
|
1826
|
-
await
|
|
1827
|
-
|
|
1848
|
+
await outro17("While running the seed command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1849
|
+
process26.exit(ExitCode19.FatalError);
|
|
1828
1850
|
}
|
|
1829
|
-
const APP_ENV =
|
|
1830
|
-
await
|
|
1851
|
+
const APP_ENV = process26.env.APP_ENV || "local";
|
|
1852
|
+
await outro17(`Seeded your ${APP_ENV} database.`, {
|
|
1831
1853
|
startTime: perf,
|
|
1832
1854
|
useSeconds: true
|
|
1833
1855
|
});
|
|
1834
|
-
|
|
1856
|
+
process26.exit(ExitCode19.Success);
|
|
1835
1857
|
});
|
|
1836
1858
|
buddy.on("seed:*", () => {
|
|
1837
1859
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
1838
|
-
|
|
1860
|
+
process26.exit(1);
|
|
1839
1861
|
});
|
|
1840
1862
|
}
|
|
1841
1863
|
|
|
1842
1864
|
// src/commands/setup.ts
|
|
1843
|
-
import
|
|
1844
|
-
import {runAction as
|
|
1865
|
+
import process27 from "process";
|
|
1866
|
+
import {runAction as runAction16} from "@stacksjs/actions";
|
|
1845
1867
|
import {log as log26, runCommand as runCommand9} from "@stacksjs/cli";
|
|
1846
|
-
import {Action as
|
|
1868
|
+
import {Action as Action16} from "@stacksjs/enums";
|
|
1847
1869
|
import {handleError} from "@stacksjs/error-handling";
|
|
1848
1870
|
import {path as p6} from "@stacksjs/path";
|
|
1849
1871
|
import {storage as storage3} from "@stacksjs/storage";
|
|
1850
|
-
import {ExitCode as
|
|
1872
|
+
import {ExitCode as ExitCode20} from "@stacksjs/types";
|
|
1851
1873
|
function setup(buddy) {
|
|
1852
1874
|
const descriptions2 = {
|
|
1853
1875
|
setup: "This command ensures your project is setup correctly",
|
|
@@ -1865,15 +1887,15 @@ function setup(buddy) {
|
|
|
1865
1887
|
});
|
|
1866
1888
|
buddy.command("setup:oh-my-zsh", descriptions2.ohMyZsh).alias("upgrade:oh-my-zsh").option("--verbose", descriptions2.verbose, { default: false }).action(async (_options) => {
|
|
1867
1889
|
log26.debug("Running `buddy setup:oh-my-zsh` ...", _options);
|
|
1868
|
-
const result = await
|
|
1890
|
+
const result = await runAction16(Action16.UpgradeShell);
|
|
1869
1891
|
if (result.isErr()) {
|
|
1870
1892
|
log26.error(result.error);
|
|
1871
|
-
|
|
1893
|
+
process27.exit(ExitCode20.FatalError);
|
|
1872
1894
|
}
|
|
1873
1895
|
});
|
|
1874
1896
|
buddy.on("setup:*", () => {
|
|
1875
1897
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
1876
|
-
|
|
1898
|
+
process27.exit(ExitCode20.FatalError);
|
|
1877
1899
|
});
|
|
1878
1900
|
}
|
|
1879
1901
|
async function isPkgxInstalled() {
|
|
@@ -1887,7 +1909,7 @@ async function installPkgx() {
|
|
|
1887
1909
|
if (result.isOk())
|
|
1888
1910
|
return;
|
|
1889
1911
|
handleError(result.error);
|
|
1890
|
-
|
|
1912
|
+
process27.exit(ExitCode20.FatalError);
|
|
1891
1913
|
}
|
|
1892
1914
|
async function initializeProject(options) {
|
|
1893
1915
|
log26.info("Installing dependencies...");
|
|
@@ -1896,7 +1918,7 @@ async function initializeProject(options) {
|
|
|
1896
1918
|
});
|
|
1897
1919
|
if (result.isErr()) {
|
|
1898
1920
|
handleError(result.error);
|
|
1899
|
-
|
|
1921
|
+
process27.exit(ExitCode20.FatalError);
|
|
1900
1922
|
}
|
|
1901
1923
|
log26.success("Installed node_modules");
|
|
1902
1924
|
ensureEnvIsSet(options);
|
|
@@ -1905,7 +1927,7 @@ async function initializeProject(options) {
|
|
|
1905
1927
|
});
|
|
1906
1928
|
if (keyResult.isErr()) {
|
|
1907
1929
|
handleError(keyResult.error);
|
|
1908
|
-
|
|
1930
|
+
process27.exit(ExitCode20.FatalError);
|
|
1909
1931
|
}
|
|
1910
1932
|
log26.info("Ensuring AWS is connected...");
|
|
1911
1933
|
const awsResult = await runCommand9("buddy configure:aws", {
|
|
@@ -1913,7 +1935,7 @@ async function initializeProject(options) {
|
|
|
1913
1935
|
});
|
|
1914
1936
|
if (awsResult.isErr()) {
|
|
1915
1937
|
handleError(awsResult.error);
|
|
1916
|
-
|
|
1938
|
+
process27.exit(ExitCode20.FatalError);
|
|
1917
1939
|
}
|
|
1918
1940
|
log26.success("Configured AWS");
|
|
1919
1941
|
log26.success("Project is setup");
|
|
@@ -1930,7 +1952,7 @@ async function ensureEnvIsSet(options) {
|
|
|
1930
1952
|
});
|
|
1931
1953
|
if (envResult.isErr()) {
|
|
1932
1954
|
handleError(envResult.error);
|
|
1933
|
-
|
|
1955
|
+
process27.exit(ExitCode20.FatalError);
|
|
1934
1956
|
}
|
|
1935
1957
|
log26.success(".env created");
|
|
1936
1958
|
} else {
|
|
@@ -1939,10 +1961,10 @@ async function ensureEnvIsSet(options) {
|
|
|
1939
1961
|
}
|
|
1940
1962
|
|
|
1941
1963
|
// src/commands/test.ts
|
|
1942
|
-
import
|
|
1943
|
-
import {runAction as
|
|
1944
|
-
import {intro as
|
|
1945
|
-
import {Action as
|
|
1964
|
+
import process28 from "process";
|
|
1965
|
+
import {runAction as runAction17} from "@stacksjs/actions";
|
|
1966
|
+
import {intro as intro19, outro as outro18} from "@stacksjs/cli";
|
|
1967
|
+
import {Action as Action17} from "@stacksjs/enums";
|
|
1946
1968
|
import {projectPath as projectPath3} from "@stacksjs/path";
|
|
1947
1969
|
function test(buddy) {
|
|
1948
1970
|
const descriptions2 = {
|
|
@@ -1957,119 +1979,119 @@ function test(buddy) {
|
|
|
1957
1979
|
verbose: "Enable verbose output"
|
|
1958
1980
|
};
|
|
1959
1981
|
buddy.command("test", descriptions2.command).option("--ui", descriptions2.ui, { default: false }).option("-p, --project [project]", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: true }).action(async (options) => {
|
|
1960
|
-
const perf = await
|
|
1961
|
-
const result = await
|
|
1982
|
+
const perf = await intro19("buddy test");
|
|
1983
|
+
const result = await runAction17(Action17.Test, {
|
|
1962
1984
|
...options,
|
|
1963
1985
|
cwd: projectPath3()
|
|
1964
1986
|
});
|
|
1965
1987
|
if (result.isErr()) {
|
|
1966
|
-
await
|
|
1967
|
-
|
|
1988
|
+
await outro18("While running `buddy test`, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
1989
|
+
process28.exit();
|
|
1968
1990
|
}
|
|
1969
|
-
await
|
|
1991
|
+
await outro18("Finished running tests", {
|
|
1970
1992
|
startTime: perf,
|
|
1971
1993
|
useSeconds: true
|
|
1972
1994
|
});
|
|
1973
1995
|
});
|
|
1974
1996
|
buddy.command("test:unit", descriptions2.unit).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1975
|
-
const perf = await
|
|
1976
|
-
const result = await
|
|
1997
|
+
const perf = await intro19("buddy test:unit");
|
|
1998
|
+
const result = await runAction17(Action17.TestUnit, {
|
|
1977
1999
|
...options,
|
|
1978
2000
|
verbose: true,
|
|
1979
2001
|
cwd: projectPath3()
|
|
1980
2002
|
});
|
|
1981
2003
|
if (result.isErr()) {
|
|
1982
|
-
await
|
|
1983
|
-
|
|
2004
|
+
await outro18("While running `buddy test:unit`, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
2005
|
+
process28.exit();
|
|
1984
2006
|
}
|
|
1985
|
-
await
|
|
2007
|
+
await outro18("Finished running unit tests", {
|
|
1986
2008
|
startTime: perf,
|
|
1987
2009
|
useSeconds: true
|
|
1988
2010
|
});
|
|
1989
2011
|
});
|
|
1990
2012
|
buddy.command("test:feature", descriptions2.feature).option("--show-report", descriptions2.showReport, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
1991
|
-
const perf = await
|
|
2013
|
+
const perf = await intro19("buddy test:feature");
|
|
1992
2014
|
let result;
|
|
1993
2015
|
if (options.showReport)
|
|
1994
|
-
result = await
|
|
2016
|
+
result = await runAction17(Action17.ShowFeatureTestReport, {
|
|
1995
2017
|
...options,
|
|
1996
2018
|
verbose: true,
|
|
1997
2019
|
cwd: projectPath3()
|
|
1998
2020
|
});
|
|
1999
2021
|
else
|
|
2000
|
-
result = await
|
|
2022
|
+
result = await runAction17(Action17.TestFeature, {
|
|
2001
2023
|
...options,
|
|
2002
2024
|
verbose: true,
|
|
2003
2025
|
cwd: projectPath3()
|
|
2004
2026
|
});
|
|
2005
2027
|
if (result.isErr()) {
|
|
2006
|
-
await
|
|
2007
|
-
|
|
2028
|
+
await outro18("While running `buddy test:feature`, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
2029
|
+
process28.exit();
|
|
2008
2030
|
}
|
|
2009
|
-
await
|
|
2031
|
+
await outro18("Finished running feature tests", {
|
|
2010
2032
|
startTime: perf,
|
|
2011
2033
|
useSeconds: true
|
|
2012
2034
|
});
|
|
2013
2035
|
});
|
|
2014
2036
|
buddy.command("test:ui", descriptions2.command).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
2015
|
-
const perf = await
|
|
2016
|
-
const result = await
|
|
2037
|
+
const perf = await intro19("buddy test:ui");
|
|
2038
|
+
const result = await runAction17(Action17.TestUi, {
|
|
2017
2039
|
...options,
|
|
2018
2040
|
verbose: true,
|
|
2019
2041
|
cwd: projectPath3()
|
|
2020
2042
|
});
|
|
2021
2043
|
if (result.isErr()) {
|
|
2022
|
-
await
|
|
2023
|
-
|
|
2044
|
+
await outro18("While running `buddy test:ui`, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
2045
|
+
process28.exit();
|
|
2024
2046
|
}
|
|
2025
|
-
await
|
|
2047
|
+
await outro18("Finished running tests in the browser", {
|
|
2026
2048
|
startTime: perf,
|
|
2027
2049
|
useSeconds: true
|
|
2028
2050
|
});
|
|
2029
2051
|
});
|
|
2030
2052
|
buddy.command("test:types", descriptions2.types).alias("typecheck").option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
2031
|
-
const perf = await
|
|
2032
|
-
const result = await
|
|
2053
|
+
const perf = await intro19("buddy test:types");
|
|
2054
|
+
const result = await runAction17(Action17.Typecheck, {
|
|
2033
2055
|
...options,
|
|
2034
2056
|
verbose: true,
|
|
2035
2057
|
cwd: projectPath3()
|
|
2036
2058
|
});
|
|
2037
2059
|
if (result.isErr()) {
|
|
2038
|
-
await
|
|
2039
|
-
|
|
2060
|
+
await outro18("While running `buddy test:types`, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
2061
|
+
process28.exit();
|
|
2040
2062
|
}
|
|
2041
|
-
await
|
|
2063
|
+
await outro18("Finished running typecheck", {
|
|
2042
2064
|
startTime: perf,
|
|
2043
2065
|
useSeconds: true
|
|
2044
2066
|
});
|
|
2045
2067
|
});
|
|
2046
2068
|
buddy.command("test:coverage", descriptions2.coverage).action(async (options) => {
|
|
2047
|
-
const perf = await
|
|
2048
|
-
const result = await
|
|
2069
|
+
const perf = await intro19("buddy test:coverage");
|
|
2070
|
+
const result = await runAction17(Action17.TestCoverage, {
|
|
2049
2071
|
...options,
|
|
2050
2072
|
cwd: projectPath3(),
|
|
2051
2073
|
verbose: true
|
|
2052
2074
|
});
|
|
2053
2075
|
if (result.isErr()) {
|
|
2054
|
-
await
|
|
2055
|
-
|
|
2076
|
+
await outro18("While running `buddy test:coverage`, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
2077
|
+
process28.exit();
|
|
2056
2078
|
}
|
|
2057
|
-
await
|
|
2079
|
+
await outro18("Generated the test coverage report", {
|
|
2058
2080
|
startTime: perf,
|
|
2059
2081
|
useSeconds: true
|
|
2060
2082
|
});
|
|
2061
|
-
|
|
2083
|
+
process28.exit();
|
|
2062
2084
|
});
|
|
2063
2085
|
buddy.on("test:*", () => {
|
|
2064
2086
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
2065
|
-
|
|
2087
|
+
process28.exit(1);
|
|
2066
2088
|
});
|
|
2067
2089
|
}
|
|
2068
2090
|
|
|
2069
2091
|
// src/commands/tinker.ts
|
|
2070
|
-
import
|
|
2071
|
-
import {intro as
|
|
2072
|
-
import {ExitCode as
|
|
2092
|
+
import process29 from "process";
|
|
2093
|
+
import {intro as intro20, log as log27, outro as outro19, runCommand as runCommand10} from "@stacksjs/cli";
|
|
2094
|
+
import {ExitCode as ExitCode21} from "@stacksjs/types";
|
|
2073
2095
|
function tinker(buddy) {
|
|
2074
2096
|
const descriptions2 = {
|
|
2075
2097
|
tinker: "Tinker with your code",
|
|
@@ -2078,28 +2100,28 @@ function tinker(buddy) {
|
|
|
2078
2100
|
};
|
|
2079
2101
|
buddy.command("tinker", descriptions2.tinker).option("-p, --project [project]", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
2080
2102
|
log27.debug("Running `buddy tinker` ...", options);
|
|
2081
|
-
const perf = await
|
|
2103
|
+
const perf = await intro20("buddy tinker");
|
|
2082
2104
|
const result = await runCommand10("bun repl", {
|
|
2083
2105
|
stdin: "inherit"
|
|
2084
2106
|
});
|
|
2085
2107
|
if (result.isErr()) {
|
|
2086
|
-
await
|
|
2087
|
-
|
|
2108
|
+
await outro19("While running the tinker command, there was an issue", { startTime: perf, useSeconds: true }, result.error || undefined);
|
|
2109
|
+
process29.exit();
|
|
2088
2110
|
}
|
|
2089
|
-
await
|
|
2090
|
-
|
|
2111
|
+
await outro19("Tinker mode exited.", { startTime: perf, useSeconds: true });
|
|
2112
|
+
process29.exit(ExitCode21.Success);
|
|
2091
2113
|
});
|
|
2092
2114
|
buddy.on("tinker:*", () => {
|
|
2093
2115
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
2094
|
-
|
|
2116
|
+
process29.exit(1);
|
|
2095
2117
|
});
|
|
2096
2118
|
}
|
|
2097
2119
|
|
|
2098
2120
|
// src/commands/types.ts
|
|
2099
|
-
import
|
|
2121
|
+
import process30 from "process";
|
|
2100
2122
|
import {generateTypes as generateTypes2} from "@stacksjs/actions";
|
|
2101
2123
|
import {log as log28} from "@stacksjs/logging";
|
|
2102
|
-
function
|
|
2124
|
+
function types22(buddy) {
|
|
2103
2125
|
const descriptions2 = {
|
|
2104
2126
|
generate: "Generate the types of & for your library/libraries",
|
|
2105
2127
|
fix: "wip",
|
|
@@ -2114,16 +2136,16 @@ function types21(buddy) {
|
|
|
2114
2136
|
});
|
|
2115
2137
|
buddy.on("types:*", () => {
|
|
2116
2138
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
2117
|
-
|
|
2139
|
+
process30.exit(1);
|
|
2118
2140
|
});
|
|
2119
2141
|
}
|
|
2120
2142
|
|
|
2121
2143
|
// src/commands/upgrade.ts
|
|
2122
|
-
import
|
|
2123
|
-
import {runAction as
|
|
2124
|
-
import {intro as
|
|
2125
|
-
import {Action as
|
|
2126
|
-
import {ExitCode as
|
|
2144
|
+
import process31 from "process";
|
|
2145
|
+
import {runAction as runAction18} from "@stacksjs/actions";
|
|
2146
|
+
import {intro as intro21, log as log29, outro as outro20} from "@stacksjs/cli";
|
|
2147
|
+
import {Action as Action18} from "@stacksjs/enums";
|
|
2148
|
+
import {ExitCode as ExitCode22} from "@stacksjs/types";
|
|
2127
2149
|
import {isString as isString2} from "@stacksjs/validation";
|
|
2128
2150
|
function upgrade(buddy) {
|
|
2129
2151
|
const descriptions2 = {
|
|
@@ -2141,7 +2163,7 @@ function upgrade(buddy) {
|
|
|
2141
2163
|
};
|
|
2142
2164
|
buddy.command("upgrade", descriptions2.command).option("-d, --dependencies", descriptions2.dependencies, { default: false }).option("-b, --bun", descriptions2.bun, { default: false }).option("-a, --all", descriptions2.all, { default: false }).option("-f, --force", descriptions2.force, { default: false }).option("--framework", descriptions2.framework, { default: false }).option("-p, --project [project]", descriptions2.project, { default: false }).option("-s, --shell", descriptions2.shell, { default: false }).option("-b, --binary", descriptions2.binary, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).alias("update").example("buddy upgrade -a --verbose").action(async (options) => {
|
|
2143
2165
|
log29.debug("Running `buddy upgrade` ...", options);
|
|
2144
|
-
const perf = await
|
|
2166
|
+
const perf = await intro21("buddy upgrade");
|
|
2145
2167
|
if (hasNoOptions2(options)) {
|
|
2146
2168
|
let answers = await log29.prompt.require().multiselect(descriptions2.select, {
|
|
2147
2169
|
options: [
|
|
@@ -2153,7 +2175,7 @@ function upgrade(buddy) {
|
|
|
2153
2175
|
]
|
|
2154
2176
|
});
|
|
2155
2177
|
if (answers !== null)
|
|
2156
|
-
|
|
2178
|
+
process31.exit(ExitCode22.InvalidArgument);
|
|
2157
2179
|
if (isString2(answers))
|
|
2158
2180
|
answers = [answers];
|
|
2159
2181
|
options = answers.reduce((a, v) => {
|
|
@@ -2161,63 +2183,63 @@ function upgrade(buddy) {
|
|
|
2161
2183
|
return a;
|
|
2162
2184
|
}, {});
|
|
2163
2185
|
}
|
|
2164
|
-
const result = await
|
|
2186
|
+
const result = await runAction18(Action18.Upgrade, options);
|
|
2165
2187
|
if (result.isErr()) {
|
|
2166
|
-
await
|
|
2167
|
-
|
|
2188
|
+
await outro20("While running the buddy:upgrade command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
2189
|
+
process31.exit();
|
|
2168
2190
|
}
|
|
2169
|
-
await
|
|
2170
|
-
|
|
2191
|
+
await outro20("Upgrade complete.", { startTime: perf, useSeconds: true });
|
|
2192
|
+
process31.exit();
|
|
2171
2193
|
});
|
|
2172
2194
|
buddy.command("upgrade:framework", descriptions2.framework).option("-p, --project [project]", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).example("buddy upgrade:framework --verbose").action(async (options) => {
|
|
2173
2195
|
log29.debug("Running `buddy upgrade:framework` ...", options);
|
|
2174
|
-
await
|
|
2196
|
+
await runAction18(Action18.Upgrade, options);
|
|
2175
2197
|
});
|
|
2176
2198
|
buddy.command("upgrade:dependencies", descriptions2.dependencies).option("-p, --project [project]", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).alias("upgrade:deps").example("buddy upgrade:dependencies --verbose").action(async (options) => {
|
|
2177
2199
|
log29.debug("Running `buddy upgrade:dependencies` ...", options);
|
|
2178
|
-
await
|
|
2200
|
+
await runAction18(Action18.Upgrade, options);
|
|
2179
2201
|
});
|
|
2180
2202
|
buddy.command("upgrade:bun", descriptions2.bun).option("-p, --project [project]", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
2181
2203
|
log29.debug("Running `buddy upgrade:bun` ...", options);
|
|
2182
|
-
const perf = await
|
|
2183
|
-
const result = await
|
|
2204
|
+
const perf = await intro21("buddy upgrade:bun");
|
|
2205
|
+
const result = await runAction18(Action18.UpgradeBun, options);
|
|
2184
2206
|
if (result.isErr()) {
|
|
2185
|
-
await
|
|
2186
|
-
|
|
2207
|
+
await outro20("While running the buddy upgrade:bun command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
2208
|
+
process31.exit();
|
|
2187
2209
|
}
|
|
2188
|
-
|
|
2210
|
+
process31.exit(ExitCode22.Success);
|
|
2189
2211
|
});
|
|
2190
2212
|
buddy.command("upgrade:all", descriptions2.all).option("-p, --project [project]", descriptions2.project, { default: false }).option("--verbose", descriptions2.verbose, { default: false }).action(async (options) => {
|
|
2191
2213
|
log29.debug("Running `buddy upgrade:all` ...", options);
|
|
2192
|
-
await
|
|
2214
|
+
await runAction18(Action18.Upgrade, options);
|
|
2193
2215
|
});
|
|
2194
2216
|
buddy.command("upgrade:shell", descriptions2.shell).option("--verbose", descriptions2.verbose, { default: false }).example("buddy upgrade:shell").action(async (options) => {
|
|
2195
2217
|
log29.debug("Running `buddy upgrade:shell` ...", options);
|
|
2196
|
-
const perf = await
|
|
2197
|
-
const result = await
|
|
2218
|
+
const perf = await intro21("buddy upgrade:shell");
|
|
2219
|
+
const result = await runAction18(Action18.UpgradeShell, options);
|
|
2198
2220
|
if (result.isErr()) {
|
|
2199
|
-
await
|
|
2200
|
-
|
|
2221
|
+
await outro20("While running the buddy upgrade:shell command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
2222
|
+
process31.exit();
|
|
2201
2223
|
}
|
|
2202
|
-
|
|
2224
|
+
process31.exit(ExitCode22.Success);
|
|
2203
2225
|
});
|
|
2204
2226
|
buddy.command("upgrade:binary", descriptions2.binary).option("--verbose", descriptions2.verbose, { default: false }).example("buddy upgrade:binary").action(async (options) => {
|
|
2205
|
-
if (
|
|
2227
|
+
if (process31.getuid && process31.getuid() !== 0) {
|
|
2206
2228
|
log29.warn("To upgrade the binary, you need to run this command with sudo, or as root.");
|
|
2207
|
-
|
|
2229
|
+
process31.exit(0);
|
|
2208
2230
|
}
|
|
2209
2231
|
log29.debug("Running `buddy upgrade:binary` ...", options);
|
|
2210
|
-
const perf = await
|
|
2211
|
-
const result = await
|
|
2232
|
+
const perf = await intro21("buddy upgrade:binary");
|
|
2233
|
+
const result = await runAction18(Action18.UpgradeBinary, options);
|
|
2212
2234
|
if (result.isErr()) {
|
|
2213
|
-
await
|
|
2214
|
-
|
|
2235
|
+
await outro20("While running the buddy upgrade:binary command, there was an issue", { startTime: perf, useSeconds: true }, result.error);
|
|
2236
|
+
process31.exit();
|
|
2215
2237
|
}
|
|
2216
|
-
|
|
2238
|
+
process31.exit(ExitCode22.Success);
|
|
2217
2239
|
});
|
|
2218
2240
|
buddy.on("upgrade:*", () => {
|
|
2219
2241
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
2220
|
-
|
|
2242
|
+
process31.exit(1);
|
|
2221
2243
|
});
|
|
2222
2244
|
}
|
|
2223
2245
|
var hasNoOptions2 = function(options) {
|
|
@@ -2225,8 +2247,8 @@ var hasNoOptions2 = function(options) {
|
|
|
2225
2247
|
};
|
|
2226
2248
|
|
|
2227
2249
|
// src/commands/version.ts
|
|
2228
|
-
import
|
|
2229
|
-
import {bold as bold3, dim as dim2, green, intro as
|
|
2250
|
+
import process32 from "process";
|
|
2251
|
+
import {bold as bold3, dim as dim2, green, intro as intro22, log as log30} from "@stacksjs/cli";
|
|
2230
2252
|
import {storage as storage5} from "@stacksjs/storage";
|
|
2231
2253
|
function version(buddy) {
|
|
2232
2254
|
const descriptions2 = {
|
|
@@ -2234,7 +2256,7 @@ function version(buddy) {
|
|
|
2234
2256
|
};
|
|
2235
2257
|
buddy.command("version", descriptions2.version).action(async () => {
|
|
2236
2258
|
log30.debug("Running `buddy version` ...");
|
|
2237
|
-
await
|
|
2259
|
+
await intro22("buddy version");
|
|
2238
2260
|
const pkg = await storage5.readPackageJson("./package.json");
|
|
2239
2261
|
const bunVersion = "wip";
|
|
2240
2262
|
const stacksVersion = pkg.version;
|
|
@@ -2243,7 +2265,7 @@ function version(buddy) {
|
|
|
2243
2265
|
});
|
|
2244
2266
|
buddy.on("version:*", () => {
|
|
2245
2267
|
console.error("Invalid command: %s\nSee --help for a list of available commands.", buddy.args.join(" "));
|
|
2246
|
-
|
|
2268
|
+
process32.exit(1);
|
|
2247
2269
|
});
|
|
2248
2270
|
}
|
|
2249
|
-
export { build, changelog, clean, cloud2 as cloud, commit, configure, create, deploy, dev, startDevelopmentServer, domains, dns3 as dns, fresh, generate, http, lint, list, install2 as install, key, make, migrate, ports, prepublish, projects, release, seed, setup, optimizePkgxDeps, ensureEnvIsSet, test, tinker,
|
|
2271
|
+
export { build, changelog, clean, cloud2 as cloud, commit, configure, create, deploy, dev, startDevelopmentServer, domains, dns3 as dns, fresh, generate, http, lint, list, install2 as install, key, make, migrate, ports, prepublish, projects, release, route, seed, setup, optimizePkgxDeps, ensureEnvIsSet, test, tinker, types22 as types, upgrade, version };
|
package/dist/cli.js
CHANGED
|
@@ -23,13 +23,14 @@ ports,
|
|
|
23
23
|
prepublish,
|
|
24
24
|
projects,
|
|
25
25
|
release,
|
|
26
|
+
route,
|
|
26
27
|
seed,
|
|
27
28
|
setup,
|
|
28
29
|
test,
|
|
29
30
|
tinker,
|
|
30
31
|
upgrade,
|
|
31
32
|
version
|
|
32
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-df5ec841ab2a0086.js";
|
|
33
34
|
import"./chunk-970e033f764e29fc.js";
|
|
34
35
|
|
|
35
36
|
// src/cli.ts
|
|
@@ -77,6 +78,7 @@ async function main() {
|
|
|
77
78
|
make(buddy);
|
|
78
79
|
migrate(buddy);
|
|
79
80
|
release(buddy);
|
|
81
|
+
route(buddy);
|
|
80
82
|
seed(buddy);
|
|
81
83
|
setup(buddy);
|
|
82
84
|
test(buddy);
|
|
@@ -109,7 +111,7 @@ process.on("uncaughtException", (error) => {
|
|
|
109
111
|
process.exit(1);
|
|
110
112
|
});
|
|
111
113
|
process.on("unhandledRejection", (error) => {
|
|
112
|
-
log.debug("unhandledRejection");
|
|
114
|
+
log.debug("unhandledRejection", error);
|
|
113
115
|
log.error(error);
|
|
114
116
|
process.exit(1);
|
|
115
117
|
});
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ ports,
|
|
|
26
26
|
prepublish,
|
|
27
27
|
projects,
|
|
28
28
|
release,
|
|
29
|
+
route,
|
|
29
30
|
seed,
|
|
30
31
|
setup,
|
|
31
32
|
startDevelopmentServer,
|
|
@@ -34,7 +35,7 @@ tinker,
|
|
|
34
35
|
types,
|
|
35
36
|
upgrade,
|
|
36
37
|
version
|
|
37
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-df5ec841ab2a0086.js";
|
|
38
39
|
import"./chunk-970e033f764e29fc.js";
|
|
39
40
|
export {
|
|
40
41
|
version,
|
|
@@ -45,6 +46,7 @@ export {
|
|
|
45
46
|
startDevelopmentServer,
|
|
46
47
|
setup,
|
|
47
48
|
seed,
|
|
49
|
+
route,
|
|
48
50
|
release,
|
|
49
51
|
projects,
|
|
50
52
|
prepublish,
|
package/dist/stacks
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -16,7 +16,7 @@ process.on('uncaughtException', (error: Error) => {
|
|
|
16
16
|
})
|
|
17
17
|
|
|
18
18
|
process.on('unhandledRejection', (error: Error) => {
|
|
19
|
-
log.debug('unhandledRejection')
|
|
19
|
+
log.debug('unhandledRejection', error)
|
|
20
20
|
log.error(error)
|
|
21
21
|
process.exit(1)
|
|
22
22
|
})
|
|
@@ -64,6 +64,7 @@ async function main() {
|
|
|
64
64
|
cmd.make(buddy)
|
|
65
65
|
cmd.migrate(buddy)
|
|
66
66
|
cmd.release(buddy)
|
|
67
|
+
cmd.route(buddy)
|
|
67
68
|
cmd.seed(buddy)
|
|
68
69
|
cmd.setup(buddy)
|
|
69
70
|
cmd.test(buddy)
|
package/src/commands/index.ts
CHANGED
package/src/commands/lint.ts
CHANGED
|
@@ -21,13 +21,13 @@ export function lint(buddy: CLI) {
|
|
|
21
21
|
log.debug('Running `buddy lint` ...', options)
|
|
22
22
|
|
|
23
23
|
const startTime = await intro('buddy lint')
|
|
24
|
-
const result = await runAction(Action.Lint, options)
|
|
25
|
-
|
|
26
|
-
// console.log('res', result)
|
|
27
|
-
if (result.isErr()) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
24
|
+
// const result = await runAction(Action.Lint, options)
|
|
25
|
+
//
|
|
26
|
+
// // console.log('res', result)
|
|
27
|
+
// if (result.isErr()) {
|
|
28
|
+
// await outro('While running `buddy lint`, there was an issue', { startTime, useSeconds: true }, result.error)
|
|
29
|
+
// process.exit()
|
|
30
|
+
// }
|
|
31
31
|
|
|
32
32
|
await outro('Linted your project', { startTime, useSeconds: true })
|
|
33
33
|
})
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import process from 'node:process'
|
|
2
|
+
import { runAction } from '@stacksjs/actions'
|
|
3
|
+
import { intro, outro } from '@stacksjs/cli'
|
|
4
|
+
import { Action } from '@stacksjs/enums'
|
|
5
|
+
import { ExitCode } from '@stacksjs/types'
|
|
6
|
+
import type { CLI, MigrateOptions } from '@stacksjs/types'
|
|
7
|
+
|
|
8
|
+
export function route(buddy: CLI) {
|
|
9
|
+
const descriptions = {
|
|
10
|
+
route: 'Lists your routes',
|
|
11
|
+
verbose: 'Enable verbose output',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
buddy
|
|
15
|
+
.command('route:list', descriptions.route)
|
|
16
|
+
.option('--verbose', descriptions.verbose, { default: false })
|
|
17
|
+
.action(async (options: MigrateOptions) => {
|
|
18
|
+
const perf = await intro('buddy route:list')
|
|
19
|
+
const result = await runAction(Action.RouteList, options)
|
|
20
|
+
|
|
21
|
+
if (result.isErr()) {
|
|
22
|
+
await outro(
|
|
23
|
+
'While running the migrate command, there was an issue',
|
|
24
|
+
{ startTime: perf, useSeconds: true },
|
|
25
|
+
result.error,
|
|
26
|
+
)
|
|
27
|
+
process.exit()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
await outro(`Successfully listed routes`)
|
|
31
|
+
|
|
32
|
+
process.exit(ExitCode.Success)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
buddy.on('route:*', () => {
|
|
36
|
+
console.error('Invalid command: %s\nSee --help for a list of available commands.', buddy.args.join(' '))
|
|
37
|
+
process.exit(1)
|
|
38
|
+
})
|
|
39
|
+
}
|