Giter Club home page Giter Club logo

ts's Introduction

Introduction

translation-frontend app built with angular.

Table of Contents

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)
  • typescript (npm install --global typescript)

Installing

  • clone this repo
  • npm install webpack-dev-server rimraf webpack -g to install required global dependencies
  • npm install to install all dependencies
  • 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 (or if you prefer IPv6, if you're using express server, then it's http://[::1]:3000/). Go to http://0.0.0.0:3000 or http://localhost:3000 in your browser

Running translation-api service

git clone [email protected]:translation-service/api.git
cd api
npm install
npm start

Running user-management-api service

git clone [email protected]:translation-service/user-management-service-doc.git
cd user-management-service-doc
npm install
npm start

Running media service

git clone [email protected]:translation-service/media-service.git
cd media-service
npm install
npm start

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

TypeScript

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:

Types

When you include a module that doesn't include Type Definitions inside of the module you can include external Type Definitions with @types

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 @types

npm install @types/node
npm install @types/lodash

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';

Overriding webpack.dev.js

Create a file named config/webpack.local.js and change the variables like I did bellow:

const METADATA = {
  host: '0.0.0.0',
  port: 3000,
};

module.exports = {
  metadata: METADATA,
  // If you want to override all other properties
  // first merge it into webpack.common.js
};

Overriding parameters.ts

Create a file named src/parameters.dev.ts and change the variables like I did bellow:

let Parameters = {
  DEFAULT_LANG: 'en',
  USER_SERVICE_API: 'http://server:9001/v1',
  TRANSLATION_SERVICE_API: 'http://server:9001/v1',
  PUBLIC_DIR: './src/app'
}

export { Parameters };

ts's People

Contributors

zender avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.