@viechoice/scrape-service-lib
v1.1.21
Published
Generated TypeScript client wrapping the marketing scrape service API.
Downloads
103
Readme
scrape-service-lib
Generated TypeScript client wrapping the marketing scrape service API.
Project structure
api/: OpenAPI definitions (api.cleaned.yamldrives the generator).scripts/: helper scripts for the generator (custom request + wrapper CLI).src/: TypeScript source generated from the OpenAPI spec plus lightweight wrappers.dist/: compiled output produced bypnpm run build.
Key scripts
pnpm run generate: regenerates the TypeScript client from the OpenAPI spec.pnpm run build: compiles the client intodist/.pnpm run prepare: convenience script that runs both commands; executed automatically before publishing.
Publishing to npm
- Store the npm automation token as the
NPM_TOKENsecret in the GitHub repository (Settings → Secrets and variables → Actions). - Push changes to
mainorproduction. ThePublish library to npmworkflow builds the client and runsnpm publish --access public. - Ensure
package.json#versionis bumped before pushing, otherwise the publish step will fail because npm rejects duplicate versions.
The package is published under the scoped name @viechoice/scrape-service-lib with public access. Install directly via:
pnpm add @viechoice/scrape-service-libHow to consume the client
Install normally in your application:
pnpm add @viechoice/scrape-service-libInstantiate the generated client (simplified example). If you pass a
TOKEN(or per-requestheaders.Authorization), the client skips the browserlocalStoragerefresh logic automatically:import { AppClient, DefaultService } from '@viechoice/scrape-service-lib'; const client = new AppClient({ BASE: 'https://your-api-host', TOKEN: process.env.SCRAPE_SERVICE_TOKEN, HEADERS: { 'x-api-key-service': process.env.SCRAPE_SERVICE_API_KEY ?? '', }, }); const data = await DefaultService.scrapeControllerScrape({ body: { socialNetwork: 'FACEBOOK', contentType: 'POST', url: 'https://facebook.com/some-post', }, }); console.log(data);For CI, you only need npm auth if the registry requires it globally (public packages do not). Keep
NPM_TOKENhandy for publishing workflows.
