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

fix(js): update ts config for hippy-react-demo #3957

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions driver/js/examples/hippy-react-demo/app.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare module '*.jpg';
declare module '*.png';
6 changes: 6 additions & 0 deletions driver/js/examples/hippy-react-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"animated-scroll-to": "^2.2.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-redux": "^9.1.2",
"react-router": "~5.1.2",
"react-router-dom": "~5.1.2",
"regenerator-runtime": "^0.13.5",
Expand All @@ -48,11 +49,16 @@
"@babel/polyfill": "^7.12.0",
"@babel/preset-env": "^7.12.0",
"@babel/preset-react": "^7.9.4",
"@babel/preset-typescript": "^7.24.7",
"@hippy/debug-server-next": "latest",
"@hippy/hippy-dynamic-import-plugin": "^2.0.0",
"@hippy/hippy-hmr-plugin": "^0.1.0",
"@hippy/hippy-react-refresh-webpack-plugin": "^0.5.5",
"@hippy/rejection-tracking-polyfill": "^1.0.0",
"@types/hippy__react": "^2.13.4",
"@types/node": "^20.14.11",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"babel-loader": "^8.1.0",
"bezier-easing": "^2.1.0",
"case-sensitive-paths-webpack-plugin": "^2.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ module.exports = {
module: {
rules: [
{
test: /\.(jsx?)$/,
test: /\.((j|t)sx?)$/,
use: [
{
loader: 'babel-loader',
options: {
sourceType: 'unambiguous',
presets: [
'@babel/preset-react',
'@babel/preset-typescript',
[
'@babel/preset-env',
{
Expand Down Expand Up @@ -90,7 +91,7 @@ module.exports = {
],
},
resolve: {
extensions: ['.js', '.jsx', '.json'],
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
// if node_modules path listed below is not your repo directory, change it.
modules: [path.resolve(__dirname, '../node_modules')],
alias: (() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module.exports = {
module: {
rules: [
{
test: /\.(jsx?)$/,
test: /\.((j|t)sx?)$/,
exclude: /@hippy\/hippy-react-devtools-plugin/,
use: [
{
Expand All @@ -76,6 +76,7 @@ module.exports = {
sourceType: 'unambiguous',
presets: [
'@babel/preset-react',
'@babel/preset-typescript',
[
'@babel/preset-env',
{
Expand Down Expand Up @@ -117,7 +118,7 @@ module.exports = {
],
},
resolve: {
extensions: ['.js', '.jsx', '.json'],
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
modules: [path.resolve(__dirname, '../node_modules')],
alias: (() => {
const aliases = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ module.exports = {
module: {
rules: [
{
test: /\.(jsx?)$/,
test: /\.((j|t)sx?)$/,
use: [
{
loader: 'babel-loader',
options: {
sourceType: 'unambiguous',
presets: [
'@babel/preset-react',
'@babel/preset-typescript',
[
'@babel/preset-env',
{
Expand Down Expand Up @@ -90,7 +91,7 @@ module.exports = {
],
},
resolve: {
extensions: ['.js', '.jsx', '.json'],
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
// if node_modules path listed below is not your repo directory, change it.
modules: [path.resolve(__dirname, '../node_modules')],
alias: (() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ module.exports = {
module: {
rules: [
{
test: /\.(jsx?)$/,
test: /\.((j|t)sx?)$/,
use: [
{
loader: 'babel-loader',
options: {
sourceType: 'unambiguous',
presets: [
'@babel/preset-react',
'@babel/preset-typescript',
[
'@babel/preset-env',
{
Expand Down Expand Up @@ -87,7 +88,7 @@ module.exports = {
],
},
resolve: {
extensions: ['.js', '.jsx', '.json'],
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
modules: [path.resolve(__dirname, '../node_modules')],
alias: (() => {
const aliases = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ module.exports = {
module: {
rules: [
{
test: /\.(jsx?)$/,
test: /\.((j|t)sx?)$/,
use: [
{
loader: 'babel-loader',
options: {
sourceType: 'unambiguous',
presets: [
'@babel/preset-react',
'@babel/preset-typescript',
[
'@babel/preset-env',
{
Expand Down Expand Up @@ -78,7 +79,7 @@ module.exports = {
],
},
resolve: {
extensions: ['.js', '.jsx', '.json'],
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
modules: [path.resolve(__dirname, '../node_modules')],
alias: (() => {
const aliases = {
Expand Down
9 changes: 4 additions & 5 deletions driver/js/examples/hippy-react-demo/src/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import React, { Component } from 'react';
import {
ConsoleModule,
} from '@hippy/react';
import HomeEntry from './pages/entry';
import ContainerView from './shared/ContainerView';
import { View, Text } from '@hippy/react';

export default class App extends Component {
componentDidMount() {
Expand All @@ -12,9 +11,9 @@ export default class App extends Component {

render() {
return (
<ContainerView>
<HomeEntry />
</ContainerView>
<View style={{ backgroundColor: '#f0f0f0f0', flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text style={{ fontSize: 24, color: '#0f0f0f' }}>Hello World!</Text>
</View>
);
}
}
20 changes: 20 additions & 0 deletions driver/js/examples/hippy-react-demo/src/pages/allowTs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';
import { connect } from 'react-redux';
import {
View,
} from '@hippy/react';
import png from './back-icon.png';

interface AllowTsProps {
test: string;
}

const AllowTs: React.FC<AllowTsProps> = ({ test }) => {
return (
<View>
AllowTs
<img src={png} />
</View>
);
}
export default connect()(AllowTs);
2 changes: 2 additions & 0 deletions driver/js/examples/hippy-react-demo/src/pages/entry.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { View } from '@hippy/react';
import routes from '../routes';
import Header from '../shared/Header';
import Gallery from './gallery';
import AllowTs from "./allowTs";

const ALL_ROUTES = [{
path: '/Gallery',
Expand All @@ -16,6 +17,7 @@ const ALL_ROUTES = [{

export const Entry = () => (
<View style={{ flex: 1 }}>
<AllowTs test='1' />
<MemoryRouter initialEntries={['/Gallery']}>
{
ALL_ROUTES.map((item) => {
Expand Down
19 changes: 19 additions & 0 deletions driver/js/examples/hippy-react-demo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"strict": true,
"target": "esnext",
"module": "esnext",
"lib": ["esnext", "dom"],
"declaration": true,
"rootDir": ".",
"baseUrl": "./",
"outDir": "dist",
"jsx": "preserve",
"moduleResolution": "node",
"allowJs": true,
"esModuleInterop": true,
"noImplicitAny": false
},
"include": ["src/*", "app.d.ts"],
"exclude": ["node_modules", "dist", "**/dist", "**/node_modules"]
}
Loading
Loading