README.md (dspace-angular-dspace-7.0) | : | README.md (dspace-angular-dspace-7.1) | ||
---|---|---|---|---|
skipping to change at line 63 | skipping to change at line 63 | |||
Then go to [http://localhost:4000](http://localhost:4000) in your browser | Then go to [http://localhost:4000](http://localhost:4000) in your browser | |||
Not sure where to start? watch the training videos linked in the [Introduction t o the technology](#introduction-to-the-technology) section below. | Not sure where to start? watch the training videos linked in the [Introduction t o the technology](#introduction-to-the-technology) section below. | |||
Table of Contents | Table of Contents | |||
----------------- | ----------------- | |||
- [Introduction to the technology](#introduction-to-the-technology) | - [Introduction to the technology](#introduction-to-the-technology) | |||
- [Requirements](#requirements) | - [Requirements](#requirements) | |||
- [Installing](#installing) | - [Installing](#installing) | |||
- [Configuring](#configuring) | - [Configuring](#configuring) | |||
- [Running the app](#running-the-app) | - [Running the app](#running-the-app) | |||
- [Running in production mode](#running-in-production-mode) | - [Running in production mode](#running-in-production-mode) | |||
- [Deploy](#deploy) | - [Deploy](#deploy) | |||
- [Running the application with Docker](#running-the-application-with-docker ) | - [Running the application with Docker](#running-the-application-with-docker ) | |||
- [Cleaning](#cleaning) | - [Cleaning](#cleaning) | |||
- [Testing](#testing) | - [Testing](#testing) | |||
- [Test a Pull Request](#test-a-pull-request) | - [Test a Pull Request](#test-a-pull-request) | |||
- [Unit Tests](#unit-tests) | ||||
- [E2E Tests](#e2e-tests) | ||||
- [Writing E2E Tests](#writing-e2e-tests) | ||||
- [Documentation](#documentation) | - [Documentation](#documentation) | |||
- [Other commands](#other-commands) | - [Other commands](#other-commands) | |||
- [Recommended Editors/IDEs](#recommended-editorsides) | - [Recommended Editors/IDEs](#recommended-editorsides) | |||
- [Collaborating](#collaborating) | - [Collaborating](#collaborating) | |||
- [File Structure](#file-structure) | - [File Structure](#file-structure) | |||
- [Managing Dependencies (via yarn)](#managing-dependencies-via-yarn) | - [Managing Dependencies (via yarn)](#managing-dependencies-via-yarn) | |||
- [Frequently asked questions](#frequently-asked-questions) | - [Frequently asked questions](#frequently-asked-questions) | |||
- [License](#license) | - [License](#license) | |||
Introduction to the technology | Introduction to the technology | |||
skipping to change at line 206 | skipping to change at line 209 | |||
* Click it, and follow "Step 1" of those instructions to checkout the pul l down the PR branch. | * Click it, and follow "Step 1" of those instructions to checkout the pul l down the PR branch. | |||
2. `yarn run clean` (This resets your local dependencies to ensure you are up-t o-date with this PR) | 2. `yarn run clean` (This resets your local dependencies to ensure you are up-t o-date with this PR) | |||
3. `yarn install` (Updates your local dependencies to those in the PR) | 3. `yarn install` (Updates your local dependencies to those in the PR) | |||
4. `yarn start` (Rebuilds the project, and deploys to localhost:4000, by default ) | 4. `yarn start` (Rebuilds the project, and deploys to localhost:4000, by default ) | |||
5. At this point, the code from the PR will be deployed to http://localhost:4000 . Test it out, and ensure that it does what is described in the PR (or fixes th e bug described in the ticket linked to the PR). | 5. At this point, the code from the PR will be deployed to http://localhost:4000 . Test it out, and ensure that it does what is described in the PR (or fixes th e bug described in the ticket linked to the PR). | |||
Once you have tested the Pull Request, please add a comment and/or approval to t he PR to let us know whether you found it to be successful (or not). Thanks! | Once you have tested the Pull Request, please add a comment and/or approval to t he PR to let us know whether you found it to be successful (or not). Thanks! | |||
### Unit Tests | ### Unit Tests | |||
Unit tests use Karma. You can find the configuration file at the same level of t | Unit tests use the [Jasmine test framework](https://jasmine.github.io/), and are | |||
his README file:`./karma.conf.js` If you are going to use a remote test environm | run via [Karma](https://karma-runner.github.io/). | |||
ent you need to edit the `./karma.conf.js`. Follow the instructions you will fin | ||||
d inside it. To executing tests whenever any file changes you can modify the 'au | You can find the Karma configuration file at the same level of this README file: | |||
toWatch' option to 'true' and 'singleRun' option to 'false'. A coverage report i | `./karma.conf.js` If you are going to use a remote test environment you need to | |||
s also available at: http://localhost:9876/ after you run: `yarn run coverage`. | edit the `./karma.conf.js`. Follow the instructions you will find inside it. To | |||
executing tests whenever any file changes you can modify the 'autoWatch' option | ||||
to 'true' and 'singleRun' option to 'false'. A coverage report is also available | ||||
at: http://localhost:9876/ after you run: `yarn run coverage`. | ||||
The default browser is Google Chrome. | The default browser is Google Chrome. | |||
Place your tests in the same location of the application source code files that they test. | Place your tests in the same location of the application source code files that they test, e.g. ending with `*.component.spec.ts` | |||
and run: `yarn run test` | and run: `yarn test` | |||
### E2E test | If you run into odd test errors, see the Angular guide to debugging tests: https ://angular.io/guide/test-debugging | |||
E2E tests use Protractor + Selenium server + browsers. You can find the configur ation file at the same level of this README file:`./protractor.conf.js` Protract or is installed as 'local' as a dev dependency. | ### E2E Tests | |||
If you are going to use a remote test enviroment you need to edit the './e2e//pr otractor.conf.js'. Follow the instructions you will find inside it. | E2E tests (aka integration tests) use [Cypress.io](https://www.cypress.io/). Con figuration for cypress can be found in the `cypress.json` file in the root direc tory. | |||
The default browser is Google Chrome. | The test files can be found in the `./cypress/integration/` folder. | |||
Before you can run e2e tests, you MUST have a running backend (i.e. REST API). B | ||||
y default, the e2e tests look for this at http://localhost:8080/server/ or whate | ||||
ver `rest` backend is defined in your `environment.prod.ts` or `environment.comm | ||||
on.ts`. You may override this using env variables, see [Configuring](#configurin | ||||
g). | ||||
Run `ng e2e` to kick off the tests. This will start Cypress and allow you to sel | ||||
ect the browser you wish to use, as well as whether you wish to run all tests or | ||||
an individual test file. Once you click run on test(s), this opens the [Cypres | ||||
s Test Runner](https://docs.cypress.io/guides/core-concepts/test-runner) to run | ||||
your test(s) and show you the results. | ||||
Place your tests at the following path: `./e2e` | #### Writing E2E Tests | |||
and run: `ng e2e` | All E2E tests must be created under the `./cypress/integration/` folder, and mus t end in `.spec.ts`. Subfolders are allowed. | |||
### Continuous Integration (CI) Test | * The easiest way to start creating new tests is by running `ng e2e`. This build | |||
s the app and brings up Cypress. | ||||
* From here, if you are editing an existing test file, you can either open it in | ||||
your IDE or run it first to see what it already does. | ||||
* To create a new test file, click `+ New Spec File`. Choose a meaningful name | ||||
ending in `spec.ts` (Please make sure it ends in `.ts` so that it's a Typescript | ||||
file, and not plain Javascript) | ||||
* Start small. Add a basic `describe` and `it` which just [cy.visit](https://doc | ||||
s.cypress.io/api/commands/visit) the page you want to test. For example: | ||||
``` | ||||
describe('Community/Collection Browse Page', () => { | ||||
it('should exist as a page', () => { | ||||
cy.visit('/community-list'); | ||||
}); | ||||
}); | ||||
``` | ||||
* Run your test file from the Cypress window. This starts the [Cypress Test Runn | ||||
er](https://docs.cypress.io/guides/core-concepts/test-runner) in a new browser w | ||||
indow. | ||||
* In the [Cypress Test Runner](https://docs.cypress.io/guides/core-concepts/test | ||||
-runner), you'll Cypress automatically visit the page. This first test will suc | ||||
ceed, as all you are doing is making sure the _page exists_. | ||||
* From here, you can use the [Selector Playground](https://docs.cypress.io/guide | ||||
s/core-concepts/test-runner#Selector-Playground) in the Cypress Test Runner wind | ||||
ow to determine how to tell Cypress to interact with a specific HTML element on | ||||
that page. | ||||
* Most commands start by telling Cypress to [get()](https://docs.cypress.io/ | ||||
api/commands/get) a specific element, using a CSS or jQuery style selector | ||||
* Cypress can then do actions like [click()](https://docs.cypress.io/api/com | ||||
mands/click) an element, or [type()](https://docs.cypress.io/api/commands/type) | ||||
text in an input field, etc. | ||||
* Cypress can also validate that something occurs, using [should()](https | ||||
://docs.cypress.io/api/commands/should) assertions. | ||||
* Any time you save your test file, the Cypress Test Runner will reload & rerun | ||||
it. This allows you can see your results quickly as you write the tests & correc | ||||
t any broken tests rapidly. | ||||
* Cypress also has a great guide on [writing your first test](https://on.cypress | ||||
.io/writing-first-test) with much more info. Keep in mind, while the examples in | ||||
the Cypress docs often involve Javascript files (.js), the same examples will w | ||||
ork in our Typescript (.ts) e2e tests. | ||||
To run all the tests (e.g.: to run tests with Continuous Integration software) y | _Hint: Creating e2e tests is easiest in an IDE (like Visual Studio), as it can h | |||
ou can execute:`yarn run ci` Keep in mind that this command prerequisites are th | elp prompt/autocomplete your Cypress commands._ | |||
e sum of unit test and E2E tests. | ||||
More Information: [docs.cypress.io](https://docs.cypress.io/) has great guides & | ||||
documentation helping you learn more about writing/debugging e2e tests in Cypre | ||||
ss. | ||||
### Learning how to build tests | ||||
See our [DSpace Code Testing Guide](https://wiki.lyrasis.org/display/DSPACE/Code | ||||
+Testing+Guide) for more hints/tips. | ||||
Documentation | Documentation | |||
-------------- | -------------- | |||
See [`./docs`](docs) for further documentation. | Official DSpace documentation is available in the DSpace wiki at https://wiki.ly | |||
rasis.org/display/DSDOC7x/ | ||||
Some UI specific configuration documentation is also found in the [`./docs`](doc | ||||
s) folder of htis codebase. | ||||
### Building code documentation | ### Building code documentation | |||
To build the code documentation we use [TYPEDOC](http://typedoc.org). TYPEDOC is a documentation generator for TypeScript projects. It extracts information from properly formatted comments that can be written within the code files. Follow t he instructions [here](http://typedoc.org/guides/doccomments/) to know how to ma ke those comments. | To build the code documentation we use [TYPEDOC](http://typedoc.org). TYPEDOC is a documentation generator for TypeScript projects. It extracts information from properly formatted comments that can be written within the code files. Follow t he instructions [here](http://typedoc.org/guides/doccomments/) to know how to ma ke those comments. | |||
Run:`yarn run docs` to produce the documentation that will be available in the ' doc' folder. | Run:`yarn run docs` to produce the documentation that will be available in the ' doc' folder. | |||
Other commands | Other commands | |||
-------------- | -------------- | |||
skipping to change at line 256 | skipping to change at line 291 | |||
A command with a name that starts with `pre` or `post` will be executed automati cally before or after the script with the matching name. e.g. if you type `yarn run start` the `prestart` script will run first, then the `start` script will tr igger. | A command with a name that starts with `pre` or `post` will be executed automati cally before or after the script with the matching name. e.g. if you type `yarn run start` the `prestart` script will run first, then the `start` script will tr igger. | |||
Recommended Editors/IDEs | Recommended Editors/IDEs | |||
------------------------ | ------------------------ | |||
To get the most out of TypeScript, you'll need a TypeScript-aware editor. We've had good experiences using these editors: | To get the most out of TypeScript, you'll need a TypeScript-aware editor. We've had good experiences using these editors: | |||
- Free | - Free | |||
- [Visual Studio Code](https://code.visualstudio.com/) | - [Visual Studio Code](https://code.visualstudio.com/) | |||
- [Debugger for Chrome](https://marketplace.visualstudio.co m/items?itemName=msjsdiag.debugger-for-chrome) | - [Debugger for Chrome](https://marketplace.visualstudio.co m/items?itemName=msjsdiag.debugger-for-chrome) | |||
- [Atom](https://atom.io/) | ||||
- [TypeScript plugin](https://atom.io/packages/atom-typescr | ||||
ipt) | ||||
- Paid | - Paid | |||
- [Webstorm](https://www.jetbrains.com/webstorm/download/) or [Inte lliJ IDEA Ultimate](https://www.jetbrains.com/idea/) | - [Webstorm](https://www.jetbrains.com/webstorm/download/) or [Inte lliJ IDEA Ultimate](https://www.jetbrains.com/idea/) | |||
- [Sublime Text](http://www.sublimetext.com/3) | - [Sublime Text](http://www.sublimetext.com/3) | |||
- [Typescript-Sublime-Plugin](https://github.com/Microsoft/ Typescript-Sublime-plugin#installation) | - [Typescript-Sublime-Plugin](https://github.com/Microsoft/ Typescript-Sublime-plugin#installation) | |||
Collaborating | Collaborating | |||
------------- | ------------- | |||
See [the guide on the wiki](https://wiki.lyrasis.org/display/DSPACE/DSpace+7+-+A ngular+UI+Development#DSpace7-AngularUIDevelopment-Howtocontribute) | See [the guide on the wiki](https://wiki.lyrasis.org/display/DSPACE/DSpace+7+-+A ngular+UI+Development#DSpace7-AngularUIDevelopment-Howtocontribute) | |||
skipping to change at line 279 | skipping to change at line 312 | |||
-------------- | -------------- | |||
``` | ``` | |||
dspace-angular | dspace-angular | |||
├── README.md * This document | ├── README.md * This document | |||
├── app.yaml * Application manifest f ile | ├── app.yaml * Application manifest f ile | |||
├── config * Folder for configurati on files | ├── config * Folder for configurati on files | |||
│ ├── environment.default.js * Default configuration files | │ ├── environment.default.js * Default configuration files | |||
│ └── environment.test.js * Test configuration fil es | │ └── environment.test.js * Test configuration fil es | |||
├── docs * Folder for documentati on | ├── docs * Folder for documentati on | |||
├── e2e * Folder for e2e test fi | ├── cypress * Folder for Cypress (ht | |||
les | tps://cypress.io/) / e2e tests | |||
│ ├── app.e2e-spec.ts * | │ ├── integration * Folder for e2e/integra | |||
│ ├── app.po.ts * | tion test files | |||
│ ├── pagenotfound * | │ ├── fixtures * Folder for any fixture | |||
│ │ ├── pagenotfound.e2e-spec.ts * | s needed by e2e tests | |||
│ │ └── pagenotfound.po.ts * | │ ├── plugins * Folder for Cypress plu | |||
gins (if any) | ||||
│ ├── support * Folder for global e2e | ||||
test actions/commands (run for all tests) | ||||
│ └── tsconfig.json * TypeScript configurati on file for e2e tests | │ └── tsconfig.json * TypeScript configurati on file for e2e tests | |||
├── karma.conf.js * Karma configuration fi le for Unit Test | ├── karma.conf.js * Karma configuration fi le for Unit Test | |||
├── nodemon.json * Nodemon (https://nodem on.io/) configuration | ├── nodemon.json * Nodemon (https://nodem on.io/) configuration | |||
├── package.json * This file describes th e npm package for this project, its dependencies, scripts, etc. | ├── package.json * This file describes th e npm package for this project, its dependencies, scripts, etc. | |||
├── postcss.config.js * PostCSS (http://postcs s.org/) configuration file | ├── postcss.config.js * PostCSS (http://postcs s.org/) configuration file | |||
├── protractor.conf.js * | ||||
├── resources * Folder for static reso | ||||
urces | ||||
│ ├── data * Folder for static data | ||||
│ │ └── en * Folder for i18n Englis | ||||
h data | ||||
│ ├── i18n * Folder for i18n transl | ||||
ations | ||||
│ │ └── en.json * i18n translations for | ||||
English | ||||
│ └── images * Folder for images | ||||
│ ├── dspace-logo-old.png * | ||||
│ ├── dspace-logo.png * | ||||
│ └── favicon.ico * | ||||
├── rollup.config.js * Rollup (http://rollupj | ||||
s.org/) configuration | ||||
├── spec-bundle.js * | ||||
├── src * The source of the appl ication | ├── src * The source of the appl ication | |||
│ ├── app * | │ ├── app * The source code of the | |||
│ │ ├── app-routing.module.ts * | application, subdivided by module/page. | |||
│ │ ├── app.component.html * | │ ├── assets * Folder for static reso | |||
│ │ ├── app.component.scss * | urces | |||
│ │ ├── app.component.spec.ts * | │ │ ├── fonts * Folder for fonts | |||
│ │ ├── app.component.ts * | │ │ ├── i18n * Folder for i18n transl | |||
│ │ ├── app.effects.ts * | ations | |||
│ │ ├── app.module.ts * | │ | └── en.json5 * i18n translations for | |||
│ │ ├── app.reducer.ts * | English | |||
│ │ ├── browser-app.module.ts * The root module for th | │ │ └── images * Folder for images | |||
e client | ||||
│ │ ├── +collection-page * Lazily loaded route fo | ||||
r collection module | ||||
│ │ ├── +community-page * Lazily loaded route fo | ||||
r community module | ||||
│ │ ├── core * | ||||
│ │ ├── header * | ||||
│ │ ├── +home * Lazily loaded route fo | ||||
r home module | ||||
│ │ ├── +item-page * Lazily loaded route fo | ||||
r item module | ||||
│ │ ├── object-list * | ||||
│ │ ├── pagenotfound * | ||||
│ │ ├── server-app.module.ts * The root module for th | ||||
e server | ||||
│ │ ├── shared * | ||||
│ │ ├── store.actions.ts * | ||||
│ │ ├── store.effects.ts * | ||||
│ │ ├── thumbnail * | ||||
│ │ └── typings.d.ts * File that allows you t | ||||
o add custom typings for libraries without TypeScript support | ||||
│ ├── backend * Folder containing a mo ck of the REST API, hosted by the express server | │ ├── backend * Folder containing a mo ck of the REST API, hosted by the express server | |||
│ │ ├── api.ts * | ||||
│ │ ├── cache.ts * | ||||
│ │ ├── data * | ||||
│ │ └── db.ts * | ||||
│ ├── config * | │ ├── config * | |||
│ │ ├── cache-config.interface.ts * | ||||
│ │ ├── config.interface.ts * | ||||
│ │ ├── global-config.interface.ts * | ||||
│ │ ├── server-config.interface.ts * | ||||
│ │ └── universal-config.interface.ts * | ||||
│ ├── config.ts * File that loads enviro | ||||
nmental and shareable settings and makes them available to app components | ||||
│ ├── index.csr.html * The index file for cli ent side rendering fallback | │ ├── index.csr.html * The index file for cli ent side rendering fallback | |||
│ ├── index.html * The index file | │ ├── index.html * The index file | |||
│ ├── main.browser.ts * The bootstrap file for the client | │ ├── main.browser.ts * The bootstrap file for the client | |||
│ ├── main.server.ts * The express (http://ex pressjs.com/) config and bootstrap file for the server | │ ├── main.server.ts * The express (http://ex pressjs.com/) config and bootstrap file for the server | |||
│ ├── robots.txt * The robots.txt file | ||||
│ ├── modules * | │ ├── modules * | |||
│ │ ├── cookies * | ||||
│ │ ├── data-loader * | ||||
│ │ ├── transfer-http * | ||||
│ │ ├── transfer-state * | ||||
│ │ ├── transfer-store * | ||||
│ │ └── translate-universal-loader.ts * | ||||
│ ├── routes.ts * The routes file for th | ||||
e server | ||||
│ ├── styles * Folder containing glob al styles | │ ├── styles * Folder containing glob al styles | |||
│ │ ├── _mixins.scss * | │ └── themes * Folder containing avai | |||
│ │ └── variables.scss * Global sass variables | lable themes | |||
file | │ ├── custom * Template folder for cr | |||
│ ├── tsconfig.browser.json * TypeScript config for | eating a custom theme | |||
the client build | │ └── dspace * Default 'dspace' theme | |||
│ ├── tsconfig.server.json * TypeScript config for | ||||
the server build | ||||
│ └── tsconfig.test.json * TypeScript config for | ||||
the test build | ||||
├── tsconfig.json * TypeScript config | ├── tsconfig.json * TypeScript config | |||
├── tslint.json * TSLint (https://palant ir.github.io/tslint/) configuration | ├── tslint.json * TSLint (https://palant ir.github.io/tslint/) configuration | |||
├── typedoc.json * TYPEDOC configuration | ├── typedoc.json * TYPEDOC configuration | |||
├── webpack * Webpack (https://webpa ck.github.io/) config directory | ├── webpack * Webpack (https://webpa ck.github.io/) config directory | |||
│ ├── webpack.aot.js * Webpack (https://webpa | │ ├── webpack.browser.ts * Webpack (https://webpa | |||
ck.github.io/) config for AoT build | ck.github.io/) config for client build | |||
│ ├── webpack.client.js * Webpack (https://webpa | │ ├── webpack.common.ts * | |||
ck.github.io/) config for client build | │ ├── webpack.prod.ts * Webpack (https://webpa | |||
│ ├── webpack.common.js * | ck.github.io/) config for production build | |||
│ ├── webpack.prod.js * Webpack (https://webpa | │ └── webpack.test.ts * Webpack (https://webpa | |||
ck.github.io/) config for production build | ck.github.io/) config for test build | |||
│ ├── webpack.server.js * Webpack (https://webpa | ||||
ck.github.io/) config for server build | ||||
│ └── webpack.test.js * Webpack (https://webpa | ||||
ck.github.io/) config for test build | ||||
├── webpack.config.ts * | ||||
└── yarn.lock * Yarn lockfile (https:/ /yarnpkg.com/en/docs/yarn-lock) | └── yarn.lock * Yarn lockfile (https:/ /yarnpkg.com/en/docs/yarn-lock) | |||
``` | ``` | |||
Managing Dependencies (via yarn) | Managing Dependencies (via yarn) | |||
------------- | ------------- | |||
This project makes use of [`yarn`](https://yarnpkg.com/en/) to ensure that the e xact same dependency versions are used every time you install it. | This project makes use of [`yarn`](https://yarnpkg.com/en/) to ensure that the e xact same dependency versions are used every time you install it. | |||
* `yarn` creates a [`yarn.lock`](https://yarnpkg.com/en/docs/yarn-lock) to track those versions. That file is updated automatically by whenever dependencies are added/updated/removed via yarn. | * `yarn` creates a [`yarn.lock`](https://yarnpkg.com/en/docs/yarn-lock) to track those versions. That file is updated automatically by whenever dependencies are added/updated/removed via yarn. | |||
* **Adding new dependencies**: To install/add a new dependency (third party libr ary), use [`yarn add`](https://yarnpkg.com/en/docs/cli/add). For example: `yarn add some-lib`. | * **Adding new dependencies**: To install/add a new dependency (third party libr ary), use [`yarn add`](https://yarnpkg.com/en/docs/cli/add). For example: `yarn add some-lib`. | |||
End of changes. 25 change blocks. | ||||
119 lines changed or deleted | 123 lines changed or added |