Skip to content

Commit 3b63c47

Browse files
committed
chore: wip
1 parent ca2f4d0 commit 3b63c47

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

.stacks/core/storage/src/files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export function writeTextFile(file: TextFile): Promise<void> {
8080
}
8181

8282
/**
83-
* Determine whether a path is a file.
83+
* Determine whether a path exists.
8484
*/
8585
export function isFile(path: string): boolean {
8686
return fs.existsSync(projectPath(path))

.stacks/core/utils/src/helpers.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
import process from 'node:process'
44
import { type AddressInfo } from 'node:net'
5-
import { type CliOptions, type Manifest, type NpmScript, type StacksError, type Subprocess } from '@stacksjs/types'
5+
import type { CliOptions, Manifest, NpmScript, StacksError, Subprocess } from '@stacksjs/types'
6+
import { Action } from '@stacksjs/types'
67
import { frameworkPath, projectPath } from '@stacksjs/path'
78
import { parse } from 'yaml'
9+
import { runAction } from '@stacksjs/actions'
810
import { italic, log, runCommand } from '@stacksjs/cli'
911
import * as storage from '@stacksjs/storage'
1012
import { readPackageJson } from '@stacksjs/storage'
11-
import { type Result } from '@stacksjs/error-handling'
12-
import { err } from '@stacksjs/error-handling'
13+
import type { Result } from '@stacksjs/error-handling'
14+
import { err, ok } from '@stacksjs/error-handling'
1315
import { semver } from './versions'
1416
import ui from '~/config/ui'
1517
import dependencies from '~/config/deps'
@@ -21,7 +23,7 @@ export async function packageManager() {
2123
}
2224

2325
export async function initProject(): Promise<Result<Subprocess, StacksError>> {
24-
if (env.APP_ENV !== 'production')
26+
if (app.env !== 'production')
2527
log.info('Project not yet initialized, generating application key...')
2628
else
2729
handleError(new Error('Please run `buddy key:generate` to generate an application key'))
@@ -40,10 +42,11 @@ export async function isProjectInitialized() {
4042
if (storage.isFile('.env'))
4143
return await isAppKeySet()
4244

43-
// TODO: need to re-enable this
44-
// copy the .env.example to become the .env file
45-
// if (storage.isFile('.env.example'))
46-
// await spawn('cp .env.example .env', { stdio: 'inherit', cwd: projectPath() })
45+
// copy the .env.example file to .env
46+
if (storage.isFile('.env.example'))
47+
await runCommand('cp .env.example .env', { cwd: projectPath() })
48+
else
49+
console.error('no .env.example file found')
4750

4851
return await isAppKeySet()
4952
}

0 commit comments

Comments
 (0)