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

Create an empty package for @solana/react #2102

Closed
Closed
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
1 change: 1 addition & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@solana/web3.js": "0.0.0-development",
"@solana/options": "2.0.0-preview.2",
"@solana/programs": "2.0.0-preview.2",
"@solana/react": "2.0.0-preview.2",
"@solana/rpc": "2.0.0-preview.2",
"@solana/rpc-api": "2.0.0-preview.2",
"@solana/rpc-graphql": "2.0.0-preview.2",
Expand Down
3 changes: 3 additions & 0 deletions packages/react/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['../../.eslintrc.js', '@solana/eslint-config-solana/react'],
};
1 change: 1 addition & 0 deletions packages/react/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
1 change: 1 addition & 0 deletions packages/react/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
1 change: 1 addition & 0 deletions packages/react/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
20 changes: 20 additions & 0 deletions packages/react/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2023 Solana Labs, Inc

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17 changes: 17 additions & 0 deletions packages/react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[![npm][npm-image]][npm-url]
[![npm-downloads][npm-downloads-image]][npm-url]
[![semantic-release][semantic-release-image]][semantic-release-url]
<br />
[![code-style-prettier][code-style-prettier-image]][code-style-prettier-url]

[code-style-prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square
[code-style-prettier-url]: https://github.com/prettier/prettier
[npm-downloads-image]: https://img.shields.io/npm/dm/@solana/react/experimental.svg?style=flat
[npm-image]: https://img.shields.io/npm/v/@solana/react/experimental.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@solana/react/v/experimental
[semantic-release-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
[semantic-release-url]: https://github.com/semantic-release/semantic-release

# @solana/react

This package contains React hooks for building Solana apps.
85 changes: 85 additions & 0 deletions packages/react/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"name": "@solana/react",
"version": "2.0.0-preview.2",
"description": "React hooks for building Solana apps",
"exports": {
"browser": {
"import": "./dist/index.browser.js",
"require": "./dist/index.browser.cjs"
},
"node": {
"import": "./dist/index.node.js",
"require": "./dist/index.node.cjs"
},
"react-native": "./dist/index.native.js",
"types": "./dist/types/index.d.ts"
},
"browser": {
"./dist/index.node.cjs": "./dist/index.browser.cjs",
"./dist/index.node.js": "./dist/index.browser.js"
},
"main": "./dist/index.node.cjs",
"module": "./dist/index.node.js",
"react-native": "./dist/index.native.js",
"types": "./dist/types/index.d.ts",
"type": "module",
"files": [
"./dist/"
],
"sideEffects": false,
"keywords": [
"blockchain",
"solana",
"web3"
],
"scripts": {
"compile:js": "tsup --config build-scripts/tsup.config.package.ts",
"compile:typedefs": "tsc -p ./tsconfig.declarations.json && node ../../node_modules/@solana/build-scripts/add-js-extension-to-types.mjs",
"dev": "jest -c ../../node_modules/@solana/test-config/jest-dev.config.ts --rootDir . --watch",
"prepublishOnly": "pnpm pkg delete devDependencies",
"publish-impl": "npm view $npm_package_name@$npm_package_version > /dev/null 2>&1 || pnpm publish --tag ${PUBLISH_TAG:-preview} --access public --no-git-checks",
"publish-packages": "pnpm prepublishOnly && pnpm publish-impl",
"style:fix": "pnpm eslint --fix src/* && pnpm prettier --log-level warn --ignore-unknown --write ./*",
"test:lint": "jest -c ../../node_modules/@solana/test-config/jest-lint.config.ts --rootDir . --silent",
"test:prettier": "jest -c ../../node_modules/@solana/test-config/jest-prettier.config.ts --rootDir . --silent",
"test:treeshakability:browser": "agadoo dist/index.browser.js",
"test:treeshakability:native": "agadoo dist/index.native.js",
"test:treeshakability:node": "agadoo dist/index.node.js",
"test:typecheck": "tsc --noEmit",
"test:unit:browser": "jest -c ../../node_modules/@solana/test-config/jest-unit.config.browser.ts --rootDir . --silent",
"test:unit:node": "jest -c ../../node_modules/@solana/test-config/jest-unit.config.node.ts --rootDir . --silent"
},
"author": "Solana Labs Maintainers <maintainers@solanalabs.com>",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/solana-labs/solana-web3.js"
},
"bugs": {
"url": "http://github.com/solana-labs/solana-web3.js/issues"
},
"browserslist": [
"supports bigint and not dead",
"maintained node versions"
],
"engine": {
"node": ">=17.4"
},
"devDependencies": {
"@types/react": "^18",
"@types/react-test-renderer": "^18",
"react": "^18",
"react-test-renderer": "^18"
},
"peerDependencies": {
"react": "^18"
},
"bundlewatch": {
"defaultCompression": "gzip",
"files": [
{
"path": "./dist/index*.js"
}
]
}
}
1 change: 1 addition & 0 deletions packages/react/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
4 changes: 4 additions & 0 deletions packages/react/src/types/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare const __BROWSER__: boolean;
declare const __DEV__: boolean;
declare const __NODEJS__: boolean;
declare const __REACTNATIVE__: boolean;
10 changes: 10 additions & 0 deletions packages/react/tsconfig.declarations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"outDir": "./dist/types"
},
"extends": "./tsconfig.json",
"include": ["src/index.ts", "src/types"]
}
10 changes: 10 additions & 0 deletions packages/react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"jsx": "react",
"lib": ["DOM", "ES2015"]
},
"display": "@solana/react",
"extends": "../tsconfig/base.json",
"include": ["src"]
}
2 changes: 1 addition & 1 deletion packages/test-config/jest-unit.config.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const config: Partial<Config.InitialProjectOptions> = {
],
testPathIgnorePatterns: ['__setup__.ts'],
transform: {
'^.+\\.(ts|js)$': [
'^.+\\.(ts|js)x?$': [
'@swc/jest',
{
jsc: {
Expand Down
87 changes: 82 additions & 5 deletions pnpm-lock.yaml

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

Loading