Add Makefile to bundle in app

This commit is contained in:
rijkvanzanten
2020-07-24 16:45:42 -04:00
parent cfbec943a3
commit e6dcf0d83e
5 changed files with 23 additions and 5 deletions

1
.gitignore vendored
View File

@@ -6,3 +6,4 @@ uploads
debug.db
test
dist
tmp

6
Makefile Normal file
View File

@@ -0,0 +1,6 @@
bundle:
npm run build
git clone git@github.com:directus/app-next.git tmp-app
cd tmp-app && npm install && npm run build
cp -r tmp-app/dist dist/admin
rm -rf tmp-app

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "directus",
"version": "0.0.1",
"version": "0.1.0-preview.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,8 +1,8 @@
{
"name": "directus",
"version": "0.0.1",
"version": "0.1.0-preview.1",
"description": "Directus",
"main": "dist/server.js",
"main": "dist/app.js",
"bin": {
"directus": "dist/cli/index.js"
},
@@ -10,12 +10,19 @@
"start": "NODE_ENV=production node dist/server.js",
"build": "rimraf dist && tsc -b && copyfiles \"src/**/*.*\" -e \"src/**/*.ts\" -u 1 dist",
"dev": "NODE_ENV=development LOG_LEVEL=trace ts-node-dev --files src/server.ts --clear --respawn --watch \"src/**/*.ts\" --transpile-only | pino-colada",
"cli": "NODE_ENV=development ts-node --script-mode --transpile-only src/cli/index.ts"
"cli": "NODE_ENV=development ts-node --script-mode --transpile-only src/cli/index.ts",
"prepublishOnly": "make bundle"
},
"repository": {
"type": "git",
"url": "git+https://github.com/directus/api-node.git"
},
"files": [
"dist",
"LICENSE",
"README.md",
"example.env"
],
"keywords": [
"directus",
"api",
@@ -26,7 +33,7 @@
"crm"
],
"author": "Rijk van Zanten <rijkvanzanten@me.com>",
"license": "GPL-3.0",
"license": "GPL-3.0-only",
"bugs": {
"url": "https://github.com/directus/api-node/issues"
},

View File

@@ -4,6 +4,7 @@ dotenv.config();
import express from 'express';
import bodyParser from 'body-parser';
import logger from 'express-pino-logger';
import path from 'path';
import errorHandler from './middleware/error-handler';
@@ -44,6 +45,9 @@ const app = express()
})
// the auth endpoints allow you to login/logout etc. It should ignore the authentication check
.use('/admin', express.static(path.join(__dirname, 'admin')))
.use('/admin/*', (req, res) => res.sendFile(path.join(__dirname, 'admin/index.html')))
.use('/auth', authRouter)
.use(authenticate)