diff --git a/package-lock.json b/package-lock.json index 76f89c5d..efa37620 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3262,6 +3262,10 @@ "node": ">=12" } }, + "node_modules/@readme/api-core": { + "resolved": "packages/core", + "link": true + }, "node_modules/@readme/better-ajv-errors": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/@readme/better-ajv-errors/-/better-ajv-errors-1.6.0.tgz", @@ -5260,10 +5264,6 @@ "resolved": "packages/api", "link": true }, - "node_modules/api.core": { - "resolved": "packages/core", - "link": true - }, "node_modules/aproba": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", @@ -22124,6 +22124,7 @@ }, "devDependencies": { "@api/test-utils": "file:../test-utils", + "@readme/api-core": "file:../core", "@readme/oas-examples": "^5.12.0", "@types/js-yaml": "^4.0.5", "@types/lodash.camelcase": "^4.3.7", @@ -22135,7 +22136,6 @@ "@types/ssri": "^7.1.1", "@types/validate-npm-package-name": "^4.0.0", "@vitest/coverage-v8": "^0.34.4", - "api.core": "file:../core", "fetch-mock": "^9.11.0", "oas-normalize": "^8.3.2", "type-fest": "^4.3.1", @@ -22155,7 +22155,7 @@ } }, "packages/core": { - "name": "api.core", + "name": "@readme/api-core", "version": "7.0.0-alpha.0", "license": "MIT", "dependencies": { diff --git a/packages/api/package.json b/packages/api/package.json index da64aa5f..2f8ca71f 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -69,7 +69,7 @@ "@types/ssri": "^7.1.1", "@types/validate-npm-package-name": "^4.0.0", "@vitest/coverage-v8": "^0.34.4", - "api.core": "file:../core", + "@readme/api-core": "file:../core", "fetch-mock": "^9.11.0", "oas-normalize": "^8.3.2", "type-fest": "^4.3.1", diff --git a/packages/api/src/codegen/languages/typescript.ts b/packages/api/src/codegen/languages/typescript.ts index 9570fb0f..faa2320a 100644 --- a/packages/api/src/codegen/languages/typescript.ts +++ b/packages/api/src/codegen/languages/typescript.ts @@ -86,7 +86,7 @@ export default class TSGenerator extends CodeGeneratorLanguage { this.requiredPackages = { api: { - reason: "Required for the `api.core` library that the codegen'd SDK uses for making requests.", + reason: "Required for the `@readme/api-core` library that the codegen'd SDK uses for making requests.", url: 'https://npm.im/api', }, 'json-schema-to-ts': { @@ -94,7 +94,7 @@ export default class TSGenerator extends CodeGeneratorLanguage { url: 'https://npm.im/json-schema-to-ts', }, oas: { - reason: 'Used within `api.core` and is also loaded for TypeScript types.', + reason: 'Used within `@readme/api-core` and is also loaded for TypeScript types.', url: 'https://npm.im/oas', }, }; @@ -229,7 +229,7 @@ export default class TSGenerator extends CodeGeneratorLanguage { sdkSource .getImportDeclarations() .find(id => id.getText().includes('HTTPMethodRange')) - ?.replaceWithText("import type { ConfigOptions, FetchResponse } from 'api.core';"); + ?.replaceWithText("import type { ConfigOptions, FetchResponse } from '@readme/api-core';"); } if (this.outputJS) { @@ -300,10 +300,10 @@ export default class TSGenerator extends CodeGeneratorLanguage { { // `HTTPMethodRange` will be conditionally removed later if it ends up not being used. defaultImport: 'type { ConfigOptions, FetchResponse, HTTPMethodRange }', - moduleSpecifier: 'api.core', + moduleSpecifier: '@readme/api-core', }, { defaultImport: 'Oas', moduleSpecifier: 'oas' }, - { defaultImport: 'APICore', moduleSpecifier: 'api.core' }, + { defaultImport: 'APICore', moduleSpecifier: '@readme/api-core' }, { defaultImport: 'definition', moduleSpecifier: this.specPath }, ]); @@ -710,7 +710,7 @@ sdk.server('https://eu.api.example.com/v14');`), // our `metadata` parameter is actually required for this operation this is the only way we're // able to have an optional `body` parameter be present before `metadata`. // - // Thankfully our core fetch work in `api.core` is able to do the proper determination to + // Thankfully our core fetch work in `@readme/api-core` is able to do the proper determination to // see if what the user is supplying is `metadata` or `body` content when they supply one or // both. operationIdAccessor.addParameters([ diff --git a/packages/api/test/__fixtures__/sdk/alby/index.ts b/packages/api/test/__fixtures__/sdk/alby/index.ts index 4b38353d..b020444f 100644 --- a/packages/api/test/__fixtures__/sdk/alby/index.ts +++ b/packages/api/test/__fixtures__/sdk/alby/index.ts @@ -1,7 +1,7 @@ import type * as types from './types'; -import type { ConfigOptions, FetchResponse } from 'api.core'; +import type { ConfigOptions, FetchResponse } from '@readme/api-core'; import Oas from 'oas'; -import APICore from 'api.core'; +import APICore from '@readme/api-core'; import definition from '@api/test-utils/definitions/alby.json'; class SDK { diff --git a/packages/api/test/__fixtures__/sdk/operationid-quirks/index.ts b/packages/api/test/__fixtures__/sdk/operationid-quirks/index.ts index b6a2eaaa..4b0f7562 100644 --- a/packages/api/test/__fixtures__/sdk/operationid-quirks/index.ts +++ b/packages/api/test/__fixtures__/sdk/operationid-quirks/index.ts @@ -1,6 +1,6 @@ -import type { ConfigOptions, FetchResponse } from 'api.core'; +import type { ConfigOptions, FetchResponse } from '@readme/api-core'; import Oas from 'oas'; -import APICore from 'api.core'; +import APICore from '@readme/api-core'; import definition from '@api/test-utils/definitions/operationid-quirks.json'; class SDK { diff --git a/packages/api/test/__fixtures__/sdk/optional-payload/index.ts b/packages/api/test/__fixtures__/sdk/optional-payload/index.ts index 0f2be611..f0b145d4 100644 --- a/packages/api/test/__fixtures__/sdk/optional-payload/index.ts +++ b/packages/api/test/__fixtures__/sdk/optional-payload/index.ts @@ -1,7 +1,7 @@ import type * as types from './types'; -import type { ConfigOptions, FetchResponse } from 'api.core'; +import type { ConfigOptions, FetchResponse } from '@readme/api-core'; import Oas from 'oas'; -import APICore from 'api.core'; +import APICore from '@readme/api-core'; import definition from '@api/test-utils/definitions/optional-payload.json'; class SDK { diff --git a/packages/api/test/__fixtures__/sdk/petstore/index.ts b/packages/api/test/__fixtures__/sdk/petstore/index.ts index 7beb3c61..03e12c83 100644 --- a/packages/api/test/__fixtures__/sdk/petstore/index.ts +++ b/packages/api/test/__fixtures__/sdk/petstore/index.ts @@ -1,7 +1,7 @@ import type * as types from './types'; -import type { ConfigOptions, FetchResponse } from 'api.core'; +import type { ConfigOptions, FetchResponse } from '@readme/api-core'; import Oas from 'oas'; -import APICore from 'api.core'; +import APICore from '@readme/api-core'; import definition from '@readme/oas-examples/3.0/json/petstore.json'; class SDK { diff --git a/packages/api/test/__fixtures__/sdk/readme/index.ts b/packages/api/test/__fixtures__/sdk/readme/index.ts index 93ac4ac6..275bc650 100644 --- a/packages/api/test/__fixtures__/sdk/readme/index.ts +++ b/packages/api/test/__fixtures__/sdk/readme/index.ts @@ -1,7 +1,7 @@ import type * as types from './types'; -import type { ConfigOptions, FetchResponse } from 'api.core'; +import type { ConfigOptions, FetchResponse } from '@readme/api-core'; import Oas from 'oas'; -import APICore from 'api.core'; +import APICore from '@readme/api-core'; import definition from '@readme/oas-examples/3.0/json/readme.json'; class SDK { diff --git a/packages/api/test/__fixtures__/sdk/response-title-quirks/index.ts b/packages/api/test/__fixtures__/sdk/response-title-quirks/index.ts index e2c227bc..17b3a68e 100644 --- a/packages/api/test/__fixtures__/sdk/response-title-quirks/index.ts +++ b/packages/api/test/__fixtures__/sdk/response-title-quirks/index.ts @@ -1,7 +1,7 @@ import type * as types from './types'; -import type { ConfigOptions, FetchResponse, HTTPMethodRange } from 'api.core'; +import type { ConfigOptions, FetchResponse, HTTPMethodRange } from '@readme/api-core'; import Oas from 'oas'; -import APICore from 'api.core'; +import APICore from '@readme/api-core'; import definition from '@api/test-utils/definitions/response-title-quirks.json'; class SDK { diff --git a/packages/api/test/__fixtures__/sdk/simple-js-cjs/index.d.ts b/packages/api/test/__fixtures__/sdk/simple-js-cjs/index.d.ts index f472a493..6476e472 100644 --- a/packages/api/test/__fixtures__/sdk/simple-js-cjs/index.d.ts +++ b/packages/api/test/__fixtures__/sdk/simple-js-cjs/index.d.ts @@ -1,7 +1,7 @@ import type * as types from './types'; -import type { ConfigOptions, FetchResponse } from 'api.core'; +import type { ConfigOptions, FetchResponse } from '@readme/api-core'; import Oas from 'oas'; -import APICore from 'api.core'; +import APICore from '@readme/api-core'; declare class SDK { spec: Oas; core: APICore; diff --git a/packages/api/test/__fixtures__/sdk/simple-js-cjs/index.js b/packages/api/test/__fixtures__/sdk/simple-js-cjs/index.js index 6cadd9b4..30a966dd 100644 --- a/packages/api/test/__fixtures__/sdk/simple-js-cjs/index.js +++ b/packages/api/test/__fixtures__/sdk/simple-js-cjs/index.js @@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; var oas_1 = __importDefault(require("oas")); -var api_core_1 = __importDefault(require("api.core")); +var api_core_1 = __importDefault(require("@readme/api-core")); var simple_json_1 = __importDefault(require("@api/test-utils/definitions/simple.json")); var SDK = /** @class */ (function () { function SDK() { diff --git a/packages/api/test/__fixtures__/sdk/simple-js-esm/index.d.ts b/packages/api/test/__fixtures__/sdk/simple-js-esm/index.d.ts index c0ed8d1a..19ddf0d2 100644 --- a/packages/api/test/__fixtures__/sdk/simple-js-esm/index.d.ts +++ b/packages/api/test/__fixtures__/sdk/simple-js-esm/index.d.ts @@ -1,7 +1,7 @@ import type * as types from './types'; -import type { ConfigOptions, FetchResponse } from 'api.core'; +import type { ConfigOptions, FetchResponse } from '@readme/api-core'; import Oas from 'oas'; -import APICore from 'api.core'; +import APICore from '@readme/api-core'; declare class SDK { spec: Oas; core: APICore; diff --git a/packages/api/test/__fixtures__/sdk/simple-js-esm/index.js b/packages/api/test/__fixtures__/sdk/simple-js-esm/index.js index 998113d0..a1a65782 100644 --- a/packages/api/test/__fixtures__/sdk/simple-js-esm/index.js +++ b/packages/api/test/__fixtures__/sdk/simple-js-esm/index.js @@ -1,5 +1,5 @@ import Oas from 'oas'; -import APICore from 'api.core'; +import APICore from '@readme/api-core'; import definition from '@api/test-utils/definitions/simple.json'; class SDK { constructor() { diff --git a/packages/api/test/__fixtures__/sdk/simple-ts/index.ts b/packages/api/test/__fixtures__/sdk/simple-ts/index.ts index 4ec9fd43..3e3ccd94 100644 --- a/packages/api/test/__fixtures__/sdk/simple-ts/index.ts +++ b/packages/api/test/__fixtures__/sdk/simple-ts/index.ts @@ -1,7 +1,7 @@ import type * as types from './types'; -import type { ConfigOptions, FetchResponse } from 'api.core'; +import type { ConfigOptions, FetchResponse } from '@readme/api-core'; import Oas from 'oas'; -import APICore from 'api.core'; +import APICore from '@readme/api-core'; import definition from '@api/test-utils/definitions/simple.json'; class SDK { diff --git a/packages/core/README.md b/packages/core/README.md index 7bdf70ea..2c76d0bc 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -1,9 +1,9 @@ -# api.core +# @readme/api-core

- NPM Version - Node Version - MIT License + NPM Version + Node Version + MIT License Build status

diff --git a/packages/core/package.json b/packages/core/package.json index 70077d55..58046db3 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,5 +1,5 @@ { - "name": "api.core", + "name": "@readme/api-core", "version": "7.0.0-alpha.0", "description": "The magic behind `api` 🧙", "main": "./dist/index.js",