Skip to content

Commit d7b497b

Browse files
committed
Revert "Merge branch 'test' of https://github.com/devforth/adminforth into test"
This reverts commit e398695, reversing changes made to 797028f.
1 parent e398695 commit d7b497b

Some content is hidden

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

56 files changed

+10392
-18218
lines changed

README.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,21 @@ npx adminforth create-app
5858

5959
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.
6060

61+
# Requirements
62+
63+
- **Node.js 20**
64+
- **Docker**
65+
- **pnpm**
66+
- **Taskfile**
67+
6168
To run dev demo:
6269
```sh
6370
cd dev-demo
6471

65-
npm run setup-dev-demo
66-
npm run migrate:all
72+
pnpm setup-dev-demo
73+
pnpm migrate:all
6774

68-
npm start
75+
pnpm start
6976
```
7077

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

7885

7986
```
80-
npm run makemigration:sqlite -- --name init
87+
pnpm makemigration:sqlite -- --name init
8188
```
8289

8390
and
8491

8592
```
86-
npm run migrate:sqlite
93+
pnpm migrate:sqlite
8794
```
8895

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

97104
Then run
98105
```
99-
npm run migrate:clickhouse
106+
pnpm migrate:clickhouse
100107
```
101108

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

109116

110117
```sh
111-
npm uninstall -g adminforth
118+
pnpm uninstall -g adminforth
112119
```
113120

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

116123
```
117124
cd adminforth/adminforth
118-
npm run build
125+
pnpm build
126+
pnpm linl
119127
```
120128

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

125131
```

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
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+
"dev": "pnpm _env:dev -- tsx watch index.ts",
12+
"prod": "pnpm _env:prod -- tsx index.ts",
13+
"start": "pnpm dev",
14+
"makemigration": "pnpm _env:dev -- npx --yes prisma migrate dev --create-only",
15+
"migrate:local": "pnpm _env:dev -- npx --yes prisma migrate deploy",
16+
"migrate:prod": "pnpm _env:prod -- npx --yes prisma migrate deploy",
1717
"_env:dev": "dotenvx run -f .env -f .env.local --",
1818
"_env:prod": "dotenvx run -f .env.prod --"
1919
},

adminforth/commands/createApp/templates/readme.md.hbs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
Install dependencies:
44

55
```bash
6-
npm ci
6+
pnpm i
77
```
88

99
Migrate the database:
1010

1111
```bash
12-
npm run migrate:local
12+
pnpm migrate:local
1313
```
1414

1515
Start the server:
1616

1717
```bash
18-
npm run dev
18+
pnpm dev
1919
```
2020

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

2828
```bash
29-
npm run makemigration -- --name <name_of_changes>
29+
pnpm makemigration -- --name <name_of_changes>
3030
```
3131

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

3535
## Deployment tips

adminforth/commands/createApp/utils.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,12 @@ async function installDependencies(ctx, cwd) {
362362
const isWindows = process.platform === 'win32';
363363

364364
const nodeBinary = process.execPath;
365-
const npmPath = path.join(path.dirname(nodeBinary), isWindows ? 'npm.cmd' : 'npm');
365+
const npmPath = path.join(path.dirname(nodeBinary), isWindows ? 'pnpm.cmd' : 'pnpm');
366366
const customDir = ctx.customDir;
367367
if (isWindows) {
368368
const res = await Promise.all([
369-
await execAsync(`npm install`, { cwd, env: { PATH: process.env.PATH } }),
370-
await execAsync(`npm install`, { cwd: customDir, env: { PATH: process.env.PATH } }),
369+
await execAsync(`pnpm install`, { cwd, env: { PATH: process.env.PATH } }),
370+
await execAsync(`pnpm install`, { cwd: customDir, env: { PATH: process.env.PATH } }),
371371
]);
372372
} else {
373373
const res = await Promise.all([
@@ -387,11 +387,11 @@ function generateFinalInstructions(skipPrismaSetup, options) {
387387

388388
instruction += `
389389
${chalk.dim('// Generate and apply initial migration')}
390-
${chalk.dim('$')}${chalk.cyan(' npm run makemigration -- --name init && npm run migrate:local')}\n`;
390+
${chalk.dim('$')}${chalk.cyan(' pnpm makemigration -- --name init && pnpm migrate:local')}\n`;
391391

392392
instruction += `
393393
${chalk.dim('// Start dev server with tsx watch for hot-reloading')}
394-
${chalk.dim('$')}${chalk.cyan(' npm run dev')}\n
394+
${chalk.dim('$')}${chalk.cyan(' pnpm dev')}\n
395395
`;
396396

397397
instruction += '😉 Happy coding!';

