View | Details | Raw Unified | Return to bug 15522
Collapse All | Expand All

(-)a/.gitignore (+1 lines)
Lines 5-7 Link Here
5
node_modules/
5
node_modules/
6
koha-tmpl/opac-tmpl/bootstrap/css/maps/
6
koha-tmpl/opac-tmpl/bootstrap/css/maps/
7
koha-tmpl/intranet-tmpl/prog/css/maps/
7
koha-tmpl/intranet-tmpl/prog/css/maps/
8
koha-tmpl/intranet-tmpl/prog/js/built
(-)a/Makefile.PL (-1 / +18 lines)
Lines 1832-1838 sub postamble { Link Here
1832
		$env .= join("\n", map { "export __${_}__ := $config{$_}" } keys %config);
1832
		$env .= join("\n", map { "export __${_}__ := $config{$_}" } keys %config);
1833
	}
1833
	}
1834
1834
1835
    return "$env\n";
1835
    my $js_build_targets = <<'JS';
1836
.PHONY: js-build js-deps js-watch
1837
YARN=node_modules/.bin/yarn
1838
1839
$(YARN):
1840
	npm install yarn
1841
1842
js-deps: $(YARN)
1843
	$(YARN) install
1844
1845
js-build: $(YARN) js-deps
1846
	$(YARN) build
1847
1848
js-watch: $(YARN) js-deps
1849
	$(YARN) watch
1850
JS
1851
1852
    return "$env\n$js_build_targets\n";
1836
}
1853
}
1837
1854
1838
1855
(-)a/gulpfile.js (-4 / +52 lines)
Lines 10-22 const sourcemaps = require('gulp-sourcemaps'); Link Here
10
const autoprefixer = require('gulp-autoprefixer');
10
const autoprefixer = require('gulp-autoprefixer');
11
const args = require('minimist')(process.argv.slice(2));
11
const args = require('minimist')(process.argv.slice(2));
12
const rename = require('gulp-rename');
12
const rename = require('gulp-rename');
13
const glob = require('glob');
14
const path = require('path');
15
16
const rollupTypescript = require('@rollup/plugin-typescript');
17
const rollupVue = require('rollup-plugin-vue');
18
const rollup = require('rollup');
19
const { nodeResolve } = require('@rollup/plugin-node-resolve');
20
const commonjs = require('@rollup/plugin-commonjs');
21
const replace = require('@rollup/plugin-replace');
22
const rollupCss = require('rollup-plugin-css-only');
13
23
14
const STAFF_JS_BASE = "koha-tmpl/intranet-tmpl/prog/js";
24
const STAFF_JS_BASE = "koha-tmpl/intranet-tmpl/prog/js";
15
const STAFF_CSS_BASE = "koha-tmpl/intranet-tmpl/prog/css";
25
const STAFF_CSS_BASE = "koha-tmpl/intranet-tmpl/prog/css";
16
const OPAC_JS_BASE = "koha-tmpl/opac-tmpl/bootstrap/js";
26
const OPAC_JS_BASE = "koha-tmpl/opac-tmpl/bootstrap/js";
17
const OPAC_CSS_BASE = "koha-tmpl/opac-tmpl/bootstrap/css";
27
const OPAC_CSS_BASE = "koha-tmpl/opac-tmpl/bootstrap/css";
18
28
19
if (args.view == "opac") {
29
if( args.view == "opac" ){
20
    var css_base = OPAC_CSS_BASE;
30
    var css_base = OPAC_CSS_BASE;
21
    var js_base = OPAC_JS_BASE;
31
    var js_base = OPAC_JS_BASE;
22
} else {
32
} else {
Lines 62-69 function build() { Link Here
62
        .pipe(dest(css_base));
72
        .pipe(dest(css_base));
63
}
73
}
64
74
65
exports.build = build;
75
async function vue() {
76
77
    const files = glob.sync(js_base + '/src/**/main.ts');
78
79
    const inputs = files.reduce((prev, file) => {
80
        prev[path.relative(js_base + '/src', file).slice(0, -3)] = file;
81
        return prev;
82
    }, {});
83
84
    const bundle = await rollup.rollup({
85
        input: inputs,
86
        plugins: [
87
            nodeResolve(),
88
            commonjs(),
89
            rollupVue({
90
                css: true,
91
                compileTemplate: true
92
            }),
93
            rollupTypescript({
94
                typescript: require('typescript')
95
            }),
96
            replace({
97
                // alternatively, one could pass process.env.NODE_ENV or 'development` to stringify
98
                'process.env.NODE_ENV': JSON.stringify('production')
99
            })
100
        ]
101
    });
102
103
    await bundle.write({
104
        dir: js_base + '/built',
105
        format: 'umd',
106
        sourcemap: true
107
    });
108
109
}
110
111
exports.build = series(build, vue);
66
exports.css = css;
112
exports.css = css;
67
exports.default = function () {
113
exports.vue = vue;
68
    watch(css_base + "/src/**/*.scss", series('css'));
114
exports.default = exports.watch = function () {
115
    watch(css_base + "/src/**/*.scss", css);
116
    watch([js_base + '/src/**/*.ts', js_base + '/src/**/*.vue'], vue);
69
}
117
}
(-)a/package.json (-3 / +27 lines)
Lines 15-26 Link Here
15
    "gulp-rtlcss": "^1.4.1",
15
    "gulp-rtlcss": "^1.4.1",
16
    "gulp-sass": "^3.1.0",
16
    "gulp-sass": "^3.1.0",
17
    "gulp-sourcemaps": "^2.6.1",
17
    "gulp-sourcemaps": "^2.6.1",
18
    "minimist": "^1.2.5"
18
    "gulp-tap": "^1.0.1",
19
    "lodash": "^4.17.4",
20
    "minimist": "^1.2.5",
21
    "node-sass": "^4.14.1",
22
    "promise-polyfill": "^6.0.2",
23
    "react": "^16.0.0",
24
    "react-dom": "^16.0.0",
25
    "uglifyify": "^4.0.4",
26
    "vinyl-source-stream": "^1.1.0",
27
    "vue": "^3.0.0",
28
    "whatwg-fetch": "^2.0.3"
29
  },
30
  "devDependencies": {
31
    "@rollup/plugin-commonjs": "^15.1.0",
32
    "@rollup/plugin-multi-entry": "^4.0.0",
33
    "@rollup/plugin-node-resolve": "^9.0.0",
34
    "@rollup/plugin-replace": "^2.3.3",
35
    "@rollup/plugin-typescript": "^6.0.0",
36
    "@vue/compiler-sfc": "^3.0.0",
37
    "glob": "^7.1.6",
38
    "rollup": "^2.29.0",
39
    "rollup-plugin-css-only": "^2.1.0",
40
    "rollup-plugin-vue": "^6.0.0-beta.10",
41
    "tslib": "^2.0.3",
42
    "typescript": "^4.0.3"
19
  },
43
  },
20
  "scripts": {
44
  "scripts": {
21
    "build": "node_modules/.bin/gulp build",
45
    "build": "node_modules/.bin/gulp build",
22
    "css": "node_modules/.bin/gulp css",
46
    "css": "node_modules/.bin/gulp css",
23
    "watch": "node_modules/.bin/gulp watch"
47
    "watch": "node_modules/.bin/gulp watch",
48
    "vue": "node_modules/.bin/gulp vue"
24
  },
49
  },
25
  "repository": {
50
  "repository": {
26
    "type": "git",
51
    "type": "git",
27
- 

Return to bug 15522