Skip to content
Open

Test #498

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
1c690c5
fix: add missing package name
yaroslav8765 Mar 9, 2026
b004b4c
fix: fallback to the package-lock.json, if there is no pnpm-lock.yaml…
yaroslav8765 Mar 9, 2026
555366b
fix: add 'test' prerelease to release test package
yaroslav8765 Mar 9, 2026
0b30490
Merge branch 'next' into test
yaroslav8765 Mar 9, 2026
797028f
fix: rebuild
yaroslav8765 Mar 9, 2026
e398695
Merge branch 'test' of https://github.com/devforth/adminforth into test
yaroslav8765 Mar 9, 2026
d7b497b
Revert "Merge branch 'test' of https://github.com/devforth/adminforth…
yaroslav8765 Mar 9, 2026
0cee947
fix: make create-app work with pnpm
yaroslav8765 Mar 9, 2026
dcd5a88
fix:do not create package.json in "./custom" folder in newly created …
yaroslav8765 Mar 10, 2026
4962d3c
chore: remove debug logs
yaroslav8765 Mar 10, 2026
804b8bb
fix: update dockerfile for the newly created adminforth app
yaroslav8765 Mar 10, 2026
a39d222
docs: correct makemigration command
yaroslav8765 Mar 10, 2026
d998335
fix: update vite config to rename compiled .pnpm.... files into pnpm...
yaroslav8765 Mar 10, 2026
59061e3
fix: update vite config to rename compiled .pnpm.... files into pnpm.…
yaroslav8765 Mar 10, 2026
664a99f
fix: update vite config to rename compiled .pnpm.... files into pnpm.…
yaroslav8765 Mar 10, 2026
9defc0f
fix: update vite config to rename compiled .pnpm.... files into pnpm.…
yaroslav8765 Mar 10, 2026
f151425
fix: update vite config to rename compiled .pnpm.... files into pnpm.…
yaroslav8765 Mar 10, 2026
dd848be
fix: add check, if user has pnmp, before installing frontend dependen…
yaroslav8765 Mar 10, 2026
53ec143
fix: add sctripts directory to package files for inclusion
yaroslav8765 Mar 10, 2026
a62f31d
fix: correct typo in scripts directory path in package.json
yaroslav8765 Mar 10, 2026
bdf2721
feat: add ability to select between pnpm and npm, when we create apdm…
yaroslav8765 Mar 10, 2026
9d77809
fix: throw an error, when we are bundling adminforth
yaroslav8765 Mar 10, 2026
fbea776
fix: add check, if user has pnpm-lock in custom folder and use npm/pnpm
yaroslav8765 Mar 10, 2026
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
26 changes: 16 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,21 @@ npx adminforth create-app

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.

# Requirements

- **Node.js 20**
- **Docker**
- **pnpm**
- **Taskfile**

To run dev demo:
```sh
cd dev-demo

npm run setup-dev-demo
npm run migrate:all
pnpm setup-dev-demo
pnpm migrate:all

npm start
pnpm start
```

## Adding columns to a database in dev-demo
Expand All @@ -77,13 +84,13 @@ To make migration add to the .prisma file in folder with database you need and a


```
npm run makemigration:sqlite -- --name init
pnpm makemigration:sqlite -- --name init
```

and

```
npm run migrate:sqlite
pnpm migrate:sqlite
```

