Editor (used in inspirehep.net) for JSON documents with bibliographic metadata
Still in early development
Configuration for autocompletion of a field from remote source. Field to be autocompleted must have the x_editor_autocompletion
property
with configuration object that has the following properties below.
{
url: string; (remote source url that returns the autocompletion results)
path: string; (path to array of autocompletion results in response from the url, seprated by dot '.')
size: number; (maximum number of items to be showed)
}
Note that:
- query string is appended to
url
, so it should end like.../foo?bar=
- autocompletion results array which is located in
path
, must be a array of objects which havetext
property inside.
- Angular 2
- Webpack
- Sass
- Typescript
Make sure you have Node version >= 4.0 and NPM >= 3
# clone our repo or alternatively your fork
git clone https://github.com/inspirehep/record-editor.git
# change directory to our repo
cd record-editor
# add required global libraries
npm install typings webpack-dev-server rimraf webpack -g
# install the repo with npm
npm install
# start the server
npm start
# use Hot Module Replacement
npm run server:dev:hmr
# deploy dev build to surge (record-editor.surge.sh)
npm run surge
go to http://0.0.0.0:3000 or http://localhost:3000 in your browser
What you need to run this app:
node
andnpm
(brew install node
)- Ensure you're running the latest versions Node
v4.x.x
+ (orv5.x.x
) and NPM3.x.x
+
Once you have those, you should install these globals with npm install --global
:
webpack
(npm install --global webpack
)webpack-dev-server
(npm install --global webpack-dev-server
)karma
(npm install --global karma-cli
)protractor
(npm install --global protractor
)typings
(npm install --global typings
)typescript
(npm install --global typescript
)
fork
this repoclone
your forknpm install typings webpack-dev-server rimraf webpack -g
to install required global dependenciesnpm install
to install all dependenciestypings install
to install necessary typingsnpm run server
to start the dev server in another tab
After you have installed all dependencies you can now run the app. Run npm run server
to start a local server using webpack-dev-server
which will watch, build (in-memory), and reload for you. The port will be displayed to you as http://0.0.0.0:3000
# development
npm run server
# production
npm run build:prod
npm run server:prod
# development
npm run build:dev
# production
npm run build:prod
npm run server:dev:hmr
npm run watch
npm run test
npm run watch:test
# make sure you have your server running in another terminal
npm run e2e
npm run webdriver:update
npm run webdriver:start
npm run webdriver:start
# in another terminal
npm run e2e:live
Configuration files live in config/
we are currently using webpack, karma, and protractor for different stages of your application
Please see CONTRIBUTING
To take full advantage of TypeScript with autocomplete you would have to install it globally and use an editor with the correct TypeScript plugins.
TypeScript 1.7.x includes everything you need. Make sure to upgrade, even if you installed TypeScript previously.
npm install --global typescript
We have good experience using these editors:
- Visual Studio Code
- Webstorm 10
- Atom with TypeScript plugin
- Sublime Text with Typescript-Sublime-Plugin
When you include a module that doesn't include Type Definitions inside of the module you need to include external Type Definitions with Typings
npm install --global typings
When including 3rd party modules you also need to include the type definition for the module if they don't provide one within the module. You can try to install it with typings
typings install dt~node --save --global
If you can't find the type definition in the registry we can make an ambient definition in this file for now. For example
declare module "my-module" {
export function doesSomething(value: string): string;
}
If you're prototyping and you will fix the types later you can also declare it as type any
declare var assert: any;
declare var _: any;
declare var $: any;
If you're importing a module that uses Node.js modules which are CommonJS you need to import as
import * as _ from 'lodash';
You can include your type definitions in this file until you create one for the typings registry see typings/registry