-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce bot modules, move TCCPP-specific components into tccpp module #136
Conversation
.gitmodules
Outdated
[submodule "wheatley-private"] | ||
path = src/wheatley-private | ||
[submodule "src/components/tccpp/private"] | ||
path = src/components/tccpp/private |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had forgotten that wheatley-private isn't just components, it's
algorithm/
components/
services/
test/
Thoughts on keeping this top-level? Maybe moving src/components/tccpp
to src/tccpp/components
? Not sure what's best.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could have bot modules—libraries of related components and their infrastructure—that can be installed in src/modules
. And then we just load components from src/**/components/*.ts
.
0e82bba
to
31a93d8
Compare
31a93d8
to
b981949
Compare
src/components/wiki.ts
Outdated
const name = path.basename(file_path, path.extname(file_path)); | ||
const content = await fs.promises.readFile(file_path, { encoding: "utf-8" }); | ||
for await (const file_path of globIterate("wiki/articles/**/*.md", { withFileTypes: true })) { | ||
const name = file_path.name.slice(0, -3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer this to remain in terms of path operations if possible, it’s a lot clearer than a splice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would actually suggest just using the file name here, it seems to only be used as an internal identifier anyways, everything seems to work fine with just file_path.name
instead.
@@ -395,25 +395,16 @@ export class Wheatley { | |||
})().catch(this.critical_error.bind(this)); | |||
}); | |||
|
|||
for await (const file of walk_dir("src/components")) { | |||
const default_export = (await import(`../${file.replace(".ts", ".js")}`)).default; | |||
for await (const file of globIterate("**/components/*.js", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m a bit concerned about globbing every js file in any components/ folder here. Would be better to make sure this is in the dist folder or whatnot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cwd: import.meta.dirname
should constrain it to only take .js
files from components
subdirectories of the src/
directory.
test/wiki-articles.ts
Outdated
} | ||
const name = path.basename(file_path, path.extname(file_path)); | ||
for (const file_path of globSync("wiki/articles/**/*.md", { withFileTypes: true })) { | ||
const name = file_path.name.slice(0, -3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto here re splicing
d8acadd
to
35dc897
Compare
35dc897
to
8bd6841
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM!
Take a first step in untying Wheatley from TCCPP by introducing bot modules and moving TCCPP stuff into a
tccpp
module. Also introduces anexcludes
config option to skip loading certain components, and replaces our customwalk_dir()
with theglob
package.