Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: generated empty provider #323

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"libs/providers/flagd": "0.7.5",
"libs/providers/flagd-web": "0.3.3",
"libs/providers/env-var": "0.1.1",
"libs/providers/in-memory": "0.1.1"
"libs/providers/in-memory": "0.1.1",
"libs/providers/backstage": "0.1.0"
}
18 changes: 18 additions & 0 deletions libs/providers/backstage/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
15 changes: 15 additions & 0 deletions libs/providers/backstage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# backstage Provider

## Installation

```
$ npm install @openfeature/backstage-provider
```

## Building

Run `nx package providers-backstage` to build the library.

## Running unit tests

Run `nx test providers-backstage` to execute the unit tests via [Jest](https://jestjs.io).
3 changes: 3 additions & 0 deletions libs/providers/backstage/babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": [["minify", { "builtIns": false }]]
}
10 changes: 10 additions & 0 deletions libs/providers/backstage/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* eslint-disable */
export default {
displayName: 'providers-backstage',
preset: '../../../jest.preset.js',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../../coverage/libs/providers/backstage',
};
12 changes: 12 additions & 0 deletions libs/providers/backstage/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@openfeature/backstage-provider",
"version": "0.0.1",
"type": "commonjs",
"scripts": {
"publish-if-not-exists": "cp $NPM_CONFIG_USERCONFIG .npmrc && if [ \"$(npm show $npm_package_name@$npm_package_version version)\" = \"$(npm run current-version -s)\" ]; then echo 'already published, skipping'; else npm publish --access public; fi",
"current-version": "echo $npm_package_version"
},
"peerDependencies": {
"@openfeature/js-sdk": "^1.0.0"
}
}
76 changes: 76 additions & 0 deletions libs/providers/backstage/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"name": "providers-backstage",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/providers/backstage/src",
"projectType": "library",
"targets": {
"publish": {
"executor": "nx:run-commands",
"options": {
"command": "npm run publish-if-not-exists",
"cwd": "dist/libs/providers/backstage"
},
"dependsOn": [
{
"projects": "self",
"target": "package"
}
]
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/providers/backstage/**/*.ts"]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/providers/backstage/jest.config.ts",
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
},
"package": {
"executor": "@nrwl/rollup:rollup",
"outputs": ["{options.outputPath}"],
"options": {
"project": "libs/providers/backstage/package.json",
"outputPath": "dist/libs/providers/backstage",
"entryFile": "libs/providers/backstage/src/index.ts",
"tsConfig": "libs/providers/backstage/tsconfig.lib.json",
"buildableProjectDepsInPackageJsonType": "dependencies",
"compiler": "tsc",
"generateExportsField": true,
"umdName": "backstage",
"external": ["typescript"],
"format": ["cjs", "esm"],
"assets": [
{
"glob": "package.json",
"input": "./assets",
"output": "./src/"
},
{
"glob": "LICENSE",
"input": "./",
"output": "./"
},
{
"glob": "README.md",
"input": "./libs/providers/backstage",
"output": "./"
}
]
}
}
},
"tags": []
}
1 change: 1 addition & 0 deletions libs/providers/backstage/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/backstage-provider';
7 changes: 7 additions & 0 deletions libs/providers/backstage/src/lib/backstage-provider.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { BackstageProvider } from './backstage-provider';

describe('BackstageProvider', () => {
it('should be and instance of BackstageProvider', () => {
expect(new BackstageProvider()).toBeInstanceOf(BackstageProvider);
});
});
41 changes: 41 additions & 0 deletions libs/providers/backstage/src/lib/backstage-provider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { EvaluationContext, Provider, JsonValue, ResolutionDetails } from '@openfeature/js-sdk';

export class BackstageProvider implements Provider {
metadata = {
name: BackstageProvider.name,
};

hooks = [];

resolveBooleanEvaluation(
flagKey: string,
defaultValue: boolean,
context: EvaluationContext
): Promise<ResolutionDetails<boolean>> {
throw new Error('Method not implemented.');
}

resolveStringEvaluation(
flagKey: string,
defaultValue: string,
context: EvaluationContext
): Promise<ResolutionDetails<string>> {
throw new Error('Method not implemented.');
}

resolveNumberEvaluation(
flagKey: string,
defaultValue: number,
context: EvaluationContext
): Promise<ResolutionDetails<number>> {
throw new Error('Method not implemented.');
}

resolveObjectEvaluation<U extends JsonValue>(
flagKey: string,
defaultValue: U,
context: EvaluationContext
): Promise<ResolutionDetails<U>> {
throw new Error('Method not implemented.');
}
}
22 changes: 22 additions & 0 deletions libs/providers/backstage/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"module": "ES6",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
10 changes: 10 additions & 0 deletions libs/providers/backstage/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../dist/out-tsc",
"declaration": true,
"types": ["node"]
},
"include": ["src/**/*.ts"],
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
}
9 changes: 9 additions & 0 deletions libs/providers/backstage/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"]
}
5 changes: 3 additions & 2 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": ["build", "lint", "test", "e2e"]
"cacheableOperations": []
}
}
},
Expand All @@ -31,5 +31,6 @@
"projects": "dependencies"
}
]
}
},
"defaultBase": "main"
}
Loading