Skip to content

Commit

Permalink
Move JS dependencies to a theme-specific package.json and update-scri…
Browse files Browse the repository at this point in the history
…pt. (#3290)

- Also removes some unused jstree-related files.
  • Loading branch information
EreMaijala authored Jan 4, 2024
1 parent 6ed2414 commit c4d4922
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 1,138 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
module.exports = {
plugins: ["no-jquery"],
ignorePatterns: ["themes/**/vendor/**"],
ignorePatterns: [
"themes/**/vendor/**",
"themes/**/node_modules/**"
],
extends: ["eslint:recommended", "plugin:no-jquery/deprecated"],
env: {
"browser": true,
Expand Down
24 changes: 2 additions & 22 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@

<!-- JSHint -->
<target name="jshint">
<exec command="npx jshint --config=${srcdir}/tests/jshint.json --exclude=themes/*/js/vendor ${srcdir}/themes" checkreturn="true" passthru="true" />
<exec command="npx jshint --config=${srcdir}/tests/jshint.json --exclude=themes/*/js/vendor,themes/*/node_modules ${srcdir}/themes" checkreturn="true" passthru="true" />
</target>
<target name="jshint-report">
<exec command="npx jshint --config=${srcdir}/tests/jshint.json --exclude=themes/*/js/vendor --reporter=checkstyle ${srcdir}/themes &gt; ${builddir}/reports/jshint-checkstyle.xml" />
<exec command="npx jshint --config=${srcdir}/tests/jshint.json --exclude=themes/*/js/vendor,themes/*/node_modules --reporter=checkstyle ${srcdir}/themes &gt; ${builddir}/reports/jshint-checkstyle.xml" />
</target>

<!-- Run Sass build, error if it fails -->
Expand Down Expand Up @@ -372,26 +372,6 @@
<exec command="php ${srcdir}/composer.phar install ${composer_extra_params}" passthru="true" checkreturn="true" />
</target>

<!-- Copy files from node modules to themes -->
<target name="copynodemodules">
<!-- autocomplete.js -->
<copy file="${srcdir}/node_modules/autocomplete.js/autocomplete.js" todir="${srcdir}/themes/bootstrap3/js/vendor" overwrite="true" />
<!-- jstree -->
<copy todir="${srcdir}/themes/bootstrap3/js/vendor/jsTree" overwrite="true">
<fileset dir="${srcdir}/node_modules/jstree/dist/" >
<include name="**/**" />
<exclude name="jstree.js" />
<exclude name="themes/default-dark/" />
</fileset>
</copy>
<!-- simple-keyboard -->
<copy file="${srcdir}/node_modules/simple-keyboard/build/index.js" todir="${srcdir}/themes/bootstrap3/js/vendor/simple-keyboard" overwrite="true" />
<copy file="${srcdir}/node_modules/simple-keyboard/build/css/index.css" todir="${srcdir}/themes/bootstrap3/css/vendor/simple-keyboard" overwrite="true" />
<copy file="${srcdir}/node_modules/simple-keyboard-layouts/build/index.js" todir="${srcdir}/themes/bootstrap3/js/vendor/simple-keyboard-layouts" overwrite="true" />
<!-- vanilla-cookieconsent -->
<copy file="${srcdir}/node_modules/vanilla-cookieconsent/dist/cookieconsent.umd.js" todir="${srcdir}/themes/bootstrap3/js/vendor" overwrite="true" />
</target>

<!-- Install and Activate VuFind -->
<target name="startup" description="install and activate demo">
<property name="solr_pid_file" value="${localdir}/solr-${solr_port}.pid" />
Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@
"post-install-cmd": "@phing-install-dependencies",
"post-update-cmd": "@phing-install-dependencies",
"qa": "phing qa-console -Ddefaultconfigs=true",
"install-npm-dependencies": "npm install && phing copynodemodules",
"update-npm-dependencies": "npm update && phing copynodemodules"
"update-npm-dependencies": [
"npm update",
"cd themes/bootstrap3 && npm run updateDeps"
]
}
}
7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"watch:lessToSass": "grunt watch:lessToSass"
},
"dependencies": {
"autocomplete.js": "vufind-org/autocomplete.js#v2.1.7",
"grunt": "^1.0.4",
"grunt-contrib-less": "^2.0.0",
"grunt-less-to-sass": "duvillierA/grunt-less-to-sass#0.0.11",
Expand All @@ -45,10 +44,6 @@
"eslint": "^8.15.0",
"eslint-plugin-no-jquery": "^2.7.0",
"grunt-contrib-watch": "^1.1.0",
"jshint": "^2.13.4",
"jstree": "3.3.15",
"simple-keyboard": "^3.6.0",
"simple-keyboard-layouts": "^3.0.0",
"vanilla-cookieconsent": "3.0.0-rc.16"
"jshint": "^2.13.4"
}
}
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit c4d4922

Please sign in to comment.