Skip to content

Commit

Permalink
chore: Fix docs for latest version of typedoc (#889)
Browse files Browse the repository at this point in the history
* chore: Fix docs for latest version of typedoc

* adjust search.js instead of search.json

Co-authored-by: Junjie Tang <[email protected]>
  • Loading branch information
marikaner and jjtang1985 authored Jan 7, 2021
1 parent 759cb74 commit fa605d5
Show file tree
Hide file tree
Showing 26 changed files with 143 additions and 79 deletions.
18 changes: 9 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ All dependencies that are used in more than one of the packages are hoisted into

## Testing
In order to run all tests, execute:
```sh-session
```bash
$ yarn test
```

Expand All @@ -16,20 +16,20 @@ This will run unit tests for all our packages as well as integration tests and t
### Unit Tests
Unit tests shall test specific modules of a package, units that are tested for behavior.
You can run all unit tests by executing:
```sh-session
```bash
$ yarn test:unit
```

To run unit tests for a specific package add the workspace name to the command. For the core package this would be:
```sh-session
```bash
$ yarn @sap-cloud-sdk/core run test
```

### Integration Tests
Integration tests shall test how modules behave in combination. The integration tests are located in [`test-packages/integration-tests`](./test-packages/integration-tests).

To run the integration tests, execute:
```sh-session
```bash
$ yarn test:integration
```

Expand All @@ -38,7 +38,7 @@ As this project is written in TypeScript, it shall be consumable by other TypeSc
The type tests are located at [`test-packages/type-tests`](./test-packages/type-tests).

To run the integration tests, execute:
```sh-session
```bash
$ yarn test:type
```

Expand All @@ -51,27 +51,27 @@ First, we generate type script sources, that are generated into the test-utils o
Second, we generate a transpiled version of a non-modified OData client based on the specifications, that is located at [`test-packages/test-services`](./test-packages/test-services). This is used in the integration tests and type tests.

If you need to extend the existing services, run the following to regenerate the OData clients.
```sh-session
```bash
$ yarn generate:test-services
```

### End to End (E2E) tests

The E2E are the most realistic tests included in this repo and run on each pull request.
There are also nightly tests executed on the internal jenkins - see the internal repo for more details on these.
These are also called E2E tests but are not meant here.
These are also called E2E tests but are not meant here.

The E2E tests are based on a locally running server providing an OData interface using [CAP](https://cap.cloud.sap/docs/) and a Rest interface using OpenApi.
This server is used by the E2E tests located at [test-packages/e2e-tests](./test-packages/e2e-tests).
**Attention** The imports in the E2E tests use the root packages e.g. `@sap-cloud-sdk/core` to mimic the way a customer would use it.
So if you made code changes in one of the packages you need to run `yarn compile` to make the changes take effect.
So if you made code changes in one of the packages you need to run `yarn compile` to make the changes take effect.

For manual E2E to a real remote system we have also some tests agains the [TripPin service](https://www.odata.org/blog/trippin-new-odata-v4-sample-service/) which is the standard OData V4 sample service.
Since the remote service is not really stable we commented out the tests under [test-packages/e2e-tests/test/TripPin](./test-packages/e2e-tests/test/TripPin) but for manual testing they can be useful.

## Linting
To fix all linting issues, run:
```sh-session
```bash
$ yarn lint:fix
```

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ To use the SDK in your project, we recommend using our [commandline interface](#
The core is the heart of the SAP Cloud SDK and contains the functionality that is essential to every project powered by the SDK. Any OData client built by the SAP Cloud SDK, be it the VDM or clients built by the generator are using the core. We recommend to install this in addition to your clients.

To install the SAP Cloud SDK core in your project, run:
```sh-session
```bash
$ npm install @sap-cloud-sdk/core
```

### @sap-cloud-sdk/generator
The SAP Cloud SDK generator is a command line interface (CLI) that allows you to create clients for your own OData services or other SAP systems besides SAP S/4HANA based on their service specifications.

To install the SAP Cloud SDK generator in your project, run:
```sh-session
```bash
$ npm install @sap-cloud-sdk/generator
```

### @sap-cloud-sdk/test-util
The test-util package makes writing tests for your SAP Cloud Platform application more convenient.

To install the SAP Cloud SDK test-util as development dependencies in your project, run:
```sh-session
```bash
$ npm install -D @sap-cloud-sdk/test-util
```

Expand All @@ -64,7 +64,7 @@ In addition to the Open Source parts of this project, we also publish the SAP Cl

To install an OData client for an SAP S/4HANA service run:

```sh-session
```bash
$ npm install @sap/cloud-sdk-vdm-<service name>-service
```
In the example above, `service name` is the name of the service you want to use, e. g. for the business partner service, run: `npm install @sap/cloud-sdk-vdm-business-partner-service`.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "sap-cloud-sdk",
"version": "1.34.0",
"private": true,
"sideEffects": false,
"description": "SAP Cloud SDK for JavaScript",
Expand Down Expand Up @@ -82,8 +83,7 @@
"prettier": "^2.0.2",
"ts-jest": "^26.4.1",
"ts-node": "^9.0.0",
"typedoc": "^0.20.0",
"typedoc-plugin-lerna-packages": "0.3.0",
"typedoc": "^0.20.13",
"typescript": "~4.1.2"
},
"dependencies": {},
Expand Down
6 changes: 6 additions & 0 deletions packages/analytics/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* [[include:analytics/README.md]]
* @packageDocumentation
* @module @sap-cloud-sdk/analytics
*/

export * from './analytics-data';
export * from './usage-analytics';
export * from './config';
6 changes: 6 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* [[include:core/README.md]]
* @packageDocumentation
* @module @sap-cloud-sdk/core
*/

export * from './connectivity';
export * from './header-util';
export * from './http-client';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/odata-common/filter/filterable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type Filterable<EntityT extends Entity> =
* .filter(and(filterExp1, filterExp2));
* ```
*
* Note that the [[GetAllRequestBuilderV2.filter]] and [[GetAllRequestBuilderV4.filter]] method take a rest parameter and thereby an array of filter expressions that are then combined conjunctively. As a consequence following is equivalent to the example above:
* Note that the [[GetAllRequestBuilder.filter | GetAllRequestBuilderV2.filter]] and [[GetAllRequestBuilderV4.filter]] method take a rest parameter and thereby an array of filter expressions that are then combined conjunctively. As a consequence following is equivalent to the example above:
* ```ts
* Entity.requestBuilder()
* .getAll()
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/odata-common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export * from './time';
export * from './uri-conversion';
export * from './expandable';
export * from './entity-deserializer';
export * from './entity-serializer';
export * from './payload-value-converter';
export * from './name-converter';
export * from './properties-util';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/odata-common/selectable/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class Link<EntityT extends Entity, LinkedEntityT extends Entity = any>
) {}

/**
* Creates a selection on a linked entity. Has the same behavior as [[GetAllRequestBuilderV2.select]] and [[GetByKeyRequestBuilderV4.select]] but for linked entities.
* Creates a selection on a linked entity. Has the same behavior as [[GetAllRequestBuilder.select | GetAllRequestBuilderV2.select]] and [[GetByKeyRequestBuilderV4.select]] but for linked entities.
*
* See also, [[Selectable]]
*
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/odata-v2/uri-conversion/get-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Constructable, Filterable } from '../../odata-common';
import { oDataUri } from './odata-uri';

/**
* @deprecated Since v1.21.0. Use [[oDataUri.getFilter]] instead.
* @deprecated Since v1.21.0. Use [[ODataUri.getFilter]] instead.
* Get an object containing the given filter as query parameter, or an empty object if none was given.
*
* @typeparam EntityT - Type of the entity to filter on
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/odata-v2/uri-conversion/get-orderby.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getOrderBy, Orderable } from '../../odata-common';
import { Entity } from '../entity';

/**
* @deprecated Since v1.21.0. Use [[oDataUri.getOrderBy]] instead.
* @deprecated Since v1.21.0. Use [[ODataUri.getOrderBy]] instead.
* Get an object containing the given order bys as query parameter, or an empty object if none was given.
*
* @typeparam EntityT - Type of the entity to order
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
import { oDataUri } from './odata-uri';

/**
* @deprecated Since v1.21.0. Use [[oDataUri.getResourcePathForKeys]] instead.
* @deprecated Since v1.21.0. Use [[ODataUri.getResourcePathForKeys]] instead.
* Get the resource path of an entity specified by key-value pairs.
*
* @typeparam EntityT - Type of the entity to get the resource path for
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/odata-v2/uri-conversion/get-selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getSelect } from './get-select';
import { getExpand } from './get-expand';

/**
* @deprecated Since v1.21.0. Use [[oDataUri.getSelect]] and [[oDataUri.getExpand]] instead.
* @deprecated Since v1.21.0. Use [[ODataUri.getSelect]] and [[ODataUri.getExpand]] instead.
*
* Get an object containing the given Selectables as query parameter, or an empty object if none were given.
* This retrieves where in addition to the selection (`select`) there is also an expansion (`expand`) needed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { oDataUri } from '../uri-conversion';
import { responseDataAccessor } from './response-data-accessor';
/**
* Create an OData request to get a single entity based on its key properties.
* The properties available in the response can be restricted by creating a [[GetByKeyRequestBuilder.select selection]], where no selection is equal to selecting all fields of the entity.
* Navigational properties need to expanded explicitly by [[GetAllRequestBuilder.expand]].
* The properties available in the response can be restricted by creating a [[GetByKeyRequestBuilderV4.select selection]], where no selection is equal to selecting all fields of the entity.
* Navigational properties need to expanded explicitly by [[GetAllRequestBuilderV4.expand]].
* where no selection is equal to selecting all fields.
*
* @typeparam EntityT - Type of the entity to be requested
Expand Down
1 change: 1 addition & 0 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"**/*.spec.ts",
"node_modules/**/*"
],
"files": [],
"references": [
{"path": "../util"},
{"path": "../analytics"}
Expand Down
6 changes: 6 additions & 0 deletions packages/generator/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
/**
* [[include:generator/README.md]]
* @packageDocumentation
* @module @sap-cloud-sdk/generator
*/

export * from './generator';
export * from './generator-options';
3 changes: 2 additions & 1 deletion packages/generator/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
"tsBuildInfoFile": "./dist/.tsbuildinfo"
"tsBuildInfoFile": "./dist/.tsbuildinfo",
"composite": true
},
"include": [
"src/**/*.ts"
Expand Down
2 changes: 1 addition & 1 deletion packages/openapi-generator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This generator is based on the [OpenAPI Tools generator](https://openapi-generat
The official OpenAPI generator is Java based, therefore you need to have a Java runtime installed to use the SAP Cloud SDK OpenAPI generator.

# Installation
```sh-session
```bash
$ npm install @sap-cloud-sdk/openapi-generator
```
# Usage (CLI)
Expand Down
6 changes: 5 additions & 1 deletion packages/openapi-generator/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. */
/**
* [[include:openapi-generator/README.md]]
* @packageDocumentation
* @module @sap-cloud-sdk/openapi-generator
*/

export { generate } from './generator';
5 changes: 3 additions & 2 deletions packages/openapi-generator/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
"target": "es2017"
"tsBuildInfoFile": "./dist/.tsbuildinfo",
"composite": true
},
"include": [
"src/**/*.ts", "test/emptyApiDefinition.ts"
"src/**/*.ts"
],
"exclude": [
"dist/**/*",
Expand Down
6 changes: 6 additions & 0 deletions packages/test-util/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
/**
* [[include:test-util/README.md]]
* @packageDocumentation
* @module @sap-cloud-sdk/test-util
*/

export * from './test-destination-provider';
export * from './test-destination-mocker';
6 changes: 6 additions & 0 deletions packages/util/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* [[include:util/README.md]]
* @packageDocumentation
* @module @sap-cloud-sdk/util
*/

export * from './array';
export * from './code-block';
export * from './constants';
Expand Down
26 changes: 20 additions & 6 deletions scripts/after-bump.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
const path = require('path');
const { transformFile, version, jsonStringify, apiDocsDir } = require('./util');

function updateRootPackageJson() {
transformFile(path.resolve('package.json'), packageJson =>
jsonStringify({
...JSON.parse(packageJson),
version: `${version}`
})
);
}

function updateDocumentationMd() {
transformFile(path.resolve('DOCUMENTATION.md'), documentation =>
documentation
Expand All @@ -13,12 +22,16 @@ function updateDocumentationMd() {
}

function updateTypeDocConfig() {
transformFile('typedoc.json', config =>
jsonStringify({
...JSON.parse(config),
out: `${path.relative(path.resolve(), apiDocsDir)}/${version}`
})
);
transformFile('tsconfig.typedoc.json', config => {
const parsedConfig = JSON.parse(config);
return jsonStringify({
...parsedConfig,
typedocOptions: {
...parsedConfig.typedocOptions,
out: `${path.relative(path.resolve(), apiDocsDir)}/${version}`
}
});
});
}

function updateDocsVersions() {
Expand Down Expand Up @@ -81,6 +94,7 @@ function updateChangelog() {
}

function afterBump() {
updateRootPackageJson();
updateDocumentationMd();
updateTypeDocConfig();
updateDocsVersions();
Expand Down
6 changes: 3 additions & 3 deletions scripts/generate-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const readDir = inputDir =>
)(inputDir);

const isHtmlFile = fileName => path.extname(fileName) === '.html';
const isSearchJson = fileName => path.basename(fileName) === 'search.json';
const isSearchJs = fileName => path.basename(fileName) === 'search.js';
const pipe = (...fns) => start => fns.reduce((state, fn) => fn(state), start);

/**
Expand All @@ -50,7 +50,7 @@ function adjustForGitHubPages() {
}

function adjustSearchJs(paths) {
const filtered = paths.filter(isSearchJson);
const filtered = paths.filter(isSearchJs);
if (filtered.length !== 1) {
throw Error(`Expected one 'search.json', but found: ${filtered.length}.`);
}
Expand Down Expand Up @@ -139,7 +139,7 @@ function validateLogs(generationLogs) {
}

function generateDocs() {
const generationLogs = execSync('npx typedoc .', {
const generationLogs = execSync('typedoc --tsconfig tsconfig.typedoc.json', {
cwd: path.resolve(),
encoding: 'utf8'
});
Expand Down
Loading

0 comments on commit fa605d5

Please sign in to comment.