Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

Commit

Permalink
Merge pull request #88 from ice-lab/release/1.0.15
Browse files Browse the repository at this point in the history
Release/1.0.15
  • Loading branch information
chenbin92 authored Mar 12, 2020
2 parents cdf39f3 + 77cfdef commit 65b8048
Show file tree
Hide file tree
Showing 50 changed files with 329 additions and 197 deletions.
43 changes: 43 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,53 @@

Hi! I’m really excited that you are interested in contributing to ICE. Before submitting your contribution though, please make sure to take a moment and read through the following guidelines.

- [Setup Environment](#setup-environment)
- [Run Examples](#run-examples)
- [Publish Packages](publish-packages)
- [Pull Request Guidelines](#pull-request-guidelines)
- [Issue Reporting Guidelines](#issue-reporting-guidelines)
- [Git Commit Specific](#git-commit-specific)

## Setup Environment

clone repo and initialize the setup environment:

```bash
# 1. clone and setup
$ git clone [email protected]:ice-lab/icejs.git
$ cd icejs && npm run setup

# 2. watch packages
$ npm run watch
```

## Run Examples

We provide a lot of examples, you can run the examples:

```bash
$ cd examples/basic-spa
$ npm link ../../packages/icejs
$ npm start
```

## Publish Packages

When you need to release, you can execute the command:

```bash
$ npm run publish
# 1. ✔️ ✔️ ✔️ Checking the working tree status...
# 2. 📦 📦 📦 Building packages...
# 3. ⚡ ⚡ ⚡ Update package version automatically...
# 4. 🚀 🚀 🚀 Start publishing...
# 5. 🔖 🔖 🔖 Commit & Create tag'...
# 6. 💡 💡 💡 Start syncing...
```

* When you need to release a latest version, the tag will be created automatically, running `npm publish` will tag your package with the `latest` dist-tag.
* To publish a package with the `beta` dist-tag, you can choose to release rc、beta、alpha versions, the tag will not be created.

## Pull Request Guidelines

- Only code that's ready for release should be committed to the master branch. All development should be done in dedicated branches.
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CI

on: [push]

jobs:
lint:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [10.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run lint
env:
CI: true
14 changes: 0 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,6 @@ Finally, To start developing your application run `npm run start`. The applicati

## Contributing

```bash
# 1. clone and setup
$ git clone [email protected]:ice-lab/icejs.git
$ cd icejs && npm run setup

# 2. watch packages
$ npm run watch

# 3. run example
$ cd examples/spa-basic
$ npm link ../../packages/icejs
$ npm start
```

Please see our [CONTRIBUTING.md](/.github/CONTRIBUTING.md)

## Ecosystem
Expand Down
14 changes: 0 additions & 14 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,6 @@ createApp(appConfig)

## 贡献代码

```bash
# 1. clone and setup
$ git clone [email protected]:ice-lab/icejs.git
$ cd icejs && npm run setup

# 2. watch packages
$ npm run watch

# 3. run example
$ cd examples/spa-basic
$ npm link ../../packages/icejs
$ npm start
```

贡献代码请参考 [CONTRIBUTING.md](/.github/CONTRIBUTING.md)

## 生态
Expand Down
4 changes: 2 additions & 2 deletions examples/basic-mpa/src/pages/Dashboard/app.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createApp } from 'ice'
import { createApp, IAppConfig } from 'ice'
import Dashboard from './index'

const appConfig = {
const appConfig: IAppConfig = {
router: {
routes: [{ path: '/', component: Dashboard }],
},
Expand Down
17 changes: 11 additions & 6 deletions examples/basic-mpa/src/pages/Dashboard/models/counter.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
const delay = (time) => new Promise((resolve) => setTimeout(() => resolve(), time));
export const delay = (time) => new Promise((resolve) => setTimeout(() => resolve(), time));

export default {
state: {
count: 0
},

actions: {
increment(prevState) {
reducers: {
increment (prevState) {
return { count: prevState.count + 1 }
},
decrement (prevState) {
return { count: prevState.count - 1 }
}
},

async decrement(prevState) {
effects: {
async decrementAsync (state, payload, actions) {
await delay(10);
return { count: prevState.count - 1 }
actions.decrement();
},
},
}
};
4 changes: 2 additions & 2 deletions examples/basic-mpa/src/pages/Home/app.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createApp } from 'ice'
import { createApp, IAppConfig } from 'ice'
import Home from './index'

const appConfig = {
const appConfig: IAppConfig = {
router: {
routes: [{ path: '/', component: Home }],
},
Expand Down
4 changes: 2 additions & 2 deletions examples/basic-request/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createApp } from 'ice';
import { createApp, IAppConfig } from 'ice';

const appConfig = {
const appConfig: IAppConfig = {
app: {
rootId: 'ice-container',
},
Expand Down
3 changes: 0 additions & 3 deletions examples/basic-spa/build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"router": {
"ignorePaths": ["stores", "components"]
},
"ignoreHtmlTemplate": true,
"plugins": [],
"modeConfig": {
Expand Down
16 changes: 9 additions & 7 deletions examples/basic-spa/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import { createApp, APP_MODE } from 'ice'
import { createApp, APP_MODE, IAppConfig } from 'ice'

const appConfig = {
const appConfig: IAppConfig = {
app: {
rootId: 'ice-container'
},
logger: {
level: APP_MODE === 'build' ? 'error' : 'debug',
},
router: {
type: 'hash'
},
request: {
timeout: 5000,
// baseURL: '/abc',
baseURL: '/',
interceptors: {
response: {
onConfig: (conf) => {
console.log('interceptors response:', conf)
return conf
request: {
onConfig: (config) => {
return config
}
}
}
Expand Down
11 changes: 5 additions & 6 deletions examples/basic-spa/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ const About = lazy(() => import('@/pages/About'));
const Notfound = lazy(() => import('@/pages/NotFound'));

export default [
{
path: '/',
exact: true,
component: Home
},
{
path: '/dashboard',
exact: true,
Expand All @@ -22,8 +17,12 @@ export default [
component: About
},
{
path: '*',
path: '/',
exact: true,
component: Home
},
{
path: '*',
component: Notfound
},
];
4 changes: 2 additions & 2 deletions examples/basic-store/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createApp } from 'ice';
import { createApp, IAppConfig } from 'ice';

const appConfig = {
const appConfig: IAppConfig = {
app: {
rootId: 'ice-container',
},
Expand Down
6 changes: 3 additions & 3 deletions examples/basic-store/src/models/counter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ export default {
},

reducers: {
increment: (prevState) => {
increment (prevState) {
return { count: prevState.count + 1 }
},
decrement: (prevState) => {
decrement (prevState) {
return { count: prevState.count - 1 }
}
},

effects: {
decrementAsync: async (state, payload, actions) => {
async decrementAsync (state, payload, actions) {
await delay(10);
actions.decrement();
},
Expand Down
4 changes: 2 additions & 2 deletions examples/basic-store/src/models/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
},

reducers: {
update: (prevState, payload) => {
update (prevState, payload) {
return {
...prevState,
...payload,
Expand All @@ -16,7 +16,7 @@ export default {
},

effects: {
getUserInfo: async (prevState, payload, actions, globalActions) => {
async getUserInfo (prevState, payload, actions, globalActions) {
globalActions.counter.decrement();
await delay(1000);
actions.update({
Expand Down
4 changes: 2 additions & 2 deletions examples/basic-store/src/pages/About/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
},

reducers: {
update: (prevState, payload) => {
update (prevState, payload) {
return {
...prevState,
...payload,
Expand All @@ -13,7 +13,7 @@ export default {
},

effects: {
getPageTitle: async (prevState, payload, actions) => {
async getPageTitle (prevState, payload, actions) {
actions.update({
title: 'About Page'
});
Expand Down
4 changes: 2 additions & 2 deletions examples/hello-world/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createApp } from 'ice';
import { createApp, IAppConfig } from 'ice';

const appConfig = {
const appConfig: IAppConfig = {
app: {
rootId: 'ice-container',
},
Expand Down
6 changes: 3 additions & 3 deletions examples/icestark-child/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { createApp } from 'ice'
import { createApp, IAppConfig } from 'ice'

const appConfig = {
const appConfig: IAppConfig = {
app: {
rootId: 'ice-container'
},
logger: {
level: 'warn'
},
icestark: {
type: 'child',
type: 'child'
},
};

Expand Down
17 changes: 0 additions & 17 deletions examples/icestark-child/src/pages/404.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion examples/icestark-child/src/pages/About/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function BasicLayout({
return (
<div style={{minHeight: '100vh'}}>
<section>
Headerxxx
Header
{children}
</section>
</div>
Expand Down
16 changes: 3 additions & 13 deletions examples/icestark-child/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
import React from 'react'
import { Link, useIndexPage, helpers, logger } from 'ice'

console.log('helpers from ice', helpers);
console.log('logger from ice', logger);

logger.info('=== info ===');
logger.warn('=== warn ===');
import { Link } from 'ice'

const Home = (props) => {
const page = useIndexPage()

console.log('Home props', props);
console.log('render home', { page });
return (
<>
<h2>Home Page...{props.a}</h2>
Expand All @@ -22,11 +12,11 @@ const Home = (props) => {
}

Home.getInitialProps = async () => {
return {a: 1}
return { a: 1 }
};

Home.pageConfig = {
title: 'hahah'
title: 'Home Page'
};

export default Home
Loading

0 comments on commit 65b8048

Please sign in to comment.