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

Redux Support #93

Merged
merged 20 commits into from
Apr 15, 2017
Merged

Redux Support #93

merged 20 commits into from
Apr 15, 2017

Conversation

dolymood
Copy link
Contributor

@dolymood dolymood commented Apr 13, 2017

add redux (默认全家桶:redux-actions redux-promise)

#89

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.855% when pulling 1d3e792 on dolymood:redux into deab35a on wepyjs:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.855% when pulling 7a6e841 on dolymood:redux into deab35a on wepyjs:master.

@@ -113,7 +113,7 @@ export default {
return matchs.replace(/[^\.\w'"]([a-z_\$][\w\d\._\$]*)/ig, (match, word, n) => {
//console.log(matchs + '------' + match + '--' + word + '--' + n);
let char = match[0];
let tmp = word.match(/^(\w+)(.*)/);
let tmp = word.match(/^([\w$]+)(.*)/);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是 $ ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

因为对 redux 处理中默认加入了 $state 这个 computed 的值方便直接使用。
而且加上 $ 也是合理的吧,毕竟从变量上来说是可以有$的

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对,所以是\s, 上面的comment竟然被转义了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是在 [] 中的,应该不用转义就好


if (!config.empty) {
dependencies.push('wepy-com-toast');
dependencies.push('wepy-async-function');
}
if (useRedux) {
dependencies.push.apply(dependencies, reduxDeps);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dependencies = dependencies.concat(reduxDeps)


if (!config.empty) {
dependencies.push('wepy-com-toast');
dependencies.push('wepy-async-function');
}
if (useRedux) {
dependencies.push.apply(dependencies, reduxDeps);
}

if (config.lint) {
devDependencies.push.apply(devDependencies, eslintDeps);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

@@ -94,6 +106,21 @@ let generateProject = (name, config) => {
// --on-lint will not copy eslint config
if (['.editorconfig', '.eslintignore', '.eslintrc'].indexOf(file) !== -1 && !config.lint)
return;
// 只有 redux 的项目拷贝 redux 相关内容 且做替换
const unReduxFiles = ['src/app.wpy', 'src/components/counter.wpy'];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在非--redux模式下,生成的template中并没有排除 redux 模式的相关文件,这样会导致普通模式下文件再次build报错。

const store = configStore()
setStore(store)

export default class extends wepy.app {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

示例不够充分,目前只有一个counter组件使用了redux。需要再加入一个组件,看不同组件中的同一数据流是否存在问题。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个在我的原始demo是有的,但后来我思考的是 counter 是多个实例的,所以也算是“多”个组件了

@@ -128,6 +128,7 @@ export default {
},

npmHack (filename, code) {
code = code.replace(/process\.env\.NODE_ENV/g, JSON.stringify(process.env.NODE_ENV));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这一句是处理哪里的内容的呢?能否加个注释。

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.855% when pulling eedab8a on dolymood:redux into deab35a on wepyjs:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.855% when pulling 5f43884 on dolymood:redux into deab35a on wepyjs:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.855% when pulling b74ad74 on dolymood:redux into deab35a on wepyjs:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.855% when pulling d3fa989 on dolymood:redux into deab35a on wepyjs:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.855% when pulling d3fa989 on dolymood:redux into deab35a on wepyjs:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.855% when pulling 5796e4c on dolymood:redux into deab35a on wepyjs:master.

@Gcaufy Gcaufy merged commit f7acabf into Tencent:master Apr 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants