create-absolutejs 0.8.2 → 0.9.0

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.
Files changed (61) hide show
  1. package/LICENSE +24 -24
  2. package/README.md +179 -179
  3. package/dist/data.js +3 -0
  4. package/dist/generators/configurations/generateDrizzleConfig.js +15 -15
  5. package/dist/generators/configurations/generatePrettierrc.js +9 -9
  6. package/dist/generators/configurations/initializeRoot.js +2 -0
  7. package/dist/generators/db/dockerInitTemplates.js +79 -79
  8. package/dist/generators/db/generateDatabaseTypes.js +6 -6
  9. package/dist/generators/db/generateDockerContainer.js +19 -19
  10. package/dist/generators/db/generateDrizzleSchema.js +17 -17
  11. package/dist/generators/db/generateSqliteSchema.js +8 -8
  12. package/dist/generators/db/handlerTemplates.js +259 -259
  13. package/dist/generators/db/scaffoldDocker.js +1 -1
  14. package/dist/generators/html/generateHTMLPage.js +60 -60
  15. package/dist/generators/htmx/generateHTMXPage.js +86 -86
  16. package/dist/generators/project/generateAbsoluteAuthConfig.js +96 -96
  17. package/dist/generators/project/generateBuildBlock.d.ts +2 -1
  18. package/dist/generators/project/generateBuildBlock.js +9 -5
  19. package/dist/generators/project/generateDBBlock.js +9 -9
  20. package/dist/generators/project/generateImportsBlock.js +1 -0
  21. package/dist/generators/project/generateMarkupCSS.js +145 -145
  22. package/dist/generators/project/generateRoutesBlock.js +36 -36
  23. package/dist/generators/project/generateServer.d.ts +2 -1
  24. package/dist/generators/project/generateServer.js +29 -19
  25. package/dist/generators/project/scaffoldBackend.d.ts +2 -1
  26. package/dist/generators/project/scaffoldBackend.js +2 -1
  27. package/dist/generators/react/generateReactComponents.js +95 -95
  28. package/dist/generators/svelte/generateSveltePage.js +210 -210
  29. package/dist/generators/vue/generateVuePage.js +261 -261
  30. package/dist/messages.js +43 -43
  31. package/dist/scaffold.js +1 -0
  32. package/dist/templates/README.md +35 -35
  33. package/dist/templates/assets/svg/google-logo.svg +7 -7
  34. package/dist/templates/assets/svg/htmx-logo-black.svg +9 -9
  35. package/dist/templates/assets/svg/htmx-logo-white.svg +9 -9
  36. package/dist/templates/assets/svg/vue-logo.svg +4 -4
  37. package/dist/templates/configurations/.prettierignore +3 -3
  38. package/dist/templates/configurations/.prettierrc.json +9 -9
  39. package/dist/templates/configurations/drizzle.config.ts +13 -13
  40. package/dist/templates/configurations/eslint.config.mjs +243 -243
  41. package/dist/templates/configurations/tsconfig.example.json +98 -98
  42. package/dist/templates/constants.ts +2 -2
  43. package/dist/templates/db/docker-compose.db.yml +15 -15
  44. package/dist/templates/git/gitignore +51 -51
  45. package/dist/templates/html/scripts/typescript-example.ts +21 -21
  46. package/dist/templates/react/components/App.tsx +52 -52
  47. package/dist/templates/react/components/Head.tsx +34 -34
  48. package/dist/templates/react/components/OAuthLink.tsx +39 -39
  49. package/dist/templates/react/components/ProfilePicture.tsx +56 -56
  50. package/dist/templates/styles/colors.ts +11 -11
  51. package/dist/templates/styles/reset.css +84 -84
  52. package/dist/templates/svelte/components/Counter.svelte +19 -19
  53. package/dist/templates/svelte/composables/counter.svelte.ts +14 -14
  54. package/dist/templates/tailwind/postcss.config.ts +8 -8
  55. package/dist/templates/tailwind/tailwind.config.ts +7 -7
  56. package/dist/templates/tailwind/tailwind.css +1 -1
  57. package/dist/templates/vue/components/CountButton.vue +39 -39
  58. package/dist/templates/vue/composables/useCount.ts +14 -14
  59. package/dist/versions.d.ts +1 -1
  60. package/dist/versions.js +1 -1
  61. package/package.json +1 -1
