@cedarjs/cli 2.5.2-next.16 → 2.6.0-rc.28
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 +1 -1
- package/dist/cfw.js +2 -2
- package/dist/index.js +8 -7
- package/dist/lib/runTransform.js +3 -2
- package/dist/testLib/runTransform.js +3 -2
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -101,7 +101,7 @@ how to do this you'll know how to modify one too.
|
|
|
101
101
|
CedarJS CLI is usually run in a project, this is problematic for contributors,
|
|
102
102
|
because the transpiled files are not in a project, but in the CedarJS framework
|
|
103
103
|
repo. Luckily the path can be modified at run-time via an env-var:
|
|
104
|
-
`
|
|
104
|
+
`CEDAR_CWD=../path/to/project`.
|
|
105
105
|
|
|
106
106
|
We've added a handy yarn alias to test your modified changes to the Cedar CLI
|
|
107
107
|
against the "example-todo-main" fixture (`__fixtures__/example-todo-main`) you
|
package/dist/cfw.js
CHANGED
|
@@ -22,7 +22,7 @@ if (!fs.existsSync(CFW_PATH)) {
|
|
|
22
22
|
const absCfwPath = path.resolve(process.cwd(), CFW_PATH);
|
|
23
23
|
config.set("CFW_PATH", absCfwPath);
|
|
24
24
|
const projectPath = path.dirname(
|
|
25
|
-
getConfigPath(process.env.RWJS_CWD ?? process.cwd())
|
|
25
|
+
getConfigPath(process.env.CEDAR_CWD ?? process.env.RWJS_CWD ?? process.cwd())
|
|
26
26
|
);
|
|
27
27
|
console.log("Cedar Framework Tools Path:", terminalLink(absCfwPath, absCfwPath));
|
|
28
28
|
let command = process.argv.slice(2);
|
|
@@ -35,7 +35,7 @@ try {
|
|
|
35
35
|
stdio: "inherit",
|
|
36
36
|
cwd: absCfwPath,
|
|
37
37
|
env: {
|
|
38
|
-
|
|
38
|
+
CEDAR_CWD: projectPath
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
} catch (e) {
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { trace, SpanStatusCode } from "@opentelemetry/api";
|
|
|
5
5
|
import { hideBin, Parser } from "yargs/helpers";
|
|
6
6
|
import yargs from "yargs/yargs";
|
|
7
7
|
import { loadEnvFiles, recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
8
|
-
import { projectIsEsm, getConfigPath } from "@cedarjs/project-config";
|
|
8
|
+
import { findUp, projectIsEsm, getConfigPath } from "@cedarjs/project-config";
|
|
9
9
|
import { telemetryMiddleware } from "@cedarjs/telemetry";
|
|
10
10
|
import * as buildCommand from "./commands/build.js";
|
|
11
11
|
import * as checkCommand from "./commands/check.js";
|
|
@@ -32,7 +32,6 @@ import * as typeCheckCommand from "./commands/type-check.js";
|
|
|
32
32
|
import * as upgradeCommand from "./commands/upgrade/upgrade.js";
|
|
33
33
|
import c from "./lib/colors.js";
|
|
34
34
|
import { exitWithError } from "./lib/exit.js";
|
|
35
|
-
import { findUp } from "./lib/index.js";
|
|
36
35
|
import * as updateCheck from "./lib/updateCheck.js";
|
|
37
36
|
import { loadPlugins } from "./plugin.js";
|
|
38
37
|
import { startTelemetry, shutdownTelemetry } from "./telemetry/index.js";
|
|
@@ -45,8 +44,10 @@ let { cwd, telemetry, help, version } = Parser(hideBin(process.argv), {
|
|
|
45
44
|
telemetry: process.env.REDWOOD_DISABLE_TELEMETRY === void 0 || process.env.REDWOOD_DISABLE_TELEMETRY === ""
|
|
46
45
|
}
|
|
47
46
|
});
|
|
47
|
+
cwd ??= process.env.CEDAR_CWD;
|
|
48
48
|
cwd ??= process.env.RWJS_CWD;
|
|
49
49
|
cwd = getTomlDir(cwd);
|
|
50
|
+
process.env.CEDAR_CWD = cwd;
|
|
50
51
|
process.env.RWJS_CWD = cwd;
|
|
51
52
|
if (process.argv[1]?.endsWith("redwood.js")) {
|
|
52
53
|
const tomlPath = getConfigPath(cwd);
|
|
@@ -148,13 +149,13 @@ function getTomlDir(cwd2) {
|
|
|
148
149
|
let tomlDir = "";
|
|
149
150
|
try {
|
|
150
151
|
if (cwd2) {
|
|
151
|
-
const
|
|
152
|
+
const absCwd = path.resolve(process.cwd(), cwd2);
|
|
153
|
+
const found = configFiles.some((f) => fs.existsSync(path.join(absCwd, f)));
|
|
152
154
|
if (!found) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
);
|
|
155
|
+
const tomls = configFiles.join('" or "');
|
|
156
|
+
throw new Error(`Couldn't find a "${tomls}" file in ${absCwd}`);
|
|
156
157
|
}
|
|
157
|
-
tomlDir =
|
|
158
|
+
tomlDir = absCwd;
|
|
158
159
|
} else {
|
|
159
160
|
const configTomlPath = findUp("cedar.toml", process.cwd()) || findUp("redwood.toml", process.cwd());
|
|
160
161
|
if (!configTomlPath) {
|
package/dist/lib/runTransform.js
CHANGED
|
@@ -23,8 +23,9 @@ const runTransform = async ({
|
|
|
23
23
|
parser = "tsx",
|
|
24
24
|
options = {}
|
|
25
25
|
}) => {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const cedarCwd = process.env.CEDAR_CWD || process.env.RWJS_CWD;
|
|
27
|
+
if (process.env.NODE_ENV === "test" && cedarCwd) {
|
|
28
|
+
process.chdir(cedarCwd);
|
|
28
29
|
}
|
|
29
30
|
const { output, stdoutWrite } = patchStdoutWrite();
|
|
30
31
|
const result = await jscodeshift.run(transformPath, targetPaths, {
|
|
@@ -20,8 +20,9 @@ const runTransform = async ({
|
|
|
20
20
|
options = {}
|
|
21
21
|
}) => {
|
|
22
22
|
try {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const cedarCwd = process.env.CEDAR_CWD || process.env.RWJS_CWD;
|
|
24
|
+
if (process.env.NODE_ENV === "test" && cedarCwd) {
|
|
25
|
+
process.chdir(cedarCwd);
|
|
25
26
|
}
|
|
26
27
|
await jscodeshift.run(transformPath, targetPaths, {
|
|
27
28
|
...defaultJscodeshiftOpts,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0-rc.28",
|
|
4
4
|
"description": "The CedarJS Command Line",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"build:pack": "yarn pack -o cedarjs-cli.tgz",
|
|
25
25
|
"build:types": "tsc --build --verbose ./tsconfig.build.json",
|
|
26
26
|
"build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx,template\" --ignore dist --exec \"yarn build && yarn fix:permissions\"",
|
|
27
|
-
"dev": "
|
|
27
|
+
"dev": "CEDAR_CWD=../../test-project node dist/index.js",
|
|
28
28
|
"fix:permissions": "chmod +x dist/index.js dist/cfw.js",
|
|
29
29
|
"prepublishOnly": "yarn build",
|
|
30
30
|
"test": "vitest run",
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
"@babel/parser": "7.29.0",
|
|
35
35
|
"@babel/preset-typescript": "7.28.5",
|
|
36
36
|
"@babel/runtime-corejs3": "7.29.0",
|
|
37
|
-
"@cedarjs/api-server": "2.
|
|
38
|
-
"@cedarjs/cli-helpers": "2.
|
|
39
|
-
"@cedarjs/fastify-web": "2.
|
|
40
|
-
"@cedarjs/internal": "2.
|
|
41
|
-
"@cedarjs/prerender": "2.
|
|
42
|
-
"@cedarjs/project-config": "2.
|
|
43
|
-
"@cedarjs/structure": "2.
|
|
44
|
-
"@cedarjs/telemetry": "2.
|
|
45
|
-
"@cedarjs/web-server": "2.
|
|
37
|
+
"@cedarjs/api-server": "2.6.0-rc.28",
|
|
38
|
+
"@cedarjs/cli-helpers": "2.6.0-rc.28",
|
|
39
|
+
"@cedarjs/fastify-web": "2.6.0-rc.28",
|
|
40
|
+
"@cedarjs/internal": "2.6.0-rc.28",
|
|
41
|
+
"@cedarjs/prerender": "2.6.0-rc.28",
|
|
42
|
+
"@cedarjs/project-config": "2.6.0-rc.28",
|
|
43
|
+
"@cedarjs/structure": "2.6.0-rc.28",
|
|
44
|
+
"@cedarjs/telemetry": "2.6.0-rc.28",
|
|
45
|
+
"@cedarjs/web-server": "2.6.0-rc.28",
|
|
46
46
|
"@listr2/prompt-adapter-enquirer": "2.0.16",
|
|
47
47
|
"@opentelemetry/api": "1.9.0",
|
|
48
48
|
"@opentelemetry/core": "1.30.1",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"prompts": "2.4.2",
|
|
82
82
|
"recast": "0.23.11",
|
|
83
83
|
"rimraf": "6.1.2",
|
|
84
|
-
"semver": "7.7.
|
|
84
|
+
"semver": "7.7.4",
|
|
85
85
|
"smol-toml": "1.6.0",
|
|
86
86
|
"string-env-interpolation": "1.0.1",
|
|
87
87
|
"systeminformation": "5.30.7",
|
|
@@ -106,5 +106,5 @@
|
|
|
106
106
|
"publishConfig": {
|
|
107
107
|
"access": "public"
|
|
108
108
|
},
|
|
109
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "fb5acf1b34fc17ac1c8ea326567df5b5c3c2924a"
|
|
110
110
|
}
|