mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-01 00:08:27 +01:00
Merge pull request #138 from finn-no/lerna
Move to use lerna to have multiple packages inside same repo
This commit is contained in:
commit
c92c168081
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,6 @@
|
||||
node_modules
|
||||
lerna-debug
|
||||
npm-debug
|
||||
.DS_Store
|
||||
|
||||
# Logs
|
||||
|
10
.travis.yml
10
.travis.yml
@ -1,16 +1,14 @@
|
||||
sudo: false
|
||||
language: node_js
|
||||
node_js:
|
||||
- "5.8"
|
||||
env: TEST_DATABASE_URL=postgres://postgres@localhost:5432/unleash_test
|
||||
- "6"
|
||||
env:
|
||||
- DATABASE_URL=postgres://postgres@localhost:5432/unleash_test TEST_DATABASE_URL=postgres://postgres@localhost:5432/unleash_test
|
||||
before_script:
|
||||
- echo '--timeout 10000' > test/mocha.opts
|
||||
- psql -c 'create database unleash_test;' -U postgres
|
||||
- 'DATABASE_URL=$TEST_DATABASE_URL ./node_modules/.bin/db-migrate up'
|
||||
script:
|
||||
- npm install
|
||||
- npm test
|
||||
- npm run coverage-report || true
|
||||
- npm run test:ci
|
||||
notifications:
|
||||
hipchat:
|
||||
rooms:
|
||||
|
27
README.md
27
README.md
@ -1,5 +1,7 @@
|
||||
# unleash
|
||||
|
||||
__Warning: We are in the process of splitting up unleash into multiple packages in this repository, if you want to test the previous package see [previous tag](https://github.com/finn-no/unleash/tree/v1.0.0-alpha.1) __
|
||||
|
||||
[![Build Status](https://travis-ci.org/finn-no/unleash.svg?branch=master)](https://travis-ci.org/finn-no/unleash) [![Code Climate](https://codeclimate.com/github/finn-no/unleash/badges/gpa.svg)](https://codeclimate.com/github/finn-no/unleash) [![Coverage Status](https://coveralls.io/repos/finn-no/unleash/badge.png?branch=master)](https://coveralls.io/r/finn-no/unleash?branch=master) [![Dependency Status](https://david-dm.org/finn-no/unleash.png)](https://david-dm.org/finn-no/unleash) [![devDependency Status](https://david-dm.org/finn-no/unleash/dev-status.png)](https://david-dm.org/finn-no/unleash#info=devD)
|
||||
|
||||
![Admin UI](https://cloud.githubusercontent.com/assets/572/5873775/3ddc1a66-a2fa-11e4-923c-0a9569605dad.png)
|
||||
@ -49,12 +51,12 @@ export TEST_DATABASE_URL=postgres://unleash_user:passord@localhost:5432/unleash_
|
||||
// Install dependencies
|
||||
npm install
|
||||
|
||||
// Run migrations in your local DBs
|
||||
./node_modules/.bin/db-migrate up
|
||||
DATABASE_URL=$TEST_DATABASE_URL ./node_modules/.bin/db-migrate up
|
||||
// Run migrations in your local DBs (via unleash-api)
|
||||
npm run db-migrate
|
||||
DATABASE_URL=$TEST_DATABASE_URL npm run db-migrate
|
||||
|
||||
// Start server in dev-mode:
|
||||
npm run dev
|
||||
// Start server
|
||||
npm start
|
||||
|
||||
// Admin dashboard
|
||||
http://localhost:4242
|
||||
@ -62,11 +64,8 @@ http://localhost:4242
|
||||
// Feature API:
|
||||
http://localhost:4242/features
|
||||
|
||||
// Execute tests:
|
||||
// Execute tests in all packages:
|
||||
npm test
|
||||
|
||||
// Run tests with postgres running in docker:
|
||||
npm run docker-test
|
||||
```
|
||||
|
||||
### Making a schema change
|
||||
@ -76,3 +75,13 @@ npm run docker-test
|
||||
3. Run `db-migrate create your-migration-name` and edit the generated file to have this line: `module.exports = require('../scripts/migration-runner').create('NNN-your-migration-name');`
|
||||
4. Run `db-migrate up`.
|
||||
5. Generate LB artifact using `scripts/generate-liquibase-artifact` (TODO: make this internal)
|
||||
|
||||
|
||||
### Publishing / Releasing new packages
|
||||
|
||||
Please run `npm run nsp` nad `npm run lint` checks before publishing.
|
||||
|
||||
Run `npm run publish` to start the publishing process.
|
||||
Lerna is setup with independent versioning so you will be prompted with version per package, and lerna will update all the versions across packages.
|
||||
|
||||
`npm run publish:dry`
|
4
lerna.json
Normal file
4
lerna.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"lerna": "2.0.0-beta.20",
|
||||
"version": "independent"
|
||||
}
|
108
package.json
108
package.json
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "unleash-server",
|
||||
"name": "unleash-project",
|
||||
"description": "unleash your features",
|
||||
"version": "1.0.0-alpha.2",
|
||||
"keywords": [
|
||||
@ -8,17 +8,6 @@
|
||||
"feature",
|
||||
"toggle"
|
||||
],
|
||||
"files": [
|
||||
"lib",
|
||||
"migrations",
|
||||
"scripts",
|
||||
"public",
|
||||
"app.js",
|
||||
"server.js",
|
||||
"server-impl.js",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "ssh://git@github.com:finn-no/unleash.git"
|
||||
@ -27,90 +16,31 @@
|
||||
"url": "https://github.com/finn-no/unleash/issues"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.4.3"
|
||||
"node": "6"
|
||||
},
|
||||
"main": "./server-impl.js",
|
||||
"scripts": {
|
||||
"db-migrate-and-start": "npm run db-migrate && npm run start",
|
||||
"start": "npm run build && NODE_ENV=production node server.js",
|
||||
"build": "./node_modules/.bin/webpack -p",
|
||||
"dev": "NODE_ENV=development supervisor --ignore ./node_modules/,./public/js server-dev.js",
|
||||
"start-pg": "pg_virtualenv npm run start-pg-chain",
|
||||
"start-pg-chain": "export DATABASE_URL=postgres://$PGUSER:$PGPASSWORD@localhost:$PGPORT/postgres ; db-migrate up && npm run dev",
|
||||
"test": "export PORT=4243 ; jest && npm run lint && mocha test test/*.js && npm run coverage",
|
||||
"docker-test": "export PORT=4243 ; ./scripts/docker-postgres.sh",
|
||||
"pg-virtualenv-test": "pg_virtualenv npm run pg-virtualenv-chain",
|
||||
"pg-virtualenv-chain": "export TEST_DATABASE_URL=postgres://$PGUSER:$PGPASSWORD@localhost:$PGPORT/postgres ; npm run db-migrate-testdb && npm test",
|
||||
"db-migrate": "node_modules/.bin/db-migrate up",
|
||||
"db-migrate-testdb": "DATABASE_URL=$TEST_DATABASE_URL ./node_modules/.bin/db-migrate up",
|
||||
"tdd": "mocha --watch test test/*",
|
||||
"test-bamboo-ci": "mocha test test/*",
|
||||
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec",
|
||||
"coverage-report": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
|
||||
"jest": "jest",
|
||||
"lint": "eslint . --ignore-path .gitignore",
|
||||
"release:patch": "npm version patch && npm run push-package-publish",
|
||||
"release:minor": "npm version minor && npm run push-package-publish",
|
||||
"release:major": "npm version major && npm run push-package-publish",
|
||||
"push-package-publish": "git push --follow-tags && npm publish"
|
||||
},
|
||||
"dependencies": {
|
||||
"bluebird": "2.9.14",
|
||||
"body-parser": "1.15.0",
|
||||
"cookie-parser": "^1.4.1",
|
||||
"db-migrate": "0.9.23",
|
||||
"deep-diff": "^0.3.3",
|
||||
"errorhandler": "1.3.5",
|
||||
"express": "4.13.4",
|
||||
"express-validator": "2.20.3",
|
||||
"install": "^0.6.1",
|
||||
"jsx-loader": "0.12.2",
|
||||
"jsxhint": "0.13.2",
|
||||
"knex": "^0.10.0",
|
||||
"lodash": "^3.5.0",
|
||||
"log4js": "0.6.35",
|
||||
"moment": "^2.13.0",
|
||||
"npm": "^3.8.8",
|
||||
"pg": "^4.5.5",
|
||||
"react": "^0.13.1",
|
||||
"react-router": "^0.13.2",
|
||||
"reflux": "^0.2.10",
|
||||
"reqwest": "^2.0.5",
|
||||
"serve-favicon": "^2.3.0",
|
||||
"webpack": "^1.13.0",
|
||||
"webpack-dev-middleware": "^1.6.1"
|
||||
"bootstrap": "lerna bootstrap",
|
||||
"prepublish": "npm run bootstrap",
|
||||
"lint": "lerna exec eslint .",
|
||||
"pre-commit": "echo 'no lint check' && exit 0;",
|
||||
"test": "lerna --concurrency=1 exec npm run test",
|
||||
"test:ci": "lerna --concurrency=1 exec npm run test:ci",
|
||||
"nsp": "lerna exec nsp check",
|
||||
"start": "lerna --scope=unleash-server exec npm start",
|
||||
"publish": "lerna publish",
|
||||
"publish:dry": "lerna publish --skip-git --skip-npm",
|
||||
"db-migrate": "lerna --scope=unleash-api exec npm run db-migrate"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"chai": "3.5.0",
|
||||
"coveralls": "^2.11.9",
|
||||
"eslint": "^2.9.0",
|
||||
"eslint-config-spt": "^2.0.0",
|
||||
"eslint": "^2.0.0",
|
||||
"eslint-config-finn": "^1.0.0-alpha.3",
|
||||
"eslint-plugin-react": "^4.3.0",
|
||||
"istanbul": "^0.4.3",
|
||||
"jest-cli": "0.5.8",
|
||||
"mocha": "^2.4.5",
|
||||
"mocha-lcov-reporter": "1.2.0",
|
||||
"lerna": "2.0.0-beta.20",
|
||||
"nsp": "^2.3.2",
|
||||
"pre-commit": "^1.0.2",
|
||||
"react-tools": "^0.13.1",
|
||||
"supertest": "^1.2.0",
|
||||
"supervisor": "^0.10.0"
|
||||
},
|
||||
"jest": {
|
||||
"scriptPreprocessor": "<rootDir>/scripts/jest-preprocessor.js",
|
||||
"modulePathIgnorePatterns": [
|
||||
"<rootDir>/node_modules/npm"
|
||||
],
|
||||
"unmockedModulePathPatterns": [
|
||||
"<rootDir>/node_modules/react",
|
||||
"<rootDir>/node_modules/reflux"
|
||||
],
|
||||
"moduleFileExtensions": [
|
||||
"jsx",
|
||||
"js"
|
||||
]
|
||||
"pre-commit": "^1.0.2"
|
||||
},
|
||||
"pre-commit": [
|
||||
"lint"
|
||||
"pre-commit"
|
||||
]
|
||||
}
|
||||
|
@ -6,20 +6,28 @@ var validator = require('express-validator');
|
||||
var log4js = require('log4js');
|
||||
var logger = require('./lib/logger');
|
||||
var routes = require('./lib/routes');
|
||||
var path = require('path');
|
||||
|
||||
module.exports = function(config) {
|
||||
var app = express();
|
||||
var router = express.Router(); // eslint-disable-line
|
||||
var router = express.Router();
|
||||
var baseUriPath = config.baseUriPath || '';
|
||||
var publicFolder = config.publicFolder;
|
||||
|
||||
app.set('trust proxy');
|
||||
app.set('port', config.port);
|
||||
app.locals.baseUriPath = baseUriPath;
|
||||
app.use(cookieParser());
|
||||
|
||||
app.use(favicon(__dirname + '/public/favicon.ico'));
|
||||
if (publicFolder) {
|
||||
app.use(favicon(path.join(publicFolder, 'favicon.ico')));
|
||||
}
|
||||
|
||||
app.use(validator([]));
|
||||
app.use(baseUriPath, express.static(__dirname + '/public'));
|
||||
if (publicFolder) {
|
||||
app.use(baseUriPath, express.static(publicFolder));
|
||||
}
|
||||
|
||||
app.use(bodyParser.json({ strict: false }));
|
||||
app.use(log4js.connectLogger(logger, {
|
||||
format: ':remote-addr :status :method :url :response-timems',
|
||||
@ -30,5 +38,9 @@ module.exports = function(config) {
|
||||
routes.create(router, config);
|
||||
app.use(baseUriPath, router);
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
app.use(require('errorhandler')());
|
||||
}
|
||||
|
||||
return app;
|
||||
};
|
71
packages/unleash-api/package.json
Normal file
71
packages/unleash-api/package.json
Normal file
@ -0,0 +1,71 @@
|
||||
{
|
||||
"name": "unleash-api",
|
||||
"description": "unleash your features",
|
||||
"version": "1.0.0-alpha.1",
|
||||
"keywords": [
|
||||
"unleash",
|
||||
"feature toggle",
|
||||
"feature",
|
||||
"toggle"
|
||||
],
|
||||
"files": [
|
||||
"lib",
|
||||
"migrations",
|
||||
"public",
|
||||
"app.js",
|
||||
"server.js",
|
||||
"server-impl.js",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "ssh://git@github.com:finn-no/unleash.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/finn-no/unleash/issues"
|
||||
},
|
||||
"engines": {
|
||||
"node": "6"
|
||||
},
|
||||
"main": "./server-impl.js",
|
||||
"scripts": {
|
||||
"db-migrate-and-start": "npm run db-migrate && npm run start",
|
||||
"start": "node server.js",
|
||||
"start:dev": "NODE_ENV=development supervisor --ignore ./node_modules/ server.js",
|
||||
"start:dev:pg": "pg_virtualenv npm run start:dev:pg-chain",
|
||||
"start:dev:pg-chain": "export DATABASE_URL=postgres://$PGUSER:$PGPASSWORD@localhost:$PGPORT/postgres ; db-migrate up && npm run start:dev",
|
||||
"db-migrate": "db-migrate up",
|
||||
"test": "export PORT=4243 ; mocha test test/*.js && npm run test:coverage",
|
||||
"test:ci": "npm run db-migrate && npm run test",
|
||||
"test:watch": "mocha --watch test test/*",
|
||||
"test:pg-virtualenv": "pg_virtualenv npm run test:pg-virtualenv-chai",
|
||||
"test:pg-virtualenv-chain": "export TEST_DATABASE_URL=postgres://$PGUSER:$PGPASSWORD@localhost:$PGPORT/postgres ; npm run db-migrate-testdb && npm test",
|
||||
"test:coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec",
|
||||
"test:coverage-report": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"bluebird": "2.9.14",
|
||||
"body-parser": "1.15.0",
|
||||
"cookie-parser": "^1.4.1",
|
||||
"db-migrate": "0.9.23",
|
||||
"deep-diff": "^0.3.3",
|
||||
"errorhandler": "1.3.5",
|
||||
"express": "4.13.4",
|
||||
"express-validator": "2.20.3",
|
||||
"install": "^0.6.1",
|
||||
"knex": "^0.10.0",
|
||||
"log4js": "0.6.35",
|
||||
"pg": "^4.5.5",
|
||||
"serve-favicon": "^2.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "3.5.0",
|
||||
"coveralls": "^2.11.9",
|
||||
"istanbul": "^0.4.3",
|
||||
"mocha": "^2.4.5",
|
||||
"mocha-lcov-reporter": "1.2.0",
|
||||
"supertest": "^1.2.0",
|
||||
"supervisor": "^0.10.0"
|
||||
}
|
||||
}
|
@ -19,7 +19,8 @@ function start(options) {
|
||||
eventDb: eventDb,
|
||||
eventStore: eventStore,
|
||||
featureDb: featureDb,
|
||||
strategyDb: strategyDb
|
||||
strategyDb: strategyDb,
|
||||
publicFolder: options.publicFolder
|
||||
};
|
||||
|
||||
var app = require('./app')(config);
|
6
packages/unleash-db-postgres-adapter/.eslintrc
Normal file
6
packages/unleash-db-postgres-adapter/.eslintrc
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": [
|
||||
"finn",
|
||||
"finn/node"
|
||||
]
|
||||
}
|
1
packages/unleash-db-postgres-adapter/README.md
Normal file
1
packages/unleash-db-postgres-adapter/README.md
Normal file
@ -0,0 +1 @@
|
||||
# TODO
|
6
packages/unleash-docker/README.md
Normal file
6
packages/unleash-docker/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
# unleash-docker
|
||||
|
||||
```bash
|
||||
$ docker-compose build
|
||||
$ docker-compose up
|
||||
```
|
@ -6,7 +6,8 @@
|
||||
"scripts": {
|
||||
"start": "NODE_ENV=production node index.js",
|
||||
"migrate-and-start": "npm run db-migrate && npm run start",
|
||||
"db-migrate": "db-migrate up"
|
||||
"db-migrate": "db-migrate up",
|
||||
"test:ci": "echo 'no tests for unleash-docker';"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
|
6
packages/unleash-frontend/lib/index.js
Normal file
6
packages/unleash-frontend/lib/index.js
Normal file
@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
publicFolder: path.join(__dirname, '..', 'public')
|
||||
};
|
16
packages/unleash-frontend/lib/server-dev.js
Normal file
16
packages/unleash-frontend/lib/server-dev.js
Normal file
@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
const server = require('unleash-server');
|
||||
|
||||
const unleash = server.start({});
|
||||
const app = unleash.app;
|
||||
const config = unleash.config;
|
||||
|
||||
const webpack = require('webpack');
|
||||
const webpackDevMiddleware = require('webpack-dev-middleware');
|
||||
const webpackConfig = require('./webpack.config');
|
||||
const compiler = webpack(webpackConfig);
|
||||
|
||||
app.use(config.baseUriPath, webpackDevMiddleware(compiler, {
|
||||
publicPath: '/js',
|
||||
noInfo: true
|
||||
}));
|
74
packages/unleash-frontend/package.json
Normal file
74
packages/unleash-frontend/package.json
Normal file
@ -0,0 +1,74 @@
|
||||
{
|
||||
"name": "unleash-frontend",
|
||||
"description": "unleash your features",
|
||||
"version": "1.0.0-alpha.1",
|
||||
"keywords": [
|
||||
"unleash",
|
||||
"feature toggle",
|
||||
"feature",
|
||||
"toggle"
|
||||
],
|
||||
"files": [
|
||||
"public",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "ssh://git@github.com:finn-no/unleash.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/finn-no/unleash/issues"
|
||||
},
|
||||
"engines": {
|
||||
"node": "6"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "webpack -p",
|
||||
"start": "NODE_ENV=development supervisor --ignore ./node_modules/,./public/js lib/server-dev.js",
|
||||
"test": "jest",
|
||||
"test:ci": "npm run test"
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"jsx-loader": "0.12.2",
|
||||
"lodash": "^3.5.0",
|
||||
"moment": "^2.13.0",
|
||||
"react": "^0.13.1",
|
||||
"react-router": "^0.13.2",
|
||||
"reflux": "^0.2.10",
|
||||
"reqwest": "^2.0.5",
|
||||
"webpack": "^1.13.0",
|
||||
"webpack-dev-middleware": "^1.6.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "3.5.0",
|
||||
"coveralls": "^2.11.9",
|
||||
"istanbul": "^0.4.3",
|
||||
"jest-cli": "0.5.8",
|
||||
"mocha": "^2.4.5",
|
||||
"mocha-lcov-reporter": "1.2.0",
|
||||
"nsp": "^2.3.2",
|
||||
"react-tools": "^0.13.1",
|
||||
"supertest": "^1.2.0",
|
||||
"supervisor": "^0.10.0",
|
||||
"unleash-api": "1.0.0-alpha.1"
|
||||
},
|
||||
"jest": {
|
||||
"scriptPreprocessor": "<rootDir>/jest-preprocessor.js",
|
||||
"modulePathIgnorePatterns": [
|
||||
"<rootDir>/node_modules/npm"
|
||||
],
|
||||
"unmockedModulePathPatterns": [
|
||||
"<rootDir>/node_modules/react",
|
||||
"<rootDir>/node_modules/reflux"
|
||||
],
|
||||
"moduleFileExtensions": [
|
||||
"jsx",
|
||||
"js"
|
||||
]
|
||||
},
|
||||
"pre-commit": [
|
||||
"lint"
|
||||
]
|
||||
}
|
6
packages/unleash-frontend/public/.eslintrc
Normal file
6
packages/unleash-frontend/public/.eslintrc
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": [
|
||||
"finn",
|
||||
"finn/react"
|
||||
]
|
||||
}
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
39
packages/unleash-frontend/public/js/bundle.js
Normal file
39
packages/unleash-frontend/public/js/bundle.js
Normal file
File diff suppressed because one or more lines are too long
1
packages/unleash-frontend/public/js/bundle.js.map
Normal file
1
packages/unleash-frontend/public/js/bundle.js.map
Normal file
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user