diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index fa6f49039a4a..b5d199815e2c 100755 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,4 +1,6 @@ - [ ] Check the current issues to ensure you aren't creating a duplicate. - [ ] Consider making small typo fixes and such directly as pull requests. +- [ ] For the voting application, go to https://github.com/webpack-contrib/voting-app. +- [ ] For loader/plugin docs, consider opening an issue in the corresponding repository. - [ ] No existing issue? Go ahead and open a new one. - __Remove these instructions from your PR as they are for your eyes only.__ diff --git a/README.md b/README.md index a7cc545215d3..cdc73866bb6a 100755 --- a/README.md +++ b/README.md @@ -44,37 +44,37 @@ npm start # webpack.js.org -[![build status](https://secure.travis-ci.org/webpack/webpack.js.org.svg)](http://travis-ci.org/webpack/webpack.js.org) -[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version) +[![Build Status][13]][10] +[![Standard Version][12]][11] Guides, documentation, and all things webpack. ## Content Progress -Now that we've covered much of the backlog of _missing documentation_, we are starting -to heavily review each section of the site's content to sort and structure it appropriately. -The following issues should provide a pretty good idea of where things are, and where -they are going: +Now that we've covered much of the backlog of _missing documentation_, we are +starting to heavily review each section of the site's content to sort and +structure it appropriately. The following issues should provide a pretty good +idea of where things are, and where they are going: - [Guides - Review and Simplify][1] -- [Concepts - Review, Organize, Define Clear Goals][2] +- [Concepts - Review and Organize][2] +- [API - v4 Rewrite][8] -We haven't created issues for the other sections yet, but they will be coming soon. For -dev-related work please see [General - Current Longterm Plan][3], which will soon be -replaced by a more dev-specific issue. +We haven't created issues for the other sections yet, but they will be coming +soon. For dev-related work please see [General - Updates & Fixes][3]. ## Translation -If you hope to localize this documentation please jump to the [translate branch][4]. +To help translate this documentation please jump to the [translate branch][4]. ## Contributing -Read through the [writer's guide][7] if you're interested in editing the content on this -site. See the [contributors page][5] to learn how to set up and start working on the site -locally. +Read through the [writer's guide][7] if you're interested in editing the +content on this site. See the [contributors page][5] to learn how to set up and +start working on the site locally. ## License @@ -82,10 +82,24 @@ locally. The content is available under the [Creative Commons BY 4.0][6] license. +## Special Thanks + +_BrowserStack_ has graciously allowed us to do cross-browser and cross-os +testing of the site at no cost... + +[![BrowserStackLogo](./browserstack-logo.png)][9] + + [1]: https://github.com/webpack/webpack.js.org/issues/1258 [2]: https://github.com/webpack/webpack.js.org/issues/1386 -[3]: https://github.com/webpack/webpack.js.org/issues/1380 +[3]: https://github.com/webpack/webpack.js.org/issues/1525 [4]: https://github.com/webpack/webpack.js.org/tree/translation [5]: https://github.com/webpack/webpack.js.org/blob/master/.github/CONTRIBUTING.md [6]: https://creativecommons.org/licenses/by/4.0/ [7]: https://webpack.js.org/writers-guide +[8]: https://github.com/webpack/webpack.js.org/pull/1754 +[9]: http://browserstack.com/ +[10]: http://travis-ci.org/webpack/webpack.js.org +[11]: https://github.com/conventional-changelog/standard-version +[12]: https://img.shields.io/badge/release-standard%20version-brightgreen.svg +[13]: https://secure.travis-ci.org/webpack/webpack.js.org.svg diff --git a/UPDATE.md b/UPDATE.md new file mode 100644 index 000000000000..14b8bbb3fc7c --- /dev/null +++ b/UPDATE.md @@ -0,0 +1,5 @@ +## 更新记录 + +### 2018.01.13 +* 合并记录:合并 master 分支 +* 合并记录:https://github.com/webpack-china/webpack.js.org/pull/433 diff --git a/browserstack-logo.png b/browserstack-logo.png new file mode 100644 index 000000000000..f1deff83be7e Binary files /dev/null and b/browserstack-logo.png differ diff --git a/package.json b/package.json index a8462a6d5dc3..b9ad10f47042 100755 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "antwar-helpers": "^0.19.0", "antwar-interactive": "^0.19.0", "async": "^2.5.0", - "autoprefixer": "^7.1.3", + "autoprefixer": "^7.2.3", "babel-core": "^6.26.0", "babel-eslint": "^7.2.3", "babel-loader": "^7.1.2", @@ -55,12 +55,12 @@ "babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-preset-env": "^1.6.0", "babel-preset-react": "^6.24.1", - "copy-webpack-plugin": "^4.0.1", + "copy-webpack-plugin": "^4.3.0", "css-loader": "^0.28.5", "duplexer": "^0.1.1", "eslint": "4.5.0", "eslint-loader": "^1.9.0", - "eslint-plugin-markdown": "^1.0.0-beta.6", + "eslint-plugin-markdown": "^1.0.0-beta.7", "extract-text-webpack-plugin": "^3.0.0", "file-loader": "^0.11.2", "fontgen-loader": "^0.2.1", @@ -69,22 +69,22 @@ "github": "^10.0.0", "html-webpack-plugin": "^2.30.1", "http-server": "^0.10.0", - "hyperlink": "^3.0.0", + "hyperlink": "^3.0.1", "loader-utils": "^1.1.0", "lodash": "^4.17.4", "markdown-loader": "^2.0.1", "markdownlint": "^0.6.0", "markdownlint-cli": "^0.3.1", - "marked": "^0.3.6", + "marked": "^0.3.7", "mkdirp": "^0.5.1", "modularscale-sass": "^3.0.3", - "moment": "^2.18.1", + "moment": "^2.20.1", "ncp": "^2.0.0", "node-sass": "^4.5.3", "npm-run-all": "^4.1.1", "postcss-loader": "^2.0.6", "prism-languages": "^0.3.3", - "prismjs": "^1.6.0", + "prismjs": "^1.9.0", "raw-loader": "^0.5.1", "request": "^2.81.0", "sass-loader": "^6.0.6", @@ -94,14 +94,14 @@ "tap-parser": "^6.0.1", "through2": "^2.0.3", "url-loader": "^0.5.9", - "webpack": "^3.5.5", - "webpack-dev-server": "^2.7.1", + "webpack": "^3.10.0", + "webpack-dev-server": "^2.9.7", "webpack-merge": "^4.1.0", "yaml-frontmatter-loader": "^0.1.0" }, "dependencies": { - "ajv": "^5.2.2", - "preact": "^8.2.5", + "ajv": "^5.5.2", + "preact": "^8.2.7", "preact-compat": "3.17.0", "prop-types": "^15.5.10", "react": "^15.6.1", @@ -109,6 +109,7 @@ "react-router": "^4.2.0", "react-router-dom": "^4.2.2", "tool-list": "^0.11.0", + "webpack.vote": "^0.1.2", "whatwg-fetch": "^2.0.3" } } diff --git a/src/assets/homepage-modules.svg b/src/assets/homepage-modules.svg deleted file mode 100755 index a39441644b53..000000000000 --- a/src/assets/homepage-modules.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/components/Navigation/Links.json b/src/components/Navigation/Links.json index c46d5a0080c5..d7ec12ee950b 100644 --- a/src/components/Navigation/Links.json +++ b/src/components/Navigation/Links.json @@ -15,6 +15,10 @@ "title": "参与贡献", "url": "contribute" }, + { + "title": "投票", + "url": "vote" + }, { "title": "博客", "url": "//medium.com/webpack" diff --git a/src/components/NotificationBar/NotificationBar.jsx b/src/components/NotificationBar/NotificationBar.jsx index 41deb5c66aed..50a2faee4e9d 100755 --- a/src/components/NotificationBar/NotificationBar.jsx +++ b/src/components/NotificationBar/NotificationBar.jsx @@ -2,7 +2,7 @@ import React from 'react'; import Container from '../Container/Container'; import testLocalStorage from '../../utilities/test-local-storage'; -const version = '1'; +const version = '2'; const localStorageIsEnabled = testLocalStorage() !== false; export default class NotificationBar extends React.Component { @@ -13,17 +13,16 @@ export default class NotificationBar extends React.Component {

