Skip to content

Commit bdb3939

Browse files
authored
Merge pull request #7 from oracle-samples/dist-preparation
Dist preparation
2 parents 8d318fb + 0407bef commit bdb3939

File tree

6 files changed

+146
-30
lines changed

6 files changed

+146
-30
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ In order to use this library you need to have access to an Oracle Field Service
88

99
## Installation
1010

11-
1. Clone the repository
1211

13-
2. Add the dependency to your project
12+
1. Add the dependency to your project
1413

15-
`npm install <LOCAL REPOSITORY DIR>`
14+
`npm install <LOCAL REPOSITORY DIR>` (if you have cloned the repository)
1615

17-
3. To use the library in your code:
16+
`npm install https://github.com/oracle-samples/ofs-proxy-js.git` (when installing directly from GitHub)
17+
18+
2. To use the library in your code:
1819

1920
`import {OFSPlugin} from "@ofs_users/proxy"`
2021

package-lock.json

Lines changed: 95 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@
99
"description": "A Javascript proxy to access Oracle Field Service via REST API",
1010
"main": "dist/ofs.es.js",
1111
"module": "dist/ofs.es.js",
12-
"types": "dist/src/OFS.d.ts",
12+
"types": "dist/OFS.d.ts",
1313
"repository": {
1414
"url": "https://github.com/oracle-samples/ofs-proxy-js"
1515
},
1616
"scripts": {
1717
"build": "tsc",
1818
"start": "ts-node src/index.ts",
1919
"test": "jest",
20-
"dist": "rollup --config rollup.config.mjs"
20+
"dist": "rollup --config rollup.config.mjs",
21+
"prepare": "npm run dist"
2122
},
2223
"keywords": [
2324
"ofsc",
@@ -56,6 +57,7 @@
5657
"jest-environment-jsdom": "^29.3.1",
5758
"prettier": "^2.8.1",
5859
"pretty-quick": "^3.1.3",
60+
"rollup-plugin-dts": "^5.3.0",
5961
"ts-jest": "^29.0.3",
6062
"ts-loader": "^9.4.2",
6163
"ts-node": "^10.9.1",
@@ -64,4 +66,4 @@
6466
"dependencies": {
6567
"tslib": "^2.4.1"
6668
}
67-
}
69+
}

rollup.config.mjs

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,33 @@
55

66
import typescript from "@rollup/plugin-typescript";
77
import terser from "@rollup/plugin-terser";
8-
export default {
9-
input: "src/OFS.ts",
10-
output: {
11-
name: "OFS",
12-
file: "dist/ofs.es.js",
13-
format: "es",
8+
import dts from "rollup-plugin-dts";
9+
const config = [
10+
{
11+
input: "src/OFS.ts",
12+
output: {
13+
name: "OFS",
14+
file: "dist/ofs.es.js",
15+
format: "es",
16+
},
17+
plugins: [
18+
typescript(),
19+
terser({
20+
compress: {
21+
unsafe: true,
22+
},
23+
mangle: true,
24+
keep_fnames: true,
25+
keep_classnames: true,
26+
}),
27+
],
1428
},
15-
plugins: [
16-
typescript(),
17-
terser({
18-
compress: {
19-
unsafe: true,
20-
},
21-
mangle: true,
22-
keep_fnames: true,
23-
keep_classnames: true,
24-
}),
25-
],
26-
};
29+
{
30+
// path to your declaration files root
31+
input: "dist/build/types/src/OFS.d.ts",
32+
output: [{ file: "dist/OFS.d.ts", format: "es" }],
33+
plugins: [dts()],
34+
},
35+
];
36+
37+
export default config;

src/model.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,16 @@ export interface ActivityListResponse {
6363
}
6464

6565
export class OFSSubscriptionResponse extends OFSResponse {
66-
data!: SubscriptionListResponse;
66+
data: SubscriptionListResponse = {
67+
totalResults: 0,
68+
items: [],
69+
links: undefined,
70+
};
6771
}
6872

6973
export class OFSActivityResponse extends OFSResponse {
70-
data!: ActivityResponse;
74+
data: ActivityResponse = {
75+
customerName: undefined,
76+
activityId: 0,
77+
};
7178
}

tsconfig.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
/* Modules */
2828
"module": "ES2022", /* Specify what module code is generated. */
29-
// "rootDir": "./", /* Specify the root folder within your source files. */
29+
// "rootDir": ".", /* Specify the root folder within your source files. */
3030
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
3131
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
3232
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
@@ -49,7 +49,7 @@
4949
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
5050
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
5151
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
52-
"outDir": "build", /* Specify an output folder for all emitted files. */
52+
"outDir": "./build", /* Specify an output folder for all emitted files. */
5353
// "removeComments": true, /* Disable emitting comments. */
5454
// "noEmit": true, /* Disable emitting files from a compilation. */
5555
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
@@ -65,7 +65,7 @@
6565
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
6666
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
6767
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
68-
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
68+
"declarationDir": "build/types", /* Specify the output directory for generated declaration files. */
6969
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
7070

7171
/* Interop Constraints */

0 commit comments

Comments
 (0)