release configs

This commit is contained in:
EthanShoeDev
2025-10-06 23:31:28 -04:00
parent bfcd043743
commit 18a6e0be4f
19 changed files with 592 additions and 493 deletions

View File

@@ -28,6 +28,9 @@
// Special tasks // Special tasks
"expo:doctor": {}, "expo:doctor": {},
"test:e2e": {}, "test:e2e": {},
"build:signed:apk": {}, "build:signed:apk": {
"dependsOn": ["^build", "^build:android"],
"outputs": ["android/app/build/outputs/**"],
},
}, },
} }

View File

@@ -2,32 +2,50 @@
Contributions are always welcome, no matter how large or small! Contributions are always welcome, no matter how large or small!
We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. Before contributing, please read the [code of conduct](./CODE_OF_CONDUCT.md). We want this community to be friendly and respectful to each other. Please
follow it in all your interactions with the project. Before contributing, please
read the [code of conduct](./CODE_OF_CONDUCT.md).
## Development workflow ## Development workflow
This project is a monorepo managed using [Yarn workspaces](https://yarnpkg.com/features/workspaces). It contains the following packages: This project is a monorepo managed using
[Yarn workspaces](https://yarnpkg.com/features/workspaces). It contains the
following packages:
- The library package in the root directory. - The library package in the root directory.
- An example app in the `example/` directory. - An example app in the `example/` directory.
To get started with the project, make sure you have the correct version of [Node.js](https://nodejs.org/) installed. See the [`.nvmrc`](./.nvmrc) file for the version used in this project. To get started with the project, make sure you have the correct version of
[Node.js](https://nodejs.org/) installed. See the [`.nvmrc`](./.nvmrc) file for
the version used in this project.
Run `yarn` in the root directory to install the required dependencies for each package: Run `yarn` in the root directory to install the required dependencies for each
package:
```sh ```sh
yarn yarn
``` ```
> Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development without manually migrating. > Since the project relies on Yarn workspaces, you cannot use
> [`npm`](https://github.com/npm/cli) for development without manually
> migrating.
The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make. The [example app](/example/) demonstrates usage of the library. You need to run
it to test any changes you make.
It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app. It is configured to use the local version of the library, so any changes you
make to the library's source code will be reflected in the example app. Changes
to the library's JavaScript code will be reflected in the example app without a
rebuild, but native code changes will require a rebuild of the example app.
If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/UniffiRusshExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-uniffi-russh`. If you want to use Android Studio or XCode to edit the native code, you can open
the `example/android` or `example/ios` directories respectively in those
editors. To edit the Objective-C or Swift files, open
`example/ios/UniffiRusshExample.xcworkspace` in XCode and find the source files
at `Pods > Development Pods > react-native-uniffi-russh`.
To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-uniffi-russh` under `Android`. To edit the Java or Kotlin files, open `example/android` in Android studio and
find the source files at `react-native-uniffi-russh` under `Android`.
You can use various commands from the root directory to work with the project. You can use various commands from the root directory to work with the project.
@@ -49,7 +67,8 @@ To run the example app on iOS:
yarn example ios yarn example ios
``` ```
To confirm that the app is running with the new architecture, you can check the Metro logs for a message like this: To confirm that the app is running with the new architecture, you can check the
Metro logs for a message like this:
```sh ```sh
Running "UniffiRusshExample" with {"fabric":true,"initialProps":{"concurrentRoot":true},"rootTag":1} Running "UniffiRusshExample" with {"fabric":true,"initialProps":{"concurrentRoot":true},"rootTag":1}
@@ -78,7 +97,9 @@ yarn test
### Commit message convention ### Commit message convention
We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages: We follow the
[conventional commits specification](https://www.conventionalcommits.org/en) for
our commit messages:
- `fix`: bug fixes, e.g. fix crash due to deprecated method. - `fix`: bug fixes, e.g. fix crash due to deprecated method.
- `feat`: new features, e.g. add new method to the module. - `feat`: new features, e.g. add new method to the module.
@@ -87,19 +108,25 @@ We follow the [conventional commits specification](https://www.conventionalcommi
- `test`: adding or updating tests, e.g. add integration tests using detox. - `test`: adding or updating tests, e.g. add integration tests using detox.
- `chore`: tooling changes, e.g. change CI config. - `chore`: tooling changes, e.g. change CI config.
Our pre-commit hooks verify that your commit message matches this format when committing. Our pre-commit hooks verify that your commit message matches this format when
committing.
### Linting and tests ### Linting and tests
[ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/) [ESLint](https://eslint.org/), [Prettier](https://prettier.io/),
[TypeScript](https://www.typescriptlang.org/)
We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing. We use [TypeScript](https://www.typescriptlang.org/) for type checking,
[ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting
and formatting the code, and [Jest](https://jestjs.io/) for testing.
Our pre-commit hooks verify that the linter and tests pass when committing. Our pre-commit hooks verify that the linter and tests pass when committing.
### Publishing to npm ### Publishing to npm
We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc. We use [release-it](https://github.com/release-it/release-it) to make it easier
to publish new versions. It handles common tasks like bumping version based on
semver, creating tags and releases etc.
To publish new versions, run the following: To publish new versions, run the following:
@@ -121,7 +148,9 @@ The `package.json` file contains various scripts for common tasks:
### Sending a pull request ### Sending a pull request
> **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github). > **Working on your first pull request?** You can learn how from this _free_
> series:
> [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github).
When you're sending a pull request: When you're sending a pull request:
@@ -129,4 +158,5 @@ When you're sending a pull request:
- Verify that linters and tests are passing. - Verify that linters and tests are passing.
- Review the documentation to make sure it looks good. - Review the documentation to make sure it looks good.
- Follow the pull request template when opening a pull request. - Follow the pull request template when opening a pull request.
- For pull requests that change the API or implementation, discuss with maintainers first by opening an issue. - For pull requests that change the API or implementation, discuss with
maintainers first by opening an issue.

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 EthanShoeDev
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.

View File

@@ -30,4 +30,5 @@ MIT
--- ---
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob) Made with
[create-react-native-library](https://github.com/callstack/react-native-builder-bob)

View File

@@ -1,4 +1,4 @@
module.exports = { export default {
overrides: [ overrides: [
{ {
exclude: /\/node_modules\//, exclude: /\/node_modules\//,

View File

@@ -21,6 +21,12 @@ export default defineConfig([
}, },
}, },
{ {
ignores: ['node_modules/', 'lib/', 'src/generated/', 'eslint.config.mjs'], ignores: [
'node_modules/',
'lib/',
'src/generated/',
'eslint.config.mjs',
'prettier.config.mjs',
],
}, },
]); ]);

View File

@@ -1,9 +1,10 @@
{ {
"name": "@fressh/react-native-uniffi-russh", "name": "@fressh/react-native-uniffi-russh",
"homepage": "https://github.com/EthanShoeDev/fressh", "homepage": "https://github.com/EthanShoeDev/fressh",
"license": "UNKNOWN", "license": "MIT",
"description": "Uniffi bindings for russh", "description": "Uniffi bindings for russh",
"version": "0.0.1", "version": "0.0.1",
"type": "module",
"main": "./lib/module/api.js", "main": "./lib/module/api.js",
"types": "./lib/typescript/src/api.d.ts", "types": "./lib/typescript/src/api.d.ts",
"exports": { "exports": {
@@ -20,6 +21,7 @@
"cpp", "cpp",
"*.podspec", "*.podspec",
"react-native.config.js", "react-native.config.js",
"LICENSE",
"!ios/build", "!ios/build",
"!android/build", "!android/build",
"!android/gradle", "!android/gradle",
@@ -70,6 +72,7 @@
"@react-native-community/cli": "20.0.2", "@react-native-community/cli": "20.0.2",
"@react-native/babel-preset": "0.81.1", "@react-native/babel-preset": "0.81.1",
"@react-native/eslint-config": "^0.81.1", "@react-native/eslint-config": "^0.81.1",
"@epic-web/config": "^1.21.3",
"@release-it/conventional-changelog": "^10.0.1", "@release-it/conventional-changelog": "^10.0.1",
"@types/jest": "^30.0.0", "@types/jest": "^30.0.0",
"@types/react": "~19.1.12", "@types/react": "~19.1.12",
@@ -98,13 +101,6 @@
"<rootDir>/lib/" "<rootDir>/lib/"
] ]
}, },
"prettier": {
"quoteProps": "consistent",
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false
},
"react-native-builder-bob": { "react-native-builder-bob": {
"source": "src", "source": "src",
"output": "lib", "output": "lib",

View File

@@ -0,0 +1,14 @@
import epicConfig from '@epic-web/config/prettier';
// Sometimes this plugin can remove imports that are being edited.
// As a workaround we will only use this in the cli. (pnpm run fmt)
const sortImports = process.env.SORT_IMPORTS === 'true-never';
/** @type {import("prettier").Options} */
export default {
...epicConfig,
semi: true,
plugins: [
...(sortImports ? ['prettier-plugin-organize-imports'] : []),
...(epicConfig.plugins || []),
],
};

View File

@@ -52,7 +52,7 @@ export type ConnectOptions = ConnectionDetails & {
onDisconnected?: (connectionId: string) => void; onDisconnected?: (connectionId: string) => void;
onServerKey: ( onServerKey: (
serverKeyInfo: GeneratedRussh.ServerPublicKeyInfo, serverKeyInfo: GeneratedRussh.ServerPublicKeyInfo,
signal?: AbortSignal signal?: AbortSignal,
) => Promise<boolean>; ) => Promise<boolean>;
abortSignal?: AbortSignal; abortSignal?: AbortSignal;
}; };
@@ -127,7 +127,7 @@ export type SshShell = {
// I/O // I/O
sendData: ( sendData: (
data: ArrayBuffer, data: ArrayBuffer,
opts?: { signal?: AbortSignal } opts?: { signal?: AbortSignal },
) => Promise<void>; ) => Promise<void>;
close: (opts?: { signal?: AbortSignal }) => Promise<void>; close: (opts?: { signal?: AbortSignal }) => Promise<void>;
@@ -143,7 +143,7 @@ export type SshShell = {
readBuffer: (cursor: Cursor, maxBytes?: bigint) => BufferReadResult; readBuffer: (cursor: Cursor, maxBytes?: bigint) => BufferReadResult;
addListener: ( addListener: (
cb: (ev: ListenerEvent) => void, cb: (ev: ListenerEvent) => void,
opts: ListenerOptions opts: ListenerOptions,
) => bigint; ) => bigint;
removeListener: (id: bigint) => void; removeListener: (id: bigint) => void;
}; };
@@ -152,14 +152,14 @@ type RusshApi = {
uniffiInitAsync: () => Promise<void>; uniffiInitAsync: () => Promise<void>;
connect: (opts: ConnectOptions) => Promise<SshConnection>; connect: (opts: ConnectOptions) => Promise<SshConnection>;
generateKeyPair: ( generateKeyPair: (
type: 'rsa' | 'ecdsa' | 'ed25519' type: 'rsa' | 'ecdsa' | 'ed25519',
// TODO: Add these // TODO: Add these
// passphrase?: string; // passphrase?: string;
// keySize?: number; // keySize?: number;
// comment?: string; // comment?: string;
) => Promise<string>; ) => Promise<string>;
validatePrivateKey: ( validatePrivateKey: (
key: string key: string,
) => ) =>
| { valid: true; error?: never } | { valid: true; error?: never }
| { valid: false; error: GeneratedRussh.SshError }; | { valid: false; error: GeneratedRussh.SshError };
@@ -206,7 +206,7 @@ const streamEnumToLiteral = {
} as const satisfies Record<GeneratedRussh.StreamKind, StreamKind>; } as const satisfies Record<GeneratedRussh.StreamKind, StreamKind>;
function generatedConnDetailsToIdeal( function generatedConnDetailsToIdeal(
details: GeneratedRussh.ConnectionDetails details: GeneratedRussh.ConnectionDetails,
): ConnectionDetails { ): ConnectionDetails {
const security: ConnectionDetails['security'] = const security: ConnectionDetails['security'] =
details.security instanceof GeneratedRussh.Security.Password details.security instanceof GeneratedRussh.Security.Password
@@ -247,7 +247,7 @@ function toTerminalChunk(ch: GeneratedRussh.TerminalChunk): TerminalChunk {
} }
function wrapShellSession( function wrapShellSession(
shell: GeneratedRussh.ShellSessionInterface shell: GeneratedRussh.ShellSessionInterface,
): SshShell { ): SshShell {
const info = shell.getInfo(); const info = shell.getInfo();
@@ -286,7 +286,7 @@ function wrapShellSession(
return id; return id;
} catch (e) { } catch (e) {
throw new Error( throw new Error(
`addListener failed: ${String((e as any)?.message ?? e)}` `addListener failed: ${String((e as any)?.message ?? e)}`,
); );
} }
}; };
@@ -309,7 +309,7 @@ function wrapShellSession(
} }
function wrapConnection( function wrapConnection(
conn: GeneratedRussh.SshConnectionInterface conn: GeneratedRussh.SshConnectionInterface,
): SshConnection { ): SshConnection {
const info = conn.getInfo(); const info = conn.getInfo();
return { return {
@@ -334,7 +334,7 @@ function wrapConnection(
terminalPixelSize: params.terminalPixelSize, terminalPixelSize: params.terminalPixelSize,
terminalSize: params.terminalSize, terminalSize: params.terminalSize,
}, },
params.abortSignal ? { signal: params.abortSignal } : undefined params.abortSignal ? { signal: params.abortSignal } : undefined,
); );
return wrapShellSession(shell); return wrapShellSession(shell);
}, },
@@ -381,7 +381,7 @@ async function connect({
onServerKey(serverKeyInfo, options.abortSignal), onServerKey(serverKeyInfo, options.abortSignal),
}, },
}, },
options.abortSignal ? { signal: options.abortSignal } : undefined options.abortSignal ? { signal: options.abortSignal } : undefined,
); );
return wrapConnection(sshConnection); return wrapConnection(sshConnection);
} }
@@ -396,7 +396,7 @@ async function generateKeyPair(type: 'rsa' | 'ecdsa' | 'ed25519') {
} }
function validatePrivateKey( function validatePrivateKey(
key: string key: string,
): ):
| { valid: true; error?: never } | { valid: true; error?: never }
| { valid: false; error: GeneratedRussh.SshError } { | { valid: false; error: GeneratedRussh.SshError } {

View File

@@ -1,6 +1,11 @@
import { type Config } from 'release-it'; import { type Config } from 'release-it';
export default { export default {
// Avoid double-publish from the built-in npm plugin
npm: {
publish: true,
publishArgs: ['--access', 'public'],
},
git: { git: {
requireCleanWorkingDir: true, requireCleanWorkingDir: true,
tagName: '${npm.name}-v${version}', tagName: '${npm.name}-v${version}',
@@ -10,15 +15,6 @@ export default {
push: true, push: true,
}, },
// This one *does* publish to npm
npm: {
publish: true,
// pass flags youd give to `npm publish`
publishArgs: ['--access', 'public'],
// (optional) skip npms own prepublish checks:
// skipChecks: true
},
github: { github: {
release: true, release: true,
releaseName: '${npm.name} v${version}', releaseName: '${npm.name} v${version}',
@@ -36,7 +32,7 @@ export default {
hooks: { hooks: {
'before:init': ['turbo run lint:check'], 'before:init': ['turbo run lint:check'],
'before:npm:release': 'turbo run build', 'before:github:release': 'turbo run build',
'after:release': 'echo "Published ${npm.name} v${version} to npm"', 'after:release': 'echo "Published ${npm.name} v${version} to npm"',
}, },
} satisfies Config; } satisfies Config;

View File

@@ -0,0 +1,20 @@
MIT License
Copyright (c) 2025 EthanShoeDev
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.

View File

@@ -1,8 +1,17 @@
{ {
"name": "@fressh/react-native-xtermjs-webview", "name": "@fressh/react-native-xtermjs-webview",
"private": true, "private": false,
"version": "0.0.1", "version": "0.0.3",
"license": "MIT",
"type": "module", "type": "module",
"files": [
"src",
"dist",
"dist-internal",
"!node_modules",
"!.turbo",
"*"
],
"exports": { "exports": {
".": "./dist/index.js" ".": "./dist/index.js"
}, },

3
pnpm-lock.yaml generated
View File

@@ -318,6 +318,9 @@ importers:
specifier: github:EthanShoeDev/uniffi-bindgen-react-native#build-ts specifier: github:EthanShoeDev/uniffi-bindgen-react-native#build-ts
version: https://codeload.github.com/EthanShoeDev/uniffi-bindgen-react-native/tar.gz/54dd681081a4117ee417f78607a942544636b145(patch_hash=527b712c8fb029b29d9ac7caa72e593fa37a6dcebb63e15a56e21e75ffcb88ec) version: https://codeload.github.com/EthanShoeDev/uniffi-bindgen-react-native/tar.gz/54dd681081a4117ee417f78607a942544636b145(patch_hash=527b712c8fb029b29d9ac7caa72e593fa37a6dcebb63e15a56e21e75ffcb88ec)
devDependencies: devDependencies:
'@epic-web/config':
specifier: ^1.21.3
version: 1.21.3(@typescript-eslint/utils@8.44.0(eslint@9.35.0(jiti@2.5.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.35.0(jiti@2.5.1))(prettier-plugin-astro@0.14.1)(prettier-plugin-organize-imports@4.2.0(prettier@3.6.2)(typescript@5.9.2))(prettier@3.6.2)(typescript@5.9.2)
'@eslint/compat': '@eslint/compat':
specifier: ^1.3.2 specifier: ^1.3.2
version: 1.3.2(eslint@9.35.0(jiti@2.5.1)) version: 1.3.2(eslint@9.35.0(jiti@2.5.1))