Translated using Weblate (Portuguese (Brazil))
[phpmyadmin.git] / scripts / sync-js-vendor-files.sh
blob311620a644a34505e7c48c220ad68327079d88b2
1 #!/bin/bash -eu
4 # vim: expandtab sw=4 ts=4 sts=4:
7 # This script will sync JS node_modules files with existing files in vendor folder.
8 # Warning: this will not add any more files, it uses existing files in vendor folder.
10 ROOT_DIR="$(realpath $(dirname $0)/../)"
11 echo "Using root dir: $ROOT_DIR"
13 cd ${ROOT_DIR}
15 # Remove each '-not -path' when a new package can be used from npm
16 echo 'Delete vendor files we can replace from source dists'
17 find ./js/vendor/ -type f -delete -print
19 echo 'Updating codemirror'
20 cp ./node_modules/codemirror/addon/hint/sql-hint.js ./js/vendor/codemirror/addon/hint/sql-hint.js
21 cp ./node_modules/codemirror/addon/hint/show-hint.css ./js/vendor/codemirror/addon/hint/show-hint.css
22 cp ./node_modules/codemirror/addon/hint/show-hint.js ./js/vendor/codemirror/addon/hint/show-hint.js
23 cp ./node_modules/codemirror/addon/runmode/runmode.js ./js/vendor/codemirror/addon/runmode/runmode.js
24 cp ./node_modules/codemirror/addon/lint/lint.css ./js/vendor/codemirror/addon/lint/lint.css
25 cp ./node_modules/codemirror/addon/lint/lint.js ./js/vendor/codemirror/addon/lint/lint.js
26 cp ./node_modules/codemirror/lib/codemirror.js ./js/vendor/codemirror/lib/codemirror.js
27 cp ./node_modules/codemirror/lib/codemirror.css ./js/vendor/codemirror/lib/codemirror.css
28 cp ./node_modules/codemirror/mode/sql/sql.js ./js/vendor/codemirror/mode/sql/sql.js
29 cp ./node_modules/codemirror/mode/javascript/javascript.js ./js/vendor/codemirror/mode/javascript/javascript.js
30 cp ./node_modules/codemirror/mode/xml/xml.js ./js/vendor/codemirror/mode/xml/xml.js
31 cp ./node_modules/codemirror/LICENSE ./js/vendor/codemirror/LICENSE
32 echo 'Updating jquery'
33 cp ./node_modules/jquery/dist/jquery.min.js ./js/vendor/jquery/jquery.min.js
34 cp ./node_modules/jquery/dist/jquery.min.map ./js/vendor/jquery/jquery.min.map
35 cp ./node_modules/jquery/LICENSE.txt ./js/vendor/jquery/MIT-LICENSE.txt
36 echo 'Updating jquery-migrate'
37 cp ./node_modules/jquery-migrate/dist/jquery-migrate.min.js ./js/vendor/jquery/jquery-migrate.min.js
38 cp ./node_modules/jquery-migrate/dist/jquery-migrate.min.map ./js/vendor/jquery/jquery-migrate.min.map
39 echo 'Updating jquery-ui'
40 cp ./node_modules/jquery-ui-dist/jquery-ui.min.js ./js/vendor/jquery/jquery-ui.min.js
41 # https://github.com/devongovett/jquery.event.drag/commit/2db3b7865f31eee6a8145532554f8b02210180bf#diff-ab8497cedd384270de86ee2e9f06530e
42 echo 'Updating jquery-validation'
43 cp ./node_modules/jquery-validation/dist/jquery.validate.min.js ./js/vendor/jquery/jquery.validate.min.js
44 cp ./node_modules/jquery-validation/dist/additional-methods.js ./js/vendor/jquery/additional-methods.js
45 echo 'Updating js-cookie'
46 cp ./node_modules/js-cookie/src/js.cookie.js ./js/vendor/js.cookie.js
47 echo 'Updating bootstrap'
48 cp ./node_modules/bootstrap/dist/js/bootstrap.bundle.min.js ./js/vendor/bootstrap/bootstrap.bundle.min.js
49 cp ./node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map ./js/vendor/bootstrap/bootstrap.bundle.min.js.map
50 echo 'Updating zxcvbn-ts'
51 cp ./node_modules/@zxcvbn-ts/core/dist/zxcvbn-ts.js ./js/vendor/zxcvbn-ts.js
52 cp ./node_modules/@zxcvbn-ts/core/dist/zxcvbn-ts.js.map ./js/vendor/zxcvbn-ts.js.map
53 echo 'Updating tracekit'
54 cp ./node_modules/tracekit/tracekit.js ./js/vendor/tracekit.js
55 echo 'Updating u2f-api-polyfill'
56 cp ./node_modules/u2f-api-polyfill/u2f-api-polyfill.js ./js/vendor/u2f-api-polyfill.js
57 echo 'Updating jquery-uitablefilter'
58 cp ./node_modules/jquery-uitablefilter/jquery.uitablefilter.js js/vendor/jquery/jquery.uitablefilter.js
59 echo 'Updating jquery-tablesorter'
60 cp ./node_modules/tablesorter/dist/js/jquery.tablesorter.js ./js/vendor/jquery/jquery.tablesorter.js
61 echo 'Updating jquery-debounce'
62 cp ./node_modules/jquery-debounce-throttle/index.js ./js/vendor/jquery/jquery.debounce-1.0.6.js
63 echo 'Updating jquery-Timepicker-Addon'
64 cp ./node_modules/jquery-ui-timepicker-addon/dist/jquery-ui-timepicker-addon.js ./js/vendor/jquery/jquery-ui-timepicker-addon.js
65 echo 'Updating OpenLayers'
66 cp ./node_modules/ol/ol.css ./js/vendor/openlayers/theme/ol.css
67 npx webpack-cli --config ./js/config/ol/webpack.config.js
68 echo "/*!
69 * OpenLayers v$(php -r 'echo json_decode(file_get_contents("./node_modules/ol/package.json"))->version;') (https://openlayers.org/)
70 * Copyright 2005-present, OpenLayers Contributors All rights reserved.
71 * Licensed under BSD 2-Clause License (https://github.com/openlayers/openlayers/blob/main/LICENSE.md)
73 * @license $(yarn info -s ol license)
75 $(cat ./js/vendor/openlayers/OpenLayers.js)" > ./js/vendor/openlayers/OpenLayers.js
76 echo 'Updating sprintf'
77 cp ./node_modules/locutus.sprintf/src/php/strings/sprintf.browser.js ./js/vendor/sprintf.js
79 echo 'Update jqplot'
81 echo 'Build jquery.jqplot.js'
83 JQPLOT_SOURCE_FILES=(
84 'jqplot.core.js' 'jqplot.axisLabelRenderer.js' 'jqplot.axisTickRenderer.js' 'jqplot.canvasGridRenderer.js'
85 'jqplot.divTitleRenderer.js' 'jqplot.linePattern.js' 'jqplot.lineRenderer.js' 'jqplot.linearAxisRenderer.js'
86 'jqplot.linearTickGenerator.js' 'jqplot.markerRenderer.js' 'jqplot.shadowRenderer.js' 'jqplot.shapeRenderer.js'
87 'jqplot.tableLegendRenderer.js' 'jqplot.themeEngine.js' 'jqplot.toImage.js' 'jsdate.js' 'jqplot.sprintf.js'
88 'jqplot.effects.core.js' 'jqplot.effects.blind.js'
90 for jqPlotFile in ${JQPLOT_SOURCE_FILES[@]}; do
91 cat "./node_modules/updated-jqplot/build/$jqPlotFile" >> ./js/vendor/jqplot/jquery.jqplot.js
92 done
93 echo 'Successfully built jquery.jqplot.js'
95 cp ./node_modules/updated-jqplot/build/plugins/jqplot.pieRenderer.js ./js/vendor/jqplot/plugins/jqplot.pieRenderer.js
96 cp ./node_modules/updated-jqplot/build/plugins/jqplot.barRenderer.js ./js/vendor/jqplot/plugins/jqplot.barRenderer.js
97 cp ./node_modules/updated-jqplot/build/plugins/jqplot.pointLabels.js ./js/vendor/jqplot/plugins/jqplot.pointLabels.js
98 cp ./node_modules/updated-jqplot/build/plugins/jqplot.enhancedPieLegendRenderer.js ./js/vendor/jqplot/plugins/jqplot.enhancedPieLegendRenderer.js
99 cp ./node_modules/updated-jqplot/build/plugins/jqplot.dateAxisRenderer.js ./js/vendor/jqplot/plugins/jqplot.dateAxisRenderer.js
100 cp ./node_modules/updated-jqplot/build/plugins/jqplot.categoryAxisRenderer.js ./js/vendor/jqplot/plugins/jqplot.categoryAxisRenderer.js
101 cp ./node_modules/updated-jqplot/build/plugins/jqplot.canvasTextRenderer.js ./js/vendor/jqplot/plugins/jqplot.canvasTextRenderer.js
102 cp ./node_modules/updated-jqplot/build/plugins/jqplot.canvasAxisLabelRenderer.js ./js/vendor/jqplot/plugins/jqplot.canvasAxisLabelRenderer.js
104 cp ./node_modules/updated-jqplot/build/plugins/jqplot.cursor.js ./js/vendor/jqplot/plugins/jqplot.cursor.js
105 cp ./node_modules/updated-jqplot/build/plugins/jqplot.highlighter.js ./js/vendor/jqplot/plugins/jqplot.highlighter.js
107 echo 'Done.'