@@ -55,13 +55,13 @@ export const generateDatabaseTypes = ({ databaseEngine, databaseHost, authOption
55
55
  ? `import { users, schema } from '../../db/schema';`
56
56
  : `import { countHistory } from '../../db/schema';`;
57
57
  const extraTypes = authOption === 'abs'
58
- ? `export type User = typeof users.$inferSelect;
58
+ ? `export type User = typeof users.$inferSelect;
59
59
  export type NewUser = typeof users.$inferInsert;`
60
- : `export type CountHistory = typeof countHistory.$inferSelect;
60
+ : `export type CountHistory = typeof countHistory.$inferSelect;
61
61
  export type NewCountHistory = typeof countHistory.$inferInsert;`;
62
- return `${schemaImport}
63
- ${dbImport}
64
-
65
- ${`${dbTypeLine}\n`}export type SchemaType = typeof schema;\n\n${extraTypes}
62
+ return `${schemaImport}
63
+ ${dbImport}
64
+
65
+ ${`${dbTypeLine}\n`}export type SchemaType = typeof schema;\n\n${extraTypes}
66
66
  `;
67
67
  };
@@ -119,24 +119,24 @@ export const generateDockerContainer = (databaseEngine) => {
119
119
  const envLines = Object.entries(env)
120
120
  .map(([key, value]) => ` ${key}: ${value}`)
121
121
  .join('\n');
122
- return `services:
123
- db:
124
- image: ${image}
125
- restart: always
126
- environment:
127
- ${envLines}
128
- ports:
129
- - "${port}"${commandLine}
130
- healthcheck:
131
- test: ["CMD-SHELL", "${healthcheck.test.replaceAll('"', '\\"')}"]
132
- interval: 2s
133
- timeout: 5s
134
- retries: 30
135
- start_period: ${healthcheck.startPeriod}
136
- volumes:
137
- - db_data:${volumePath}
138
-
139
- volumes:
140
- db_data:
122
+ return `services:
123
+ db:
124
+ image: ${image}
125
+ restart: always
126
+ environment:
127
+ ${envLines}
128
+ ports:
129
+ - "${port}"${commandLine}
130
+ healthcheck:
131
+ test: ["CMD-SHELL", "${healthcheck.test.replaceAll('"', '\\"')}"]
132
+ interval: 2s
133
+ timeout: 5s
134
+ retries: 30
135
+ start_period: ${healthcheck.startPeriod}
136
+ volumes:
137
+ - db_data:${volumePath}
138
+
139
+ volumes:
140
+ db_data:
141
141
  `;
142
142
  };
@@ -80,31 +80,31 @@ export const generateDrizzleSchema = ({ databaseEngine, authOption }) => {
80
80
  uidColumn = `integer('uid').primaryKey().generatedAlwaysAsIdentity()`;
81
81
  }
82
82
  const constsBlock = databaseEngine === 'sqlite'
83
- ? `const JULIAN_DAY_UNIX_EPOCH_OFFSET = 2440587.5;
83
+ ? `const JULIAN_DAY_UNIX_EPOCH_OFFSET = 2440587.5;
84
84
  const MILLIS_PER_DAY = 86400000;\n\n`
85
85
  : '';
86
86
  const timestampColumn = databaseEngine === 'sqlite'
87
87
  ? `${cfg.time}.notNull().default(sql\`(julianday('now') - \${JULIAN_DAY_UNIX_EPOCH_OFFSET}) * \${MILLIS_PER_DAY}\`)`
88
88
  : `${cfg.time}.notNull().defaultNow()`;
89
89
  const tableBlock = authOption === 'abs'
90
- ? `export const users = ${cfg.table}('users', {
91
- auth_sub: ${cfg.string}.primaryKey(),
92
- created_at: ${timestampColumn},
93
- metadata: ${cfg.json}.$type<Record<string, unknown>>().default({})
90
+ ? `export const users = ${cfg.table}('users', {
91
+ auth_sub: ${cfg.string}.primaryKey(),
92
+ created_at: ${timestampColumn},
93
+ metadata: ${cfg.json}.$type<Record<string, unknown>>().default({})
94
94
  });`
95
- : `export const countHistory = ${cfg.table}('count_history', {
96
- uid: ${uidColumn},
97
- count: ${intBuilder}('count').notNull(),
98
- created_at: ${timestampColumn}
95
+ : `export const countHistory = ${cfg.table}('count_history', {
96
+ uid: ${uidColumn},
97
+ count: ${intBuilder}('count').notNull(),
98
+ created_at: ${timestampColumn}
99
99
  });`;
100
100
  const schemaKey = authOption === 'abs' ? 'users' : 'countHistory';
101
- return `
102
- ${sqliteImports}${builderImport}
103
-
104
- ${constsBlock}${tableBlock}
105
-
106
- export const schema = {
107
- ${schemaKey}
108
- };
101
+ return `
102
+ ${sqliteImports}${builderImport}
103
+
104
+ ${constsBlock}${tableBlock}
105
+
106
+ export const schema = {
107
+ ${schemaKey}
108
+ };
109
109
  `;
110
110
  };
@@ -1,11 +1,11 @@
1
1
  export const generateSqliteSchema = (authOption) => authOption && authOption !== 'none'
2
- ? `CREATE TABLE IF NOT EXISTS users (
3
- auth_sub TEXT PRIMARY KEY,
4
- created_at INTEGER NOT NULL DEFAULT ((julianday('now') - 2440587.5) * 86400000),
5
- metadata TEXT DEFAULT '{}'
2
+ ? `CREATE TABLE IF NOT EXISTS users (
3
+ auth_sub TEXT PRIMARY KEY,
4
+ created_at INTEGER NOT NULL DEFAULT ((julianday('now') - 2440587.5) * 86400000),
5
+ metadata TEXT DEFAULT '{}'
6
6
  );`
7
- : `CREATE TABLE IF NOT EXISTS count_history (
8
- uid INTEGER PRIMARY KEY AUTOINCREMENT,
9
- count INTEGER NOT NULL,
10
- created_at INTEGER NOT NULL DEFAULT ((julianday('now') - 2440587.5) * 86400000)
7
+ : `CREATE TABLE IF NOT EXISTS count_history (
8
+ uid INTEGER PRIMARY KEY AUTOINCREMENT,
9
+ count INTEGER NOT NULL,
10
+ created_at INTEGER NOT NULL DEFAULT ((julianday('now') - 2440587.5) * 86400000)
11
11
  );`;