@aeriajs/cli 0.0.246 → 0.0.248

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.
@@ -1,12 +1,33 @@
1
1
  import { Result } from '@aeriajs/types';
2
2
  import { compileFromFiles } from '@aeriajs/compiler';
3
+ import * as fs from 'node:fs';
4
+ import * as path from 'node:path';
5
+ import { styleText } from 'node:util';
3
6
  export const OUT_DIR = '.aeria/out';
4
7
  export const buildAeriaLangPhase = async () => {
8
+ const packageJson = JSON.parse(await fs.promises.readFile(path.join(process.cwd(), 'package.json'), {
9
+ encoding: 'utf-8',
10
+ }));
11
+ const { outDir = OUT_DIR } = packageJson.aeria || {};
5
12
  const result = await compileFromFiles({
6
- outDir: OUT_DIR,
13
+ outDir,
7
14
  });
8
15
  if (!result.success) {
9
- return Result.error(result.errors.map((error) => `\n${error.location.file}:${error.location.line} at column (${error.location.start}-${error.location.end}) - ${error.message}`).join(' | '));
16
+ const errors = [];
17
+ for (const error of result.errors) {
18
+ let message = '';
19
+ message += styleText('yellow', error.location.file);
20
+ message += ':';
21
+ message += styleText('bold', error.location.line.toString());
22
+ message += `:${error.location.start} - `;
23
+ message += styleText([
24
+ 'bold',
25
+ 'red',
26
+ ], 'error');
27
+ message += `: ${error.message}`;
28
+ errors.push(message);
29
+ }
30
+ return Result.error('\n' + errors.join('\n'));
10
31
  }
11
32
  if (!('emittedFiles' in result)) {
12
33
  return Result.result('no aeria schemas to build');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aeriajs/cli",
3
3
  "type": "module",
4
- "version": "0.0.246",
4
+ "version": "0.0.248",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -40,12 +40,12 @@
40
40
  "@aeriajs/types": "link:../types"
41
41
  },
42
42
  "peerDependencies": {
43
- "@aeriajs/builtins": "^0.0.270",
44
- "@aeriajs/common": "^0.0.152",
45
- "@aeriajs/compiler": "^0.0.54",
46
- "@aeriajs/core": "^0.0.270",
47
- "@aeriajs/entrypoint": "^0.0.158",
48
- "@aeriajs/types": "^0.0.130"
43
+ "@aeriajs/builtins": "^0.0.272",
44
+ "@aeriajs/common": "^0.0.154",
45
+ "@aeriajs/compiler": "^0.0.56",
46
+ "@aeriajs/core": "^0.0.272",
47
+ "@aeriajs/entrypoint": "^0.0.160",
48
+ "@aeriajs/types": "^0.0.132"
49
49
  },
50
50
  "scripts": {
51
51
  "test": "echo skipping",