Skip to content

Commit bca7178

Browse files
authored
Merge pull request #522 from devforth/next
Next
2 parents dbefa20 + db9ad60 commit bca7178

File tree

186 files changed

+25204
-7585
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+25204
-7585
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
node_modules
22
plugins/*
3-
!plugins/install-plugins.sh
3+
!plugins/README.md
44
adapters/*
5-
!adapters/install-adapters.sh
5+
!adapters/README.md
66
background-jobs-dbs

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ npx adminforth create-app
5959

6060
The most convenient way to add new features or fixes is using `dev-demo`. It imports the source code of the repository and plugins so you can edit them and see changes on the fly.
6161

62+
# Requirements
63+
64+
- **Node.js 20**
65+
- **Docker**
66+
- **pnpm**
67+
- **Taskfile**
68+
6269
To run dev demo:
6370
```sh
6471
cd dev-demo
@@ -109,18 +116,17 @@ Make sure you have not `adminforth` globally installed. If you have it, remove i
109116

110117

111118
```sh
112-
npm uninstall -g adminforth
119+
pnpm uninstall -g adminforth
113120
```
114121

115122
Then, in the root of the project, run once:
116123

117124
```
118125
cd adminforth/adminforth
119-
npm run build
126+
pnpm build
127+
pnpm link
120128
```
121129

122-
This will automatically make an npm link to the `adminforth` package in the root of the project.
123-
124130
Then, go to testing app, e.g. created with CLI, and use next command:
125131

126132
```

adapters/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This folder will be filled with adapters, after dev_demo setup

adapters/install-adapters.sh

Lines changed: 0 additions & 41 deletions
This file was deleted.

adminforth/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class AdminForthAuth implements IAdminForthAuth {
4545
this.adminforth = adminforth;
4646
}
4747

48-
getClientIp(headers: object) {
48+
getClientIp(headers: object) {
4949
const clientIpHeader = this.adminforth.config.auth.clientIpHeader;
5050

5151
const headersLower = Object.keys(headers).reduce((acc, key) => {

adminforth/commands/bundle.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ async function bundle() {
1616
`);
1717

1818
} catch (e) {
19-
console.log(`Running budndle failed`, e);
19+
console.log(`Running bundle failed`, e);
20+
throw new Error(`Failed to bundle admin SPA: ${e.message}`);
2021
}
2122
}
2223

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1+
2+
{{#unless useNpm}}
3+
FROM devforth/node20-pnpm:latest
4+
WORKDIR /code/
5+
ADD package.json pnpm-lock.yaml pnpm-workspace.yaml /code/
6+
RUN pnpm i
7+
ADD . /code/
8+
RUN pnpm exec adminforth bundle
9+
CMD ["sh", "-c", "pnpm migrate:prod && pnpm prod"]
10+
{{/unless}}
11+
{{#if useNpm}}
112
FROM node:{{nodeMajor}}-slim
213
WORKDIR /code/
314
ADD package.json package-lock.json /code/
415
RUN npm ci
516
ADD . /code/
617
RUN npx adminforth bundle
718
CMD ["sh", "-c", "npm run migrate:prod && npm run prod"]
19+
{{/if}}

adminforth/commands/createApp/templates/package.json.hbs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,26 @@
88
"license": "ISC",
99
"description": "",
1010
"scripts": {
11-
"dev": "npm run _env:dev -- tsx watch index.ts",
12-
"prod": "npm run _env:prod -- tsx index.ts",
13-
"start": "npm run dev",
14-
"makemigration": "npm run _env:dev -- npx --yes prisma migrate dev --create-only",
15-
"migrate:local": "npm run _env:dev -- npx --yes prisma migrate deploy",
16-
"migrate:prod": "npm run _env:prod -- npx --yes prisma migrate deploy",
11+
{{#unless useNpm}}
12+
"dev": "pnpm _env:dev tsx watch index.ts",
13+
"prod": "pnpm _env:prod tsx index.ts",
14+
"start": "pnpm dev",
15+
"makemigration": "pnpm _env:dev npx --yes prisma migrate dev --create-only",
16+
"migrate:local": "pnpm _env:dev npx --yes prisma migrate deploy",
17+
"migrate:prod": "pnpm _env:prod npx --yes prisma migrate deploy",
1718
"_env:dev": "dotenvx run -f .env -f .env.local --",
1819
"_env:prod": "dotenvx run -f .env.prod --"
20+
{{/unless}}
21+
{{#if useNpm}}
22+
"dev": "npm run _env:dev -- tsx watch index.ts",
23+
"prod": "npm run _env:prod -- tsx index.ts",
24+
"start": "npm run dev",
25+
"makemigration": "npm run _env:dev -- npx --yes prisma migrate dev --create-only",
26+
"migrate:local": "npm run _env:dev -- npx --yes prisma migrate deploy",
27+
"migrate:prod": "npm run _env:prod -- npx --yes prisma migrate deploy",
28+
"_env:dev": "dotenvx run -f .env -f .env.local --",
29+
"_env:prod": "dotenvx run -f .env.prod --"
30+
{{/if}}
1931
},
2032
"engines": {
2133
"node": ">=20"

adminforth/commands/createApp/templates/pnpm_templates/pnpm-lock.yaml.hbs

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
onlyBuiltDependencies:
2+
- better-sqlite3

0 commit comments

Comments
 (0)