create-faas-app 8.0.0-beta.23 → 8.0.0-beta.24

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/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ import { dirname, join } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import enquirer from "enquirer";
8
8
  //#region package.json
9
- var version = "8.0.0-beta.22";
9
+ var version = "8.0.0-beta.23";
10
10
  //#endregion
11
11
  //#region src/action.ts
12
12
  const prompt = enquirer.prompt;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-faas-app",
3
- "version": "8.0.0-beta.23",
3
+ "version": "8.0.0-beta.24",
4
4
  "homepage": "https://faasjs.com/doc/create-faas-app",
5
5
  "bugs": {
6
6
  "url": "https://github.com/faasjs/faasjs/issues"
@@ -1,4 +1,5 @@
1
1
  import { dirname, join } from 'node:path'
2
+ import { loadEnvFile } from 'node:process'
2
3
  import { fileURLToPath } from 'node:url'
3
4
 
4
5
  import { Server, staticHandler } from '@faasjs/core'
@@ -6,6 +7,12 @@ import { Server, staticHandler } from '@faasjs/core'
6
7
  const __filename = fileURLToPath(import.meta.url)
7
8
  const __dirname = dirname(__filename)
8
9
 
10
+ try {
11
+ loadEnvFile()
12
+ } catch (error) {
13
+ console.warn('[faasjs] Failed to load env file', error)
14
+ }
15
+
9
16
  const publicHandler = staticHandler({
10
17
  root: join(__dirname, 'public'),
11
18
  notFound: false,
@@ -1,11 +1,11 @@
1
1
  import { test } from '@faasjs/dev'
2
2
  import { describe, it, expect } from 'vitest'
3
3
 
4
- import { func } from '../hello.func'
4
+ import api from '../hello.api'
5
5
 
6
6
  describe('pages/home/api/hello', () => {
7
7
  it('should work', async () => {
8
- const wrapped = test(func)
8
+ const wrapped = test(api)
9
9
 
10
10
  const { statusCode, data } = await wrapped.JSONhandler({ name: 'world' })
11
11
 
@@ -1,6 +1,6 @@
1
1
  import { defineApi, z } from '@faasjs/core'
2
2
 
3
- export const func = defineApi({
3
+ export default defineApi({
4
4
  schema: z.object({
5
5
  name: z.string().min(1).optional(),
6
6
  }),
@@ -1,4 +1,5 @@
1
1
  import { dirname, join } from 'node:path'
2
+ import { loadEnvFile } from 'node:process'
2
3
  import { fileURLToPath } from 'node:url'
3
4
 
4
5
  import { Server, staticHandler } from '@faasjs/core'
@@ -6,6 +7,12 @@ import { Server, staticHandler } from '@faasjs/core'
6
7
  const __filename = fileURLToPath(import.meta.url)
7
8
  const __dirname = dirname(__filename)
8
9
 
10
+ try {
11
+ loadEnvFile()
12
+ } catch (error) {
13
+ console.warn('[faasjs] Failed to load env file', error)
14
+ }
15
+
9
16
  const publicHandler = staticHandler({
10
17
  root: join(__dirname, 'public'),
11
18
  notFound: false,
@@ -1,11 +1,11 @@
1
1
  import { test } from '@faasjs/dev'
2
2
  import { describe, it, expect } from 'vitest'
3
3
 
4
- import { func } from '../hello.func'
4
+ import api from '../hello.api'
5
5
 
6
6
  describe('pages/home/api/hello', () => {
7
7
  it('should work', async () => {
8
- const wrapped = test(func)
8
+ const wrapped = test(api)
9
9
 
10
10
  const { statusCode, data } = await wrapped.JSONhandler({ name: 'world' })
11
11
 
@@ -1,6 +1,6 @@
1
1
  import { defineApi, z } from '@faasjs/core'
2
2
 
3
- export const func = defineApi({
3
+ export default defineApi({
4
4
  schema: z.object({
5
5
  name: z.string().min(1).optional(),
6
6
  }),