Skip to content

Commit 6a6e925

Browse files
committed
Add check for adonisrc.ts for Adonis.js 'node ace' command
Improve generateSpec function to check for both .adonisrc.json and adonisrc.ts files. This ensures compatibility with projects using either configuration file. - Refactor the use of executeShellCommand to check for .adonisrc.json. - Add a new check for the presence of adonisrc.ts.
1 parent 6c7331e commit 6a6e925

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/node.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,19 @@ const completionSpec: Fig.Subcommand = {
8383
},
8484
],
8585
generateSpec: async (tokens, executeShellCommand) => {
86-
const isAdonisJsonPresentCommand = "test -f .adonisrc.json";
86+
const isAdonisJsonPresent = await executeShellCommand({
87+
command: "bash",
88+
args: ["-c", "test -f .adonisrc.json"],
89+
});
90+
91+
const isAdonisRcTsPresent = await executeShellCommand({
92+
command: "bash",
93+
args: ["-c", "test -f adonisrc.ts"],
94+
});
95+
8796
if (
88-
(
89-
await executeShellCommand({
90-
command: "bash",
91-
args: ["-c", "isAdonisJsonPresentCommand"],
92-
})
93-
).status === 0
97+
isAdonisJsonPresent.status === 0 ||
98+
isAdonisRcTsPresent.status === 0
9499
) {
95100
return {
96101
name: "node",

0 commit comments

Comments
 (0)