зеркало из https://github.com/mozilla/mozjexl.git
Fixes #21, add build step for mozilla-central with webpack, using existing code from Normandy.
This commit is contained in:
Родитель
3d090926f3
Коммит
a0decea8bb
|
@ -341,6 +341,14 @@ it with Pip, and then run `therapist install` in this repo to set it
|
|||
up. It will automatically format your Javascript with Prettier, and
|
||||
run ESLint checks before committing your code.
|
||||
|
||||
## Building a JSM for use in mozilla-central ##
|
||||
```shell
|
||||
$ yarn build
|
||||
```
|
||||
|
||||
The result will be in `vendor/mozjexl.jsm`. This is for use in `mozilla-central/toolkit`, so it is not
|
||||
minified as it will be compressed in the omnijar file.
|
||||
|
||||
## License
|
||||
Mozjexl is licensed under the MIT license. Please see `LICENSE.txt` for full
|
||||
details.
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"watch": "webpack --config ./webpack.config.js --watch",
|
||||
"build": "webpack --config ./webpack.config.js",
|
||||
"test": "mocha -R spec --recursive test",
|
||||
"lint": "eslint lib test .eslintrc.js --ignore-pattern '!.eslintrc.js'"
|
||||
},
|
||||
|
@ -41,6 +43,8 @@
|
|||
"eslint": "^4.18.1",
|
||||
"eslint-config-prettier": "^2.9.0",
|
||||
"eslint-plugin-prettier": "^2.6.0",
|
||||
"prettier": "^1.10.2"
|
||||
"license-webpack-plugin": "0.5.1",
|
||||
"prettier": "^1.10.2",
|
||||
"webpack": "3.1.0"
|
||||
}
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,47 @@
|
|||
/* eslint-env node */
|
||||
const path = require("path");
|
||||
const webpack = require("webpack");
|
||||
const { ConcatSource } = require("webpack-sources");
|
||||
const LicenseWebpackPlugin = require("license-webpack-plugin");
|
||||
|
||||
module.exports = {
|
||||
context: __dirname,
|
||||
entry: {
|
||||
mozjexl: "./lib/Jexl.js"
|
||||
},
|
||||
output: {
|
||||
path: path.resolve(__dirname, "vendor/"),
|
||||
filename: "[name].jsm",
|
||||
library: "[name].jsm",
|
||||
libraryTarget: "this"
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
"process.env": {
|
||||
NODE_ENV: JSON.stringify("production")
|
||||
}
|
||||
}),
|
||||
/**
|
||||
* Plugin that appends "this.EXPORTED_SYMBOLS = ["libname"]" to assets
|
||||
* output by webpack. This allows built assets to be imported using
|
||||
* Cu.import.
|
||||
*/
|
||||
function ExportedSymbols() {
|
||||
this.plugin("emit", function(compilation, callback) {
|
||||
for (const libraryName in compilation.entrypoints) {
|
||||
const assetName = `${libraryName}.jsm`; // Matches output.filename
|
||||
compilation.assets[assetName] = new ConcatSource(
|
||||
"/* eslint-disable */", // Disable linting
|
||||
compilation.assets[assetName],
|
||||
`this.EXPORTED_SYMBOLS = ["${libraryName}"];` // Matches output.library
|
||||
);
|
||||
}
|
||||
callback();
|
||||
});
|
||||
},
|
||||
new LicenseWebpackPlugin({
|
||||
pattern: /^(MIT|ISC|MPL.*|Apache.*|BSD.*)$/,
|
||||
filename: `LICENSE_THIRDPARTY`
|
||||
})
|
||||
]
|
||||
};
|
2873
yarn.lock
2873
yarn.lock
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче