From 5ba8ff9260957fdb1e3b1b1ab68dcd771f040582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81aniewski=20Bartosz?= Date: Fri, 15 Sep 2017 13:53:19 +0200 Subject: [PATCH] :bug: Fix build scripts (closes #31) --- README.md | 27 +++++++++++++++------------ package.json | 11 ++++++----- webpack.config.js | 10 ++++------ 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 9123cda..2774ad4 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Coverage Status](https://coveralls.io/repos/github/qilin-editor/qilin-app/badge.svg?branch=master)](https://coveralls.io/github/qilin-editor/qilin-app?branch=master)
-**Qilin** is a free, open-source text editor developed for exact sciences in mind. It fully supports [`KaTeX`](https://khan.github.io/KaTeX/) and [`AsciiMath`](http://asciimath.org/), partially [`LaTeX`](https://www.latex-project.org/). Qilin works on each desktop platform - it is based on `Chromium` and `Node.js`, licensed under the *BSD-3-Clause* license. +**Qilin** is a free, open-source text editor developed for exact sciences in mind. It fully supports [`LaTeX`](https://www.latex-project.org/), [`KaTeX`](https://khan.github.io/KaTeX/) and [`AsciiMath`](http://asciimath.org/). Qilin works on each desktop platform - it is based on `Chromium` and `Node.js`, licensed under the *BSD-3-Clause* license. ![Qilin editor](https://i.imgur.com/qpguVEw.png) @@ -20,35 +20,38 @@ [![Github Closed Issues](https://img.shields.io/github/issues-closed-raw/qilin-editor/qilin-app.svg)](https://github.com/qilin-editor/qilin-app/issues?q=is%3Aissue+is%3Aclosed) [![Github Pull Requests](https://img.shields.io/github/issues-pr-raw/qilin-editor/qilin-app.svg)](https://github.com/qilin-editor/qilin-app/pulls) -**We want contributing to Qilin to be fun, enjoyable, and educational for anyone, and everyone.** Changes and improvements are more than welcome! Feel free to fork and open a pull request. If you have found any issues, please [report them here](https://github.com/qilin-editor/qilin-app/issues/new) - they are being tracked on [GitHub Issues](https://github.com/qilin-editor/qilin-app/issues). +**We want contributing to Qilin to be fun, enjoyable, and educational for everyone.** Changes and improvements are more than welcome! Feel free to fork and open a pull request. If you have found any issues, please [report them here](https://github.com/qilin-editor/qilin-app/issues/new) - they are being tracked on [GitHub Issues](https://github.com/qilin-editor/qilin-app/issues). ### License -Project was created and developed by [Bartosz Łaniewski](https://github.com/Bartozzz). The full list of contributors can be found [here](https://github.com/qilin-editor/qilin-app/graphs/contributors). Qilin's code is [BSD-3-Clause licensed](https://github.com/qilin-editor/qilin-app/blob/master/LICENSE). We also provide an additional ["patent" grant](https://github.com/qilin-editor/qilin-app/blob/master/PATENTS). +Qilin was created and developed by [Bartosz Łaniewski](https://github.com/Bartozzz). The full list of contributors can be found [here](https://github.com/qilin-editor/qilin-app/graphs/contributors). Qilin's code is [BSD-3-Clause licensed](https://github.com/qilin-editor/qilin-app/blob/master/LICENSE). We also provide an additional ["patent" grant](https://github.com/qilin-editor/qilin-app/blob/master/PATENTS). ### Development We have prepared multiple commands to help you develop Qilin on your own. Don't forget to install all `Node.js` dependencies from [npm](https://www.npmjs.com/). You will need a local copy of [Node.js](https://nodejs.org/en/) installed on your machine. ```bash -$ sudo npm install +$ npm install ``` #### Usage ```bash -$ sudo npm run +$ npm run ``` #### List of commands -| Command | Description | Root | -|---------------|---------------------------------------------------|:----:| -| preapre | Compiles SCSS and JavaScript used by Qilin | × | -| build | Builds Qilin releases for macOS, Windows, Linux | ✓ | -| watch | Runs Qilin application and re-compiles on changes | ✓ | -| start | Runs Qilin application | × | -| clean | Deletes output, builds ands cache | ✓ | +| Command | Description | +|---------------|---------------------------------------------------| +| `preapre` | Compiles resources used by Qilin | +| `build` | Builds Qilin releases for macOS, Windows, Linux | +| `watch` | Runs Qilin application and re-compiles on changes | +| `start` | Runs Qilin application | +| `clean` | Deletes builds and caches | +| `eslint` | Fixes ESLinter errors | + +> **Note:** In some cases, you might need to run those scripts with administrator privileges (`sudo`). ### Installation diff --git a/package.json b/package.json index 817d7e9..2f0e740 100644 --- a/package.json +++ b/package.json @@ -85,11 +85,12 @@ "node-sass": "^4.5.3" }, "scripts": { - "prepare": "set NODE_ENV=production && ./node_modules/.bin/webpack --progress", - "watch": "set NODE_ENV=development && ./node_modules/.bin/webpack --progress --watch & ./node_modules/.bin/nw . --nwjs_build_type=sdk", - "start": "npm run prepare && ./node_modules/.bin/nw . --nwjs_build_type=sdk", - "build": "npm run prepare && node ./bin/compile", - "clear": "rm -rf ./build ./dist" + "prepare": "export NODE_ENV=production && npm run eslint && node_modules/.bin/webpack --progress", + "watch": "npm run prepare --watch & node_modules/.bin/nw . --nwjs_build_type=sdk", + "start": "npm run prepare && node_modules/.bin/nw . --nwjs_build_type=sdk", + "build": "npm run prepare && node bin/compile", + "eslint": "node_modules/.bin/eslint src --fix", + "clear": "rm -rf build cache dist" }, "maintainers": [ { diff --git a/webpack.config.js b/webpack.config.js index c2a9e1c..ccbb47f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -3,6 +3,8 @@ const Webpack = require("webpack"); const HtmlWebpackPlugin = require("html-webpack-plugin"); const ExtractTextPlugin = require("extract-text-webpack-plugin"); +console.log(`Running in ${process.env.NODE_ENV || "production"} mode`); + const config = { entry: "./src/index.js", @@ -13,12 +15,12 @@ const config = { resolve: { extensions: [".js", ".jsx", ".json"], - modules: ["node_modules"], }, watchOptions: { ignored: [ path.resolve(__dirname, "./node_modules"), + path.resolve(__dirname, "./demos"), path.resolve(__dirname, "./build"), path.resolve(__dirname, "./cache"), path.resolve(__dirname, "./dist"), @@ -37,11 +39,7 @@ const config = { use: "url-loader?limit=1000", }, { - test: /\.(woff|woff2|eot|otf|ttf)$/, - use: "file-loader", - }, - { - test: /\.svg$/, + test: /\.(woff|woff2|eot|otf|ttf|svg)$/, use: "file-loader", }, {