Skip to content

jmartinm/record-editor

 
 

Repository files navigation

record-editor

Join the chat at https://gitter.im/inspirehep/record-editor Editor (used in inspirehep.net) for JSON documents with bibliographic metadata

Still in early development

USAGE

Configuration

Extended Schema

x_editor_autocompletion

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 have text property inside.

DEVELOPMENT

Tech

  • Angular 2
  • Webpack
  • Sass
  • Typescript

Quick start

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

Getting Started

Dependencies

What you need to run this app:

  • node and npm (brew install node)
  • Ensure you're running the latest versions Node v4.x.x+ (or v5.x.x) and NPM 3.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)

Installing

  • fork this repo
  • clone your fork
  • npm install typings webpack-dev-server rimraf webpack -g to install required global dependencies
  • npm install to install all dependencies
  • typings install to install necessary typings
  • npm run server to start the dev server in another tab

Running the app

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

server

# development
npm run server
# production
npm run build:prod
npm run server:prod

Other commands

build files

# development
npm run build:dev
# production
npm run build:prod

hot module replacement

npm run server:dev:hmr

watch and build files

npm run watch

run tests

npm run test

watch and run our tests

npm run watch:test

run end-to-end tests

# make sure you have your server running in another terminal
npm run e2e

run webdriver (for end-to-end)

npm run webdriver:update
npm run webdriver:start

run Protractor's elementExplorer (for end-to-end)

npm run webdriver:start
# in another terminal
npm run e2e:live

Configuration

Configuration files live in config/ we are currently using webpack, karma, and protractor for different stages of your application

Contributing

Please see CONTRIBUTING

TypeScript Suggestions

To take full advantage of TypeScript with autocomplete you would have to install it globally and use an editor with the correct TypeScript plugins.

Use latest TypeScript compiler

TypeScript 1.7.x includes everything you need. Make sure to upgrade, even if you installed TypeScript previously.

npm install --global typescript

Use a TypeScript-aware editor

We have good experience using these editors:

Typings

When you include a module that doesn't include Type Definitions inside of the module you need to include external Type Definitions with Typings

Use latest Typings module

npm install --global typings

Custom Type Definitions

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

License

MIT

About

Record editing tool used in http://inspirehep.net

Resources

License

GPL-2.0, Unknown licenses found

Licenses found

GPL-2.0
LICENSE
Unknown
license-header.txt

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 54.9%
  • JavaScript 35.3%
  • HTML 8.8%
  • CSS 1.0%