Skip to content

Commit 78f52f1

Browse files
Muntermontogeek
authored andcommitted
feat(infra) Rebuild hyperlink (#2382)
* Update link checking to use latest hyperlink. Replaces #1582 * Stop appending empty fragment to urls pointing ad no fragment identifier * Resolve relative hrefs from README's to their github.com url instead of linking locally inside docs * Prefer https where available and also use https in examples * Make non-fragment links inside headings visible * Update webpack docs china link * Fixed invalid edit links to index pages * skip fragment check for vimdoc that is known to fail * Fix broken link to migration guide from configuration/resolve * Also resolve github README relative links when they don't start with a dot * Add missing pages: Vote, Organization, Starter kits * Remove unused code * Fix link that was redirected * Open all target='_blank' links with rel='noopener' for security * Skip link checking img.shields.io * Change order of markdown url rewriting to avoid errors * Use lowercase variable name for node url module. See #2382 (comment) * Update link to file-loader github repo * Rewrite links from https://npmjs.com to https://www.npmjs.com to avoid the inevitable redirect * Skip checking links to npmjs.com/package that causes hyperlink to get http 500 responses. This should probably be reverted and fixed later * Updated organization projects urls to their redirect target * Update tool-list to get correct links for projects * Updated links to their redirect target * Remove jscs-loader. The project is deprecated, merged with eslint and the domain we link to is for sale * Update link to karma-webpack project * Remove link to named-modules-plugin, which is now in webpack core * Added missing mini-css-extract-plugin to fetch script * Skip checking links to known deleted github users * Update broken fragments to work with new markdown generator * Fixed more broken links * infra(site) Copy assets when building * Update github location for css-loader * Remove dead github accounts from contributors listings * infra(site) Fix fetchPackages script when running locally * Fix internal fragmtn links in optimization.md * Skip link checking or opencollective.com/webpack. Massive html response made the checker go into CPU overdrive * Remove link to non-existing named-modules-plugin * Use new release of hyperlink * feat(infra) Travis optimization (#2404) * Fix internal fragmtn links in optimization.md * Skip link checking or opencollective.com/webpack. Massive html response made the checker go into CPU overdrive * Try out travis staged build * Add proselint * Upgrade pip before using it * Move before-hooks around to try and make proselint install * Try adding python as a language as well to geet an updated version * More messing with config * Manually handle node versioning * Add node minor version to nvm install. Defaulted to slightly too low version * Manually install node 8.11 * Try a matrix build to separate node and python stuff * Add linkcheck task and try a different cahce setup * Minor name change to test if cache works correctly across builds * Attempt to combine matrix and staged build * Attempt going back to staged build * Bump travis * Ping Travis. You alive? * Fix broken travis.yml * Fix wrong stage order * Explicitly run specific lintings, exclude proselint * Allow failures for link checker * Change proselint cache directory. Maybe this works * Add new script to fetch repository names that the docs should contain. Try to centralize github API usage to avoid rate limitations * Add caching to eslint * Remove parts of deploy.sh that are now run by travis * Added new ./repositories to store github api results * Replace fetch.sh with npm scripts and fetch-package-readmes.js * Attempt to make caches more specific to the containers and stages they refer to * Remove deprecaed fetch_packages script. Now replaced by two-step fetch-package-repos and fetch-package-readmes * Attempt a more windows friendly build by using npm and webpack instead of shell commands * Disable link checking for now to speed up builds * Revert "Disable link checking for now to speed up builds" This reverts commit 7d4bb06. * Add dist to proselint cache so generated content also gets checked * Remove unnessessary GITHUB_TOKEN env variable check in repo fetching script * Revert "Add dist to proselint cache so generated content also gets checked" This reverts commit fc7676d. * Rework pipeline for better speed and make proselint a deployment blocker * Rename build stage to reflect its actions * Run content-tree only after generating all external content * Remove link to non-existing named-modules-plugin * Fix double slashes in edit links * Rename stages * Add new internal link check as a blocking check * Fix wrong name in allowed_failures config
1 parent 7cf051b commit 78f52f1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1441
-547
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ src/**/_*.md
88
npm-debug.log
99
yarn-error.log
1010
package-lock.json
11+
.cache

.travis.yml

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,52 @@
1-
branches:
2-
only:
3-
- master
4-
- develop
1+
sudo: false
52
language: node_js
63
node_js:
74
- "8"
8-
sudo: required
9-
install:
10-
- yarn
11-
- sudo pip install proselint
12-
before_script:
13-
- source ./src/scripts/env.sh
14-
script:
15-
- bash ./src/scripts/deploy.sh
5+
6+
cache:
7+
yarn: true
8+
directories:
9+
- node_modules
10+
- dist
11+
- .cache
12+
13+
stages:
14+
- Build
15+
- Post-build
16+
17+
jobs:
18+
fast_finish: true
19+
allow_failures:
20+
- name: External Link Check
21+
22+
include:
23+
- stage: Build
24+
name: Lint and Build
25+
before_install: npm install --global yarn
26+
install: yarn
27+
script:
28+
- yarn lint:js
29+
- yarn lint:markdown
30+
- yarn lint:social
31+
- yarn build
32+
- yarn lint:links
33+
34+
- stage: Build
35+
name: Proselint
36+
language: python
37+
python: 3.6
38+
cache:
39+
pip: true
40+
directories:
41+
- $HOME/.cache
42+
install: pip install -r requirements.txt
43+
script: cp .proselintrc ~/ && proselint src/content
44+
45+
- stage: Post-build
46+
name: Deploy
47+
if: branch = master
48+
script: bash ./src/scripts/deploy.sh
49+
50+
- stage: Post-build
51+
name: External Link Check
52+
script: yarn linkcheck

package.json

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,24 @@
2626
"scripts": {
2727
"clean": "rimraf ./dist src/content/**/_*.md src/**/_*.json",
2828
"start": "cross-env NODE_ENV=development webpack-dev-server --config webpack.dev.js --env.dev",
29+
"update-repos": "node src/utilities/fetch-package-repos.js",
2930
"content": "node src/scripts/build-content-tree.js ./src/content ./src/_content.json",
3031
"build-test": "npm run build && http-server build/",
31-
"fetch": "sh src/scripts/fetch.sh",
32+
"fetch": "run-p fetch:*",
33+
"fetch:readmes": "node src/utilities/fetch-package-readmes.js",
34+
"fetch:supporters": "node src/utilities/fetch-supporters.js",
35+
"fetch:starter-kits": "node src/utilities/fetch-starter-kits.js",
3236
"prebuild": "npm run clean",
33-
"build": "npm run fetch && npm run content && cross-env NODE_ENV=production webpack --config webpack.prod.js && npm run sitemap && echo webpack.js.org > dist/CNAME",
37+
"build": "run-s fetch content && cross-env NODE_ENV=production webpack --config webpack.prod.js",
38+
"postbuild": "npm run sitemap",
3439
"test": "npm run lint",
3540
"lint": "run-s lint:*",
36-
"lint:js": "eslint src --ext .js,.jsx,.md",
41+
"lint:js": "eslint src --ext .js,.jsx,.md --cache true --cache-location .cache/.eslintcache",
3742
"lint:markdown": "markdownlint --config ./.markdownlint.json *.md ./src/content/**/*.md --ignore './src/content/**/_*.md'",
3843
"lint:social": "alex . -q",
3944
"lint:prose": "cp .proselintrc ~/ && proselint src/content",
45+
"lint:links": "hyperlink -r dist/index.html --canonicalroot https://webpack.js.org/ -i | tee internal-links.tap | tap-spot",
46+
"linkcheck": "hyperlink -r dist/index.html --canonicalroot https://webpack.js.org/ --skip support__ --skip sidecar.gitter.im --skip vimdoc.sourceforge.net --skip img.shields.io --skip npmjs.com/package/ --skip opencollective.com/webpack --todo external-redirect | tee external-links.tap | tap-spot",
4047
"sitemap": "cd dist && sitemap-static --prefix=https://webpack.js.org/ > sitemap.xml",
4148
"serve": "npm run build && sirv start ./dist --port 4000",
4249
"deploy": "gh-pages -d dist"
@@ -47,11 +54,15 @@
4754
}
4855
},
4956
"lint-staged": {
50-
"*.{js,jsx,md}": ["npm run lint:js"],
51-
"*.md": ["npm run lint:markdown"]
57+
"*.{js,jsx,md}": [
58+
"npm run lint:js"
59+
],
60+
"*.md": [
61+
"npm run lint:markdown"
62+
]
5263
},
5364
"devDependencies": {
54-
"@octokit/rest": "^15.2.6",
65+
"@octokit/rest": "^15.9.4",
5566
"alex": "^5.1.0",
5667
"autoprefixer": "^7.2.3",
5768
"babel-core": "^6.26.0",
@@ -62,7 +73,7 @@
6273
"babel-plugin-transform-object-rest-spread": "^6.26.0",
6374
"babel-preset-env": "^1.6.0",
6475
"babel-preset-react": "^6.24.1",
65-
"copy-webpack-plugin": "^4.3.0",
76+
"copy-webpack-plugin": "4.5.2",
6677
"cross-env": "5.2.0",
6778
"css-loader": "^0.28.5",
6879
"directory-tree": "2.1.0",
@@ -81,7 +92,7 @@
8192
"html-webpack-template": "^6.1.0",
8293
"http-server": "^0.10.0",
8394
"husky": "^1.0.0-rc.8",
84-
"hyperlink": "^3.0.1",
95+
"hyperlink": "^4.0.0",
8596
"lint-staged": "^7.2.0",
8697
"loader-utils": "^1.1.0",
8798
"lodash": "^4.17.4",
@@ -113,7 +124,7 @@
113124
"sitemap-static": "^0.4.2",
114125
"static-site-generator-webpack-plugin": "^3.4.1",
115126
"style-loader": "^0.18.2",
116-
"tap-parser": "^6.0.1",
127+
"tap-spot": "^1.1.1",
117128
"through2": "^2.0.3",
118129
"uglifyjs-webpack-plugin": "^1.1.6",
119130
"webpack": "^3.10.0",
@@ -122,9 +133,9 @@
122133
},
123134
"dependencies": {
124135
"@rigor789/remark-autolink-headings": "^5.1.0",
136+
"ajv": "^5.5.2",
125137
"docsearch.js": "^2.5.2",
126138
"gitter-sidecar": "^1.2.3",
127-
"ajv": "^5.5.2",
128139
"javascriptstuff-db": "^1.12.0",
129140
"lodash.throttle": "^4.1.1",
130141
"prop-types": "^15.5.10",

repositories/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Webpack documentation repositories
2+
3+
The files in this directory are auto generated from `src/utils/fetch-package-repos.js` and should not be edited by hand. Any manual changes will be overwritten by the automation next time it runs.

repositories/loaders.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
[
2+
"webpack-contrib/json-loader",
3+
"webpack-contrib/raw-loader",
4+
"webpack-contrib/coffee-loader",
5+
"webpack-contrib/css-loader",
6+
"webpack-contrib/style-loader",
7+
"webpack-contrib/script-loader",
8+
"webpack-contrib/less-loader",
9+
"webpack-contrib/bundle-loader",
10+
"webpack-contrib/val-loader",
11+
"webpack-contrib/file-loader",
12+
"webpack-contrib/url-loader",
13+
"webpack-contrib/i18n-loader",
14+
"webpack-contrib/json5-loader",
15+
"webpack-contrib/worker-loader",
16+
"webpack-contrib/jshint-loader",
17+
"webpack-contrib/imports-loader",
18+
"webpack-contrib/exports-loader",
19+
"webpack-contrib/mocha-loader",
20+
"webpack-contrib/coverjs-loader",
21+
"webpack-contrib/expose-loader",
22+
"webpack-contrib/node-loader",
23+
"webpack-contrib/coffee-redux-loader",
24+
"webpack-contrib/transform-loader",
25+
"webpack-contrib/html-loader",
26+
"webpack-contrib/sass-loader",
27+
"webpack-contrib/source-map-loader",
28+
"webpack-contrib/react-proxy-loader",
29+
"webpack-contrib/null-loader",
30+
"webpack-contrib/multi-loader",
31+
"webpack-contrib/istanbul-instrumenter-loader",
32+
"webpack-contrib/eslint-loader",
33+
"webpack-contrib/yaml-frontmatter-loader",
34+
"webpack-contrib/svg-inline-loader",
35+
"webpack-contrib/restyle-loader",
36+
"webpack-contrib/gzip-loader",
37+
"webpack-contrib/cache-loader",
38+
"webpack-contrib/thread-loader",
39+
"webpack-contrib/polymer-webpack-loader",
40+
"webpack-contrib/workerize-loader",
41+
"webpack-contrib/config-loader",
42+
"babel/babel-loader",
43+
"postcss/postcss-loader",
44+
"peerigon/extract-loader"
45+
]

repositories/plugins.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[
2+
"webpack-contrib/i18n-webpack-plugin",
3+
"webpack-contrib/component-webpack-plugin",
4+
"webpack-contrib/compression-webpack-plugin",
5+
"webpack-contrib/extract-text-webpack-plugin",
6+
"webpack-contrib/copy-webpack-plugin",
7+
"webpack-contrib/npm-install-webpack-plugin",
8+
"webpack-contrib/stylelint-webpack-plugin",
9+
"webpack-contrib/babel-minify-webpack-plugin",
10+
"webpack-contrib/uglifyjs-webpack-plugin",
11+
"webpack-contrib/zopfli-webpack-plugin",
12+
"webpack-contrib/closure-webpack-plugin",
13+
"webpack-contrib/css-webpack-plugin",
14+
"webpack-contrib/mini-css-extract-plugin"
15+
]

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
proselint

src/CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
webpack.js.org

src/components/Link/Link.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default ({
1111
if ( url ) to = url;
1212

1313
if ( to.startsWith('http') || to.startsWith('//') )
14-
return <a href={ to } target="_blank" { ...props } />;
14+
return <a href={ to } target="_blank" rel="noopener" { ...props } />;
1515

1616
else return <Link to={ to } { ...props } />;
1717
};

src/components/Markdown/Markdown.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
color: inherit;
2727
}
2828

29-
a {
29+
a[aria-hidden="true"] {
3030
margin-left: 8px;
3131
font-size: 0.8em;
3232
height: 1em;
@@ -35,7 +35,7 @@
3535
transition: all 250ms;
3636
}
3737

38-
&:hover a {
38+
&:hover a[aria-hidden="true"] {
3939
opacity: 1;
4040
visibility: visible;
4141
}

src/components/Navigation/Navigation.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default class Navigation extends React.Component {
4646
className="navigation__languages"
4747
items={[
4848
{ title: 'English', url: 'https://webpack.js.org/' },
49-
{ lang: 'zh', title: '中文', url: 'https://doc.webpack-china.org/' }
49+
{ lang: 'zh', title: '中文', url: 'https://webpack.docschina.org/' }
5050
]} />
5151
)
5252
}

src/components/Organization/Organization.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import './Organization.scss';
88

99
const Organization = props => {
1010
return (
11-
<Container className="organization page__content">
11+
<Container className="organization page__content markdown">
1212
<h1>The Organization</h1>
1313

1414
<p>The list below provides a brief overview of all commonly used projects in the webpack ecosystem.</p>

src/components/Organization/Organization.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
.organization {
55
padding: 1.5em;
6+
7+
&__title > h4 {
8+
margin-top: 0; // Overrides markdown scss
9+
}
610
}
711

812
.organization__projects {

0 commit comments

Comments
 (0)