to apply migration
Expand All @@ -96,7 +103,7 @@ In order to make migration for the clickhouse, go to the `./migrations/clickhous

Then run
```
npm run migrate:clickhouse
pnpm migrate:clickhouse
```

to apply the migration.
Expand All @@ -108,18 +115,17 @@ Make sure you have not `adminforth` globally installed. If you have it, remove i


```sh
npm uninstall -g adminforth
pnpm uninstall -g adminforth
```

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

```
cd adminforth/adminforth
npm run build
pnpm build
pnpm linl
```

This will automatically make an npm link to the `adminforth` package in the root of the project.

Then, go to testing app, e.g. created with CLI, and use next command:

```
Expand Down
3 changes: 2 additions & 1 deletion adminforth/commands/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ async function bundle() {
`);

} catch (e) {
console.log(`Running budndle failed`, e);
console.log(`Running bundle failed`, e);
throw new Error(`Failed to bundle admin SPA: ${e.message}`);
}
}

Expand Down
12 changes: 12 additions & 0 deletions adminforth/commands/createApp/templates/Dockerfile.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@

{{#unless useNpm}}
FROM devforth/node20-pnpm:latest
WORKDIR /code/
ADD package.json pnpm-lock.yaml pnpm-workspace.yaml /code/
RUN pnpm i
ADD . /code/
RUN pnpm exec adminforth bundle
CMD ["sh", "-c", "pnpm migrate:prod && pnpm prod"]
{{/unless}}
{{#if useNpm}}
FROM node:{{nodeMajor}}-slim
WORKDIR /code/
ADD package.json package-lock.json /code/
RUN npm ci
ADD . /code/
RUN npx adminforth bundle
CMD ["sh", "-c", "npm run migrate:prod && npm run prod"]
{{/if}}
24 changes: 18 additions & 6 deletions adminforth/commands/createApp/templates/package.json.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,26 @@
"license": "ISC",
"description": "",
"scripts": {
"dev": "npm run _env:dev -- tsx watch index.ts",
"prod": "npm run _env:prod -- tsx index.ts",
"start": "npm run dev",
"makemigration": "npm run _env:dev -- npx --yes prisma migrate dev --create-only",
"migrate:local": "npm run _env:dev -- npx --yes prisma migrate deploy",
"migrate:prod": "npm run _env:prod -- npx --yes prisma migrate deploy",
{{#unless useNpm}}
"dev": "pnpm _env:dev tsx watch index.ts",
"prod": "pnpm _env:prod tsx index.ts",
"start": "pnpm dev",
"makemigration": "pnpm _env:dev npx --yes prisma migrate dev --create-only",
"migrate:local": "pnpm _env:dev npx --yes prisma migrate deploy",
"migrate:prod": "pnpm _env:prod npx --yes prisma migrate deploy",
"_env:dev": "dotenvx run -f .env -f .env.local --",
"_env:prod": "dotenvx run -f .env.prod --"
{{/unless}}
{{#if useNpm}}
"dev": "npm run _env:dev -- tsx watch index.ts",
"prod": "npm run _env:prod -- tsx index.ts",
"start": "npm run dev",
"makemigration": "npm run _env:dev -- npx --yes prisma migrate dev --create-only",
"migrate:local": "npm run _env:dev -- npx --yes prisma migrate deploy",
"migrate:prod": "npm run _env:prod -- npx --yes prisma migrate deploy",
"_env:dev": "dotenvx run -f .env -f .env.local --",
"_env:prod": "dotenvx run -f .env.prod --"
{{/if}}
},
"engines": {
"node": ">=20"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
onlyBuiltDependencies:
- better-sqlite3
27 changes: 23 additions & 4 deletions adminforth/commands/createApp/templates/readme.md.hbs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## Starting the application

Install dependencies:

{{#if useNpm}}
```bash
npm ci
npm i
```

Migrate the database:
Expand All @@ -17,6 +17,25 @@ Start the server:
```bash
npm run dev
```
{{/if}}

{{#unless useNpm}}
```bash
pnpm i
```

Migrate the database:

```bash
pnpm migrate:local
```

Start the server:

```bash
pnpm dev
```
{{/unless}}

{{#if prismaDbUrl}}
## Changing schema
Expand All @@ -26,10 +45,10 @@ Open `schema.prisma` and change schema as needed: add new tables, columns, etc (
Run the following command to generate a new migration and apply it instantly in local database:

```bash
npm run makemigration -- --name <name_of_changes>
pnpm makemigration --name <name_of_changes>
```

Your colleagues will need to pull the changes and run `npm run migrateLocal` to apply the migration in their local database.
Your colleagues will need to pull the changes and run `pnpm migrate:local` to apply the migration in their local database.
{{/if}}

## Deployment tips
Expand Down
Loading