@cedarjs/cli 2.0.4-next.0 → 2.0.4-next.16
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/commands/lint.js +63 -3
- package/dist/commands/upgrade.js +8 -2
- package/package.json +11 -11
package/dist/commands/lint.js
CHANGED
|
@@ -1,8 +1,63 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
2
3
|
import execa from "execa";
|
|
3
4
|
import { terminalLink } from "termi-link";
|
|
4
5
|
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
5
|
-
import { getPaths } from "../lib/index.js";
|
|
6
|
+
import { getPaths, getConfig } from "../lib/index.js";
|
|
7
|
+
function detectLegacyEslintConfig() {
|
|
8
|
+
const projectRoot = getPaths().base;
|
|
9
|
+
const legacyConfigFiles = [
|
|
10
|
+
".eslintrc.js",
|
|
11
|
+
".eslintrc.cjs",
|
|
12
|
+
".eslintrc.json",
|
|
13
|
+
".eslintrc.yaml",
|
|
14
|
+
".eslintrc.yml"
|
|
15
|
+
];
|
|
16
|
+
const foundLegacyFiles = [];
|
|
17
|
+
for (const configFile of legacyConfigFiles) {
|
|
18
|
+
if (fs.existsSync(path.join(projectRoot, configFile))) {
|
|
19
|
+
foundLegacyFiles.push(configFile);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const packageJsonPath = path.join(projectRoot, "package.json");
|
|
23
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
24
|
+
try {
|
|
25
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
26
|
+
if (packageJson.eslintConfig) {
|
|
27
|
+
foundLegacyFiles.push("package.json (eslintConfig field)");
|
|
28
|
+
}
|
|
29
|
+
if (packageJson.eslint) {
|
|
30
|
+
foundLegacyFiles.push("package.json (eslint field)");
|
|
31
|
+
}
|
|
32
|
+
} catch (error) {
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return foundLegacyFiles;
|
|
36
|
+
}
|
|
37
|
+
function showLegacyEslintDeprecationWarning(legacyFiles) {
|
|
38
|
+
console.warn("");
|
|
39
|
+
console.warn("\u26A0\uFE0F DEPRECATION WARNING: Legacy ESLint Configuration Detected");
|
|
40
|
+
console.warn("");
|
|
41
|
+
console.warn(" The following legacy ESLint configuration files were found:");
|
|
42
|
+
legacyFiles.forEach((file) => {
|
|
43
|
+
console.warn(` - ${file}`);
|
|
44
|
+
});
|
|
45
|
+
console.warn("");
|
|
46
|
+
console.warn(
|
|
47
|
+
" Cedar has migrated to ESLint flat config format. Legacy configurations"
|
|
48
|
+
);
|
|
49
|
+
console.warn(
|
|
50
|
+
" still work but are deprecated and will be removed in a future version."
|
|
51
|
+
);
|
|
52
|
+
console.warn("");
|
|
53
|
+
console.warn(" To migrate to the new format:");
|
|
54
|
+
console.warn(" 1. Remove the legacy config file(s) listed above");
|
|
55
|
+
console.warn(" 2. Create an eslint.config.mjs");
|
|
56
|
+
console.warn(" 3. Use the flat config format with @cedarjs/eslint-config");
|
|
57
|
+
console.warn("");
|
|
58
|
+
console.warn(" See more here: https://github.com/cedarjs/cedar/pull/629");
|
|
59
|
+
console.warn("");
|
|
60
|
+
}
|
|
6
61
|
const command = "lint [path..]";
|
|
7
62
|
const description = "Lint your files";
|
|
8
63
|
const builder = (yargs) => {
|
|
@@ -24,10 +79,15 @@ const builder = (yargs) => {
|
|
|
24
79
|
)}`
|
|
25
80
|
);
|
|
26
81
|
};
|
|
27
|
-
const handler = async ({ path, fix, format }) => {
|
|
82
|
+
const handler = async ({ path: path2, fix, format }) => {
|
|
28
83
|
recordTelemetryAttributes({ command: "lint", fix, format });
|
|
84
|
+
const config = getConfig();
|
|
85
|
+
const legacyConfigFiles = detectLegacyEslintConfig();
|
|
86
|
+
if (legacyConfigFiles.length > 0 && config.eslintLegacyConfigWarning) {
|
|
87
|
+
showLegacyEslintDeprecationWarning(legacyConfigFiles);
|
|
88
|
+
}
|
|
29
89
|
try {
|
|
30
|
-
const pathString =
|
|
90
|
+
const pathString = path2?.join(" ");
|
|
31
91
|
const sbPath = getPaths().web.storybook;
|
|
32
92
|
const args = [
|
|
33
93
|
"eslint",
|
package/dist/commands/upgrade.js
CHANGED
|
@@ -15,7 +15,7 @@ const command = "upgrade";
|
|
|
15
15
|
const description = "Upgrade all @cedarjs packages via interactive CLI";
|
|
16
16
|
const builder = (yargs) => {
|
|
17
17
|
yargs.example(
|
|
18
|
-
"
|
|
18
|
+
"cedar upgrade -t 0.20.1-canary.5",
|
|
19
19
|
"Specify a version. URL for Version History:\nhttps://www.npmjs.com/package/@cedarjs/core"
|
|
20
20
|
).option("dry-run", {
|
|
21
21
|
alias: "d",
|
|
@@ -23,7 +23,7 @@ const builder = (yargs) => {
|
|
|
23
23
|
type: "boolean"
|
|
24
24
|
}).option("tag", {
|
|
25
25
|
alias: "t",
|
|
26
|
-
description: '[choices: "latest", "rc", "next", "canary", "experimental", or a specific-version (see example below)] WARNING: "canary", "rc" and "experimental" are unstable releases! And "canary" releases include breaking changes often requiring
|
|
26
|
+
description: '[choices: "latest", "rc", "next", "canary", "experimental", or a specific-version (see example below)] WARNING: "canary", "rc" and "experimental" are unstable releases! And "canary" releases include breaking changes often requiring changes to your codebase when upgrading a project.',
|
|
27
27
|
requiresArg: true,
|
|
28
28
|
type: "string",
|
|
29
29
|
coerce: validateTag
|
|
@@ -88,6 +88,12 @@ const handler = async ({ dryRun, tag, verbose, dedupe, yes }) => {
|
|
|
88
88
|
task.skip("Skipping confirmation prompt because of --yes flag.");
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
|
+
if (tag) {
|
|
92
|
+
task.skip(
|
|
93
|
+
"Skipping confirmation prompt because a specific tag is specified."
|
|
94
|
+
);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
91
97
|
const prompt = task.prompt(ListrEnquirerPromptAdapter);
|
|
92
98
|
const proceed = await prompt.run({
|
|
93
99
|
type: "Confirm",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "2.0.4-next.
|
|
3
|
+
"version": "2.0.4-next.16+45e20cca7",
|
|
4
4
|
"description": "The CedarJS Command Line",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,15 +31,15 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@babel/preset-typescript": "7.27.1",
|
|
33
33
|
"@babel/runtime-corejs3": "7.27.6",
|
|
34
|
-
"@cedarjs/api-server": "2.0.4-next.
|
|
35
|
-
"@cedarjs/cli-helpers": "2.0.4-next.
|
|
36
|
-
"@cedarjs/fastify-web": "2.0.4-next.
|
|
37
|
-
"@cedarjs/internal": "2.0.4-next.
|
|
38
|
-
"@cedarjs/prerender": "2.0.4-next.
|
|
39
|
-
"@cedarjs/project-config": "2.0.4-next.
|
|
40
|
-
"@cedarjs/structure": "2.0.4-next.
|
|
41
|
-
"@cedarjs/telemetry": "2.0.4-next.
|
|
42
|
-
"@cedarjs/web-server": "2.0.4-next.
|
|
34
|
+
"@cedarjs/api-server": "2.0.4-next.16+45e20cca7",
|
|
35
|
+
"@cedarjs/cli-helpers": "2.0.4-next.16+45e20cca7",
|
|
36
|
+
"@cedarjs/fastify-web": "2.0.4-next.16+45e20cca7",
|
|
37
|
+
"@cedarjs/internal": "2.0.4-next.16+45e20cca7",
|
|
38
|
+
"@cedarjs/prerender": "2.0.4-next.16+45e20cca7",
|
|
39
|
+
"@cedarjs/project-config": "2.0.4-next.16+45e20cca7",
|
|
40
|
+
"@cedarjs/structure": "2.0.4-next.16+45e20cca7",
|
|
41
|
+
"@cedarjs/telemetry": "2.0.4-next.16+45e20cca7",
|
|
42
|
+
"@cedarjs/web-server": "2.0.4-next.16+45e20cca7",
|
|
43
43
|
"@listr2/prompt-adapter-enquirer": "2.0.16",
|
|
44
44
|
"@opentelemetry/api": "1.8.0",
|
|
45
45
|
"@opentelemetry/core": "1.22.0",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"publishConfig": {
|
|
102
102
|
"access": "public"
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "45e20cca7a9b55ac486af5503f118df99311c309"
|
|
105
105
|
}
|