-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #980 from raxjs/release-next
hotfix: v3.8.13
- Loading branch information
Showing
35 changed files
with
385 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { buildFixture, setupBrowser } from '../utils/build'; | ||
import { IPage } from '../utils/browser'; | ||
|
||
const example = 'spa-keep-alive'; | ||
let page: IPage = null; | ||
let browser = null; | ||
|
||
buildFixture(example); | ||
|
||
describe('should build web result: ', () => { | ||
test('open /', async () => { | ||
const res = await setupBrowser({ example }); | ||
page = res.page; | ||
browser = res.browser; | ||
await page.waitForFunction(`document.getElementsByTagName('img').length > 0`); | ||
expect(await page.$$text('.title')).toStrictEqual(['Welcome to Your Rax App']); | ||
await page.click('#link'); | ||
await page.waitForFunction(`document.getElementsByClassName('about').length > 0`); | ||
}); | ||
}); | ||
|
||
afterAll(async () => { | ||
await browser.close(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import * as path from 'path'; | ||
import * as fs from 'fs-extra'; | ||
import { startFixture, setupBrowser } from '../utils/start'; | ||
import { IPage } from '../utils/browser'; | ||
|
||
const example = 'spa-keep-alive'; | ||
let page: IPage = null; | ||
let browser = null; | ||
let devServer = null; | ||
|
||
|
||
describe('should start web devServer: ', () => { | ||
test('open /', async () => { | ||
const serverOptions = await startFixture(example); | ||
const port = serverOptions.port; | ||
devServer = serverOptions.devServer; | ||
const res = await setupBrowser({ port, defaultHtml: '' }); | ||
page = res.page; | ||
browser = res.browser; | ||
await page.waitForFunction(`document.getElementsByTagName('span').length > 0`); | ||
expect(await page.$$text('.title')).toStrictEqual(['Welcome to Your Rax App']); | ||
await page.click('#link'); | ||
await page.waitForFunction(`document.getElementsByClassName('about').length > 0`); | ||
}, 120000); | ||
}); | ||
|
||
afterAll(async () => { | ||
await browser?.close?.(); | ||
await devServer?.close(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# spa-keep-alive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"targets": ["web"], | ||
"compileDependencies": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "basic-spa", | ||
"description": "rax example", | ||
"devDependencies": { | ||
"@types/rax": "^1.0.0" | ||
}, | ||
"scripts": { | ||
"start": "../../packages/rax-app/bin/rax-cli.js start", | ||
"build": "../../packages/rax-app/bin/rax-cli.js build" | ||
}, | ||
"engines": { | ||
"node": ">=8.0.0" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"routes": [ | ||
{ | ||
"path": "/", | ||
"source": "pages/Home/index", | ||
"window": { | ||
"title": "Home Page" | ||
}, | ||
"keepAlive": true | ||
}, | ||
{ | ||
"path": "/pages/about.html", | ||
"source": "pages/About/index", | ||
"window": { | ||
"title": "About Page" | ||
}, | ||
"keepAlive": true | ||
} | ||
], | ||
"window": { | ||
"title": "Rax App" | ||
}, | ||
"tabBar": { | ||
"textColor": "#dddddd", | ||
"selectedColor": "#49a9ee", | ||
"backgroundColor": "#ffffff", | ||
"items": [ | ||
{ | ||
"pageName": "/", | ||
"name": "Home Page" | ||
}, | ||
{ | ||
"pageName": "/pages/about.html", | ||
"text": "About" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { runApp } from 'rax-app'; | ||
|
||
runApp({ | ||
app: { | ||
// ErrorBoundary | ||
|
||
// 生命周期 | ||
onShow() { | ||
console.log('app show...'); | ||
}, | ||
onHide() { | ||
console.log('app hide...'); | ||
}, | ||
|
||
// 获取初始数据 | ||
getInitialData: async () => { | ||
return { | ||
a: 1, | ||
b: 2, | ||
}; | ||
}, | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.logo { | ||
width: 200rpx; | ||
height: 180rpx; | ||
margin-bottom: 20rpx; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { createElement, PureComponent } from 'rax'; | ||
import Image from 'rax-image'; | ||
|
||
import './index.css'; | ||
|
||
class Logo extends PureComponent { | ||
render() { | ||
const source = { | ||
uri: `${process.env.PUBLIC_URL}/rax.png`, | ||
}; | ||
console.log('with router =>', this.props); | ||
return ( | ||
<Image | ||
className="logo" | ||
source={source} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
export default Logo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.home { | ||
align-items: center; | ||
margin-top: 200rpx; | ||
} | ||
|
||
.title { | ||
font-size: 35rpx; | ||
font-weight: bold; | ||
margin: 20rpx 0; | ||
} | ||
|
||
.info { | ||
font-size: 36rpx; | ||
margin: 8rpx 0; | ||
color: #555; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { createElement, Component } from 'rax'; | ||
import View from 'rax-view'; | ||
import Text from 'rax-text'; | ||
import { getSearchParams } from 'rax-app'; | ||
|
||
import './index.css'; | ||
|
||
class About extends Component { | ||
componentDidMount() { | ||
console.log('about search params', getSearchParams()); | ||
} | ||
|
||
render() { | ||
return ( | ||
<View className="about"> | ||
<Text className="title">About Page</Text> | ||
<Text className="info" onClick={() => (this.props as any).history.push('/')}>Go Home</Text> | ||
</View> | ||
); | ||
} | ||
} | ||
|
||
export default About; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.home { | ||
align-items: center; | ||
margin-top: 200rpx; | ||
} | ||
|
||
.title { | ||
font-size: 35rpx; | ||
font-weight: bold; | ||
margin: 20rpx 0; | ||
} | ||
|
||
.info { | ||
font-size: 36rpx; | ||
margin: 8rpx 0; | ||
color: #555; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { createElement, useState } from 'rax'; | ||
import { usePageShow, usePageHide, getSearchParams } from 'rax-app'; | ||
import View from 'rax-view'; | ||
import Text from 'rax-text'; | ||
import Logo from '@/components/Logo'; | ||
|
||
import './index.css'; | ||
|
||
export default function Home(props) { | ||
const { history } = props; | ||
const [count, setCount] = useState(0); | ||
|
||
const searchParams = getSearchParams(); | ||
|
||
console.log('home search params =>', searchParams); | ||
console.log('home page props =>', props); | ||
|
||
usePageShow(() => { | ||
console.log('home show...'); | ||
}); | ||
|
||
usePageHide(() => { | ||
console.log('home hide...'); | ||
}); | ||
|
||
return ( | ||
<View className="home"> | ||
<Logo /> | ||
<Text className="title">Welcome to Your Rax App</Text> | ||
<Text className="info">More information about Rax</Text> | ||
<Text onClick={() => { | ||
setCount(count + 1); | ||
}}>State: {count}</Text> | ||
<Text className="info" id="link" onClick={() => history.push('/pages/about.html', { id: 1 })}>Go About</Text> | ||
</View> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"compileOnSave": false, | ||
"buildOnSave": false, | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"outDir": "build", | ||
"module": "esnext", | ||
"target": "es6", | ||
"jsx": "preserve", | ||
"jsxFactory": "createElement", | ||
"moduleResolution": "node", | ||
"allowSyntheticDefaultImports": true, | ||
"lib": ["es6", "dom"], | ||
"sourceMap": true, | ||
"allowJs": true, | ||
"rootDir": "./", | ||
"forceConsistentCasingInFileNames": true, | ||
"noImplicitReturns": true, | ||
"noImplicitThis": true, | ||
"noImplicitAny": false, | ||
"importHelpers": true, | ||
"strictNullChecks": true, | ||
"suppressImplicitAnyIndexErrors": true, | ||
"noUnusedLocals": true, | ||
"skipLibCheck": true, | ||
"paths": { | ||
"@/*": ["./src/*"], | ||
"rax-app": [".rax/index.ts"] | ||
} | ||
}, | ||
"include": ["src", ".rax"], | ||
"exclude": ["node_modules", "build", "public"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# Changelog | ||
|
||
## v2.0.1 | ||
|
||
- Fix: build-scripts version | ||
|
||
## v2.0.0 | ||
|
||
- Feat: upgrade dependencies for webpack 5 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default function filterByTarget(routes, { target }) { | ||
return routes.filter(({ targets }) => { | ||
if (!targets) return true; | ||
return targets.includes(target); | ||
}); | ||
} | ||
|
Oops, something went wrong.