Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

symfony starterkit has two package.json files with different version numbers for the same dependencies


hi there,

in the metronic symfony starterkit there are 2 package.json files.

one inside the _keenthemes/tools folder:


{
"name": "keenthemes",
"version": "1.0.0",
"author": "Keenthemes",
"license": "ISC",
"homepage": "https://keenthemes.com/",
"description": "Packages used by yarn, npm, gulp and webpack",
"main": "gulpfile.js",
"type": "module",
"dependencies": {
"@ckeditor/ckeditor5-alignment": "^38.1.0",
"@ckeditor/ckeditor5-build-balloon": "^38.1.0",
"@ckeditor/ckeditor5-build-balloon-block": "^38.1.0",
"@ckeditor/ckeditor5-build-classic": "^38.1.0",
"@ckeditor/ckeditor5-build-decoupled-document": "^38.1.0",
"@ckeditor/ckeditor5-build-inline": "^38.1.0",
... and so on...


and another one in the outer "real" <projectdir> folder:


{
"dependencies": {
"@ckeditor/ckeditor5-alignment": "^35.2.1",
"@ckeditor/ckeditor5-build-balloon": "^35.2.1",
"@ckeditor/ckeditor5-build-balloon-block": "^35.2.1",
"@ckeditor/ckeditor5-build-classic": "^35.2.1",
"@ckeditor/ckeditor5-build-decoupled-document": "^35.2.1",
"@ckeditor/ckeditor5-build-inline": "^35.2.1",
... and so on ...


please note the differences in the version numbers!



i have some questions:

i suppose "<projectdir>/_keenthemes/tools/package.json" is used to bundle all theme dependencies and put everything in the <projectdir>/public/assets folder, is this correct?


why are these theme dependencies referenced in the "<projectdir>/package.json" file also?


are they really needed?


the symfony starterkit demo seems to run fine even without running yarn install and yarn dev in the outer <projectdir>, or did i miss something here?


why do the version numbers of all the packages in the two package.json files differ? if the references are really needed, should the version numbers not be the same?


please help me understand how the dependency references in the two package.json files are related, what their purpose is, and if i have to care about the
"<projectdir>/package.json" file if i integrate all the metronics symfony stuff into another already existing project.


thank you!


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (5)


Thank you for reaching out with your questions regarding the two package.json files in the Metronic Symfony Starterkit. We apologize for any confusion and inconvenience caused.

The two package.json files serve different purposes:

The package.json file inside the _keenthemes/tools folder is specifically for Keenthemes assets. It contains dependencies and scripts necessary to manage and build Keenthemes assets, such as styles, scripts, and other resources. This file is used to bundle all theme dependencies and put everything in the public/assets folder within your Symfony project. Its primary purpose is to handle Keenthemes-specific assets.

The package.json file in the root directory of your Symfony project is related to the Symfony assets component. However, by design, it should contain empty dependencies. We will this update this by removing the dependencies as it cause confusions.

In summary, the package.json file inside _keenthemes/tools is for Keenthemes assets, while the one in the root of the Symfony folder is meant for Symfony assets.

If you integrate the Metronic into an existing project, you can focus on the _keenthemes/tools/package.json for theme-related assets.

We hope this clarifies the purpose of the two package.json files. If you have any more questions or need further assistance, please feel free to ask.

Thanks



thanks for clarifying!



so the dependencies from "_keenthemes/tools/package.json" get bundled into "public/assets/plugins/global/plugins.bundle.js", is that correct?



what happens if i add a javascript dependency to the projects "<projectdir>/package.json" file (which will be bundled into "build/app.js"),
but that dependency is already included in "_keenthemes/tools/package.json", possibly even in a different version?



will this create some kind of conflict when both "app.js" and "plugins.bundle.js" are loaded in the frontend?



how would i reference my version of the dependency from javascript code?



is this something i have to be aware of and just avoid this situation?



or is there a recommended way of dealing with this?



or maybe this is no problem at all?



thanks,
best regards



Hi Gerd,

Certainly, here are two approaches you can consider for managing dependencies in your Laravel project with Metronic:

1) Importing Plugins Directly in Custom JS:
In your custom JavaScript code, you can import the plugins directly from _keenthemes/tools/node_modules instead of the root node_modules. This way, you'll have only one reference to the plugin, avoiding potential conflicts with different versions.

2) Merging and Symlinking Node Modules:
Another approach is to merge the dependencies from _keenthemes/tools/package.json into your project's root package.json. This allows you to manage all your project's dependencies from one location.
After merging, you can install the node modules in your root directory.
To ensure that Metronic's Gulp build tool works, you can create a symbolic link (symlink) from the root node_modules folder into _keenthemes/tools/node_modules. This way, Metronic's assets can be built from _keenthemes/tools while still using the root node_modules for dependencies.


Both of these approaches aim to streamline your dependency management and minimize potential conflicts between versions. Choose the one that best fits your project's needs and structure.


Here are instructions for creating a symbolic link (symlink) using commands in both Windows and macOS:

On Windows:

Open Command Prompt as Administrator and run this command:

mklink /d "_keenthemes\tools\node_modules" "your\project\node_modules"

Replace _keenthemes\tools\node_modules with the path where you want the symlink, and your\project\node_modules with the path to your root node_modules directory.

On macOS (or Linux):

Open Terminal and run this command:

ln -s /path/to/your/project/node_modules /path/to/_keenthemes/tools/node_modules

Replace /path/to/your/project/node_modules with the path to your root node_modules directory, and /path/to/_keenthemes/tools/node_modules with the path where you want the symlink inside _keenthemes/tools.



thanks for answering!



You're welcome! If you have any more questions or need further assistance, feel free to ask.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(