Skip to content

Commit 192b395

Browse files
committed
cleaned up package.json / README
1 parent 0b1f891 commit 192b395

File tree

7 files changed

+17
-361
lines changed

7 files changed

+17
-361
lines changed

.github/workflows/size.yml

-12
This file was deleted.

README.md

+1-103
Original file line numberDiff line numberDiff line change
@@ -1,103 +1 @@
1-
# TSDX User Guide
2-
3-
Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it.
4-
5-
> This TSDX setup is meant for developing libraries (not apps!) that can be published to NPM. If you’re looking to build a Node app, you could use `ts-node-dev`, plain `ts-node`, or simple `tsc`.
6-
7-
> If you’re new to TypeScript, checkout [this handy cheatsheet](https://devhints.io/typescript)
8-
9-
## Commands
10-
11-
TSDX scaffolds your new library inside `/src`.
12-
13-
To run TSDX, use:
14-
15-
```bash
16-
npm start # or yarn start
17-
```
18-
19-
This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`.
20-
21-
To do a one-off build, use `npm run build` or `yarn build`.
22-
23-
To run tests, use `npm test` or `yarn test`.
24-
25-
## Configuration
26-
27-
Code quality is set up for you with `prettier`, `husky`, and `lint-staged`. Adjust the respective fields in `package.json` accordingly.
28-
29-
### Jest
30-
31-
Jest tests are set up to run with `npm test` or `yarn test`.
32-
33-
### Bundle Analysis
34-
35-
[`size-limit`](https://github.com/ai/size-limit) is set up to calculate the real cost of your library with `npm run size` and visualize the bundle with `npm run analyze`.
36-
37-
#### Setup Files
38-
39-
This is the folder structure we set up for you:
40-
41-
```txt
42-
/src
43-
index.tsx # EDIT THIS
44-
/test
45-
blah.test.tsx # EDIT THIS
46-
.gitignore
47-
package.json
48-
README.md # EDIT THIS
49-
tsconfig.json
50-
```
51-
52-
### Rollup
53-
54-
TSDX uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details.
55-
56-
### TypeScript
57-
58-
`tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `react` for `jsx`. Adjust according to your needs.
59-
60-
## Continuous Integration
61-
62-
### GitHub Actions
63-
64-
Two actions are added by default:
65-
66-
- `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
67-
- `size` which comments cost comparison of your library on every pull request using [`size-limit`](https://github.com/ai/size-limit)
68-
69-
## Optimizations
70-
71-
Please see the main `tsdx` [optimizations docs](https://github.com/palmerhq/tsdx#optimizations). In particular, know that you can take advantage of development-only optimizations:
72-
73-
```js
74-
// ./types/index.d.ts
75-
declare var __DEV__: boolean;
76-
77-
// inside your code...
78-
if (__DEV__) {
79-
console.log('foo');
80-
}
81-
```
82-
83-
You can also choose to install and use [invariant](https://github.com/palmerhq/tsdx#invariant) and [warning](https://github.com/palmerhq/tsdx#warning) functions.
84-
85-
## Module Formats
86-
87-
CJS, ESModules, and UMD module formats are supported.
88-
89-
The appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are found.
90-
91-
## Named Exports
92-
93-
Per Palmer Group guidelines, [always use named exports.](https://github.com/palmerhq/typescript#exports) Code split inside your React app instead of your React library.
94-
95-
## Including Styles
96-
97-
There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like.
98-
99-
For vanilla CSS, you can include it at the root directory and add it to the `files` section in your `package.json`, so that it can be imported separately by your users and run through their bundler's loader.
100-
101-
## Publishing to NPM
102-
103-
We recommend using [np](https://github.com/sindresorhus/np).
1+
# @quest-chains/sdk

package.json

+6-25
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,18 @@
44
"license": "GPL-3.0",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",
7-
"files": [
8-
"dist",
9-
"src"
10-
],
7+
"files": ["dist", "src"],
118
"engines": {
12-
"node": ">=10"
9+
"node": ">=14"
1310
},
1411
"scripts": {
1512
"start": "tsdx watch",
1613
"build": "tsdx build",
17-
"test": "tsdx test",
14+
"test": "tsdx test --passWithNoTests",
1815
"lint": "tsdx lint",
1916
"typecheck": "tsc",
20-
"prepare": "yarn generate && tsdx build",
21-
"size": "size-limit",
22-
"analyze": "size-limit --why",
17+
"prepare": "yarn generate",
18+
"prepublishOnly": "yarn build",
2319
"format": "prettier --ignore-path .gitignore --write \"{*,**/*}.{ts,tsx,js,jsx,json,yml,yaml,md,css,scss,sol}\"",
2420
"generate": "graphql-codegen --config=src/codegen.yml"
2521
},
@@ -34,10 +30,7 @@
3430
"url": "https://github.com/quest-chains/sdk.git"
3531
},
3632
"homepage": "https://github.com/quest-chains/sdk",
37-
"keywords": [
38-
"ethereum",
39-
"quest-chains"
40-
],
33+
"keywords": ["ethereum", "quest-chains"],
4134
"prettier": {
4235
"semi": true,
4336
"trailingComma": "all",
@@ -48,25 +41,13 @@
4841
},
4942
"author": "dan13ram",
5043
"module": "dist/sdk.esm.js",
51-
"size-limit": [
52-
{
53-
"path": "dist/sdk.cjs.production.min.js",
54-
"limit": "10 KB"
55-
},
56-
{
57-
"path": "dist/sdk.esm.js",
58-
"limit": "10 KB"
59-
}
60-
],
6144
"devDependencies": {
6245
"@graphql-codegen/add": "^3.2.0",
6346
"@graphql-codegen/cli": "^2.12.0",
6447
"@graphql-codegen/typescript": "^2.6.0",
6548
"@graphql-codegen/typescript-operations": "^2.4.3",
6649
"@graphql-codegen/typescript-urql": "^3.7.0",
67-
"@size-limit/preset-small-lib": "^8.0.1",
6850
"husky": "^8.0.1",
69-
"size-limit": "^8.0.1",
7051
"tsdx": "^0.14.1"
7152
},
7253
"dependencies": {

test/blah.test.ts

-7
This file was deleted.

tsconfig.json

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,21 @@
11
{
2-
// see https://www.typescriptlang.org/tsconfig to better understand tsconfigs
3-
"include": ["src", "types"],
2+
"include": ["src"],
43
"compilerOptions": {
54
"module": "esnext",
6-
"lib": ["dom", "esnext"],
5+
"lib": ["esnext"],
76
"importHelpers": true,
8-
// output .d.ts declaration files for consumers
97
"declaration": true,
10-
// output .js.map sourcemap files for consumers
118
"sourceMap": true,
12-
// match output dir to input dir. e.g. dist/index instead of dist/src/index
139
"rootDir": "./src",
14-
// stricter type-checking for stronger correctness. Recommended by TS
1510
"strict": true,
16-
// linter checks for common issues
1711
"noImplicitReturns": true,
1812
"noFallthroughCasesInSwitch": true,
19-
// noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative
2013
"noUnusedLocals": true,
2114
"noUnusedParameters": true,
22-
// use Node's module resolution algorithm, instead of the legacy TS one
2315
"moduleResolution": "node",
24-
// transpile JSX to React.createElement
25-
"jsx": "react",
26-
// interop between ESM and CJS modules. Recommended by TS
2716
"esModuleInterop": true,
28-
// significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS
2917
"skipLibCheck": true,
30-
// error out if import and file system have a casing mismatch. Recommended by TS
3118
"forceConsistentCasingInFileNames": true,
32-
// `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc`
3319
"noEmit": true
3420
}
3521
}

tsdx.config.js.bak

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
rollup(config, options) {
3+
config.external = ['react'];
4+
return config;
5+
},
6+
};

0 commit comments

Comments
 (0)