@travetto/lint 8.0.0-alpha.27 → 8.0.0-alpha.29

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/lint",
3
- "version": "8.0.0-alpha.27",
3
+ "version": "8.0.0-alpha.29",
4
4
  "type": "module",
5
5
  "description": "Linting and Formatting integration for Travetto",
6
6
  "keywords": [
@@ -1,7 +1,7 @@
1
1
  import fs from 'node:fs/promises';
2
2
 
3
3
  import { CliCommand, type CliCommandShape } from '@travetto/cli';
4
- import { Runtime } from '@travetto/runtime';
4
+ import { Runtime, RuntimeIndex } from '@travetto/runtime';
5
5
 
6
6
  /**
7
7
  * Generate the workspace oxlint, oxfmt, and cspell configuration entry files.
@@ -14,11 +14,14 @@ export class LintRegisterCommand implements CliCommandShape {
14
14
  // Bootstrap oxlint configuration
15
15
  const oxlintOutput = Runtime.workspaceRelative('oxlint.config.ts');
16
16
  if (!(await fs.stat(oxlintOutput, { throwIfNoEntry: false }))) {
17
- const oxlintContent = `import { oxlintConfig } from '@travetto/lint';
18
-
19
- export default oxlintConfig();
17
+ const entry = RuntimeIndex.getFromImport('@travetto/lint/support/oxlint');
18
+ const content = `
19
+ const { oxlintConfig } = await import('./${Runtime.stripWorkspacePath(entry!.outputFile)}');
20
+ export default oxlintConfig({
21
+ // Override here
22
+ });
20
23
  `;
21
- await fs.writeFile(oxlintOutput, oxlintContent);
24
+ await fs.writeFile(oxlintOutput, content.trimStart());
22
25
  console.log(`Wrote lint config to ${oxlintOutput}`);
23
26
  } else {
24
27
  console.log(`Lint config already present ${oxlintOutput}`);
@@ -27,11 +30,15 @@ export default oxlintConfig();
27
30
  // Bootstrap oxfmt configuration
28
31
  const oxfmtOutput = Runtime.workspaceRelative('oxfmt.config.ts');
29
32
  if (!(await fs.stat(oxfmtOutput, { throwIfNoEntry: false }))) {
30
- const oxfmtContent = `import { oxfmtConfig } from '@travetto/lint';
31
-
32
- export default oxfmtConfig();
33
+ const entry = RuntimeIndex.getFromImport('@travetto/lint/support/oxfmt');
34
+ const content = `
35
+ const { oxfmtConfig } = await import('./${Runtime.stripWorkspacePath(entry!.outputFile)}');
36
+ export default oxfmtConfig({
37
+ // Override here
38
+ });
33
39
  `;
34
- await fs.writeFile(oxfmtOutput, oxfmtContent);
40
+
41
+ await fs.writeFile(oxfmtOutput, content.trimStart());
35
42
  console.log(`Wrote format config to ${oxfmtOutput}`);
36
43
  } else {
37
44
  console.log(`Format config already present ${oxfmtOutput}`);