Moves resolveProjectPath to wasp/dev (#1759)

This commit is contained in:
Mihovil Ilakovac 2024-02-13 18:27:26 +01:00 committed by GitHub
parent abcb1cb7b0
commit 0e7a951742
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 28 additions and 22 deletions

View File

@ -1,4 +1,4 @@
const { resolveProjectPath } = require('wasp/client')
const { resolveProjectPath } = require('wasp/dev')
/** @type {import('tailwindcss').Config} */
module.exports = {

View File

@ -1,4 +1,4 @@
const { resolveProjectPath } = require('wasp/client')
const { resolveProjectPath } = require('wasp/dev')
/** @type {import('tailwindcss').Config} */
module.exports = {

View File

@ -1,4 +1,4 @@
const { resolveProjectPath } = require('wasp/client')
const { resolveProjectPath } = require('wasp/dev')
/** @type {import('tailwindcss').Config} */
module.exports = {

View File

@ -1,15 +1,3 @@
import { join as joinPaths } from 'path';
// PUBLIC API
/**
* Wasp runs the client code in the `web-app` directory which is nested in the
* .wasp/out/web-app directory. This function resolves a project root dir path
* to be relative to the `web-app` directory i.e. `../../../projectDirPath`.
*/
export function resolveProjectPath(path: string): string {
return joinPaths('../../../', path);
}
// PUBLIC API
// NOTE: This is enough to cover Operations and our APIs (src/Wasp/AppSpec/Api.hs).
export enum HttpMethod {

View File

@ -0,0 +1,17 @@
/**
* Code found in this module is not meant to be used in user's server or client
* code. It is used by the Wasp tooling e.g. in the Tailwind config to resolve
* paths to the project root directory.
*/
import { join as joinPaths } from 'path'
// PUBLIC API
/**
* Wasp runs the client code in the `web-app` directory which is nested in the
* .wasp/out/web-app directory. This function resolves a project root dir path
* to be relative to the `web-app` directory i.e. `../../../projectDirPath`.
*/
export function resolveProjectPath(path: string): string {
return joinPaths('../../../', path)
}

View File

@ -108,7 +108,8 @@
"./server/operations": "./dist/server/operations/index.js",
"./client/router": "./dist/client/router/index.js",
"./client/test": "./dist/client/test/index.js",
"./client": "./dist/client/index.js"
"./client": "./dist/client/index.js",
"./dev": "./dist/dev/index.js"
},
{=!
TypeScript doesn't care about the redirects we define above in "exports" field; those

View File

@ -13,4 +13,3 @@ export { MiddlewareConfigFn } from './middleware/index.js'
// PUBLIC API
export type DbSeedFn = (prisma: PrismaClient) => Promise<void>

View File

@ -1,4 +1,4 @@
const { resolveProjectPath } = require('wasp/client')
const { resolveProjectPath } = require('wasp/dev')
const { nextui } = require("@nextui-org/react");
/** @type {import('tailwindcss').Config} */

View File

@ -1,4 +1,4 @@
const { resolveProjectPath } = require('wasp/client')
const { resolveProjectPath } = require('wasp/dev')
/** @type {import('tailwindcss').Config} */
module.exports = {

View File

@ -1,4 +1,4 @@
const { resolveProjectPath } = require('wasp/client')
const { resolveProjectPath } = require('wasp/dev')
/** @type {import('tailwindcss').Config} */
module.exports = {

View File

@ -296,7 +296,7 @@ generateTailwindConfigFile :: NewProjectDetails -> File
generateTailwindConfigFile newProjectDetails =
( "tailwind.config.cjs",
[trimming|
const { resolveProjectPath } = require('wasp/client')
const { resolveProjectPath } = require('wasp/dev')
const colors = require('tailwindcss/colors')
/** @type {import('tailwindcss').Config} */

View File

@ -88,6 +88,7 @@ genSdkReal spec =
genFileCopy [relfile|client/test/vitest/helpers.tsx|],
genFileCopy [relfile|client/test/index.ts|],
genFileCopy [relfile|client/index.ts|],
genFileCopy [relfile|dev/index.ts|],
genServerConfigFile spec,
genTsConfigJson,
genServerUtils spec,

View File

@ -40,7 +40,7 @@ Make sure to use the `.cjs` extension for these config files, if you name them w
1. Add `./tailwind.config.cjs`.
```js title="./tailwind.config.cjs"
const { resolveProjectPath } = require('wasp/client')
const { resolveProjectPath } = require('wasp/dev')
/** @type {import('tailwindcss').Config} */
module.exports = {