Skip to content

Commit

Permalink
Merge pull request #12 from BitBagCommerce/FIN-35/fix_webpack_issues
Browse files Browse the repository at this point in the history
[FIN-35]Fix webpack configuration and templates
  • Loading branch information
liszkapawel authored Aug 4, 2022
2 parents 0d4c96a + 475986b commit 0b869ef
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 17 deletions.
1 change: 1 addition & 0 deletions src/Resources/assets/admin/js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './attributeGroups'
1 change: 0 additions & 1 deletion tests/Application/assets/admin/entry.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
import 'sylius/bundle/AdminBundle/Resources/private/entry';
import './product/attributeGroups'
8 changes: 4 additions & 4 deletions tests/Application/config/packages/assets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ framework:
json_manifest_path: '%kernel.project_dir%/public/build/shop/manifest.json'
admin:
json_manifest_path: '%kernel.project_dir%/public/build/admin/manifest.json'
skeleton_shop:
json_manifest_path: '%kernel.project_dir%/public/build/bitbag/skeleton/shop/manifest.json'
skeleton_admin:
json_manifest_path: '%kernel.project_dir%/public/build/bitbag/skeleton/admin/manifest.json'
product_attribute_groups_shop:
json_manifest_path: '%kernel.project_dir%/public/build/bitbag/productAttributeGroups/shop/manifest.json'
product_attribute_groups_admin:
json_manifest_path: '%kernel.project_dir%/public/build/bitbag/productAttributeGroups/admin/manifest.json'
4 changes: 2 additions & 2 deletions tests/Application/config/packages/webpack_encore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ webpack_encore:
builds:
shop: '%kernel.project_dir%/public/build/shop'
admin: '%kernel.project_dir%/public/build/admin'
skeleton_shop: '%kernel.project_dir%/public/build/bitbag/skeleton/shop'
skeleton_admin: '%kernel.project_dir%/public/build/bitbag/skeleton/admin'
product_attribute_groups_shop: '%kernel.project_dir%/public/build/bitbag/productAttributeGroups/shop'
product_attribute_groups_admin: '%kernel.project_dir%/public/build/bitbag/productAttributeGroups/admin'
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="ui fluid action input" id="attributeChoice" data-action="{{ path('sylius_admin_render_attribute_forms') }}" style="margin-bottom: 30px;">
{{ form_widget(form, {'attr': {'class': 'ui fluid search dropdown', 'id': 'sylius_product_attribute_choice', 'data-attributes': ''}}) }}

<button class="ui olive labeled icon floating dropdown link button" id="add_attributes_group" data-tab="add_attributes_group" tabindex="0" >
<button class="ui olive labeled icon floating dropdown button" id="add_attributes_group" data-tab="add_attributes_group" tabindex="0" type="button">
<i class="icon clipboard list"></i> <span class="text"> {{ 'bitbag_sylius_product_attribute_group_plugin.ui.attributes_group'|trans }} </span>

<div id="menuWithAttributesGroup" class="menu transition hidden" data-attribute-groups tabindex="-1"></div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{{ encore_entry_script_tags('admin-entry', null, 'admin') }}
{{ encore_entry_script_tags('bitbag-skeleton-admin', null, 'skeleton_admin') }}
{{ encore_entry_script_tags('bitbag-productAttributeGroups-admin', null, 'product_attribute_groups_admin') }}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{{ encore_entry_link_tags('admin-entry', null, 'admin') }}
{{ encore_entry_link_tags('bitbag-skeleton-admin', null, 'skeleton_admin') }}
{{ encore_entry_link_tags('bitbag-productAttributeGroups-admin', null, 'product_attribute_groups_admin') }}
5 changes: 3 additions & 2 deletions tests/Application/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const path = require('path');
const Encore = require('@symfony/webpack-encore');

const [bitbagSkeletonShop, bitbagSkeletonAdmin] = require('../../webpack.config.js')
const [bitbagProductAttributeGroupsShop, bitbagProductAttributeGroupsAdmin] = require('../../webpack.config.js')

const syliusBundles = path.resolve(__dirname, '../../vendor/sylius/sylius/src/Sylius/Bundle/');

const uiBundleScripts = path.resolve(syliusBundles, 'UiBundle/Resources/private/js/');
const uiBundleResources = path.resolve(syliusBundles, 'UiBundle/Resources/private/');

Expand Down Expand Up @@ -46,4 +47,4 @@ adminConfig.resolve.alias['sylius/bundle'] = syliusBundles;
adminConfig.externals = Object.assign({}, adminConfig.externals, { window: 'window', document: 'document' });
adminConfig.name = 'admin';

module.exports = [shopConfig, adminConfig, bitbagSkeletonShop, bitbagSkeletonAdmin];
module.exports = [shopConfig, adminConfig, bitbagProductAttributeGroupsShop, bitbagProductAttributeGroupsAdmin];
10 changes: 5 additions & 5 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path');
const Encore = require('@symfony/webpack-encore');
const pluginName = 'skeleton';
const pluginName = 'productAttributeGroups';

const getConfig = (pluginName, type) => {
Encore.reset();
Expand All @@ -21,8 +21,8 @@ const getConfig = (pluginName, type) => {
}

Encore
.setOutputPath(`src/Resources/public/`)
.setPublicPath(`/public/`)
.setOutputPath(`src/Resources/public/build/`)
.setPublicPath(`/public/build`)
.addEntry(`bitbag-${pluginName}-shop`, path.resolve(__dirname, `./src/Resources/assets/shop/entry.js`))
.addEntry(`bitbag-${pluginName}-admin`, path.resolve(__dirname, `./src/Resources/assets/admin/entry.js`))
.cleanupOutputBeforeBuild()
Expand All @@ -34,7 +34,7 @@ distConfig.name = `bitbag-plugin-dist`;

Encore.reset();

const shopConfig = getConfig(pluginName, 'shop')
const adminConfig = getConfig(pluginName, 'admin')
const shopConfig = getConfig(pluginName, 'shop')

module.exports = [shopConfig, adminConfig, distConfig];
module.exports = [adminConfig, shopConfig, distConfig];

0 comments on commit 0b869ef

Please sign in to comment.