Skip to content

Commit 561a4a3

Browse files
committed
[WIP] All Package directory restructure
1 parent 2e0dc46 commit 561a4a3

File tree

337 files changed

+489
-350
lines changed

Some content is hidden

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

337 files changed

+489
-350
lines changed

.github/workflows/test-turbo.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ jobs:
7777
${{ runner.os }}-yarn-
7878
7979
- name: Install JavaScript dependencies
80-
working-directory: src/Turbo/Tests/app
80+
working-directory: src/Turbo/tests/app
8181
run: yarn install
8282

8383
- name: Build JavaScript
84-
working-directory: src/Turbo/Tests/app
84+
working-directory: src/Turbo/tests/app
8585
run: yarn build
8686

8787
- name: Create DB
88-
working-directory: src/Turbo/Tests/app
88+
working-directory: src/Turbo/tests/app
8989
run: php public/index.php doctrine:schema:create
9090

9191
- name: Run tests
@@ -139,15 +139,15 @@ jobs:
139139
${{ runner.os }}-yarn-
140140
141141
- name: Install JavaScript dependencies
142-
working-directory: src/Turbo/Tests/app
142+
working-directory: src/Turbo/tests/app
143143
run: yarn install
144144

145145
- name: Build JavaScript
146-
working-directory: src/Turbo/Tests/app
146+
working-directory: src/Turbo/tests/app
147147
run: yarn build
148148

149149
- name: Create DB
150-
working-directory: src/Turbo/Tests/app
150+
working-directory: src/Turbo/tests/app
151151
run: php public/index.php doctrine:schema:create
152152