- 赞助 webpack,同时获取官方衣服!访问 webpack 官方商店!  查看所有收益请转到 webpack 的 Open Collective 页面! -

-

- 在 Unixstickers! 上购买全新的 webpack 贴纸 - {localStorageIsEnabled ? -

); diff --git a/src/components/NotificationBar/NotificationBar.scss b/src/components/NotificationBar/NotificationBar.scss index 4a5e0f308be5..4e8a3f0af00f 100755 --- a/src/components/NotificationBar/NotificationBar.scss +++ b/src/components/NotificationBar/NotificationBar.scss @@ -5,10 +5,6 @@ color: getColor(white); background: getColor(emperor); - p:not(:last-child) { - padding-bottom: 1em; - } - p { font-size: 14px; } @@ -36,15 +32,15 @@ } .notification-bar__close { - color: getColor(white); - font-size: 16px; - padding: 0; - background: none; - border: none; position: absolute; + font-size: 16px; top: 10px; right: 1em; + padding: 0; + border: none; cursor: pointer; + color: getColor(white); + background: none; transition: color 250ms; &:hover { diff --git a/src/components/Site/Site.jsx b/src/components/Site/Site.jsx index 7f09856e186b..fa98e96caa1b 100755 --- a/src/components/Site/Site.jsx +++ b/src/components/Site/Site.jsx @@ -45,9 +45,17 @@ const Site = ({ title: section.path.title, url: section.url, pages: section.pages.map(page => ({ + file: page.file, title: page.file.title, url: page.url - })) + })).sort(({ file: { attributes: a }}, { file: { attributes: b }}) => { + let group1 = a.group.toLowerCase(); + let group2 = b.group.toLowerCase(); + + if (group1 < group2) return -1; + if (group1 > group2) return 1; + return a.sort - b.sort; + }) })) } /> diff --git a/src/components/SplashViz/SplashViz.jsx b/src/components/SplashViz/SplashViz.jsx index 3cae30b3eba3..1c8f9f3e5ff3 100755 --- a/src/components/SplashViz/SplashViz.jsx +++ b/src/components/SplashViz/SplashViz.jsx @@ -2,7 +2,7 @@ import React from 'react'; import Cube from '../Cube/Cube'; import TextRotator from '../TextRotater/TextRotater'; -import Modules from '../../assets/homepage-modules.svg'; +import homeSVG from './SplashVizSVG'; export default class SplashViz extends React.Component { @@ -18,9 +18,7 @@ export default class SplashViz extends React.Component { styles -
- dependency bundling graphic -
+
); diff --git a/src/components/SplashViz/SplashViz.scss b/src/components/SplashViz/SplashViz.scss index 09b105f33a7f..2bd9894fa8b2 100755 --- a/src/components/SplashViz/SplashViz.scss +++ b/src/components/SplashViz/SplashViz.scss @@ -27,16 +27,17 @@ position: absolute; left: 0; right: 0; - top: 0; + top: 50%; // vertical center bottom: 0; width: 75vw; min-width: 550px; max-width: map-get($screens, large); - margin: auto; + margin: 0 auto; + transform: translateY(-50%); // vertical center display: none; @include break { - display: block; + display: table; // Get height of its child svg } img { diff --git a/src/components/SplashViz/SplashVizSVG.js b/src/components/SplashViz/SplashVizSVG.js new file mode 100644 index 000000000000..95e6ba1ad7ea --- /dev/null +++ b/src/components/SplashViz/SplashVizSVG.js @@ -0,0 +1,200 @@ +// TODO: Try raw-loader or other approach when build process is refactored +module.exports = { + body: ` + + + + STATIC ASSETS + + + + + + + + .png + + + + + + + + + .css + + + + + + + + + .jpg + + + + + + + + + .js + + + + + + + + + + MODULES WITH DEPENDENCIES + + + + + + + + .jpg + + + + + + + + + .png + + + + + + + + + + + + + + + + .sass + + + + + + + + + .sass + + + + + + + + + + + + + + + + + + + + + + + + + + + .js + + + + + + + + + + + + + + + + .sass + + + + + + + + + + + + + + + + .cjs + + + + + + + + + + + + + + + + + + + + + + + + + + + + .hbs + + + + + + + + + + + + + + .js + + + + ` +}; diff --git a/src/components/StarterKits/StarterKits.jsx b/src/components/StarterKits/StarterKits.jsx index ac73d7efeb71..7d0a856cd5fa 100755 --- a/src/components/StarterKits/StarterKits.jsx +++ b/src/components/StarterKits/StarterKits.jsx @@ -17,15 +17,15 @@ const StarterKits = props => (

下面表格包含一个起步配套工具的辅助列表, 可以作为基于 webpack 的项目的起点。 - 要向列表添加新的配套工具请访问 - 仓库 + 要向列表添加新的配套工具请访问{' '} + 仓库{' '} 以及提交一个 PR 来修改这个文件 generator/starterProjectUrls.js.

- 模板应该是用于验证概念, + 模板应该是用于验证概念, 以帮助你学习各种框架的 webpack 不同技术。 确保你了解他们在做什么,并避免复制和粘贴制造重复代码。 另外还请注意,这些都不是由 webpack 官方支持的。 diff --git a/src/components/Vote/App.jsx b/src/components/Vote/App.jsx deleted file mode 100755 index cfba8704f200..000000000000 --- a/src/components/Vote/App.jsx +++ /dev/null @@ -1,411 +0,0 @@ -import React from 'react'; -import 'whatwg-fetch'; -import * as api from "./api"; -import VoteButton from './Button/Button'; -import Influence from './Influence'; -import GithubMark from '../../assets/github-logo.svg'; - -function updateByProperty(array, property, propertyValue, update) { - return array.map(item => { - if(item[property] === propertyValue) { - return update(item); - } else { - return item; - } - }); -} - -export default class VoteApp extends React.Component { - constructor(props) { - super(props); - this.state = { - selfInfo: undefined, - listInfo: undefined, - isFetchingSelf: false, - isVoting: 0 - }; - } - - isBrowserSupported() { - return typeof localStorage === 'object'; - } - - componentDidMount() { - if(!this.isBrowserSupported()) - return; - - let { selfInfo, listInfo } = this.state; - - if(api.isLoginActive()) { - this.setState({ - isLoginActive: true - }); - api.continueLogin().then(token => { - window.localStorage.voteAppToken = token; - }); - } else { - if(!selfInfo) { - this.updateSelf(); - } - if(!listInfo) { - this.updateList(); - } - } - } - - componentWillReceiveProps(props) { - if(!this.isBrowserSupported()) - return; - - this.updateList(props); - } - - updateSelf() { - let { voteAppToken } = localStorage; - if(voteAppToken) { - this.setState({ - isFetchingSelf: true - }); - api.getSelf(voteAppToken).catch(e => { - this.setState({ - selfInfo: null, - isFetchingSelf: false - }); - }).then(result => { - this.setState({ - selfInfo: result, - isFetchingSelf: false - }); - }); - } - } - - updateList(props = this.props) { - let { name } = props; - let { voteAppToken } = localStorage; - this.setState({ - isFetchingList: true - }); - api.getList(voteAppToken, name).catch(e => { - this.setState({ - listInfo: null, - isFetchingList: false - }); - }).then(result => { - this.setState({ - listInfo: result, - isFetchingList: false - }); - }); - } - - localVote(itemId, voteName, diffValue, currencyName, score) { - let { selfInfo, listInfo } = this.state; - this.setState({ - isVoting: this.state.isVoting + 1, - listInfo: listInfo && { - ...listInfo, - items: updateByProperty(listInfo.items, "id", itemId, item => ({ - ...item, - votes: updateByProperty(item.votes, "name", voteName, vote => ({ - ...vote, - votes: vote.votes + diffValue - })), - userVotes: updateByProperty(item.userVotes, "name", voteName, vote => ({ - ...vote, - votes: vote.votes + diffValue - })), - score: item.score + score * diffValue - })) - }, - selfInfo: selfInfo && { - ...selfInfo, - currencies: updateByProperty(selfInfo.currencies, "name", currencyName, currency => ({ - ...currency, - used: currency.used + diffValue, - remaining: currency.remaining - diffValue - })) - } - }); - } - - vote(itemId, voteName, diffValue, currencyName, score) { - if(!diffValue) return; - this.localVote(itemId, voteName, diffValue, currencyName, score); - let { voteAppToken } = localStorage; - api.vote(voteAppToken, itemId, voteName, diffValue).catch(e => { - console.error(e); - // revert local vote - this.localVote(itemId, voteName, -diffValue, currencyName, score); - this.setState({ - isVoting: this.state.isVoting - 1 - }); - }).then(() => { - this.setState({ - isVoting: this.state.isVoting - 1 - }); - }); - } - - render() { - let { name } = this.props; - - if(!this.isBrowserSupported()) - return
Your browser is not supported.
; - - let { selfInfo, listInfo, isVoting, isFetchingList, isFetchingSelf, isCreating, isLoginActive, editItem, editItemTitle, editItemDescription } = this.state; - - let { voteAppToken } = localStorage; - - if(isLoginActive) { - return
Logging in...
; - } - - const inProgress = isFetchingList || isFetchingSelf || isCreating || isVoting; - - let maxVoteInfo = listInfo && listInfo.possibleVotes.map(() => 0); - - if(listInfo) listInfo.items.forEach(item => { - if(item.userVotes) { - maxVoteInfo.forEach((max, idx) => { - let votes = item.userVotes[idx].votes; - if(votes > max) - maxVoteInfo[idx] = votes; - }); - } - }); - return ( -
-
- Vote -
-
-
-
-
- - -
-
- DISCLAIMER: Since this feature is its Alpha stages, the formula for calculating influence may change. -
-
-
- {this.renderSelf(inProgress)} -
-
-
- { listInfo &&
-

{listInfo.displayName}

-
{listInfo.description}
-
    - { listInfo.items.map(item =>
  • -
    -
    -
    {item.score}
    - {listInfo.possibleVotes.map((voteSettings, idx) => { - let vote = item.votes[idx]; - let userVote = item.userVotes && item.userVotes[idx]; - let currencyInfo = selfInfo && voteSettings.currency && this.findByName(selfInfo.currencies, voteSettings.currency); - let maximum = voteSettings.maximum || 1000; // infinity - let minimum = voteSettings.minimum || 0; - let value = (userVote && userVote.votes) ? userVote.votes: 0; - if(currencyInfo && currencyInfo.remaining + value < maximum) maximum = currencyInfo.remaining + value; - return
    - { - this.vote(item.id, voteSettings.name, diffValue, voteSettings.currency, voteSettings.score); - }} - /> -
    ; - })} -
    - { editItem !== item.id &&
    - {item.title} - {item.description} - { listInfo.isAdmin &&
    - - - - - -
    } -
    } - { editItem === item.id &&
    -
    - this.setState({ editItemTitle: e.target.value })} /> -
    -
    -