-
Notifications
You must be signed in to change notification settings - Fork 680
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
client/commands: statically import commands
Dynamic imports won't work very well with modules and we don't really need them, it's just there to save us an import statement. Let's flip this to a static version.
- Loading branch information
Showing
6 changed files
with
23 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,11 @@ | ||
// Taken from views/index.js | ||
|
||
// This creates a version of `require()` in the context of the current | ||
// directory, so we iterate over its content, which is a map statically built by | ||
// Webpack. | ||
// Second argument says it's recursive, third makes sure we only load javascript. | ||
const commands = require.context("./", true, /\.ts$/); | ||
|
||
export default commands.keys().reduce<Record<string, unknown>>((acc, path) => { | ||
const command = path.substring(2, path.length - 3); | ||
|
||
if (command === "index") { | ||
return acc; | ||
} | ||
|
||
acc[command] = commands(path).default; | ||
|
||
return acc; | ||
}, {}); | ||
import {input as collapse} from "./collapse"; | ||
import {input as expand} from "./expand"; | ||
import {input as join} from "./join"; | ||
import {input as search} from "./search"; | ||
|
||
export const commands = { | ||
collapse: collapse, | ||
expand: expand, | ||
join: join, | ||
search: search, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters