0.0.42 • Published 8 years ago

baDataModel v0.0.42

Weekly downloads
1
License
MIT
Repository
-
Last release
8 years ago

BrightAuthor Next Generation (BANG)

BrightAuthorNG Data Model

This project contains the data model for BrightAuthor projects implemented on top of Redux.

General dependencies

  • Node.js 6.x (supports ES6)
    • We have minor dependencies so far in code, otherwise this is used for compiling, running tests, etc.
  • Redux, Reselect
  • Typescript
  • Typings (Typescript definition manager for libraries)
  • TsUnit for simple unit testing

About Typescript

  • This project is currently using version 2.0 of Typescript, which was released on Sept. 6, 2016. The latest version of Webstorm still bundles version 1.8 - see setup instructions below to point Webstorm at the newer compiler.
    • I am using the new readonly keyword which requires version 2.0.

General Development Prep

  • If you get errors when using 'npm install' or 'npm link', see https://docs.npmjs.com/getting-started/fixing-npm-permissions
  • You still might have to use sudo to install global packages
  • Install node.js (Latest version recommended - currently 6.6.0. Electron uses 6.3.0 as of last check.)
  • Install the 'typings' package:

    npm install -g typings

  • Typescript: the stand-alone version must be installed and used. If you have already installed it, install again to get version 2.0.

    npm install - g typescript

Project Prep

  • Before doing anything to prepare this project, make sure that the directory you have opened in WebStorm is the baDataModel directory - not the base directory of the repo, which is the master directory for other related projects.
    • The baDataModel directory will then become the "content root" of the WebStorm project - all additional paths are calculated relative to that.
  • Install node_modules (this will create or update node-modules directory)

    npm install

  • Link globally installed Typescript compiler for current project

    npm link typescript

  • Retrieve library typings (this will create or update typings directory)

    typings install

  • Extra prepare step to compile the Typescript tsUnit files

    npm run prepare

WebStorm Setup

  • Open WebStorm Preferences

    • On page: Directories
      • Make sure the top line in the Directory list - the "content root" - is \<repo_base>/baDataModel. If it isn't, you probably started in the wrong directory.
    • On page: Languages and Frameworks, select Javascript
      • Select ECMAScript 6 as Javascript language version
    • On page: Languages and Frameworks, expand Javascript node, select Libraries
      • The Redux library is installed by npm, and the typings file should have loaded the library declarations already
      • You should see redux-DefinitelyTyped in the Libraries list - enable it.
      • The library for ECMAScript 6 should also bechecked.
    • On page: Languages and Frameworks, select TypeScript
      • If the Typescript version is less than 2.0, you need to point to version 2 of the compiler that you have installed globally.
        • Click the edit button next to Typescript version
        • Browse to the directory containing the typescriptServices.js files. On macOS, this is probably /usr/local/lib/node_modules/typescript/lib.
        • Set this as the custom directory and click ok.
      • Make sure "Enable TypeScript Compiler" and "Track Changes" is checked (this enables the watcher for immediate transpilation.)
      • Make sure "Resolve objects using tsconfig.json is checked.
  • Testing

    • Testing is based on the tsUnit package - see https://github.com/Steve-Fenton/tsUnit
      • The advantage of tsUnit is that it is Typescript, it is simple, and it can be easily debugged and traced.
    • I am currently directly running my various test files, all located in the 'tests' directory, directly from the terminal window.
      • For example, to run the Sign Tests, type:

        node temp/tests/baDmSignTests.js

      • We are running out of the temp directory because that is where the transpiled javascript is
    • Current configuration of this is very rudimentary. This will get more formalized, but it works fine for development. Eventually we will have a single master test suite entry file.
  • Set up debug configuration

    • You can debug with the tests as well, placing breakpoints in the Typescript code.
    • From Run menu, select "Edit Configurations..."
    • Click on the '+' at upper left to add a debug configuration.
    • Select Node.js as configuration type. Node.js Debug details page will open.
    • Type a friendly name into the Name box (e.g., 'BaDm Test')
    • In the working directory field, select the full path on your machine to the ../BANextGen/baDataModel/temp/tests
    • In the Javascript file field, type the name of the file you want to debug.
    • Click OK.
  • Build and Test

    • No separate build step is necessary currently - the WebStorm Typescript watcher handles it.
    • Run test file directly from terminal window as described above (or add scripts to package.json and run with npm.)
    • Start debugging by clicking on green bug icon at top right of WebStorm menu.
0.0.42

8 years ago

0.0.41

8 years ago

0.0.40

8 years ago

0.0.37

8 years ago

0.0.36

8 years ago

0.0.35

8 years ago

0.0.34

8 years ago

0.0.33

8 years ago

0.0.32

8 years ago

0.0.31

8 years ago

0.0.30

8 years ago

0.0.29

8 years ago

0.0.28

8 years ago

0.0.27

8 years ago

0.0.26

8 years ago

0.0.25

8 years ago

0.0.24

8 years ago

0.0.23

8 years ago

0.0.22

8 years ago

0.0.21

8 years ago

0.0.20

8 years ago

0.0.19

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.1

8 years ago