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

New UI integration #206

Merged
merged 17 commits into from
May 5, 2023
Merged
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
Binary file modified .yarn/install-state.gz
Binary file not shown.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ RUN yarn install && yarn build
ENV PORT=3000
EXPOSE $PORT


CMD [ "yarn", "workspace", "@celluloid/server", "run", "start"]
CMD [ "yarn", "server", "start"]

2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
POSTGRES_MULTIPLE_DATABASES: celluloid, keycloak
volumes:
- ./.data:/var/lib/postgresql/data
- ./scripts/pg-init-scripts:/docker-entrypoint-initdb.d
- ./scripts/pg-init-scripts.sh:/docker-entrypoint-initdb.d/init.sh
ports:
- "5432:5432"
restart: unless-stopped
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"clean": "for package in $(ls packages); do (cd packages/${package} && yarn clean); done",
"build": "yarn workspaces foreach -pt run build",
"i18n:sync": "yarn workspace translations sync",
"database:migrate": "./scripts/docker-bootstrap.sh admin",
"deploy": "./bin/deploy",
"eslint": "eslint --ext .js,.jsx,.ts,.tsx",
"prettier:all": "prettier --ignore-path .eslintignore \"**/*.{js,jsx,ts,tsx,md}\"",
Expand Down
6 changes: 4 additions & 2 deletions packages/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
"node": ">=14.16"
},
"scripts": {
"dev": "dotenv -e .env -- nodemon -e ts,json --exec node --loader ts-node/esm src/server.ts",
"dev": "dotenv -e .env -- nodemon -e ts,json --exec node --loader ts-node/esm src/index.ts",
"dev-tsup": "tsup src/index.ts --watch --onSuccess 'node dist/index.js'",
"test": "echo $TEST",
"build": "rm -rf dist && tsc",
"start": "node --use-strict dist/index.js"
"start": "DATABASE_URL=$DATABASE_URL node --use-strict dist/index.js"
},
"dependencies": {
"@adminjs/express": "6.0.0",
"@adminjs/import-export": "^3.0.0",
"@adminjs/prisma": "4.0.0",
"@adminjs/themes": "^1.0.0",
"@celluloid/database": "*",
Expand Down
4 changes: 1 addition & 3 deletions packages/admin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ const start = async () => {
});


app.use('/', adminRouter);
app.use('/admin', adminRouter);

const __dirname = url.fileURLToPath(new URL('.', import.meta.url))

app.use("/admin", express.static(path.join(__dirname, "../public")));

app.get("/*", (_, res) => res.status(404).send("page not found"));

app.listen(3000, () => {
console.log(
`AdminJS started on localhost:3000`
Expand Down
15 changes: 9 additions & 6 deletions packages/admin/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import AdminJSExpress from "@adminjs/express";
import importExportFeature from "@adminjs/import-export";
import * as AdminJSPrisma from "@adminjs/prisma";
import { dark, light, noSidebar } from '@adminjs/themes'
import { DMMFClass, prisma } from "@celluloid/database";
Expand Down Expand Up @@ -55,11 +56,11 @@ const getAdminRouter = (options: Partial<AdminJSOptions> = {}) => {
branding: {
companyName: 'Celluloid',
withMadeWithLove: false,
logo: '/admin/assets/images/logo.svg',
logo: '/assets/images/logo.svg',
theme: overrides
},
assets: {
styles: ['/admin/assets/styles/override.css'],
styles: ['/assets/styles/override.css'],
},
dashboard: {
component: Components.MyInput,
Expand Down Expand Up @@ -130,7 +131,12 @@ const getAdminRouter = (options: Partial<AdminJSOptions> = {}) => {
},
},
},
}
},
features: [
importExportFeature({
componentLoader,
}),
],
},
{
resource: { model: dmmf.modelMap.Comment, client: prisma },
Expand All @@ -157,12 +163,9 @@ const getAdminRouter = (options: Partial<AdminJSOptions> = {}) => {
};



const admin = new AdminJS(adminOptions);
if (process.env.NODE_ENV == "developement")
admin.watch()

console.log("DATABASE_URL", process.env.DATABASE_URL);
return AdminJSExpress.buildRouter(admin);
};

Expand Down
9 changes: 6 additions & 3 deletions packages/client/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
"~components/*": [
"src/components/*"
],
"~hooks/*": [
"src/hooks/*"
],
"~images/*": [
"src/images/*"
],
Expand Down Expand Up @@ -40,6 +37,12 @@
],
"~/*": [
"src/*"
],
"~pages/*": [
"src/pages/*"
],
"~hooks/*": [
"src/hooks/*"
]
}
}
Expand Down
7 changes: 6 additions & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,17 @@
"change-case": "^4.0.0",
"connected-react-router": "6.9.3",
"enzyme": "^3.3.0",
"formik": "^2.2.9",
"get-urls": "^11.0.0",
"history": "^4.7.2",
"i18next": "^22.0.4",
"i18next-browser-languagedetector": "^7.0.0",
"linkify-urls": "^4.0.0",
"lodash": "^4.17.21",
"material-ui-confirm": "^3.0.9",
"material-ui-pickers": "^1.0.0-rc.17",
"moment-duration-format": "^2.2.2",
"mui-image": "^1.0.7",
"prop-types": "^15.6.2",
"query-string": "^6.1.0",
"ramda": "^0.28.0",
Expand All @@ -58,7 +61,8 @@
"redux-thunk": "^2.3.0",
"rooks": "^7.4.1",
"shiitake": "^3.0.2",
"typescript": "^5.0.4"
"typescript": "^5.0.4",
"yup": "^1.1.1"
},
"browserslist": {
"production": [
Expand Down Expand Up @@ -86,6 +90,7 @@
"@types/jss": "^9.3.0",
"@types/lodash": "^4.14.187",
"@types/moment-duration-format": "^2.2.0",
"@types/mui-image": "^1.0.1",
"@types/node": "^16.18.3",
"@types/query-string": "^6.0.0",
"@types/randomcolor": "^0.5.0",
Expand Down
Loading