Skip to content

Commit 591bf37

Browse files
ASAS
authored andcommitted
feat(nx-plugin): rename artefact to artifacts
1 parent 338e88a commit 591bf37

File tree

4 files changed

+53
-53
lines changed

4 files changed

+53
-53
lines changed

packages/models/docs/models-reference.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Code PushUp models reference
22

3+
## ArtifactGenerationCommand
4+
5+
_Object containing the following properties:_
6+
7+
| Property | Description | Type |
8+
| :----------------- | :--------------------------------------------------------- | :------------------------- |
9+
| **`command`** (\*) | Generate artifact files | `string` (_min length: 1_) |
10+
| `args` | Arguments to be passed to the artifact generation command. | `Array<string>` |
11+
12+
_(\*) Required._
13+
314
## AuditDetails
415

516
Detailed information
@@ -1227,14 +1238,14 @@ _Object containing the following properties:_
12271238

12281239
_All properties are optional._
12291240

1230-
## PluginArtefactOptions
1241+
## PluginArtifactOptions
12311242

12321243
_Object containing the following properties:_
12331244

1234-
| Property | Type |
1235-
| :------------------------ | :-------------------------- |
1236-
| `generateArtefacts` | [ToolCommand](#toolcommand) |
1237-
| **`artefactsPaths`** (\*) | `string \| Array<string>` |
1245+
| Property | Type |
1246+
| :------------------------ | :------------------------------------------------------ |
1247+
| `generateArtifacts` | [ArtifactGenerationCommand](#artifactgenerationcommand) |
1248+
| **`artifactsPaths`** (\*) | `string` _or_ `Array<string>` (_min: 1_) |
12381249

12391250
_(\*) Required._
12401251

@@ -1442,17 +1453,6 @@ Primitive row
14421453

14431454
_Array of [TableCellValue](#tablecellvalue) (\_optional & nullable_) items.\_
14441455

1445-
## ToolCommand
1446-
1447-
_Object containing the following properties:_
1448-
1449-
| Property | Description | Type |
1450-
| :----------------- | :---------------------------------- | :------------------------- |
1451-
| **`command`** (\*) | Command to run the tool. | `string` (_min length: 1_) |
1452-
| `args` | Arguments to be passed to the tool. | `Array<string>` |
1453-
1454-
_(\*) Required._
1455-
14561456
## Tree
14571457

14581458
_Union of the following possible types:_

packages/models/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,5 +134,5 @@ export {
134134
export { uploadConfigSchema, type UploadConfig } from './lib/upload-config.js';
135135
export {
136136
artifactGenerationCommand,
137-
pluginArtefactOptionsSchema,
137+
pluginArtifactOptionsSchema,
138138
} from './lib/configuration.js';

packages/models/src/lib/configuration.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ import { z } from 'zod';
44
* Generic schema for a tool command configuration, reusable across plugins.
55
*/
66
export const artifactGenerationCommand = z.object({
7-
command: z.string({ description: 'Generate artefact files' }).min(1),
7+
command: z.string({ description: 'Generate artifact files' }).min(1),
88
args: z
99
.array(z.string(), {
10-
description: 'Arguments to be passed to the artefact generation command.',
10+
description: 'Arguments to be passed to the artifact generation command.',
1111
})
1212
.optional(),
1313
});
1414

15-
export type ArtefactGenerationCommand = z.infer<
15+
export type ArtifactGenerationCommand = z.infer<
1616
typeof artifactGenerationCommand
1717
>;
1818

19-
export const pluginArtefactOptionsSchema = z.object({
20-
generateArtefacts: artifactGenerationCommand.optional(),
21-
artefactsPaths: z.union([z.string(), z.array(z.string()).min(1)]),
19+
export const pluginArtifactOptionsSchema = z.object({
20+
generateArtifacts: artifactGenerationCommand.optional(),
21+
artifactsPaths: z.union([z.string(), z.array(z.string()).min(1)]),
2222
});
2323

24-
export type PluginArtefactOptions = z.infer<typeof pluginArtefactOptionsSchema>;
24+
export type PluginArtifactOptions = z.infer<typeof pluginArtifactOptionsSchema>;
Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, expect, it } from 'vitest';
22
import {
33
artifactGenerationCommand,
4-
pluginArtefactOptionsSchema,
4+
pluginArtifactOptionsSchema,
55
} from './configuration.js';
66

77
describe('artifactGenerationCommand', () => {
@@ -37,61 +37,61 @@ describe('artifactGenerationCommand', () => {
3737
});
3838
});
3939

40-
describe('pluginArtefactOptionsSchema', () => {
41-
it('should validate with only artefactsPaths as string', () => {
42-
const data = { artefactsPaths: 'dist/report.json' };
43-
expect(pluginArtefactOptionsSchema.safeParse(data)).toStrictEqual({
40+
describe('pluginArtifactOptionsSchema', () => {
41+
it('should validate with only artifactsPaths as string', () => {
42+
const data = { artifactsPaths: 'dist/report.json' };
43+
expect(pluginArtifactOptionsSchema.safeParse(data)).toStrictEqual({
4444
success: true,
4545
data: {
46-
artefactsPaths: 'dist/report.json',
46+
artifactsPaths: 'dist/report.json',
4747
},
4848
});
4949
});
5050

51-
it('should validate with artefactsPaths as array of strings', () => {
52-
const data = { artefactsPaths: ['dist/report.json', 'dist/summary.json'] };
53-
expect(pluginArtefactOptionsSchema.safeParse(data)).toStrictEqual({
51+
it('should validate with artifactsPaths as array of strings', () => {
52+
const data = { artifactsPaths: ['dist/report.json', 'dist/summary.json'] };
53+
expect(pluginArtifactOptionsSchema.safeParse(data)).toStrictEqual({
5454
success: true,
5555
data: {
56-
artefactsPaths: ['dist/report.json', 'dist/summary.json'],
56+
artifactsPaths: ['dist/report.json', 'dist/summary.json'],
5757
},
5858
});
5959
});
6060

61-
it('should fail if artefactsPaths is an empty array', () => {
62-
const data = { artefactsPaths: [] };
63-
expect(pluginArtefactOptionsSchema.safeParse(data).success).toBe(false);
61+
it('should fail if artifactsPaths is an empty array', () => {
62+
const data = { artifactsPaths: [] };
63+
expect(pluginArtifactOptionsSchema.safeParse(data).success).toBe(false);
6464
});
6565

66-
it('should validate with generateArtefacts and artefactsPaths', () => {
66+
it('should validate with generateArtifacts and artifactsPaths', () => {
6767
const data = {
68-
generateArtefacts: { command: 'npm', args: ['run', 'build'] },
69-
artefactsPaths: ['dist/report.json'],
68+
generateArtifacts: { command: 'npm', args: ['run', 'build'] },
69+
artifactsPaths: ['dist/report.json'],
7070
};
71-
expect(pluginArtefactOptionsSchema.safeParse(data)).toStrictEqual({
71+
expect(pluginArtifactOptionsSchema.safeParse(data)).toStrictEqual({
7272
success: true,
7373
data: {
74-
generateArtefacts: { command: 'npm', args: ['run', 'build'] },
75-
artefactsPaths: ['dist/report.json'],
74+
generateArtifacts: { command: 'npm', args: ['run', 'build'] },
75+
artifactsPaths: ['dist/report.json'],
7676
},
7777
});
7878
});
7979

80-
it('should fail if artefactsPaths is missing', () => {
81-
const data = { generateArtefacts: { command: 'npm' } };
82-
expect(pluginArtefactOptionsSchema.safeParse(data).success).toBe(false);
80+
it('should fail if artifactsPaths is missing', () => {
81+
const data = { generateArtifacts: { command: 'npm' } };
82+
expect(pluginArtifactOptionsSchema.safeParse(data).success).toBe(false);
8383
});
8484

85-
it('should fail if artefactsPaths is not string or array of strings', () => {
86-
const data = { artefactsPaths: 123 };
87-
expect(pluginArtefactOptionsSchema.safeParse(data).success).toBe(false);
85+
it('should fail if artifactsPaths is not string or array of strings', () => {
86+
const data = { artifactsPaths: 123 };
87+
expect(pluginArtifactOptionsSchema.safeParse(data).success).toBe(false);
8888
});
8989

90-
it('should fail if generateArtefacts is invalid', () => {
90+
it('should fail if generateArtifacts is invalid', () => {
9191
const data = {
92-
generateArtefacts: { command: '' },
93-
artefactsPaths: 'dist/report.json',
92+
generateArtifacts: { command: '' },
93+
artifactsPaths: 'dist/report.json',
9494
};
95-
expect(pluginArtefactOptionsSchema.safeParse(data).success).toBe(false);
95+
expect(pluginArtifactOptionsSchema.safeParse(data).success).toBe(false);
9696
});
9797
});

0 commit comments

Comments
 (0)