Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop into main #78

Merged
merged 13 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .changeset/warm-camels-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
'google-webfonts-client': patch
'validation-adapters': patch
'validation-adapter': patch
'elevenlabs-client': patch
'feature-logger': patch
'@blgc/openapi-router': patch
'feature-fetch': patch
'feature-react': patch
'feature-state': patch
'figma-connect': patch
'xml-tokenizer': patch
'eprel-client': patch
'feature-form': patch
'@blgc/config': patch
'@blgc/utils': patch
'@blgc/cli': patch
---

Bumped dependency versions
4 changes: 2 additions & 2 deletions examples/feature-state/react/counter/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ export default function App() {
<p>{counter}</p>
<button
onClick={() => {
$counter.set($counter.get() + 1);
$counter.set((c) => c + 1);
}}
>
+
</button>
<button
onClick={() => {
$counter.set($counter.get() - 1);
$counter.set((c) => c - 1);
}}
>
-
Expand Down
12 changes: 6 additions & 6 deletions examples/openapi-router/express/petstore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
"main": "./dist/index.js",
"dependencies": {
"@blgc/openapi-router": "workspace:*",
"express": "^4.19.2",
"valibot": "^0.39.0",
"express": "^4.21.1",
"valibot": "^0.42.1",
"validation-adapters": "workspace:*"
},
"devDependencies": {
"@blgc/config": "workspace:*",
"@types/express": "^4.17.21",
"@types/node": "^22.5.1",
"nodemon": "^3.1.4",
"openapi-typescript": "^7.3.0",
"@types/express": "^5.0.0",
"@types/node": "^22.8.5",
"nodemon": "^3.1.7",
"openapi-typescript": "^7.4.2",
"ts-node": "^10.9.2"
},
"files": [
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@
"@blgc/cli": "workspace:*",
"@blgc/config": "workspace:*",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.8",
"@changesets/cli": "^2.27.9",
"@ianvs/prettier-plugin-sort-imports": "^4.3.1",
"@size-limit/esbuild": "^11.1.5",
"@size-limit/esbuild-why": "^11.1.5",
"@size-limit/preset-small-lib": "^11.1.5",
"@size-limit/esbuild": "^11.1.6",
"@size-limit/esbuild-why": "^11.1.6",
"@size-limit/preset-small-lib": "^11.1.6",
"eslint": "^8.57.0",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.6",
"prettier-plugin-tailwindcss": "^0.6.8",
"shx": "^0.3.4",
"size-limit": "^11.1.5",
"turbo": "^2.1.2",
"typescript": "^5.6.2",
"vitest": "^2.1.1"
"size-limit": "^11.1.6",
"turbo": "^2.2.3",
"typescript": "^5.6.3",
"vitest": "^2.1.4"
},
"packageManager": "[email protected]",
"pnpm": {
Expand Down
35 changes: 22 additions & 13 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@blgc/cli",
"description": "Straightforward CLI to bundle Typescript libraries with presets, powered by Rollup and Esbuild",
"version": "0.0.17",
"version": "0.0.18",
"private": false,
"bin": {
"blgc": "./bin/run"
Expand Down Expand Up @@ -31,36 +31,45 @@
},
"homepage": "https://builder.group/?source=package-json",
"dependencies": {
"@oclif/core": "^3.26.9",
"@rollup/plugin-commonjs": "^25.0.8",
"@rollup/plugin-html": "^1.0.3",
"@oclif/core": "^4.0.31",
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-html": "^1.0.4",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-replace": "^6.0.1",
"chalk": "^4.1.2",
"dotenv": "^16.4.5",
"execa": "^8.0.1",
"figlet": "^1.7.0",
"figlet": "^1.8.0",
"lodash": "^4.17.21",
"maxmin": "^4.1.0",
"rollup": "^4.18.0",
"rollup": "^4.24.4",
"rollup-plugin-bundle-size": "^1.0.3",
"rollup-plugin-esbuild": "^6.1.1",
"rollup-plugin-license": "^3.4.0",
"rollup-plugin-license": "^3.5.3",
"rollup-plugin-node-externals": "^5.1.3",
"rollup-plugin-postcss": "^4.0.2"
},
"devDependencies": {
"@types/figlet": "^1.5.8",
"@types/lodash": "^4.17.4",
"@types/node": "^20.14.1",
"type-fest": "^4.18.3"
"@types/figlet": "^1.7.0",
"@types/lodash": "^4.17.13",
"@types/node": "^22.9.0",
"type-fest": "^4.26.1"
},
"files": [
"dist",
"bin",
"README.md"
],
"pnpm": {
"updateConfig": {
"ignoreDependencies": [
"chalk",
"execa",
"rollup-plugin-node-externals"
]
}
},
"oclif": {
"bin": "blgc",
"dirname": "blgc",
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/bundle/figma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ export default class Figma extends DynCommand {
)}.`
);
this.log(`\n`);
this.exit(0);
}

private async getPackageJson(): Promise<PackageJson | null> {
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/bundle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ export default class Bundle extends DynCommand {
)}.`
);
this.log(`\n`);
this.exit(0);
}

