Skip to content

Commit bb01347

Browse files
committed
Update JS deps, move to algolia v3, move to plausible analytics, add frontend build system
1 parent 8b809e5 commit bb01347

14 files changed

+6468
-92
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
/.parcel-cache/
2+
/node_modules/
13
/composer-src/
24
/web/composer.phar
35
/web/composer.phar.sig
46
/web/version
57
/web/versions
8+
/web/build/*.map
69
/bin/
710

811
###> symfony/framework-bundle ###

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,11 @@ change a file in the doc directory. Documentation sources can be browsed
77
at https://github.com/composer/composer/tree/main/doc
88

99
Documentation is then automatically generated on getcomposer.org
10+
11+
## JS / CSS
12+
13+
To change JS and CSS, make sure you run `npm install` first and then use
14+
`npm run dev` or `npm run build` to build new assets from the sources.
15+
16+
The output of build should be committed to be deployed, but please do not commit
17+
it if you are sending a pull request.

web/css/style.css renamed to css/style.css

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; }
6-
audio, canvas, video { display: inline-block; *display: inline; *zoom: 1; }
6+
audio, canvas, video { display: inline-block; }
77
audio:not([controls]) { display: none; }
88
[hidden] { display: none; }
99

@@ -42,10 +42,9 @@ figure { margin: 0; }
4242
form { margin: 0; }
4343
fieldset { border: 0; margin: 0; padding: 0; }
4444
label { cursor: pointer; }
45-
legend { border: 0; *margin-left: -7px; padding: 0; }
46-
button, input, select, textarea { font-size: 100%; margin: 0; vertical-align: baseline; *vertical-align: middle; }
47-
button, input { line-height: normal; *overflow: visible; }
48-
table button, table input { *overflow: auto; }
45+
legend { border: 0; padding: 0; }
46+
button, input, select, textarea { font-size: 100%; margin: 0; vertical-align: baseline; }
47+
button, input { line-height: normal; }
4948
button, input[type="button"], input[type="reset"], input[type="submit"] { cursor: pointer; -webkit-appearance: button; }
5049
input[type="checkbox"], input[type="radio"] { box-sizing: border-box; }
5150
input[type="search"] { -webkit-appearance: textfield; -moz-box-sizing: content-box; -webkit-box-sizing: content-box; box-sizing: content-box; }
@@ -134,8 +133,6 @@ h1 .anchor, h2 .anchor, h3 .anchor, h4 .anchor {
134133
display: inline-block;
135134
width: 200px;
136135
border: 1px solid #ccc;
137-
-webkit-border-radius: 4px;
138-
-moz-border-radius: 4px;
139136
border-radius: 4px;
140137
padding: 10px;
141138
margin: 10px;
@@ -151,8 +148,6 @@ h1 .anchor, h2 .anchor, h3 .anchor, h4 .anchor {
151148
blockquote {
152149
background: #ddf;
153150
border: 1px solid #ddf;
154-
-webkit-border-radius: 4px;
155-
-moz-border-radius: 4px;
156151
border-radius: 4px;
157152
margin: 0 20px;
158153
padding: 10px;
@@ -175,8 +170,6 @@ blockquote p {
175170

176171
code:not([class*="language-"]) {
177172
border: 1px solid #ccc;
178-
-webkit-border-radius: 3px;
179-
-moz-border-radius: 3px;
180173
border-radius: 3px;
181174
padding: 0px 4px;
182175
display: inline-block;
@@ -211,7 +204,7 @@ li .tagline {
211204
}
212205

213206
.fork-and-edit {
214-
background: url("../img/github.gif") no-repeat scroll 0 0 transparent;
207+
background: url("../web/img/github.gif") no-repeat scroll 0 0 transparent;
215208
font-style: italic;
216209
height: 40px;
217210
margin: 40px auto 0;
@@ -238,27 +231,7 @@ th, td {
238231
}
239232

240233
#searchbar {
241-
text-align: right;
242-
}
243-
244-
input#docsearch {
245-
width: 260px;
246-
padding: 4px 4px 2px 4px;
247-
box-shadow: 0px 5px 6px -2px #fafafa;
248-
border-radius: 3px;
249-
border: 1px solid #dedede;
250-
padding: 0.4em 0.8em;
251-
background-color: #fbfbff;
252-
transition: all 0.2s ease;
253-
}
254-
255-
input#docsearch:focus {
256-
box-shadow: 0px 5px 6px -2px #e6e6e6;
257-
border-color: #b4b4b4;
258-
}
259-
260-
.ds-dropdown-menu {
261-
width: 600px;
234+
float: right;
262235
}
263236

264237
h1 .latest {

js/app.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import docsearch from '@docsearch/js';
2+
import Plausible from 'plausible-tracker'
3+
import '@docsearch/css';
4+
import 'prismjs/themes/prism.css';
5+
import '../css/style.css';
6+
import 'prismjs';
7+
import 'prismjs/components/prism-markup-templating';
8+
import 'prismjs/components/prism-php';
9+
import 'prismjs/components/prism-bash';
10+
import 'prismjs/components/prism-json';
11+
import 'prismjs/components/prism-json5';
12+
import 'prismjs/components/prism-javascript';
13+
14+
function processQuery(query) {
15+
var parts = query.split(' ');
16+
17+
parts = parts.map(function (part, index) {
18+
var word = part.trim();
19+
20+
// quote --foo args so they are not parsed as negations but rather return actual results
21+
if (word.length >= 2 && word[0] === '-' && word[1] === '-') {
22+
word = '"' + word + (index === parts.length - 1 ? '' : '"');
23+
}
24+
// quote -x args
25+
if (word.length == 2 && word[0] === '-') {
26+
word = '"' + word + (index === parts.length - 1 ? '' : '"');
27+
}
28+
29+
return word;
30+
});
31+
32+
return parts.join(' ');
33+
}
34+
35+
if (document.getElementById('docsearch')) {
36+
docsearch({
37+
container: '#docsearch',
38+
appId: 'DLYN25JSFJ',
39+
indexName: 'getcomposer',
40+
apiKey: '59b32c5fdb7d9198939d01eebcc4ecab',
41+
transformSearchClient: (searchClient) => {
42+
return {
43+
...searchClient,
44+
search: (spec) => {
45+
let f = spec[0].query;
46+
spec[0].query = processQuery(spec[0].query);
47+
48+
return searchClient.search(spec);
49+
}
50+
};
51+
},
52+
});
53+
}
54+
55+
const plausible = Plausible({
56+
domain: 'getcomposer.org',
57+
apiHost: 'https://getcomposer.org',
58+
});
59+
plausible.trackPageview();

0 commit comments

Comments
 (0)