create-sonicjs 3.0.0-beta.2 → 3.0.0-beta.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.
- package/package.json +1 -1
- package/src/cli.js +20 -49
- package/templates/starter/wrangler.toml +1 -1
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -205,16 +205,6 @@ async function getProjectDetails(initialName) {
|
|
|
205
205
|
}
|
|
206
206
|
})
|
|
207
207
|
|
|
208
|
-
// Include example collection (only ask if neither flag is set)
|
|
209
|
-
if (!flags.skipExample && !flags.includeExample) {
|
|
210
|
-
questions.push({
|
|
211
|
-
type: 'confirm',
|
|
212
|
-
name: 'includeExample',
|
|
213
|
-
message: 'Include example blog collection?',
|
|
214
|
-
initial: true
|
|
215
|
-
})
|
|
216
|
-
}
|
|
217
|
-
|
|
218
208
|
// Create Cloudflare resources
|
|
219
209
|
if (!flags.skipCloudflare) {
|
|
220
210
|
questions.push({
|
|
@@ -249,7 +239,7 @@ async function getProjectDetails(initialName) {
|
|
|
249
239
|
seedAdmin: answers.seedAdmin !== undefined ? answers.seedAdmin : true,
|
|
250
240
|
adminEmail: answers.adminEmail,
|
|
251
241
|
adminPassword: answers.adminPassword,
|
|
252
|
-
includeExample:
|
|
242
|
+
includeExample: true,
|
|
253
243
|
createResources: flags.skipCloudflare ? false : answers.createResources,
|
|
254
244
|
runMigrations: true, // Always run migrations automatically
|
|
255
245
|
initGit: flags.skipGit ? false : answers.initGit,
|
|
@@ -415,7 +405,7 @@ async function copyTemplate(templateName, targetDir, options) {
|
|
|
415
405
|
|
|
416
406
|
// Add @sonicjs-cms/core dependency
|
|
417
407
|
packageJson.dependencies = {
|
|
418
|
-
'@sonicjs-cms/core': '^3.0.0-beta.
|
|
408
|
+
'@sonicjs-cms/core': '^3.0.0-beta.3',
|
|
419
409
|
...packageJson.dependencies
|
|
420
410
|
}
|
|
421
411
|
|
|
@@ -509,8 +499,8 @@ async function seed() {
|
|
|
509
499
|
// Hash password using SHA-256 (same as SonicJS auth system)
|
|
510
500
|
const data = '${password}' + 'salt-change-in-production'
|
|
511
501
|
const passwordHash = crypto.createHash('sha256').update(data).digest('hex')
|
|
512
|
-
const now = Date
|
|
513
|
-
const odid = \`admin-\${now}-\${Math.random().toString(36).substr(2, 9)}\`
|
|
502
|
+
const now = new Date()
|
|
503
|
+
const odid = \`admin-\${now.getTime()}-\${Math.random().toString(36).substr(2, 9)}\`
|
|
514
504
|
|
|
515
505
|
// Create admin user
|
|
516
506
|
await db
|
|
@@ -774,49 +764,25 @@ function printSuccessMessage(answers) {
|
|
|
774
764
|
console.log()
|
|
775
765
|
console.log(kleur.bold().green('🎉 Success!'))
|
|
776
766
|
console.log()
|
|
777
|
-
console.log(kleur.bold('
|
|
767
|
+
console.log(kleur.bold('Get started:'))
|
|
778
768
|
console.log()
|
|
779
769
|
console.log(kleur.cyan(` cd ${projectName}`))
|
|
780
770
|
|
|
781
771
|
if (skipInstall) {
|
|
782
772
|
console.log(kleur.cyan(' npm install'))
|
|
783
773
|
console.log()
|
|
784
|
-
console.log(kleur.yellow('⚠
|
|
774
|
+
console.log(kleur.yellow('⚠ After npm install, copy migrations:'))
|
|
785
775
|
console.log(kleur.dim(' cp -r node_modules/@sonicjs-cms/core/migrations ./'))
|
|
786
776
|
}
|
|
787
777
|
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
console.log()
|
|
791
|
-
console.log(kleur.bold('Create Cloudflare resources:'))
|
|
792
|
-
if (!databaseIdSet) {
|
|
793
|
-
console.log(kleur.cyan(` wrangler d1 create ${answers.databaseName}`))
|
|
794
|
-
console.log(kleur.dim(' # Copy database_id to wrangler.toml'))
|
|
795
|
-
}
|
|
796
|
-
console.log(kleur.cyan(` wrangler r2 bucket create ${answers.bucketName}`))
|
|
778
|
+
if (!migrationsRan) {
|
|
779
|
+
console.log(kleur.cyan(' npm run db:migrate:local'))
|
|
797
780
|
}
|
|
798
781
|
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
const needsSeeding = seedAdmin && !adminSeeded
|
|
802
|
-
|
|
803
|
-
if (needsMigrations || needsSeeding) {
|
|
804
|
-
console.log()
|
|
805
|
-
console.log(kleur.bold('Complete setup:'))
|
|
806
|
-
if (needsMigrations) {
|
|
807
|
-
console.log(kleur.cyan(' npm run db:migrate:local'))
|
|
808
|
-
}
|
|
809
|
-
if (needsSeeding) {
|
|
810
|
-
console.log(kleur.cyan(' npm run seed'))
|
|
811
|
-
}
|
|
782
|
+
if (seedAdmin && !adminSeeded) {
|
|
783
|
+
console.log(kleur.cyan(' npm run seed'))
|
|
812
784
|
}
|
|
813
785
|
|
|
814
|
-
console.log()
|
|
815
|
-
if (migrationsRan && (!seedAdmin || adminSeeded)) {
|
|
816
|
-
console.log(kleur.bold().green('✓ Database is ready! Start development:'))
|
|
817
|
-
} else {
|
|
818
|
-
console.log(kleur.bold('Start development:'))
|
|
819
|
-
}
|
|
820
786
|
console.log(kleur.cyan(' npm run dev'))
|
|
821
787
|
|
|
822
788
|
if (seedAdmin && answers.adminEmail) {
|
|
@@ -826,15 +792,20 @@ function printSuccessMessage(answers) {
|
|
|
826
792
|
console.log(kleur.dim(` Password: [as entered]`))
|
|
827
793
|
}
|
|
828
794
|
|
|
829
|
-
if (migrationsRan && (!seedAdmin || adminSeeded)) {
|
|
830
|
-
console.log()
|
|
831
|
-
console.log(kleur.green('✓ Everything is set up! Just run npm run dev and login.'))
|
|
832
|
-
}
|
|
833
|
-
|
|
834
795
|
console.log()
|
|
835
796
|
console.log(kleur.bold('Visit:'))
|
|
836
797
|
console.log(kleur.cyan(' http://localhost:8787/admin'))
|
|
837
798
|
|
|
799
|
+
if (!createResources || !resourcesCreated) {
|
|
800
|
+
console.log()
|
|
801
|
+
console.log(kleur.bold('Deploy to Cloudflare (when ready):'))
|
|
802
|
+
if (!databaseIdSet) {
|
|
803
|
+
console.log(kleur.cyan(` wrangler d1 create ${answers.databaseName}`))
|
|
804
|
+
console.log(kleur.dim(' # Copy database_id to wrangler.toml'))
|
|
805
|
+
}
|
|
806
|
+
console.log(kleur.cyan(` wrangler r2 bucket create ${answers.bucketName}`))
|
|
807
|
+
}
|
|
808
|
+
|
|
838
809
|
console.log()
|
|
839
810
|
console.log(kleur.dim('Need help? Visit https://sonicjs.com'))
|
|
840
811
|
console.log()
|