From 7bde7039bb5305c8dcd630cd1a7cd76920e3b058 Mon Sep 17 00:00:00 2001 From: Labhansh Agrawal Date: Mon, 27 Apr 2020 11:25:38 +0530 Subject: [PATCH] add webpack config --- addons/xterm-addon-ligatures/.npmignore | 12 +++++++ addons/xterm-addon-ligatures/package.json | 10 +++--- .../xterm-addon-ligatures/webpack.config.js | 32 +++++++++++++++++++ 3 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 addons/xterm-addon-ligatures/webpack.config.js diff --git a/addons/xterm-addon-ligatures/.npmignore b/addons/xterm-addon-ligatures/.npmignore index 298e0b7b..9f4fec9a 100644 --- a/addons/xterm-addon-ligatures/.npmignore +++ b/addons/xterm-addon-ligatures/.npmignore @@ -6,6 +6,12 @@ !*.js !*.json +# Whitelist - lib/ +!lib/**/*.d.ts + +!lib/**/*.js +!lib/**/*.js.map + # Whitelist - out/ !out/**/*.d.ts @@ -34,3 +40,9 @@ docs/ coverage/ .nyc_output/ fonts/ + +**/*.api.js +**/*.api.ts +tsconfig.json +.yarnrc +webpack.config.js diff --git a/addons/xterm-addon-ligatures/package.json b/addons/xterm-addon-ligatures/package.json index fe99f6cc..1e34d1a3 100644 --- a/addons/xterm-addon-ligatures/package.json +++ b/addons/xterm-addon-ligatures/package.json @@ -13,16 +13,18 @@ "engines": { "node": ">8.0.0" }, - "main": "out/LigaturesAddon.js", + "main": "lib/xterm-addon-ligatures.js", "types": "typings/xterm-addon-ligatures.d.ts", "scripts": { "prepare": "node bin/download-fonts.js", - "build": "tsc -p src", - "watch": "tsc -w -p src", + "build": "../../node_modules/.bin/tsc -p src", + "watch": "../../node_modules/.bin/tsc -w -p src", + "prepackage": "npm run build", + "package": "../../node_modules/.bin/webpack", "pretest": "npm run build", "test": "nyc mocha out/**/*.test.js", "coveralls": "nyc report --reporter=text-lcov | coveralls", - "prepublish": "npm run build" + "prepublish": "npm run package" }, "keywords": [ "font", diff --git a/addons/xterm-addon-ligatures/webpack.config.js b/addons/xterm-addon-ligatures/webpack.config.js new file mode 100644 index 00000000..819256fb --- /dev/null +++ b/addons/xterm-addon-ligatures/webpack.config.js @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2019 The xterm.js authors. All rights reserved. + * @license MIT + */ + +const path = require('path'); + +const addonName = 'LigaturesAddon'; +const mainFile = 'xterm-addon-ligatures.js'; + +module.exports = { + entry: `./out/${addonName}.js`, + devtool: 'source-map', + target: 'electron-renderer', + module: { + rules: [ + { + test: /\.js$/, + use: ["source-map-loader"], + enforce: "pre", + exclude: /node_modules/ + } + ] + }, + output: { + filename: mainFile, + path: path.resolve('./lib'), + library: addonName, + libraryTarget: 'umd' + }, + mode: 'production' +};