Skip to content

Commit 7821ee3

Browse files
committed
fix: generate config as .mjs
Reworks the init script to generate the config as .mjs to avoid Node warnings.
1 parent 38a357e commit 7821ee3

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ You can customize the `web-codegen-scorer eval` script with the following flags:
6363

6464
- `--env=<path>` (alias: `--environment`): (**Required**) Specifies the path from which to load the
6565
environment config.
66-
- Example: `web-codegen-scorer eval --env=foo/bar/my-env.js`
66+
- Example: `web-codegen-scorer eval --env=foo/bar/my-env.mjs`
6767

6868
- `--model=<name>`: Specifies the model to use when generating code. Defaults to the value of
6969
`DEFAULT_MODEL_NAME`.

docs/environment-reference.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Environment configuration reference
22

3-
Environments are configured by creating a `config.js` that exposes an object that satisfies the
4-
`EnvironmentConfig` interface. This document covers all options in `EnvironmentConfig`
5-
and what they do.
3+
Environments are configured by creating a `config.mjs` or `config.js` file that exposes an object
4+
that satisfies the `EnvironmentConfig` interface. This document covers all options in
5+
`EnvironmentConfig` and what they do.
66

77
## Required properties
88

runner/init-cli.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,11 @@ async function getAnswers(): Promise<InitOptions | null> {
8080
const configPath = await input({
8181
message: 'Where should we place the environment config file?',
8282
required: true,
83-
default: join(generateId(displayName) || 'env', 'config.js'),
83+
default: join(generateId(displayName) || 'env', 'config.mjs'),
8484
validate: (value) =>
85-
value.endsWith('.js') ? true : 'Config must be a .js file',
85+
value.endsWith('.js') || value.endsWith('.mjs')
86+
? true
87+
: 'Config must be a .mjs or .js file',
8688
});
8789
const clientSideFramework = await input({
8890
message: 'What client-side framework will it be using?',

0 commit comments

Comments
 (0)