Skip to content

Commit

Permalink
mkdir if no dir
Browse files Browse the repository at this point in the history
  • Loading branch information
POPPIN-FUMI committed Mar 11, 2024
1 parent 7bfa08a commit c6a95ea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions packages/cli/src/lib/files/getAllApps.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { mkdir } from 'fs/promises'
import { getDirectoryLastModified } from './getDirectoryLastModified'
import { getFunctions } from './getFunctions'
import { getSQLs } from './getSQLs'
import path from 'path'

export const getAllApps = async () => {
try {
const functionDirs = []
const dirs = (await getFunctions()).map((dir) => `functions/${dir}`)
const sqls = (await getSQLs()).map((dir) => `sql/${dir}`)
dirs.push('webapp')
if (!path.join(process.cwd(), 'webapp')) {
await mkdir('webapp', { recursive: true })
}
dirs.push(...sqls)
for (const dir of dirs) {
const name = dir
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lib/files/getFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const getFunctions = async () => {
try {
const dir = path.join(process.cwd(), 'functions')
if (!dir) {
await mkdir(dir)
await mkdir(dir, { recursive: true })
}
const sqlDirs = (await readdir(dir)).map((dirName) =>
path.join(dir, dirName),
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lib/files/getSQLs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const getSQLs = async () => {
try {
const dir = path.join(process.cwd(), 'sql')
if (!dir) {
await mkdir(dir)
await mkdir(dir, { recursive: true })
}
const sqlDirs = (await readdir(dir)).map((dirName) =>
path.join(dir, dirName),
Expand Down

0 comments on commit c6a95ea

Please sign in to comment.