Skip to content

Commit

Permalink
Merge pull request #50 from jpudysz/feature/ssr
Browse files Browse the repository at this point in the history
Add support for SSR and NextJS
  • Loading branch information
jpudysz authored Oct 26, 2023
2 parents ce6c88d + 7d3bbba commit bd164bb
Show file tree
Hide file tree
Showing 43 changed files with 1,687 additions and 732 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ android.iml

# Cocoapods
#
example/ios/Pods
examples/expo/ios/Pods

# Ruby
example/vendor/
examples/expo/vendor/

# node.js
#
Expand Down Expand Up @@ -76,7 +76,8 @@ android/keystores/debug.keystore

# generated by bob
lib/
example/.yarn
example/expo/.yarn

#docs
docs/.yarn
coverage
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

![GitHub package.json version](https://img.shields.io/github/package-json/v/jpudysz/react-native-unistyles?style=for-the-badge)
[![npm downloads](https://img.shields.io/npm/dm/react-native-unistyles.svg?style=for-the-badge)](https://www.npmjs.com/package/react-native-unistyles)
![Platform - Android and iOS](https://img.shields.io/badge/platform-Android%20%7C%20iOS%20%7C%20RNWeb-blue.svg?style=for-the-badge)
![Platform - Android and iOS](https://img.shields.io/badge/platform-Android%20%7C%20IOS%20%7C%20SSR%20%7C%20Web-blue.svg?style=for-the-badge)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)

## Features
Expand All @@ -18,7 +18,8 @@
- 🖥️ Supports custom breakpoints and css-like media queries
- 🎨 Access theme in your StyleSheets and components
- 🪄 Supports dynamic functions to access values from JSX
- 🥳 Compatible with Expo, Expo Go, Bare React Native and React Native Web
- 🥳 Compatible with Expo, Expo Go, Bare React Native, React Native Web and SSR
- 🛡️ ~99% Test coverage
- ⚔️ No 3rd party dependencies

*-based on this [benchmark](https://github.com/efstathiosntonas/react-native-style-libraries-benchmark)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ hero:
icon: right-arrow
variant: primary
- text: Examples
link: https://github.com/jpudysz/react-native-unistyles/tree/main/example
link: https://github.com/jpudysz/react-native-unistyles/tree/main/examples
icon: external
---

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
4 changes: 2 additions & 2 deletions example/babel.config.js → examples/expo/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require('path')
const pak = require('../package.json')
const pak = require('../../package.json')

module.exports = function (api) {
api.cache(true)
Expand All @@ -13,7 +13,7 @@ module.exports = function (api) {
extensions: ['.tsx', '.ts', '.js', '.json'],
alias: {
// For development, we want to alias the library to the source
[pak.name]: path.join(__dirname, '..', pak.source)
[pak.name]: path.join(__dirname, '../..', pak.source)
}
}
]
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions example/metro.config.js → examples/expo/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ const path = require('path')
const escape = require('escape-string-regexp')
const { getDefaultConfig } = require('@expo/metro-config')
const exclusionList = require('metro-config/src/defaults/exclusionList')
const pak = require('../package.json')
const pak = require('../../package.json')

const root = path.resolve(__dirname, '..')
const root = path.resolve(__dirname, '../..')
const modules = Object.keys({ ...pak.peerDependencies })

const defaultConfig = getDefaultConfig(__dirname)
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion example/tsconfig.json → examples/expo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"extends": "expo/tsconfig.base",
"references": [
{
"path": "../"
"path": "../../"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const path = require('path')
const createExpoWebpackConfigAsync = require('@expo/webpack-config')
const { resolver } = require('./metro.config')

const root = path.resolve(__dirname, '..')
const root = path.resolve(__dirname, '../..')
const modules = path.join(__dirname, 'node_modules')

module.exports = async (env, argv) => {
Expand Down
1 change: 1 addition & 0 deletions examples/ssr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Due to a package scoping issue with NextJS and Yarn, I decided to move the example to a separate repository, which can be found [here](https://github.com/jpudysz/react-native-unistyles-ssr-exmaple).
Binary file not shown.
Binary file not shown.
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Level up your React Native StyleSheet",
"scripts": {
"test": "jest",
"test:coverage": "jest --coverage",
"tsc": "node_modules/typescript/bin/tsc --noEmit",
"lint": "eslint . --ext .ts,.tsx",
"clean": "del-cli lib",
Expand Down Expand Up @@ -84,7 +85,7 @@
}
},
"workspaces": [
"example",
"examples/expo",
"docs"
],
"packageManager": "[email protected]",
Expand All @@ -94,9 +95,13 @@
"jest": {
"preset": "react-native",
"modulePathIgnorePatterns": [
"<rootDir>/example/node_modules",
"<rootDir>/examples/expo/node_modules",
"<rootDir>/examples/ssr/node_modules",
"<rootDir>/docs/node_modules",
"<rootDir>/lib/"
],
"coverageReporters": [
"html"
]
},
"commitlint": {
Expand Down
Loading

0 comments on commit bd164bb

Please sign in to comment.