create-sonicjs 2.3.4 → 2.3.6
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.
- package/package.json +1 -1
- package/src/cli.js +14 -8
- package/templates/starter/package.json +1 -0
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -418,7 +418,7 @@ async function copyTemplate(templateName, targetDir, options) {
|
|
|
418
418
|
|
|
419
419
|
// Add @sonicjs-cms/core dependency
|
|
420
420
|
packageJson.dependencies = {
|
|
421
|
-
'@sonicjs-cms/core': '^2.3.
|
|
421
|
+
'@sonicjs-cms/core': '^2.3.6',
|
|
422
422
|
...packageJson.dependencies
|
|
423
423
|
}
|
|
424
424
|
|
|
@@ -451,7 +451,7 @@ async function copyTemplate(templateName, targetDir, options) {
|
|
|
451
451
|
async function createAdminSeedScript(targetDir, { email, password }) {
|
|
452
452
|
const seedScriptContent = `import { createDb, users } from '@sonicjs-cms/core'
|
|
453
453
|
import { eq } from 'drizzle-orm'
|
|
454
|
-
import
|
|
454
|
+
import * as crypto from 'crypto'
|
|
455
455
|
import { getPlatformProxy } from 'wrangler'
|
|
456
456
|
|
|
457
457
|
/**
|
|
@@ -498,20 +498,26 @@ async function seed() {
|
|
|
498
498
|
return
|
|
499
499
|
}
|
|
500
500
|
|
|
501
|
-
// Hash password using
|
|
502
|
-
const
|
|
501
|
+
// Hash password using SHA-256 (same as SonicJS auth system)
|
|
502
|
+
const data = '${password}' + 'salt-change-in-production'
|
|
503
|
+
const passwordHash = crypto.createHash('sha256').update(data).digest('hex')
|
|
504
|
+
const now = Date.now()
|
|
505
|
+
const odid = \`admin-\${now}-\${Math.random().toString(36).substr(2, 9)}\`
|
|
503
506
|
|
|
504
507
|
// Create admin user
|
|
505
508
|
await db
|
|
506
509
|
.insert(users)
|
|
507
510
|
.values({
|
|
511
|
+
id: odid,
|
|
508
512
|
email: '${email}',
|
|
509
513
|
username: '${email.split('@')[0]}',
|
|
510
|
-
|
|
514
|
+
firstName: 'Admin',
|
|
515
|
+
lastName: 'User',
|
|
516
|
+
passwordHash: passwordHash,
|
|
511
517
|
role: 'admin',
|
|
512
|
-
isActive:
|
|
513
|
-
createdAt:
|
|
514
|
-
updatedAt:
|
|
518
|
+
isActive: true,
|
|
519
|
+
createdAt: now,
|
|
520
|
+
updatedAt: now
|
|
515
521
|
})
|
|
516
522
|
.run()
|
|
517
523
|
|