Skip to content

Commit 45239ca

Browse files
committed
1 parent 68ac3e0 commit 45239ca

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

tools/adaptor-apis/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @openfn/adaptor-apis
22

3+
## 0.2.3
4+
5+
### Patch Changes
6+
7+
- Log errors
8+
39
## 0.2.2
410

511
### Patch Changes

tools/adaptor-apis/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openfn/adaptor-apis",
3-
"version": "0.2.2",
3+
"version": "0.2.3",
44
"description": "Describes OpenFn Adaptor APIs",
55
"type": "module",
66
"scripts": {

tools/adaptor-apis/src/gen.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import loadPkg from './util/load-pkg';
1313
const loadActualPackageJson = async (specifier: string) => {
1414
// call unpkg for a production package json
1515
const res = await fetch(
16-
`https://cdn.jsdelivr.net/npm/${specifier}/package.json`
16+
`https://cdn.jsdelivr.net/npm/${specifier}/package.json`,
1717
);
1818
if (res.status === 200) {
1919
return res.json();
@@ -24,7 +24,7 @@ const loadActualPackageJson = async (specifier: string) => {
2424
export const installAndGen = async (
2525
specifier: string,
2626
cacheDir?: string,
27-
clean?: boolean
27+
clean?: boolean,
2828
) => {
2929
try {
3030
if (!specifier.startsWith('@openfn/language-')) {
@@ -50,19 +50,21 @@ export const installAndGen = async (
5050
try {
5151
const commonPath = await preinstallAdaptor(
5252
`@openfn/language-common@${commonVersion}`,
53-
cacheDir
53+
cacheDir,
5454
);
5555
commonDocs = await gen(commonPath, { serialize: true });
5656
console.log('✅ common ready');
5757
} catch (e) {
5858
console.log('❌ error loading common');
59+
console.log(e);
5960
}
6061
}
6162
const docs = await gen(root, { serialize: true, common: commonDocs });
6263

6364
return { docs, path: path.join(root, 'docs', 'raw.json') };
6465
} catch (e: any) {
6566
console.log('Error installing adaptor docs');
67+
console.log(e);
6668
throw { message: e.message };
6769
}
6870
};
@@ -86,7 +88,7 @@ const gen = async (root: string, { serialize = false, common }: any = {}) => {
8688
await mkdir(`${root}/docs`, { recursive: true });
8789
await writeFile(
8890
`${root}/docs/raw.json`,
89-
JSON.stringify(functions, null, 2)
91+
JSON.stringify(functions, null, 2),
9092
);
9193
}
9294

@@ -103,7 +105,7 @@ export default gen;
103105
// But that's for later: first pass is parity but in a standalone package
104106
const findExternalFunctions = async (
105107
root: string,
106-
commonDefs?: string | object
108+
commonDefs?: string | object,
107109
) => {
108110
const externals: any[] = [];
109111

@@ -121,7 +123,7 @@ const findExternalFunctions = async (
121123
const commonRaw = await readFile(
122124
// '../../packages/common/docs/raw.json'
123125
path.resolve(commonDefs),
124-
'utf8'
126+
'utf8',
125127
);
126128
common = JSON.parse(commonRaw || '');
127129
} else if (commonDefs) {
@@ -135,7 +137,7 @@ const findExternalFunctions = async (
135137
// TODO: use a cached value if it exists
136138
} catch (e) {
137139
console.warn(
138-
'WARNING: failed to load common docs. This may result in incorrect documentation'
140+
'WARNING: failed to load common docs. This may result in incorrect documentation',
139141
);
140142
}
141143

@@ -178,7 +180,7 @@ const findExternalFunctions = async (
178180
const fetchFilesList = async (
179181
specifier: string,
180182
dir: string,
181-
filterDir: string[] = []
183+
filterDir: string[] = [],
182184
): Promise<any[]> => {
183185
const url = `https://api.github.com/repos/openfn/adaptors/contents/${dir}?ref=${specifier}`;
184186
const headers: HeadersInit = {
@@ -237,7 +239,7 @@ const fetchFiles = async (files: string[], output: string) => {
237239

238240
export const preinstallAdaptor = async (
239241
specifier: string,
240-
targetDir?: string
242+
targetDir?: string,
241243
): Promise<string> => {
242244
const { name, version } = getNameAndVersion(specifier);
243245
const shortName = name.split('@openfn/language-')[1];

0 commit comments

Comments
 (0)