Skip to content

Commit

Permalink
Tristan/reduce file amount (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
baked-dev authored Dec 8, 2022
1 parent ccbd31b commit c49cbb0
Show file tree
Hide file tree
Showing 19 changed files with 171 additions and 127 deletions.
74 changes: 1 addition & 73 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,73 +1 @@
# Turborepo starter

This is an official pnpm starter turborepo.

## What's inside?

This turborepo uses [pnpm](https://pnpm.io) as a package manager. It includes the following packages/apps:

### Apps and Packages

- `docs`: a [Next.js](https://nextjs.org/) app
- `web`: another [Next.js](https://nextjs.org/) app
- `ui`: a stub React component library shared by both `web` and `docs` applications
- `eslint-config-custom`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`)
- `tsconfig`: `tsconfig.json`s used throughout the monorepo

Each package/app is 100% [TypeScript](https://www.typescriptlang.org/).

### Utilities

This turborepo has some additional tools already setup for you:

- [TypeScript](https://www.typescriptlang.org/) for static type checking
- [ESLint](https://eslint.org/) for code linting
- [Prettier](https://prettier.io) for code formatting

### Build

To build all apps and packages, run the following command:

```
cd my-turborepo
pnpm run build
```

### Develop

To develop all apps and packages, run the following command:

```
cd my-turborepo
pnpm run dev
```

### Remote Caching

Turborepo can use a technique known as [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching) to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.

By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can [create one](https://vercel.com/signup), then enter the following commands:

```
cd my-turborepo
pnpm dlx turbo login
```

This will authenticate the Turborepo CLI with your [Vercel account](https://vercel.com/docs/concepts/personal-accounts/overview).

Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your turborepo:

```
pnpm dlx turbo link
```

## Useful Links

Learn more about the power of Turborepo:

- [Pipelines](https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks)
- [Caching](https://turbo.build/repo/docs/core-concepts/caching)
- [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching)
- [Filtering](https://turbo.build/repo/docs/core-concepts/monorepos/filtering)
- [Configuration Options](https://turbo.build/repo/docs/reference/configuration)
- [CLI Usage](https://turbo.build/repo/docs/reference/command-line-reference)
# whop-sdk-ts (WIP)
7 changes: 7 additions & 0 deletions examples/next/lib/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { MembersService } from "@whop-sdk/core/node/services/MembersService";

export const logMembers = async (sdk: MembersService) => {
await sdk.listMembers({
whopCompany: process.env.NEXT_PUBLIC_WHOP_COMPANY_ID!,
});
};
9 changes: 4 additions & 5 deletions examples/next/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { WhopSDK } from "@whop-sdk/core/browser";
import { logMembers } from "./lib/test";

const middleware = async () => {
console.log(
await new WhopSDK({
await logMembers(
new WhopSDK({
TOKEN: process.env.WHOP_BOT_TOKEN,
}).members.listMembers({
whopCompany: process.env.NEXT_PUBLIC_WHOP_COMPANY_ID!,
})
}).members
);
};

Expand Down
9 changes: 4 additions & 5 deletions examples/next/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Head from "next/head";
import Image from "next/image";
import styles from "../styles/Home.module.css";
import { WhopSDK } from "@whop-sdk/core";
import { logMembers } from "../lib/test";

export default function Home() {
return (
Expand Down Expand Up @@ -74,12 +75,10 @@ export default function Home() {

export const getServerSideProps: GetServerSideProps = async () => {
console.log(WhopSDK);
console.log(
await new WhopSDK({
await logMembers(
new WhopSDK({
TOKEN: process.env.WHOP_BOT_TOKEN,
}).members.listMembers({
whopCompany: process.env.NEXT_PUBLIC_WHOP_COMPANY_ID!,
})
}).members
);
return {
props: {},
Expand Down
5 changes: 4 additions & 1 deletion examples/next/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true
"incremental": true,
"paths": {
"@/lib/*": ["/lib/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "whop-sdk-ts",
"version": "0.0.3-canary.5",
"version": "0.0.3-canary.6",
"private": true,
"workspaces": [
"apps/*",
Expand Down
15 changes: 10 additions & 5 deletions packages/core/.gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
src/browser
src/models
src/node
**/*.cjs
**/*.cjs.map
**/*.mjs
**/*.mjs.map
**/*.d.ts
src/core
/browser
/models
/core
/node
/*.cjs
/*.cjs.map
/*.mjs
/*.mjs.map
/*.d.ts
14 changes: 7 additions & 7 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
"exports": {
".": {
"import": "./index.mjs",
"require": "./index.cjs"
"require": "./index.cjs",
"types": "./index.d.ts"
},
"./browser": {
"import": "./browser/index.mjs",
"require": "./browser/index.cjs"
"require": "./browser/index.cjs",
"types": "./browser/index.d.ts"
}
},
"scripts": {
"build": "rimraf dist && pnpm run gen && buildr",
"gen": "rimraf src/base src/node src/browser && concurrently \"pnpm run gen:base\" \"pnpm run gen:node\" \"pnpm run gen:browser\" && node scripts/fix-generated-sdk.js",
"gen:base": "openapi --input ../spec/openapi.json --output ./src/base --useOptions --indent 2 --name WhopSDK --exportCore false",
"gen:node": "openapi --input ../spec/openapi.json --output ./src/node --useOptions --indent 2 --name WhopSDK --request request/node.ts --exportModels false --exportServices false",
"gen:browser": "openapi --input ../spec/openapi.json --output ./src/browser --useOptions --indent 2 --name WhopSDK --request request/browser.ts --exportModels false --exportServices false",
"build": "rimraf browser code models node && pnpm run gen && buildr",
"gen": "rimraf src/base src/browser src/core src/models src/node && pnpm run gen:base && node scripts/fix-generated-sdk.js",
"gen:base": "openapi --input ../spec/openapi.json --output ./src/base --useOptions --indent 2 --name WhopSDK",
"release": "publishr"
},
"engines": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ApiRequestOptions } from './ApiRequestOptions';
import { BaseHttpRequest } from './BaseHttpRequest';
import type { CancelablePromise } from './CancelablePromise';
import type { OpenAPIConfig } from './OpenAPI';
import { request as __request } from './request';
import type { ApiRequestOptions } from "../../core/ApiRequestOptions";
import { BaseHttpRequest } from "../../core/BaseHttpRequest";
import type { CancelablePromise } from "../../core/CancelablePromise";
import type { OpenAPIConfig } from "../../core/OpenAPI";
import { request as __request } from "./request";

export class FetchHttpRequest extends BaseHttpRequest {

constructor(config: OpenAPIConfig) {
super(config);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import { ApiError } from "./ApiError";
import type { ApiRequestOptions } from "./ApiRequestOptions";
import type { ApiResult } from "./ApiResult";
import { CancelablePromise } from "./CancelablePromise";
import type { OnCancel } from "./CancelablePromise";
import type { OpenAPIConfig } from "./OpenAPI";
import { ApiError } from "../../core/ApiError";
import type { ApiRequestOptions } from "../../core/ApiRequestOptions";
import type { ApiResult } from "../../core/ApiResult";
import { CancelablePromise } from "../../core/CancelablePromise";
import type { OnCancel } from "../../core/CancelablePromise";
import type { OpenAPIConfig } from "../../core/OpenAPI";

const isDefined = <T>(
value: T | null | undefined
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions packages/core/request/node/core/FetchHttpRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ApiRequestOptions } from "../../core/ApiRequestOptions";
import { BaseHttpRequest } from "../../core/BaseHttpRequest";
import type { CancelablePromise } from "../../core/CancelablePromise";
import type { OpenAPIConfig } from "../../core/OpenAPI";
import { request as __request } from "./request";

export class FetchHttpRequest extends BaseHttpRequest {
constructor(config: OpenAPIConfig) {
super(config);
}

/**
* Request method
* @param options The request options from the service
* @returns CancelablePromise<T>
* @throws ApiError
*/
public override request<T>(options: ApiRequestOptions): CancelablePromise<T> {
return __request(this.config, options);
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import { ApiError } from "./ApiError";
import type { ApiRequestOptions } from "./ApiRequestOptions";
import type { ApiResult } from "./ApiResult";
import { CancelablePromise } from "./CancelablePromise";
import type { OnCancel } from "./CancelablePromise";
import type { OpenAPIConfig } from "./OpenAPI";
import { ApiError } from "../../core/ApiError";
import type { ApiRequestOptions } from "../../core/ApiRequestOptions";
import type { ApiResult } from "../../core/ApiResult";
import { CancelablePromise } from "../../core/CancelablePromise";
import type { OnCancel } from "../../core/CancelablePromise";
import type { OpenAPIConfig } from "../../core/OpenAPI";
import type { Response as UndiciResponse } from "undici";

type FullResponse = Response | UndiciResponse;
Expand Down
Loading

0 comments on commit c49cbb0

Please sign in to comment.