@cedarjs/cli 1.0.0-canary.12465 → 1.0.0-canary.12467
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 +5 -5
- package/dist/commands/deploy/serverlessHandler.js +2 -2
- package/dist/commands/experimental/util.js +4 -4
- package/dist/commands/generate/sdl/sdlHandler.js +3 -3
- package/dist/commands/setup/middleware/ogImage/__codemod_tests__/middleware.js +16 -16
- package/dist/commands/setup/middleware/ogImage/__codemod_tests__/vitePlugin.js +7 -7
- package/dist/lib/colors.js +13 -13
- package/dist/lib/exit.js +2 -2
- package/dist/lib/plugin.js +7 -7
- package/dist/lib/updateCheck.js +2 -2
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -659,7 +659,7 @@ We also use methods that we want to affect all commands here, like `demandComman
|
|
|
659
659
|
|
|
660
660
|
#### lib/colors.js
|
|
661
661
|
|
|
662
|
-
[colors.js](https://github.com/redwoodjs/redwood/blob/main/packages/cli/src/lib/colors.js) provides a declarative way of coloring output to the console using [
|
|
662
|
+
[colors.js](https://github.com/redwoodjs/redwood/blob/main/packages/cli/src/lib/colors.js) provides a declarative way of coloring output to the console using [ansis](https://github.com/webdiscus/ansis#styles). You'll see it imported like:
|
|
663
663
|
|
|
664
664
|
```javascript
|
|
665
665
|
import c from '../lib/colors'
|
|
@@ -685,10 +685,10 @@ Adding a new color is as simple as adding a new property to the default export:
|
|
|
685
685
|
// ./src/lib/colors.js
|
|
686
686
|
|
|
687
687
|
export default {
|
|
688
|
-
error:
|
|
689
|
-
warning:
|
|
690
|
-
green:
|
|
691
|
-
info:
|
|
688
|
+
error: ansis.bold.red,
|
|
689
|
+
warning: ansis.hex('#ffa500'),
|
|
690
|
+
green: ansis.green,
|
|
691
|
+
info: ansis.gray,
|
|
692
692
|
}
|
|
693
693
|
```
|
|
694
694
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
+
import ansis from "ansis";
|
|
2
3
|
import boxen from "boxen";
|
|
3
|
-
import chalk from "chalk";
|
|
4
4
|
import { config } from "dotenv-defaults";
|
|
5
5
|
import execa from "execa";
|
|
6
6
|
import fs from "fs-extra";
|
|
@@ -91,7 +91,7 @@ const handler = async (yargs) => {
|
|
|
91
91
|
try {
|
|
92
92
|
await tasks.run();
|
|
93
93
|
if (yargs.firstRun) {
|
|
94
|
-
const SETUP_MARKER =
|
|
94
|
+
const SETUP_MARKER = ansis.bgBlue.black("First Setup ");
|
|
95
95
|
console.log();
|
|
96
96
|
console.log(SETUP_MARKER, c.success("Starting first setup wizard..."));
|
|
97
97
|
const { stdout: slsInfo } = await execa(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import
|
|
2
|
+
import ansis from "ansis";
|
|
3
3
|
import fs from "fs-extra";
|
|
4
4
|
import { terminalLink } from "termi-link";
|
|
5
5
|
import { getPaths } from "../../lib/index.js";
|
|
@@ -21,9 +21,9 @@ Please find documentation and links to provide feedback for ${command} at:
|
|
|
21
21
|
)}`;
|
|
22
22
|
const printTaskEpilogue = (command, description, topicId) => {
|
|
23
23
|
console.log(
|
|
24
|
-
`${
|
|
24
|
+
`${ansis.hex("#ff845e")(
|
|
25
25
|
`------------------------------------------------------------------
|
|
26
|
-
\u{1F9EA} ${
|
|
26
|
+
\u{1F9EA} ${ansis.green(
|
|
27
27
|
"Experimental Feature"
|
|
28
28
|
)} \u{1F9EA}
|
|
29
29
|
------------------------------------------------------------------`
|
|
@@ -31,7 +31,7 @@ const printTaskEpilogue = (command, description, topicId) => {
|
|
|
31
31
|
);
|
|
32
32
|
console.log(getEpilogue(command, description, topicId, false));
|
|
33
33
|
console.log(
|
|
34
|
-
`${
|
|
34
|
+
`${ansis.hex("#ff845e")(
|
|
35
35
|
"------------------------------------------------------------------"
|
|
36
36
|
)}
|
|
37
37
|
`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
+
import ansis from "ansis";
|
|
2
3
|
import boxen from "boxen";
|
|
3
4
|
import camelcase from "camelcase";
|
|
4
|
-
import chalk from "chalk";
|
|
5
5
|
import { Listr } from "listr2";
|
|
6
6
|
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
7
7
|
import { generate as generateTypes } from "@cedarjs/internal/dist/generate/generate";
|
|
@@ -29,11 +29,11 @@ import { files as serviceFiles } from "../service/serviceHandler.js";
|
|
|
29
29
|
import { customOrDefaultTemplatePath } from "../yargsHandlerHelpers.js";
|
|
30
30
|
const DEFAULT_IGNORE_FIELDS_FOR_INPUT = ["createdAt", "updatedAt"];
|
|
31
31
|
const missingIdConsoleMessage = () => {
|
|
32
|
-
const line1 =
|
|
32
|
+
const line1 = ansis.bold.yellow("WARNING") + ": Cannot generate CRUD SDL without an `@id` database column.";
|
|
33
33
|
const line2 = "If you are trying to generate for a many-to-many join table ";
|
|
34
34
|
const line3 = "you'll need to update your schema definition to include";
|
|
35
35
|
const line4 = "an `@id` column. Read more here: ";
|
|
36
|
-
const line5 =
|
|
36
|
+
const line5 = ansis.underline.blue(
|
|
37
37
|
"https://redwoodjs.com/docs/schema-relations"
|
|
38
38
|
);
|
|
39
39
|
console.error(
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { describe, it } from "vitest";
|
|
2
|
-
describe(
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
describe.skipIf(process.env.CI && process.platform === "win32")(
|
|
3
|
+
"Middleware codemod",
|
|
4
|
+
() => {
|
|
5
|
+
it("Handles the default TSX case", async () => {
|
|
6
|
+
await matchTransformSnapshot("codemodMiddleware", "defaultTsx");
|
|
7
|
+
});
|
|
8
|
+
it("Handles when OgImageMiddleware is already imported", async () => {
|
|
9
|
+
await matchTransformSnapshot("codemodMiddleware", "alreadyContainsImport");
|
|
10
|
+
});
|
|
11
|
+
it("Handles when registerMiddleware function is already defined", async () => {
|
|
12
|
+
await matchTransformSnapshot(
|
|
13
|
+
"codemodMiddleware",
|
|
14
|
+
"registerFunctionAlreadyDefined"
|
|
15
|
+
);
|
|
16
|
+
});
|
|
5
17
|
}
|
|
6
|
-
|
|
7
|
-
await matchTransformSnapshot("codemodMiddleware", "defaultTsx");
|
|
8
|
-
});
|
|
9
|
-
it("Handles when OgImageMiddleware is already imported", async () => {
|
|
10
|
-
await matchTransformSnapshot("codemodMiddleware", "alreadyContainsImport");
|
|
11
|
-
});
|
|
12
|
-
it("Handles when registerMiddleware function is already defined", async () => {
|
|
13
|
-
await matchTransformSnapshot(
|
|
14
|
-
"codemodMiddleware",
|
|
15
|
-
"registerFunctionAlreadyDefined"
|
|
16
|
-
);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
18
|
+
);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { describe, it } from "vitest";
|
|
2
|
-
describe(
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
describe.skipIf(process.env.CI && process.platform === "win32")(
|
|
3
|
+
"Vite plugin codemod",
|
|
4
|
+
() => {
|
|
5
|
+
it("Handles the default vite config case", async () => {
|
|
6
|
+
await matchTransformSnapshot("codemodVitePlugin", "defaultViteConfig");
|
|
7
|
+
});
|
|
5
8
|
}
|
|
6
|
-
|
|
7
|
-
await matchTransformSnapshot("codemodVitePlugin", "defaultViteConfig");
|
|
8
|
-
});
|
|
9
|
-
});
|
|
9
|
+
);
|
package/dist/lib/colors.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ansis from "ansis";
|
|
2
2
|
var colors_default = {
|
|
3
|
-
error:
|
|
4
|
-
warning:
|
|
5
|
-
highlight:
|
|
6
|
-
success:
|
|
7
|
-
info:
|
|
8
|
-
bold:
|
|
9
|
-
underline:
|
|
10
|
-
note:
|
|
11
|
-
tip:
|
|
12
|
-
important:
|
|
13
|
-
caution:
|
|
14
|
-
link:
|
|
3
|
+
error: ansis.bold.red,
|
|
4
|
+
warning: ansis.hex("#ffa500"),
|
|
5
|
+
highlight: ansis.hex("#ffa500"),
|
|
6
|
+
success: ansis.green,
|
|
7
|
+
info: ansis.gray,
|
|
8
|
+
bold: ansis.bold,
|
|
9
|
+
underline: ansis.underline,
|
|
10
|
+
note: ansis.blue,
|
|
11
|
+
tip: ansis.green,
|
|
12
|
+
important: ansis.magenta,
|
|
13
|
+
caution: ansis.red,
|
|
14
|
+
link: ansis.underline
|
|
15
15
|
};
|
|
16
16
|
export {
|
|
17
17
|
colors_default as default
|
package/dist/lib/exit.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ansis from "ansis";
|
|
2
2
|
import { terminalLink } from "termi-link";
|
|
3
3
|
import { v4 as uuidv4 } from "uuid";
|
|
4
4
|
import {
|
|
@@ -23,7 +23,7 @@ function exitWithError(error, { exitCode, message, epilogue, includeEpilogue, in
|
|
|
23
23
|
includeReferenceCode ??= true;
|
|
24
24
|
message ??= error.stack ?? (error.toString() || "Unknown error");
|
|
25
25
|
const errorReferenceCode = uuidv4();
|
|
26
|
-
const line =
|
|
26
|
+
const line = ansis.red("-".repeat(process.stderr.columns));
|
|
27
27
|
const content = !includeEpilogue ? message : [
|
|
28
28
|
"",
|
|
29
29
|
line,
|
package/dist/lib/plugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import
|
|
2
|
+
import ansis from "ansis";
|
|
3
3
|
import enquirer from "enquirer";
|
|
4
4
|
import fs from "fs-extra";
|
|
5
5
|
import { getCompatibilityData } from "@cedarjs/cli-helpers";
|
|
@@ -100,14 +100,14 @@ function checkPluginListAndWarn(plugins) {
|
|
|
100
100
|
for (const plugin of plugins) {
|
|
101
101
|
if (!plugin.package) {
|
|
102
102
|
console.warn(
|
|
103
|
-
|
|
103
|
+
ansis.yellow(`\u26A0\uFE0F A plugin is missing a package, it cannot be loaded.`)
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
const pluginPackages = plugins.map((p) => p.package).filter((p) => p !== void 0);
|
|
108
108
|
if (pluginPackages.length !== new Set(pluginPackages).size) {
|
|
109
109
|
console.warn(
|
|
110
|
-
|
|
110
|
+
ansis.yellow(
|
|
111
111
|
"\u26A0\uFE0F Duplicate plugin packages found in redwood.toml, duplicates will be ignored."
|
|
112
112
|
)
|
|
113
113
|
);
|
|
@@ -116,7 +116,7 @@ function checkPluginListAndWarn(plugins) {
|
|
|
116
116
|
namespaces.forEach((ns) => {
|
|
117
117
|
if (ns !== void 0 && !ns.startsWith("@")) {
|
|
118
118
|
console.warn(
|
|
119
|
-
|
|
119
|
+
ansis.yellow(
|
|
120
120
|
`\u26A0\uFE0F Plugin "${ns}" is missing a scope/namespace, it will not be loaded.`
|
|
121
121
|
)
|
|
122
122
|
);
|
|
@@ -129,13 +129,13 @@ async function loadPluginPackage(packageName, packageVersion, autoInstall) {
|
|
|
129
129
|
}
|
|
130
130
|
if (!autoInstall) {
|
|
131
131
|
console.warn(
|
|
132
|
-
|
|
132
|
+
ansis.yellow(
|
|
133
133
|
`\u26A0\uFE0F Plugin "${packageName}" cannot be loaded because it is not installed and "autoInstall" is disabled.`
|
|
134
134
|
)
|
|
135
135
|
);
|
|
136
136
|
return null;
|
|
137
137
|
}
|
|
138
|
-
console.log(
|
|
138
|
+
console.log(ansis.green(`Installing plugin "${packageName}"...`));
|
|
139
139
|
const installed = await installPluginPackage(packageName, packageVersion);
|
|
140
140
|
if (installed) {
|
|
141
141
|
return await import(packageName);
|
|
@@ -154,7 +154,7 @@ async function installPluginPackage(packageName, packageVersion) {
|
|
|
154
154
|
);
|
|
155
155
|
versionToInstall = compatibilityData.compatible.version;
|
|
156
156
|
console.log(
|
|
157
|
-
|
|
157
|
+
ansis.green(
|
|
158
158
|
`Installing the latest compatible version: ${versionToInstall}`
|
|
159
159
|
)
|
|
160
160
|
);
|
package/dist/lib/updateCheck.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
+
import ansis from "ansis";
|
|
2
3
|
import boxen from "boxen";
|
|
3
|
-
import chalk from "chalk";
|
|
4
4
|
import fs from "fs-extra";
|
|
5
5
|
import latestVersion from "latest-version";
|
|
6
6
|
import semver from "semver";
|
|
@@ -95,7 +95,7 @@ function getUpdateMessage() {
|
|
|
95
95
|
if (tag === localTag) {
|
|
96
96
|
message += `
|
|
97
97
|
|
|
98
|
-
\u2756 ${
|
|
98
|
+
\u2756 ${ansis.underline.bold(tag)}:
|
|
99
99
|
v${data.localVersion} -> v${version} `;
|
|
100
100
|
} else {
|
|
101
101
|
message += `
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "1.0.0-canary.
|
|
3
|
+
"version": "1.0.0-canary.12467+51334c03a",
|
|
4
4
|
"description": "The Redwood Command Line",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,15 +31,15 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime-corejs3": "7.27.6",
|
|
34
|
-
"@cedarjs/api-server": "1.0.0-canary.
|
|
35
|
-
"@cedarjs/cli-helpers": "1.0.0-canary.
|
|
36
|
-
"@cedarjs/fastify-web": "1.0.0-canary.
|
|
37
|
-
"@cedarjs/internal": "1.0.0-canary.
|
|
38
|
-
"@cedarjs/prerender": "1.0.0-canary.
|
|
39
|
-
"@cedarjs/project-config": "1.0.0-canary.
|
|
40
|
-
"@cedarjs/structure": "1.0.0-canary.
|
|
41
|
-
"@cedarjs/telemetry": "1.0.0-canary.
|
|
42
|
-
"@cedarjs/web-server": "1.0.0-canary.
|
|
34
|
+
"@cedarjs/api-server": "1.0.0-canary.12467",
|
|
35
|
+
"@cedarjs/cli-helpers": "1.0.0-canary.12467",
|
|
36
|
+
"@cedarjs/fastify-web": "1.0.0-canary.12467",
|
|
37
|
+
"@cedarjs/internal": "1.0.0-canary.12467",
|
|
38
|
+
"@cedarjs/prerender": "1.0.0-canary.12467",
|
|
39
|
+
"@cedarjs/project-config": "1.0.0-canary.12467",
|
|
40
|
+
"@cedarjs/structure": "1.0.0-canary.12467",
|
|
41
|
+
"@cedarjs/telemetry": "1.0.0-canary.12467",
|
|
42
|
+
"@cedarjs/web-server": "1.0.0-canary.12467",
|
|
43
43
|
"@listr2/prompt-adapter-enquirer": "2.0.16",
|
|
44
44
|
"@opentelemetry/api": "1.8.0",
|
|
45
45
|
"@opentelemetry/core": "1.22.0",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"@opentelemetry/sdk-trace-node": "1.22.0",
|
|
49
49
|
"@opentelemetry/semantic-conventions": "1.22.0",
|
|
50
50
|
"@prisma/internals": "5.20.0",
|
|
51
|
+
"ansis": "4.1.0",
|
|
51
52
|
"archiver": "7.0.1",
|
|
52
53
|
"boxen": "5.1.2",
|
|
53
54
|
"camelcase": "6.3.0",
|
|
54
|
-
"chalk": "4.1.2",
|
|
55
55
|
"change-case": "4.1.2",
|
|
56
56
|
"ci-info": "4.0.0",
|
|
57
57
|
"concurrently": "8.2.2",
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"typescript": "5.6.2",
|
|
99
99
|
"vitest": "3.2.4"
|
|
100
100
|
},
|
|
101
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "51334c03a7c5e26987cd0a7d857bc43deba64f91"
|
|
102
102
|
}
|