Skip to content

Commit c46b9c4

Browse files
committed
feat: add webpack encore configuration
1 parent b9dfc7f commit c46b9c4

File tree

11 files changed

+89
-3
lines changed

11 files changed

+89
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@
1616
/.php-version
1717
/.phpunit.result.cache
1818
/node_modules
19+
yarn.lock

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ COMPOSER=symfony composer
66
CONSOLE=${SYMFONY} console
77
export COMPOSE_PROJECT_NAME=search
88
COMPOSE=docker-compose
9-
YARN=cd ${APP_DIR} && yarn
9+
YARN=yarn
1010
PHPSTAN=symfony php vendor/bin/phpstan
1111
PHPUNIT=symfony php vendor/bin/phpunit
1212
PHPSPEC=symfony php vendor/bin/phpspec
@@ -51,9 +51,9 @@ endif
5151
yarn.install: ${APP_DIR}/yarn.lock
5252

5353
${APP_DIR}/yarn.lock:
54-
ln -sf ${APP_DIR}/node_modules node_modules
54+
cd ${APP_DIR} && ${YARN} install && ${YARN} build
5555
${YARN} install
56-
${YARN} build
56+
${YARN} encore prod
5757

5858
node_modules: ${APP_DIR}/node_modules ## Install the Node dependencies using yarn
5959

assets/js/app.js

Whitespace-only changes.

package.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "monsieurbiz-sylius-search-plugin",
3+
"version": "0.0.1",
4+
"description": "Add instant search on the search form",
5+
"main": "webpack.config.js",
6+
"scripts": {
7+
"build": "encore production",
8+
"watch": "encore dev --watch"
9+
},
10+
"repository": {
11+
"type": "git",
12+
"url": "git+https://github.com/monsieurbiz/SyliusSearchPlugin.git"
13+
},
14+
"author": "Monsieur Biz <[email protected]>",
15+
"license": "MIT",
16+
"bugs": {
17+
"url": "https://github.com/monsieurbiz/SyliusSearchPlugin/issues"
18+
},
19+
"homepage": "https://github.com/monsieurbiz/SyliusSearchPlugin#readme",
20+
"devDependencies": {
21+
"@symfony/webpack-encore": "^0.28.1"
22+
},
23+
"dependencies": {
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
/*
4+
* This file is part of SyliusSearchPlugin.
5+
*
6+
* (c) Monsieur Biz
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace MonsieurBiz\SyliusSearchPlugin\Exception;
15+
16+
class UnknownRequestType
17+
{
18+
19+
}

src/Resources/config/sylius/ui.yaml

Whitespace-only changes.

src/Resources/views/Instant/Product/_box.html.twig

Whitespace-only changes.

src/Resources/views/Instant/result.html.twig

Whitespace-only changes.

src/Resources/views/_scripts.html.twig

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Monsieur Biz' Search plugin for Sylius.
5+
*
6+
* (c) Monsieur Biz
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace MonsieurBiz\SyliusSearchPlugin\Search\Request\InstantSearch;
13+
14+
class Product
15+
{
16+
17+
}

webpack.config.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const Encore = require('@symfony/webpack-encore');
2+
3+
Encore
4+
// directory where compiled assets will be stored
5+
.setOutputPath('src/Resources/public')
6+
// public path used by the web server to access the output path
7+
.setPublicPath('/public')
8+
9+
// entries
10+
.addEntry('monsieurbiz-search', './assets/js/app.js')
11+
12+
// configuration
13+
.disableSingleRuntimeChunk()
14+
.cleanupOutputBeforeBuild()
15+
.enableSourceMaps(!Encore.isProduction())
16+
.enableVersioning(Encore.isProduction())
17+
18+
// organise files
19+
.configureFilenames({
20+
js: 'js/[name].js'
21+
})
22+
;
23+
24+
module.exports = Encore.getWebpackConfig();

0 commit comments

Comments
 (0)