diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9496f42..453f7d1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -27,6 +27,8 @@ jobs: run: rm -rf sdk-core/src/version.ts && echo 'export default "${{ env.RELEASE_VERSION }}";' > sdk-core/src/version.ts - name: copy README run: cp README.md sdk-core/README.md + - name: copy graphics + run: cp -R graphics sdk-core/ - name: NPM Build run: npm run --prefix sdk-core clean:build - uses: JS-DevTools/npm-publish@v1 diff --git a/README.md b/README.md index 781f47a..03b619e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,15 @@ -# api-sdk -Typescript SDK for interfacing with the Plattar V3 API +

+ Plattar Logo +

+ +[![NPM](https://img.shields.io/npm/v/@plattar/sdk-core)](https://www.npmjs.com/package/@plattar/sdk-core) + +_sdk-core_ is a generative & runtime support module for automatically generating a TypeScript SDK to interface with Plattar backend services + +### Installation + +- Install using [npm](https://www.npmjs.com/package/@plattar/sdk-core) + +```console +npm install @plattar/sdk-core +``` \ No newline at end of file diff --git a/graphics/logo.png b/graphics/logo.png new file mode 100644 index 0000000..f6532bb Binary files /dev/null and b/graphics/logo.png differ diff --git a/sdk-core/package.json b/sdk-core/package.json index 00a77a9..8582972 100644 --- a/sdk-core/package.json +++ b/sdk-core/package.json @@ -21,6 +21,7 @@ "node": ">=18.0" }, "author": "plattar", + "license": "Apache-2.0", "bugs": { "url": "https://github.com/Plattar/sdk-core/issues" }, diff --git a/sdk-core/src/generator/generator.ts b/sdk-core/src/generator/generator.ts index a9b179d..1a5f042 100644 --- a/sdk-core/src/generator/generator.ts +++ b/sdk-core/src/generator/generator.ts @@ -33,6 +33,8 @@ export class Generator { await fs.promises.writeFile(`${outputDir}/${project.packageJson.fname}`, project.packageJson.data); // write the .tsconfig file await fs.promises.writeFile(`${outputDir}/${project.tsConfig.fname}`, project.tsConfig.data); + // write the README.md file + await fs.promises.writeFile(`${outputDir}/${project.readme.fname}`, project.readme.data); // begin writing all source files const allSchemas: Array> = new Array>(); diff --git a/sdk-core/src/generator/generators/project.ts b/sdk-core/src/generator/generators/project.ts index 78cb07a..3f8b951 100644 --- a/sdk-core/src/generator/generators/project.ts +++ b/sdk-core/src/generator/generators/project.ts @@ -21,6 +21,10 @@ export interface GeneratedProject { readonly npmRc: { readonly fname: string; readonly data: string; + }; + readonly readme: { + readonly fname: string; + readonly data: string; } } @@ -46,6 +50,10 @@ export class Project { npmRc: { fname: '.npmrc', data: "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" + }, + readme: { + fname: 'README.md', + data: Project.generateReadme(vars) } } } @@ -123,4 +131,15 @@ export class Project { 'package-lock.json', '.npmrc'].join('\r\n'); } + + public static generateReadme(vars: PackageJsonVars): string { + let output = `[![NPM](https://img.shields.io/npm/v/@plattar/${vars.name})](https://www.npmjs.com/package/@plattar/${vars.name})\n\n`; + output += `### About\n\n`; + output += `_${vars.name}_ v${vars.version} is automatically generated using [sdk-core](https://www.npmjs.com/package/@plattar/sdk-core) module\n\n`; + output += `### Installation\n\n`; + output += `- Install using [npm](https://www.npmjs.com/package/@plattar/${vars.name})\n\n`; + output += `\`\`\`console\nnpm install @plattar/${vars.name}\n\`\`\`\n`; + + return output; + } } \ No newline at end of file