-
Notifications
You must be signed in to change notification settings - Fork 5
Development Patron client
The project uses a strict set of linting rules that may also choke on some formatting. To ensure a common style, formatting should be performed based on a standard config.
To install:
- Go to Preferences > Editor > Code Style > JavaScript.
- Click Manage next to Scheme.
- Choose Import, then IntelliJ IDEA code style XML, and select Standard.xml.
- Press OK in the next dialog.
- Ensure that Standard is chosen as scheme.
The editor will give a code hint anywhere where semicolons are omitted. To fix this, click on the marking and press Alt+Enter, then disable the inspection from the meny that is displayed.
By default, IntelliJ will not use the correct language standard for Patron Client. To change this:
- Go to Preferences > Languages & Frameworks > JavaScript.
- Switch JavaScript language version to React JSX.
Patron Client can de developed without any local dependencies, but it is not efficient:
- Restarting node with changes requires running
make rebuild_patron_client
. - File watching (required for Hot Module Reloading (HMR)) has proven problematic for mounted volumes.
- node.js
- compass (Ruby gem)
-
verify
: Run tests and linting. -
lint
: Run linting. -
start
: Starts the project, butKOHA_API_USER
andKOHA_API_PASS
must be provided. -
test:watch
: Start tests and watch for code changes. Will re-run tests on code changes. -
es5
: Compile all js to es5, useful for debugging unit tests in IntelliJ. See the Debugging tests section for more information. -
dev
: Convenience script, run npm start with port 8001 and withKOHA_API_USER
andKOHA_API_PASS
-
devnode
: Same as above, except it only runs node without compass. Useful when a lot of node restarts are required and no style changes are performed. -
killcompass
: Will print an error, but will kill stale compass instances (might sometimes happen on ctrl+c'ing from start or dev) -
prodbuild
: Build Patron Client for production -
production
: Run Patron Client in production mode. Must have been built for production previously.
- Be ready for ls.ext development.
- Install node.js.
- Install compass. Ruby is required.
- cd to Patron Client directory
- Run
npm install
. - Ensure that the machine's host file has the hosts properly set. Add this line to /etc/hosts or /private/etc/hosts depending on OS:
127.0.0.1 services xkoha koha elasticsearch patron_client koha_mysql
. - You are now ready to run the npm scripts.
npm run dev
is usually a good start.
Since the unit tests are written with import syntax not available in node.js, transpiling is required. IntelliJ is then set to run the tests from the transpiled (ES5) code, but thanks to source maps any breakpoint in the original code will hit.
- Run
npm run es5
to start transpiling. This is a watcher and will update any changed files. - In IntelliJ, press Run > Edit Configurations.
- Press the + sign and choose Mocha.
- In the settings for the Mocha config, change the lines according to the following screenshot:
5. The configuration can be run via Run -> Debug.