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

fix: try renaming core pkg to @readme/api-core #732

Merged
merged 1 commit into from
Sep 19, 2023
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
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions packages/api/src/codegen/languages/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ 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': {
reason: 'Required for TypeScript type handling.',
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',
},
};
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 },
]);

Expand Down Expand Up @@ -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([
Expand Down
4 changes: 2 additions & 2 deletions packages/api/test/__fixtures__/sdk/alby/index.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions packages/api/test/__fixtures__/sdk/optional-payload/index.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions packages/api/test/__fixtures__/sdk/petstore/index.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions packages/api/test/__fixtures__/sdk/readme/index.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions packages/api/test/__fixtures__/sdk/simple-js-cjs/index.d.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/api/test/__fixtures__/sdk/simple-js-cjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions packages/api/test/__fixtures__/sdk/simple-js-esm/index.d.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/api/test/__fixtures__/sdk/simple-js-esm/index.js
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions packages/api/test/__fixtures__/sdk/simple-ts/index.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions packages/core/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# api.core
# @readme/api-core

<p align="center">
<a href="https://npm.im/api.core"><img src="https://img.shields.io/npm/v/api.core?style=for-the-badge" alt="NPM Version"></a>
<a href="https://npm.im/api.core"><img src="https://img.shields.io/node/v/api.core?style=for-the-badge" alt="Node Version"></a>
<a href="https://npm.im/api.core"><img src="https://img.shields.io/npm/l/api.core?style=for-the-badge" alt="MIT License"></a>
<a href="https://npm.im/@readme/api-core"><img src="https://img.shields.io/npm/v/@readme/api-core?style=for-the-badge" alt="NPM Version"></a>
<a href="https://npm.im/@readme/api-core"><img src="https://img.shields.io/node/v/@readme/api-core?style=for-the-badge" alt="Node Version"></a>
<a href="https://npm.im/@readme/api-core"><img src="https://img.shields.io/npm/l/@readme/api-core?style=for-the-badge" alt="MIT License"></a>
<a href="https://github.com/readmeio/api"><img src="https://img.shields.io/github/actions/workflow/status/readmeio/api/ci.yml?branch=main&style=for-the-badge" alt="Build status"></a>
</p>

Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down