Skip to content

Commit

Permalink
Merge pull request #44 from Relewise/feat/integrations
Browse files Browse the repository at this point in the history
feat: integrations package
  • Loading branch information
brianhdk authored Nov 10, 2023
2 parents 737a084 + 8fca5f6 commit b341a54
Show file tree
Hide file tree
Showing 21 changed files with 9,958 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/integrations/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
27 changes: 27 additions & 0 deletions packages/integrations/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
root: true,
env: {
'es6': true,
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
indent: ['error', 4],
quotes: ['error', 'single'],
semi: ['error', 'always'],
'no-extra-semi': 0,
'comma-dangle': ['error', 'always-multiline'], // Reasoning behind using dangling commas -> https://github.com/airbnb/javascript#commas--dangling
'no-useless-constructor': 'off',
'standard/no-callback-literal': 'off',
eqeqeq: ['error', 'smart'],
'no-return-assign': 'off',
'prefer-promise-reject-errors': 'off',
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
'space-before-function-paren': ['error', 'never'],
},
parser: '@typescript-eslint/parser',
parserOptions: {
'ecmaVersion': 'latest',
'sourceType': 'module',
},
};
20 changes: 20 additions & 0 deletions packages/integrations/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# dependencies
node_modules

# production
build
dist
docs

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local environment
.env.local
.env.development.local
.env.test.local
.env.production.local

swagger.json
18 changes: 18 additions & 0 deletions packages/integrations/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# REMEMBER TO KEEP THIS IN SYNC WITH .gitignore AS NPM IGNORES .gitignore IF ITS AVAILABLE

# dependencies
node_modules

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local environment
.env.local
.env.development.local
.env.test.local
.env.production.local

# source files
src
5 changes: 5 additions & 0 deletions packages/integrations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Relewise Integrations

This is the official Relewise TS/JS SDK for updating your entities.

For usage documentation go to our [GitHub repository](https://github.com/Relewise/relewise-sdk-javascript).
43 changes: 43 additions & 0 deletions packages/integrations/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"projectFolder": ".",
"mainEntryPointFilePath": "<projectFolder>/build/index.d.ts",
"bundledPackages": [],
"compiler": {
"tsconfigFilePath": "<projectFolder>/tsconfig.json",
"overrideTsconfig": {
"compilerOptions": {
"outDir": "build"
}
}
},
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "<projectFolder>/dist/index.d.ts"
},
"apiReport": {
"enabled": false
},
"docModel": {
"enabled": false
},
"tsdocMetadata": {
"enabled": false
},
"messages": {
"compilerMessageReporting": {
"default": {
"logLevel": "none"
}
},
"extractorMessageReporting": {
"default": {
"logLevel": "none"
}
},
"tsdocMessageReporting": {
"default": {
"logLevel": "none"
}
}
}
}
80 changes: 80 additions & 0 deletions packages/integrations/dev.guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
## Usage

The following tasks are available for `npm run`:

- `dev`: Run Rollup in watch mode to detect changes to files during development
- `build`: Run Rollup to build a production release distributable
- `build:types`: Run Microsoft API Extractor to rollup a types declaration (`d.ts`) file
- `docs`: Run TypeDoc for TSDoc generated documentation in the "*docs/*" folder
- `clean`: Remove all build artifacts

## Development

**From the lib project**, issue the `npm link` (or `yarn link`) command:

```
npm link
```

Start Rollup in watch mode:

```
npm run dev
```

**From the app project**:

Link to the lib project using the `npm link @relewise/integrations` (or `yarn link @relewise/integrations`) command

Now, run your app via `npm start`.

## Development Cleanup

Once development completes, `unlink` both your library and test app projects.

**From the app project**, unlink the library using `npm unlink @relewise/integrations` (or `yarn unlink @relewise/integrations`) command:

**From the lib project**, issue the `npm unlink` (or `yarn unlink`) command:

```
npm unlink
```

## Release Publishing

Update your `package.json` to next version number, and remember to tag a release.

Once ready to submit your package to the NPM Registry, execute the following tasks via `npm` (or `yarn`):

- `npm run clean` &mdash; Assure a clean build
- `npm run gen-api` &mdash; Generate the typescript API interfaces
- `npm run build` &mdash; Build the package
- `npm run build:types` &mdash; Build API Extractor d.ts declaration

Assure the proper npm login:

```
npm login
```

Submit your package to the registry:

```
npm publish --access public
```

## Testing

### Integrations

To run integrations tests, run the following command with parameters.

DATASET_ID - This is the Relewise Dataset Id

API_KEY - This is the Relewise API Key

SERVER_URL - This is an optional parameter for changing the API url. e.g. https://localhost:5000 for development


npm run integration-test --DATASET_ID=... --API_KEY=... --SERVER_URL=https://api.relewise.com

13 changes: 13 additions & 0 deletions packages/integrations/environment.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
declare global {
namespace NodeJS {
interface ProcessEnv {
NODE_ENV: 'development' | 'production';
PORT?: string;
npm_config_API_KEY: string;
npm_config_DATASET_ID: string;
npm_config_SERVER_URL?: string;
}
}
}

export {}
21 changes: 21 additions & 0 deletions packages/integrations/jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
extensionsToTreatAsEsm: ['.ts'],
moduleDirectories: ['node_modules'],
transform: {
'^.+\\.[tj]s$': 'ts-jest',
},
transformIgnorePatterns: [
'node_modules/(?!(@relewise)/)',
'../lib/dist/cjs/relewise-integrations.js',
],
globals: {
'ts-jest': {
tsconfig: {
allowJs: true,
},
},
},
};
Loading

0 comments on commit b341a54

Please sign in to comment.