private async getPackageJson(): Promise<PackageJson | null> {
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/bundle/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export default class Node extends DynCommand {
)}.`
);
this.log(`\n`);
this.exit(0);
}

private async getPackageJson(): Promise<PackageJson | null> {
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/commands/bundle/rust.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,5 @@ export default class Rust extends DynCommand {
)}.`
);
this.log(`\n`);
this.exit(0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export async function createBaseRollupConfig(
resolveDTsSource: true
}),
'import-css', // Plugin placeholder for "rollup-plugin-import-css"
'rollup-plugin-sass', // Plugin placeholder for "rollup-plugin-sass"
'wasm', // Plugin placeholder for "rollup-plugin-wasm"
// Transpile TypeScript code to JavaScript (ES6), and minify in production
esbuild({
Expand Down
6 changes: 3 additions & 3 deletions packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
"homepage": "https://builder.group/?source=github",
"dependencies": {
"@vercel/style-guide": "^6.0.0",
"eslint-config-turbo": "^2.0.14",
"vite-tsconfig-paths": "^5.0.1"
"eslint-config-turbo": "^2.2.3",
"vite-tsconfig-paths": "^5.1.0"
},
"peerDependencies": {
"@next/eslint-plugin-next": "^14.2.5",
"@next/eslint-plugin-next": "^14.2.6",
"eslint": "^8.57.0"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/elevenlabs-client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "elevenlabs-client",
"description": "Typesafe and straightforward fetch client for interacting with the ElevenLabs API using feature-fetch",
"version": "0.0.3",
"version": "0.0.8",
"private": false,
"scripts": {
"build": "shx rm -rf dist && chmod +x ../../scripts/cli.sh && ../../scripts/cli.sh bundle",
Expand Down Expand Up @@ -36,9 +36,9 @@
},
"devDependencies": {
"@blgc/config": "workspace:*",
"@types/node": "^22.5.0",
"@types/node": "^22.9.0",
"dotenv": "^16.4.5",
"openapi-typescript": "^7.3.0"
"openapi-typescript": "^7.4.2"
},
"files": [
"dist",
Expand Down
26 changes: 21 additions & 5 deletions packages/elevenlabs-client/src/create-elevenlabs-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,36 @@ describe('createElevenLabsClient function tests', () => {
});
});

it('should work', async () => {
it('should genertate text to speak', async () => {
const result = await client.generateTextToSpeach({
text: 'Hello World',
text: 'Hello',
voice: 'Sarah' // EXAVITQu4vr4xnSDxMaL
});

const audioStream = result.unwrap();
const audioStream = result.unwrap().stream;
const filePath = path.join(process.cwd(), 'test-audio.mp3');

// Write the stream to the file using pipeline
await pipelineAsync(audioStream, fs.createWriteStream(filePath));

// Confirm that the file exists after the stream is written
const fileExists = fs.existsSync(filePath);
expect(fileExists).toBe(true);
});

it('should get voices', async () => {
const result = await client.getVoices();

// const voicesMap = result.unwrap().voices.reduce(
// (map, voice) => ({
// ...map,
// [voice.name]: {
// voiceId: voice.voice_id,
// labels: voice.labels,
// previewUrl: voice.preview_url
// }
// }),
// {}
// );

expect(result.isOk()).toBe(true);
});
});
15 changes: 12 additions & 3 deletions packages/elevenlabs-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@ declare module 'feature-fetch' {
interface TThirdPartyFeatures<GPaths> {
elevenlabs: {
getVoices(): Promise<TResult<TVoiceResponse, FetchError>>;
generateTextToSpeach(
config: TGenerateTextToSpeechConfig
): Promise<TResult<ReadableStream, FetchError>>;
generateTextToSpeach(config: TGenerateTextToSpeechConfig): Promise<
TResult<
{
stream: ReadableStream;
characterCost?: string;
contentType?: string;
historyItemId?: string;
requestId?: string;
},
FetchError
>
>;
};
}
}
22 changes: 18 additions & 4 deletions packages/elevenlabs-client/src/with-elevenlabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ export function withElevenLabs<GSelectedFeatureKeys extends TFeatureKeys[]>(

const elevenLabsFeatures: TSelectFeatures<['elevenlabs']> = {
async getVoices(this: TFetchClient<['base', 'openapi', 'elevenlabs'], paths>) {
const result = await this.get('/v1/voices', { queryParams: { show_legacy: true } });
return mapOk(result, (ok) => ok.data);
return mapOk(
await this.get('/v1/voices', { queryParams: { show_legacy: true } }),
(ok) => ok.data
);
},
async generateTextToSpeach(
this: TFetchClient<['base', 'openapi', 'elevenlabs'], paths>,
Expand Down Expand Up @@ -94,11 +96,23 @@ export function withElevenLabs<GSelectedFeatureKeys extends TFeatureKeys[]>(
if (result.isErr()) {
return Err(result.error);
}
if (result.value.data == null) {
const {
value: {
data,
response: { headers }
}
} = result;

if (data == null) {
return Err(new FetchError('#ERR_INVALID_STREAM'));
}

return Ok(result.value.data);
const contentType = headers.get('content-type') ?? undefined;
const characterCost = headers.get('character-cost') ?? undefined;
const historyItemId = headers.get('history-item-id') ?? undefined;
const requestId = headers.get('request-id') ?? undefined;

return Ok({ stream: data, contentType, characterCost, historyItemId, requestId });
}
};

Expand Down
6 changes: 3 additions & 3 deletions packages/eprel-client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "eprel-client",
"description": "Typesafe and straightforward fetch client for interacting with the European Product Registry for Energy Labelling (EPREL) API using feature-fetch",
"version": "0.0.17",
"version": "0.0.18",
"private": false,
"scripts": {
"build": "shx rm -rf dist && chmod +x ../../scripts/cli.sh && ../../scripts/cli.sh bundle",
Expand Down Expand Up @@ -36,9 +36,9 @@
},
"devDependencies": {
"@blgc/config": "workspace:*",
"@types/node": "^22.5.0",
"@types/node": "^22.9.0",
"dotenv": "^16.4.5",
"openapi-typescript": "^7.3.0"
"openapi-typescript": "^7.4.2"
},
"files": [
"dist",
Expand Down
6 changes: 6 additions & 0 deletions packages/feature-fetch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,3 +279,9 @@ const fetchClient = withDelay(
```

- **`delayInMs`**: Delay duration in milliseconds

## ❓ FAQ

### Why is `@0no-co/graphql.web` a dependency if it's not always used?

`@0no-co/graphql.web` is listed as a dependency because it's dynamically imported in the `getQueryString()` function. If the function isn’t used, Webpack's tree shaking should exclude it from the final bundle. This ensures that only necessary modules are included, keeping your build clean.
8 changes: 4 additions & 4 deletions packages/feature-fetch/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "feature-fetch",
"description": "Straightforward, typesafe, and feature-based fetch wrapper supporting OpenAPI types",
"version": "0.0.27",
"version": "0.0.30",
"private": false,
"scripts": {
"build": "shx rm -rf dist && chmod +x ../../scripts/cli.sh && ../../scripts/cli.sh bundle",
Expand Down Expand Up @@ -30,15 +30,15 @@
},
"homepage": "https://builder.group/?source=package-json",
"dependencies": {
"@0no-co/graphql.web": "^1.0.11",
"@blgc/types": "workspace:*",
"@blgc/utils": "workspace:*"
},
"devDependencies": {
"@0no-co/graphql.web": "^1.0.8",
"@blgc/config": "workspace:*",
"@types/node": "^20.14.1",
"@types/node": "^22.9.0",
"@types/url-parse": "^1.4.11",
"msw": "^2.3.1"
"msw": "^2.6.0"
},
"files": [
"dist",
Expand Down
Loading