Skip to content

Commit

Permalink
Add wasp-config package
Browse files Browse the repository at this point in the history
  • Loading branch information
sodic committed Sep 18, 2024
1 parent 4d7d8e7 commit f14b617
Show file tree
Hide file tree
Showing 13 changed files with 2,252 additions and 15 deletions.
16 changes: 12 additions & 4 deletions waspc/cli/src/Wasp/Cli/Command/TsConfigSetup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,23 @@ import Wasp.Cli.Command (Command, require)
import Wasp.Cli.Command.Require (InWaspProject (InWaspProject))
import Wasp.Generator.NpmInstall (installProjectNpmDependencies)

-- | Prepares the project for using Wasp's TypeScript SDK.
tsConfigSetup :: Command ()
tsConfigSetup = do
InWaspProject waspProjectDir <- require
messageChan <- liftIO newChan
-- TODO: Both of these should be eaiser when Miho finishes the package.json
-- and tsconfig.json validation:
-- - Edit package.json to contain the SDK package
-- - Adapt TSconfigs to fit with the TS SDK project structure
liftIO $
-- NOTE: We're only installing the user's package.json dependencies here
-- This is to provide proper IDE support for users working with the TS SDK
-- (it needs the `wasp-config` package).
-- Calling this function here shouldn't break anything for later
-- installations.
-- TODO: What about doing this during Wasp start? Can we make Wasp start
-- pick up whether the user wants to use the TS SDK automatically?
installProjectNpmDependencies messageChan waspProjectDir >>= \case
Left e -> putStrLn $ "npm install failed: " ++ show e
Right _ -> return ()

-- liftIO $ copyTsSdkLib waspProjectDir

-- TODO: Edit package.json to contain the SDK package
4 changes: 4 additions & 0 deletions waspc/packages/wasp-config/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
dist/
.env
.vscode/
6 changes: 6 additions & 0 deletions waspc/packages/wasp-config/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": false,
"singleQuote": true
}
26 changes: 26 additions & 0 deletions waspc/packages/wasp-config/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";

export default [
pluginJs.configs.recommended,
...tseslint.configs.strict,
// Todo: explore typed-linting: https://typescript-eslint.io/getting-started/typed-linting
{
languageOptions: {
globals: globals.node,
},
},
// global ignore
{
ignores: ["node_modules/", "dist/"],
},
{
rules: {
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-empty-function": "warn",
"no-empty": "warn",
"no-constant-condition": "warn",
},
},
];
6 changes: 6 additions & 0 deletions waspc/packages/wasp-config/nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"watch": [
"./src/**/*.ts"
],
"exec": "tsc || exit 1"
}
Loading

0 comments on commit f14b617

Please sign in to comment.