Skip to content

Commit fae2f92

Browse files
committed
Preparing to generate multiple versions
1 parent 3b14500 commit fae2f92

File tree

8 files changed

+50
-46
lines changed

8 files changed

+50
-46
lines changed

assets/js/app.jsx renamed to assets/js/App.jsx

+39-30
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ class App extends Component {
66
constructor(props) {
77
super(props);
88
this.state = {
9+
versions: [],
10+
selected: null,
911
error: null,
1012
is_loaded: false,
1113
version: null,
@@ -18,37 +20,44 @@ class App extends Component {
1820
}
1921

2022
componentDidMount() {
21-
fetch('data.json')
22-
.then(res => res.json())
23-
.then(
24-
(result) => {
25-
this.setState({
26-
is_loaded: true,
27-
version: result.version,
28-
updated_at: result.updated_at,
29-
composer_info: result.composer_info,
30-
types: result.types,
31-
type_extensions: result.type_extensions,
32-
type_guessers: result.type_guessers
33-
});
23+
fetch('docs.json')
24+
.then(data => data.json())
25+
.then(docs => {
26+
this.setState({
27+
versions: docs.versions,
28+
selected: docs.versions[0],
29+
});
3430

35-
// after update state, check by hash to scroll in
36-
const hash = window.location.hash;
37-
if (hash) {
38-
window.location.hash = null;
39-
window.location.hash = hash;
40-
}
41-
},
42-
// Note: it's important to handle errors here
43-
// instead of a catch() block so that we don't swallow
44-
// exceptions from actual bugs in components.
45-
(error) => {
46-
this.setState({
47-
is_loaded: true,
48-
error
49-
});
50-
}
51-
)
31+
fetch(docs.versions[0] + '.json')
32+
.then(data => data.json())
33+
.then((result) => {
34+
this.setState({
35+
is_loaded: true,
36+
version: result.version,
37+
updated_at: result.updated_at,
38+
composer_info: result.composer_info,
39+
types: result.types,
40+
type_extensions: result.type_extensions,
41+
type_guessers: result.type_guessers
42+
});
43+
44+
// after update state, check by hash to scroll in
45+
const hash = window.location.hash;
46+
if (hash) {
47+
window.location.hash = null;
48+
window.location.hash = hash;
49+
}
50+
},
51+
// Note: it's important to handle errors here
52+
// instead of a catch() block so that we don't swallow
53+
// exceptions from actual bugs in components.
54+
(error) => {
55+
this.setState({
56+
is_loaded: true,
57+
error
58+
});
59+
});
60+
});
5261
}
5362

5463
render() {

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"require": {
77
"php": "^7.1.3",
88
"ext-iconv": "*",
9-
"doctrine/doctrine-bundle": "^1.6.10",
10-
"doctrine/orm": "^2.5.11",
9+
"doctrine/doctrine-bundle": "^1.8",
10+
"doctrine/orm": "^2.6",
1111
"symfony/console": "^4.0",
1212
"symfony/flex": "^1.0",
1313
"symfony/form": "^4.0",

config/packages/doctrine.yaml

-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
parameters:
2-
# Adds a fallback DATABASE_URL if the env var is not set.
3-
# This allows you to run cache:warmup even if your
4-
# environment variables are not available yet.
5-
# You should not need to change this value.
6-
env(DATABASE_URL): ''
7-
81
doctrine:
92
dbal:
103
url: '%env(resolve:DATABASE_URL)%'

docs/data.json renamed to docs/4.0.8.json

+1-1
Large diffs are not rendered by default.

docs/build/js/app.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/docs.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"versions":["4.0.8"]}

src/Command/GenerateCommand.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
6868
$data['types'][$i] += $this->getTypeOptions($metadata['class']);
6969
}
7070

71-
file_put_contents(__DIR__.'/../../docs/data.json', json_encode($data));
71+
file_put_contents(__DIR__.'/../../docs/docs.json', json_encode(['versions' => [Kernel::VERSION]]));
72+
file_put_contents(__DIR__.'/../../docs/'.Kernel::VERSION.'.json', json_encode($data));
7273
}
7374

7475
private function getTypeOptions(string $class): array

webpack.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Encore
1111
// .enableVersioning(Encore.isProduction())
1212

1313
// uncomment to define the assets of the project
14-
.addEntry('js/app', './assets/js/app.jsx')
14+
.addEntry('js/app', './assets/js/App.jsx')
1515
.addStyleEntry('css/app', './assets/scss/app.scss')
1616

1717
.enableSassLoader()

0 commit comments

Comments
 (0)