Skip to content
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
39 changes: 4 additions & 35 deletions .eslint.ronasit.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -188,21 +188,14 @@ module.exports = [
},
],

'@typescript-eslint/explicit-function-return-type': [
'warn',
{
allowExpressions: true,
},
],

'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-unused-vars': 'off',
"@typescript-eslint/no-unused-expressions": [
"error",
'@typescript-eslint/no-unused-expressions': [
'error',
{
allowShortCircuit: true,
allowTernary: true
}
allowTernary: true,
},
],

'@typescript-eslint/array-type': [
Expand Down Expand Up @@ -339,28 +332,4 @@ module.exports = [
'@typescript-eslint/explicit-function-return-type': 'off',
},
},
{
files: ['**/*actions.ts'],

rules: {
'@stylistic/function-call-argument-newline': ['warn', 'always'],

'@stylistic/function-paren-newline': [
'warn',
{
minItems: 1,
},
],
},
},
{
files: ['**/*selectors.ts'],

rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@stylistic/function-call-argument-newline': ['warn', 'always'],
'@stylistic/function-paren-newline': ['warn', 'multiline-arguments'],
},
},
];
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release to NPM

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org/'

- name: Install dependencies
run: npm ci

- name: Build package
run: npm run build --if-present

- name: Publish to NPM
run: npm run release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
33 changes: 33 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Validate

on:
pull_request:
branches: [main, master, development]
push:
branches: [main, master, development]

jobs:
validate:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run linting
run: npm run lint --if-present

- name: Run tests
run: npm test --if-present

- name: Run build
run: npm run build --if-present
57 changes: 57 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Contributing

This document provides guidelines for contributing to this project.

## Getting started

1. Clone of fork the repository
2. Install dependencies: `npm install`

## Development workflow

1. **Create a feature branch** from `main`
2. **Make your changes** following the [coding standards](#coding-standards)
3. **Test your changes** thoroughly using example RN app in `apps/example`
4. **Update documentation** if needed
5. **Run code checks**: `lint`
6. **Submit a pull request** with a clear description

## Coding standards

### Branch naming

Use descriptive branch names and follow [Conventional Branch](https://conventional-branch.github.io/) guidelines.

### Commit messages

Follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) format

### Code checks

Repository has pre-commit code style and correctness checks. You can run them manually using `lint` and `format` scripts.

## Releases

To create a new release:

1. **Bump the version**: Run `npm version {patch|minor|major}` in `src/lib` to update the version number in `src/lib/package.json`:
- `patch`: Bug fixes (0.2.0 → 0.2.1)
- `minor`: New features (0.2.0 → 0.3.0)
- `major`: Breaking changes (0.2.0 → 1.0.0)
This will create a Git commit and tag.

2. **Push changes**: Push the commit and tag to the repository:

```bash
git push && git push --tags
```

3. **Create GitHub release**: Go to the [GitHub Releases](../../releases) page and:
- Click "Create a new release"
- Select the tag created in step 1
- Add release notes describing the changes
- Click "Publish release"

4. **Automatic npm publication**: Once the GitHub release is published, the package will be automatically published to npm via GitHub Actions workflow.

> **Note**: Make sure you have the `NPM_TOKEN` secret configured in your repository settings for the npm publication to work.
16 changes: 0 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,6 @@

Common components for Ronas IT projects.

## Development

### Use example app

1. Install dependencies: `npm install`
2. Start app for local development: `cd apps/example && npx expo start`
3. Use [Expo Go](https://expo.dev/client) to run mobile version

### Release

To publish the package update to NPM, run:

```sh
npx nx run lib:nx-release-publish
```

## Usage

1. Install the package: `npm i @ronas-it/react-native-common-modules`
Expand Down
6 changes: 3 additions & 3 deletions apps/example/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ export const unstable_settings = {

const translations = {
en: {
...require('i18n/example/en.json')
...require('i18n/example/en.json'),
},
fr: {
...require('i18n/example/fr.json')
}
...require('i18n/example/fr.json'),
},
};

const useLanguage = setLanguage(translations, 'en');
Expand Down
2 changes: 1 addition & 1 deletion apps/example/app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AppSafeAreaView } from '@ronas-it/react-native-common-modules/safe-area-view';
import { useTranslation } from '@ronas-it/react-native-common-modules/i18n';
import { AppSafeAreaView } from '@ronas-it/react-native-common-modules/safe-area-view';
import { ReactElement, useContext } from 'react';
import { View, Text, StyleSheet, Alert, Pressable } from 'react-native';
import { LanguageContext } from './_layout';
Expand Down
8 changes: 4 additions & 4 deletions apps/example/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ const { assetExts, sourceExts } = defaultConfig.resolver;
*/
const customConfig = {
transformer: {
babelTransformerPath: require.resolve('react-native-svg-transformer')
babelTransformerPath: require.resolve('react-native-svg-transformer'),
},
resolver: {
assetExts: assetExts.filter((ext) => ext !== 'svg'),
sourceExts: [...sourceExts, 'cjs', 'mjs', 'svg']
}
sourceExts: [...sourceExts, 'cjs', 'mjs', 'svg'],
},
};

module.exports = withNxMetro(mergeConfig(defaultConfig, customConfig), {
Expand All @@ -30,5 +30,5 @@ module.exports = withNxMetro(mergeConfig(defaultConfig, customConfig), {
// all the file extensions used for imports other than 'ts', 'tsx', 'js', 'jsx', 'json'
extensions: [],
// Specify folders to watch, in addition to Nx defaults (workspace libraries and node_modules)
watchFolders: [monorepoRoot]
watchFolders: [monorepoRoot],
});
10 changes: 9 additions & 1 deletion eslint.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ const constraints = require('./eslint.constraints.json');

module.exports = [
{
ignores: ['**/node_modules', '**/dist', '**/*.js', '**/*.cjs', '**/*.mjs', 'apps/*/app.config.ts', 'src/lib/nx-generators.ts'],
ignores: [
'**/node_modules',
'**/dist',
'**/*.js',
'**/*.cjs',
'**/*.mjs',
'apps/*/app.config.ts',
'src/lib/nx-generators.ts',
],
},
...baseConfig,
...ronasitConfig,
Expand Down
Loading
Loading