adminforth/commands/createPlugin/utils.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ async function installDependencies(ctx, cwd) {
158158
const customDir = ctx.customDir;
159159

160160
await Promise.all([
161-
await execa("npm", ["install", "--no-package-lock"], { cwd }),
162-
await execa("npm", ["install"], { cwd: customDir }),
161+
await execa("pnpm", ["install", "--no-package-lock"], { cwd }),
162+
await execa("pnpm", ["install"], { cwd: customDir }),
163163
]);
164164
}
165165

@@ -168,15 +168,14 @@ function generateFinalInstructions() {
168168

169169
instruction += `
170170
${chalk.dim("// Build your plugin")}
171-
${chalk.cyan("$ npm run build")}\n`;
171+
${chalk.cyan("$ pnpm build")}\n`;
172172

173173
instruction += `
174174
${chalk.dim("// To test your plugin locally")}
175-
${chalk.cyan("$ npm link")}\n`;
176-
175+
${chalk.cyan("$ pnpm link")}\n`;
177176
instruction += `
178177
${chalk.dim("// In your AdminForth project")}
179-
${chalk.cyan("$ npm link " + chalk.italic("your-plugin-name"))}\n`;
178+
${chalk.cyan("$ pnpm link " + chalk.italic("your-plugin-name"))}\n`;
180179

181180
instruction += "\n😉 Happy coding!";
182181

adminforth/commands/postinstall.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const spaPath = path.join(import.meta.dirname, 'dist', 'spa');
77

88
if (fs.existsSync(spaPath)){
99
console.log('Installing SPA dependencies...');
10-
execSync('npm ci', { cwd: spaPath, stdio: 'inherit' });
10+
execSync('pnpm i', { cwd: spaPath, stdio: 'inherit' });
1111
console.log('Installed spa dependencies');
1212
} else {
1313
console.log('SPA dependencies not found');

adminforth/documentation/docs/tutorial/001-gettingStarted.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,25 @@ myadmin/
8181
CLI will suggest you a command to initialize the database with Prisma:
8282

8383
```bash
84-
npm run makemigration -- --name init
84+
pnpm makemigration -- --name init
8585
```
8686

8787
This will create a migration file in `migrations` and apply it to the database.
8888

8989
In future, when you need to add new resources, you need to modify `schema.prisma` (add models, change fields, etc.). After doing any modification you need to create a new migration using next command:
9090

9191
```bash
92-
npm run makemigration -- --name init ; npm run migrate:local
92+
pnpm makemigration -- --name init ; pnpm migrate:local
9393
```
9494

95-
Other developers need to pull migration and run `npm run migrateLocal` to apply any unapplied migrations.
95+
Other developers need to pull migration and run `pnpm migrate:local` to apply any unapplied migrations.
9696

9797
## Run the Server
9898

9999
Now you can run your app:
100100

101101
```bash
102-
npm start
102+
pnpm start
103103
```
104104

105105
Open http://localhost:3500 in your browser and (default credentials are `adminforth`/`adminforth` if you haven’t changed them).
@@ -173,7 +173,7 @@ model apartments {
173173
Run the following command to create a new migration:
174174

175175
```bash
176-
npm run makemigration -- --name add-apartments ; npm run migrate:local
176+
pnpm makemigration -- --name add-apartments ; pnpm migrate:local
177177
```
178178

179179
### Step3. Create the `apartments` resource

adminforth/documentation/docs/tutorial/03-Customization/02-customFieldRendering.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@ To install 3rd-party npm packages you should create npm package in the `custom`
151151
cd custom
152152
```
153153

154-
And simply do `npm install` for the package you need:
154+
And simply do `pnpm install` for the package you need:
155155

156156
```bash
157-
npm i <some package> -D
157+
pnpm i <some package> -D
158158
```
159159

160160
## Editing values component

adminforth/documentation/docs/tutorial/03-Customization/03-virtualColumns.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ In this case you can use `insecureRawSQL` to write your own part of where clause
148148
However the vital concern that the SQL passed to DB as is, so if you substitute any user inputs it will not be escaped and can lead to SQL injection. To mitigate the issue we recommend using `sqlstring` package which will escape the inputs for you.
149149
150150
```bash
151-
npm i sqlstring
151+
pnpm i sqlstring
152152
```
153153
154154
Then you can use it like this:

adminforth/documentation/docs/tutorial/03-Customization/08-pageInjections.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ For this demo we will use text-analyzer package:
329329
330330
```bash
331331
cd custom
332-
npm i text-analyzer
332+
pnpm i text-analyzer
333333
```
334334
335335
@@ -396,7 +396,7 @@ Install used icon:
396396
397397
```sh
398398
cd custom
399-
npm i @iconify-prerendered/vue-mdi
399+
pnpm i @iconify-prerendered/vue-mdi
400400
```
401401
402402
## List table row replace injection

0 commit comments

Comments
 (0)