153153
- name: Run tests

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
{
22
"private": true,
33
"workspaces": [
4-
"src/**/Resources/assets",
54
"src/**/assets"
65
],
76
"scripts": {
87
"build": "yarn rollup -c",
98
"test": "yarn workspaces run jest",
109
"lint": "yarn workspaces run eslint src test",
11-
"format": "prettier src/*/Resources/assets/src/*.ts src/*/Resources/assets/test/*.js {,src/*/}*.{json,md} --write",
10+
"format": "prettier src/*/assets/src/*.ts src/*/assets/test/*.js {,src/*/}*.{json,md} --write",
1211
"check-lint": "yarn lint --no-fix",
1312
"check-format": "yarn format --no-write --check"
1413
},
@@ -61,7 +60,6 @@
6160
"overrides": [
6261
{
6362
"files": [
64-
"src/*/Resources/assets/test/**/*.ts",
6563
"src/*/assets/test/**/*.ts"
6664
],
6765
"extends": [

rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const wildcardExternalsPlugin = (peerDependencies) => ({
3838
}
3939
});
4040

41-
const files = glob.sync("src/**/assets/src/*controller.ts");
41+
const files = glob.sync("src/React/assets/src/*controller.ts");
4242
const packages = files.map((file) => {
4343
const absolutePath = path.join(__dirname, file);
4444
const packageData = require(pkgUp.sync({ cwd: absolutePath }));

src/Autocomplete/.symfony.bundle.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
branches: ["2.x"]
22
maintained_branches: ["2.x"]
3-
doc_dir: "src/Resources/doc"
3+
doc_dir: "doc"

src/Autocomplete/CHANGELOG.md

Lines changed: 12 additions & 1 deletion

src/Autocomplete/assets/src/controller.ts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default class extends Controller {
1010
noMoreResultsText: String,
1111
minCharacters: Number,
1212
tomSelectOptions: Object,
13-
}
13+
};
1414

1515
readonly urlValue: string;
1616
readonly optionsAsHtmlValue: boolean;
@@ -53,7 +53,7 @@ export default class extends Controller {
5353
}
5454

5555
#getCommonConfig(): Partial<TomSettings> {
56-
const plugins: any = {}
56+
const plugins: any = {};
5757

5858
// multiple values excepted if this is NOT A select (i.e. input) or a multiple select
5959
const isMultiple = !this.selectElement || this.selectElement.multiple;
@@ -80,7 +80,7 @@ export default class extends Controller {
8080
onItemAdd: () => {
8181
this.tomSelect.setTextboxValue('');
8282
},
83-
onInitialize: function() {
83+
onInitialize: function () {
8484
const tomSelect = this as any;
8585
tomSelect.wrapper.setAttribute('data-live-ignore', '');
8686
},
@@ -114,12 +114,12 @@ export default class extends Controller {
114114
};
115115
},
116116
render: {
117-
item: function(item: any) {
117+
item: function (item: any) {
118118
return `<div>${item.text}</div>`;
119119
},
120-
option: function(item: any) {
120+
option: function (item: any) {
121121
return `<div>${item.text}</div>`;
122-
}
122+
},
123123
},
124124
});
125125

@@ -139,9 +139,12 @@ export default class extends Controller {
139139
load: function (query: string, callback: (results?: any) => void) {
140140
const url = this.getUrl(query);
141141
fetch(url)
142-
.then(response => response.json())
142+
.then((response) => response.json())
143143
// important: next_url must be set before invoking callback()
144-
.then(json => { this.setNextUrl(query, json.next_page); callback(json.results) })
144+
.then((json) => {
145+
this.setNextUrl(query, json.next_page);
146+
callback(json.results);
147+
})
145148
.catch(() => callback());
146149
},
147150
shouldLoad: function (query: string) {
@@ -150,16 +153,16 @@ export default class extends Controller {
150153
return query.length >= minLength;
151154
},
152155
// avoid extra filtering after results are returned
153-
score: function(search: string) {
154-
return function(item: any) {
156+
score: function (search: string) {
157+
return function (item: any) {
155158
return 1;
156159
};
157160
},
158161
render: {
159-
option: function(item: any) {
162+
option: function (item: any) {
160163
return `<div>${item.text}</div>`;
161164
},
162-
item: function(item: any) {
165+
item: function (item: any) {
163166
return `<div>${item.text}</div>`;
164167
},
165168
no_more_results: (): string => {
@@ -186,7 +189,7 @@ export default class extends Controller {
186189
/**
187190
* Returns the element, but only if it's a select element.
188191
*/
189-
get selectElement(): HTMLSelectElement|null {
192+
get selectElement(): HTMLSelectElement | null {
190193
if (!(this.element instanceof HTMLSelectElement)) {
191194
return null;
192195
}
@@ -197,7 +200,7 @@ export default class extends Controller {
197200
/**
198201
* Getter to help typing.
199202
*/
200-
get formElement(): HTMLInputElement|HTMLSelectElement {
203+
get formElement(): HTMLInputElement | HTMLSelectElement {
201204
if (!(this.element instanceof HTMLInputElement) && !(this.element instanceof HTMLSelectElement)) {
202205
throw new Error('Autocomplete Stimulus controller can only be used no an <input> or <select>.');
203206
}

src/Autocomplete/phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
xsi:noNamespaceSchemaLocation="vendor/bin/.phpunit/phpunit.xsd"
66
colors="true"
7-
bootstrap="tests/bootstrap.php"
7+
bootstrap="vendor/autoload.php"
88
failOnRisky="true"
99
failOnWarning="true"
1010
>

src/Autocomplete/src/AutocompleteBundle.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,9 @@ public function build(ContainerBuilder $container)
2626
{
2727
$container->addCompilerPass(new AutocompleteFormTypePass());
2828
}
29+
30+
public function getPath(): string
31+
{
32+
return \dirname(__DIR__);
33+
}
2934
}

src/Autocomplete/src/Maker/MakeAutocompleteField.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
133133
);
134134
$generator->generateClass(
135135
$classDetails->getFullName(),
136-
__DIR__.'/../Resources/skeletons/AutocompleteField.tpl.php',
136+
__DIR__.'./skeletons/AutocompleteField.tpl.php',
137137
[
138138
'variables' => $variables,
139139
]

src/Autocomplete/tests/Fixtures/Kernel.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
use Symfony\UX\Autocomplete\Tests\Fixtures\Autocompleter\CustomProductAutocompleter;
3232
use Symfony\UX\Autocomplete\Tests\Fixtures\Form\ProductType;
3333
use Twig\Environment;
34+
use Zenstruck\Foundry\ZenstruckFoundryBundle;
3435

3536
final class Kernel extends BaseKernel
3637
{
@@ -61,6 +62,7 @@ public function registerBundles(): iterable
6162
yield new AutocompleteBundle();
6263
yield new SecurityBundle();
6364
yield new MakerBundle();
65+
yield new ZenstruckFoundryBundle();
6466
}
6567

6668
protected function configureContainer(ContainerConfigurator $c): void
@@ -79,6 +81,10 @@ protected function configureContainer(ContainerConfigurator $c): void
7981
'default_path' => '%kernel.project_dir%/tests/Fixtures/templates',
8082
]);
8183

84+
$c->extension('zenstruck_foundry', [
85+
'auto_refresh_proxies' => false,
86+
]);
87+
8288
$c->extension('doctrine', [
8389
'dbal' => ['url' => '%env(resolve:DATABASE_URL)%'],
8490
'orm' => [
@@ -144,7 +150,7 @@ protected function configureContainer(ContainerConfigurator $c): void
144150

145151
protected function configureRoutes(RoutingConfigurator $routes): void
146152
{
147-
$routes->import('@AutocompleteBundle/Resources/routes.php')
153+
$routes->import('@AutocompleteBundle/config/routes.php')
148154
->prefix('/test/autocomplete');
149155

150156
$routes->add('test_form', '/test-form')->controller('kernel::testForm');

src/Autocomplete/tests/bootstrap.php

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/Chartjs/.gitattributes

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
/.gitignore export-ignore
33
/.symfony.bundle.yaml export-ignore
44
/phpunit.xml.dist export-ignore
5-
/Resources/assets/test export-ignore
6-
/Resources/assets/jest.config.js export-ignore
7-
/Tests export-ignore
5+
/assets/test export-ignore
6+
/assets/jest.config.js export-ignore
7+
/tests export-ignore

src/Chartjs/.symfony.bundle.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
branches: ["2.x"]
22
maintained_branches: ["2.x"]
3-
doc_dir: "Resources/doc"
3+
doc_dir: "doc"

src/Chartjs/CHANGELOG.md

Lines changed: 7 additions & 0 deletions

src/Chartjs/Resources/assets/jest.config.js renamed to src/Chartjs/assets/jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const config = require('../../../../jest.config.js');
1+
const config = require('../../../jest.config.js');
22

33
config.setupFilesAfterEnv.push('./test/setup.js');
44

src/Chartjs/composer.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@
1919
],
2020
"autoload": {
2121
"psr-4": {
22-
"Symfony\\UX\\Chartjs\\": ""
23-
},
24-
"exclude-from-classmap": [
25-
"/Tests/"
26-
]
22+
"Symfony\\UX\\Chartjs\\": "src/"
23+
}
24+
},
25+
"autoload-dev": {
26+
"psr-4": {
27+
"Symfony\\UX\\Chartjs\\Tests\\": "tests/"
28+
}
2729
},
2830
"require": {
2931
"php": ">=7.2.5",

src/Chartjs/phpunit.xml.dist

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,13 @@
1818

1919
<testsuites>
2020
<testsuite name="Test Suite">
21-
<directory>Tests</directory>
21+
<directory>tests</directory>
2222
</testsuite>
2323
</testsuites>
2424

2525
<filter>
2626
<whitelist>
27-
<directory>.</directory>
28-
<exclude>
29-
<directory>./Tests</directory>
30-
<directory>./Resources</directory>
31-
<directory>./vendor</directory>
32-
</exclude>
27+
<directory>./src</directory>
3328
</whitelist>
3429
</filter>
3530
</phpunit>

src/Chartjs/ChartjsBundle.php renamed to src/Chartjs/src/ChartjsBundle.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,8 @@
2222
*/
2323
class ChartjsBundle extends Bundle
2424
{
25+
public function getPath(): string
26+
{
27+
return \dirname(__DIR__);
28+
}
2529
}
File renamed without changes.

src/Cropperjs/.gitattributes

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
/.gitignore export-ignore
33
/.symfony.bundle.yaml export-ignore
44
/phpunit.xml.dist export-ignore
5-
/Resources/assets/test export-ignore
6-
/Resources/assets/jest.config.js export-ignore
7-
/Tests export-ignore
5+
/assets/test export-ignore
6+
/assets/jest.config.js export-ignore
7+
/tests export-ignore

src/Cropperjs/.symfony.bundle.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
branches: ["2.x"]
22
maintained_branches: ["2.x"]
3-
doc_dir: "Resources/doc"
3+
doc_dir: "doc"

src/Cropperjs/CHANGELOG.md

Lines changed: 7 additions & 0 deletions

src/Cropperjs/Resources/assets/jest.config.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/Cropperjs/assets/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('../../../jest.config.js');

0 commit comments

Comments
 (0)