1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

Feature/setup typescript

This sets up the typescript compiler.

Allowing gradual migration to typescript.

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
Co-authored-by: Fredrik Oseberg <fredrik.oseberg@getunleash.ai>
Co-authored-by: Clint Checkett <clintchecketts@churchofjesuschrist.org>

fixes: #676
This commit is contained in:
Fredrik Strand Oseberg 2021-02-12 11:42:00 +01:00 committed by GitHub
parent 6389385f61
commit c1aab06798
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
247 changed files with 141 additions and 36 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@ node_modules
lerna-debug
npm-debug
.DS_Store
/dist
# Logs
logs

View File

@ -3,7 +3,7 @@
'use strict';
const auth = require('basic-auth');
const { User } = require('../lib/server-impl.js');
const { User } = require('../dist/lib/server-impl.js');
function basicAuthentication(app) {
app.use('/api/admin/', (req, res, next) => {

View File

@ -1,7 +1,7 @@
'use strict';
// const unleash = require('unleash-server');
const unleash = require('../lib/server-impl.js');
const unleash = require('../dist/lib/server-impl.js');
const basicAuth = require('./basic-auth-hook');

View File

@ -1,7 +1,7 @@
'use strict';
// const unleash = require('unleash-server');
const unleash = require('../lib/server-impl.js');
const unleash = require('../dist/lib/server-impl.js');
// You typically will not hard-code this value in your code!
const sharedSecret = '12312Random';

View File

@ -3,7 +3,7 @@
'use strict';
const express = require('express');
const unleash = require('../lib/server-impl.js');
const unleash = require('../dist/lib/server-impl.js');
const app = express();
unleash

View File

@ -24,7 +24,7 @@ const GoogleOAuth2Strategy = require('@passport-next/passport-google-oauth2')
.Strategy;
// const { User, AuthenticationRequired } = require('unleash-server');
const { User, AuthenticationRequired } = require('../lib/server-impl.js');
const { User, AuthenticationRequired } = require('../dist/lib/server-impl.js');
passport.use(
new GoogleOAuth2Strategy(

View File

@ -1,7 +1,7 @@
'use strict';
// const unleash = require('unleash-server');
const unleash = require('../lib/server-impl.js');
const unleash = require('../dist/lib/server-impl.js');
const enableGoogleOauth = require('./google-auth-hook');

View File

@ -21,7 +21,7 @@ const KeycloakStrategy = require('@exlinc/keycloak-passport');
const passport = require('passport');
// const { User, AuthenticationRequired } = require('unleash-server');
const { User, AuthenticationRequired } = require('../lib/server-impl.js');
const { User, AuthenticationRequired } = require('../dist/lib/server-impl.js');
const host = process.env.AUTH_HOST;
const realm = process.env.AUTH_REALM;

View File

@ -1,7 +1,7 @@
'use strict';
// const unleash = require('unleash-server');
const unleash = require('../lib/server-impl.js');
const unleash = require('../dist/lib/server-impl.js');
const enableKeycloak = require('./keycloak-auth-hook');

View File

@ -1,7 +1,7 @@
{
"name": "unleash-server",
"description": "Unleash is an enterprise ready feature toggles service. It provides different strategies for handling feature toggles.",
"version": "3.11.2",
"version": "3.11.3-next.1",
"keywords": [
"unleash",
"feature toggle",
@ -9,12 +9,8 @@
"toggle"
],
"files": [
"lib",
"docs",
"bin",
"migrations",
"server.js",
"migrator.js"
"dist",
"docs"
],
"repository": {
"type": "git",
@ -27,17 +23,20 @@
"node": ">=12"
},
"license": "Apache-2.0",
"main": "./lib/server-impl.js",
"main": "./dist/lib/server-impl.js",
"bin": {
"unleash": "bin/unleash.js"
"unleash": "./dist/bin/unleash.js"
},
"scripts": {
"start": "node server.js",
"start": "node ./dist/server.js",
"start:google": "node examples/google-auth-unleash.js",
"start:dev": "NODE_ENV=development supervisor --ignore ./node_modules/,website server-dev.js",
"db-migrate": "db-migrate",
"lint": "eslint .",
"test": "NODE_ENV=test PORT=4243 ava",
"start:dev": "NODE_ENV=development supervisor --ignore ./node_modules/,website ./dist/server-dev.js",
"db-migrate": "db-migrate --migrations-dir ./src/migrations",
"lint": "eslint ./src",
"build:watch": "tsc -w",
"build": "tsc",
"prepare": "yarn run build",
"test": "yarn build && NODE_ENV=test PORT=4243 ava",
"test:docker": "./scripts/docker-postgres.sh",
"test:watch": "yarn test --watch",
"test:coverage": "nyc --reporter=lcov yarn test",
@ -46,15 +45,22 @@
"nyc": {
"all": true,
"include": [
"bin/**/*.js",
"lib/**/*.js"
]
"dist/**/*.js"
],
"exclude": [
"dist/bin",
"dist/migrations"
],
"exclude-after-remap": false
},
"ava": {
"files": [
"./dist/**/*.test.js",
"!src/**/*",
"!**/helpers/**/*",
"!**/fixtures/**/*"
]
],
"snapshotDir": "snapshots"
},
"dependencies": {
"async": "^3.1.0",
@ -87,6 +93,7 @@
"prom-client": "^13.1.0",
"response-time": "^2.3.2",
"serve-favicon": "^2.5.0",
"typescript": "^4.1.5",
"unleash-frontend": "3.11.4",
"yargs": "^16.0.3"
},

View File

@ -0,0 +1,11 @@
# Snapshot report for `dist/lib/addons/slack.test.js`
The actual snapshot is saved in `slack.test.js.snap`.
Generated by [AVA](https://avajs.dev).
## Should call slack webhook
> Snapshot 1
'{"username":"Unleash","icon_emoji":":unleash:","text":"some@user.com created feature toggle <http://some-url.com/#/features/strategies/some-toggle|some-toggle>\\n*Enabled*: no | *Type*: undefined | *Project*: undefined\\n*Activation strategies*: ```- name: default\\n```","channel":"#undefined","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/#/features/strategies/some-toggle"}]}]}'

View File

@ -1,4 +1,4 @@
# Snapshot report for `lib/addons/slack.test.js`
# Snapshot report for `src/lib/addons/slack.test.js`
The actual snapshot is saved in `slack.test.js.snap`.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More