-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpacktory.config.js
112 lines (107 loc) · 4.64 KB
/
packtory.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// @ts-check
import fs from 'node:fs/promises';
import path from 'node:path';
const projectFolder = process.cwd();
const sourcesFolder = path.join(projectFolder, 'target/build/source');
const npmToken = process.env.NPM_TOKEN;
/** @returns {Promise<import('@packtory/cli').PacktoryConfig>} */
export async function buildConfig() {
const packageJsonContent = await fs.readFile('./package.json', { encoding: 'utf8' });
const packageJson = JSON.parse(packageJsonContent);
if (npmToken === undefined) {
throw new Error('Missing NPM_TOKEN environment variable');
}
return {
registrySettings: { token: npmToken },
commonPackageSettings: {
sourcesFolder,
mainPackageJson: packageJson,
includeSourceMapFiles: true,
additionalFiles: [
{
sourceFilePath: path.join(projectFolder, 'LICENSE'),
targetFilePath: 'LICENSE'
}
],
additionalPackageJsonAttributes: {
repository: packageJson.repository,
license: packageJson.license,
author: packageJson.author,
engines: packageJson.engines
}
},
packages: [
{
name: '@schema-hub/zod-error-formatter',
entryPoints: [
{
js: 'zod-error-formatter/formatter.js',
declarationFile: 'zod-error-formatter/formatter.d.ts'
}
],
additionalPackageJsonAttributes: {
description: 'Simple and easy-to-understand zod error messages',
keywords: ['zod', 'zod-error', 'zod-format', 'formatter', 'error-formatter']
},
additionalFiles: [{
sourceFilePath: path.join(projectFolder, 'source/zod-error-formatter/readme.md'),
targetFilePath: 'readme.md'
}]
},
{
name: '@schema-hub/zod-graphql-query-builder',
entryPoints: [
{
js: 'zod-graphql-query-builder/entry-point.js',
declarationFile: 'zod-graphql-query-builder/entry-point.d.ts'
}
],
additionalPackageJsonAttributes: {
description: 'Transforms Zod schemas into GraphQL queries',
keywords: ['zod', 'zod-graphql', 'graphql', 'graphql-query', 'query-builder', 'graphql-builder']
},
additionalFiles: [{
sourceFilePath: path.join(projectFolder, 'source/zod-graphql-query-builder/readme.md'),
targetFilePath: 'readme.md'
}]
},
{
name: '@schema-hub/zod-graphql-client',
entryPoints: [
{
js: 'zod-graphql-client/entry-point.js',
declarationFile: 'zod-graphql-client/entry-point.d.ts'
}
],
additionalPackageJsonAttributes: {
description: 'A lightweight and type-safe zod-based GraphQL client',
keywords: ['zod', 'zod-graphql', 'graphql', 'graphql-query', 'graphql-client', 'graphql-builder']
},
additionalFiles: [{
sourceFilePath: path.join(projectFolder, 'source/zod-graphql-client/readme.md'),
targetFilePath: 'readme.md'
}],
bundleDependencies: ['@schema-hub/zod-graphql-query-builder', '@schema-hub/zod-error-formatter']
},
{
name: '@schema-hub/zod-graphql-fake-client',
entryPoints: [
{
js: 'zod-graphql-fake-client/fake-client.js',
declarationFile: 'zod-graphql-fake-client/fake-client.d.ts'
}
],
additionalPackageJsonAttributes: {
description: 'Fake GraphQL client for testing @schema-hub/zod-graphql-client',
keywords: ['fake-graphql-client', 'testing-client']
},
additionalFiles: [{
sourceFilePath: path.join(projectFolder, 'source/zod-graphql-fake-client/readme.md'),
targetFilePath: 'readme.md'
}],
bundlePeerDependencies: ['@schema-hub/zod-graphql-client'],
bundleDependencies: ['@schema-hub/zod-graphql-query-builder']
}
]
};
}