aaex-cli 3.1.2 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,64 +32,7 @@ async function copyTemplate(database = "MongoDB") {
32
32
  errorOnExist: false,
33
33
  });
34
34
  } catch (err) {
35
- console.error(chalk.red("Error copying template:"), err);
36
- process.exit(1);
37
- }
38
- }
39
-
40
- // Create package.json
41
- async function createPackageJson() {
42
- const pkg = {
43
- name: appName,
44
- version: "0.0.0",
45
- private: true,
46
- type: "module",
47
- scripts: {
48
- dev: "node .aaex/server/server.js",
49
- build: "npm build client && npm client-entry && npm build:server",
50
- "build:client": "vite build",
51
- "build:server": "vite build --config vite.server.config.ts",
52
- "client-entry": "node .aaex/Build.js",
53
- preview: "cross-env NODE_ENV=production node .aaex/server/server.js",
54
- },
55
- dependencies: {
56
- react: "^19.1.1",
57
- "react-dom": "^19.1.1",
58
- "react-router": "^7.10.0",
59
- "react-router-dom": "^7.10.0",
60
- express: "^5.1.0",
61
- compression: "^1.8.1",
62
- sirv: "^3.0.2",
63
- "aaex-file-router": "^2.4.2",
64
- jsonwebtoken: "^9.0.3",
65
- mongodb: "^7.0.0",
66
- pg: "^8.16.3",
67
-
68
- bcrypt: "^6.0.0",
69
- dotenv: "^17.2.3",
70
- aaexjs: "^3.1.3",
71
- },
72
- devDependencies: {
73
- typescript: "~5.9.2",
74
- "@types/react": "^19.1.13",
75
- "@types/react-dom": "^19.1.9",
76
- "@types/express": "^5.0.3",
77
- "@vitejs/plugin-react": "^5.0.2",
78
- "@types/pg": "^8.16.0",
79
-
80
- vite: "^7.1.5",
81
- "cross-env": "^10.0.0",
82
- "@types/bcrypt": "^6.0.0",
83
- "@types/jsonwebtoken": "^9.0.10",
84
- },
85
- };
86
-
87
- try {
88
- await fs.writeJson(path.join(targetDir, "package.json"), pkg, {
89
- spaces: 2,
90
- });
91
- } catch (err) {
92
- console.error(chalk.red("Error creating package.json:"), err);
35
+ console.error(chalk.red("Error copying template:"), err);
93
36
  process.exit(1);
94
37
  }
95
38
  }
@@ -101,30 +44,19 @@ async function main() {
101
44
  process.exit(1);
102
45
  }
103
46
 
104
- // Interaktiv fråga
47
+ //DB config
105
48
  const answers = await inquirer.prompt([
106
49
  {
107
50
  type: "select",
108
51
  name: "database",
109
52
  message: "Which database do you want to use?",
110
- choices: [
111
- "MongoDB",
112
- "MySQL --not implemented",
113
- "PostgreSQL --not fully implemented",
114
- ],
53
+ choices: ["MongoDB", "PostgreSQL"],
115
54
  default: 0,
116
55
  },
117
56
  ]);
118
57
 
119
- if (answers.database !== "MongoDB") {
120
- console.log(
121
- chalk.yellow(`Currently only MongoDB is supported. Aborting...`)
122
- );
123
- process.exit(0);
124
- }
125
-
126
58
  await copyTemplate(answers.database);
127
- await createPackageJson();
59
+ createEnv(answers.database);
128
60
 
129
61
  console.log(chalk.green.bold("\nAAEx app created successfully!"));
130
62
  console.log(
@@ -132,4 +64,38 @@ async function main() {
132
64
  );
133
65
  }
134
66
 
67
+ function createEnv(db) {
68
+ console.log(chalk.blue("\nSetting up .env ..."));
69
+ let db_fields;
70
+
71
+ switch (db) {
72
+ case "MongoDB":
73
+ db_fields = `
74
+ DB_TYPE="mongodb"
75
+ DB_URL="mongodb://localhost:27018/"
76
+ DB_NAME="mydatabase"
77
+ `;
78
+ break;
79
+ case "PostgreSQL":
80
+ db_fields = `
81
+ DB_TYPE="postgres"
82
+ DB_URL="postgres://YourUserName:YourPassword@YourHostname:5432/YourDatabaseName"
83
+ `;
84
+ break;
85
+
86
+ default:
87
+ db_fields = `#no database configured`;
88
+ }
89
+
90
+ const jwt_fields = `
91
+ JWT_SECRET="your-jwt-secret"
92
+ JWT_EXP="24h"`;
93
+
94
+ fs.writeFileSync(
95
+ path.resolve(targetDir, ".env"),
96
+ db_fields + jwt_fields,
97
+ "utf-8"
98
+ );
99
+ }
100
+
135
101
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aaex-cli",
3
- "version": "3.1.2",
3
+ "version": "3.1.3",
4
4
  "description": "Command line interface for creating aaexjs app",
5
5
  "license": "ISC",
6
6
  "author": "",
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "my-aaex-app",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "node .aaex/server/server.js",
8
+ "build": "npm build client && npm client-entry && npm build:server",
9
+ "build:client": "vite build",
10
+ "build:server": "vite build --config vite.server.config.ts",
11
+ "client-entry": "node .aaex/Build.js",
12
+ "preview": "cross-env NODE_ENV=production node .aaex/server/server.js"
13
+ },
14
+ "dependencies": {
15
+ "react": "^19.1.1",
16
+ "react-dom": "^19.1.1",
17
+ "react-router": "^7.10.0",
18
+ "react-router-dom": "^7.10.0",
19
+ "express": "^5.1.0",
20
+ "compression": "^1.8.1",
21
+ "sirv": "^3.0.2",
22
+ "aaex-file-router": "^2.4.2",
23
+ "jsonwebtoken": "^9.0.3",
24
+ "mongodb": "^7.0.0",
25
+ "pg": "^8.16.3",
26
+ "bcrypt": "^6.0.0",
27
+ "dotenv": "^17.2.3",
28
+ "aaexjs": "^3.1.3"
29
+ },
30
+ "devDependencies": {
31
+ "typescript": "~5.9.2",
32
+ "@types/react": "^19.1.13",
33
+ "@types/react-dom": "^19.1.9",
34
+ "@types/express": "^5.0.3",
35
+ "@vitejs/plugin-react": "^5.0.2",
36
+ "@types/pg": "^8.16.0",
37
+ "vite": "^7.1.5",
38
+ "cross-env": "^10.0.0",
39
+ "@types/bcrypt": "^6.0.0",
40
+ "@types/jsonwebtoken": "^9.0.10"
41
+ }
42
+ }
@@ -15,7 +15,7 @@ export default defineConfig({
15
15
  manifest: true,
16
16
  rollupOptions: {
17
17
  treeshake: false, //makes sure the load function gets build correctly
18
- preserveEntrySignatures: true,
18
+ preserveEntrySignatures: "strict",
19
19
  input: ".aaex/framework/entry-client.tsx",
20
20
  output: {
21
21
  format: "es",