Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errors with package.json scripts in templates and examples #47

Merged
merged 6 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/pink-cycles-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-effect-app": patch
---

Fix errors with package.json scripts in templates and examples
3 changes: 3 additions & 0 deletions examples/http-server/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# HONEYCOMB_API_KEY=<PLACEHOLDER>
# HONEYCOMB_DATASET=<PLACEHOLDER>
# OTEL_EXPORTER_OTLP_ENDPOINT=<PLACEHOLDER>
5 changes: 5 additions & 0 deletions examples/http-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Effect HTTP Server Example

## Getting Started

Make sure to create a `.env` file in the root of the repository based on the `.env.example` file.
2 changes: 1 addition & 1 deletion examples/http-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"keywords": [],
"author": "",
"packageManager": "pnpm@9.7.0",
"packageManager": "pnpm@9.10.0",
"devDependencies": {
"@effect/language-service": "^0.1.0",
"@effect/vitest": "^0.9.1",
Expand Down
1 change: 1 addition & 0 deletions examples/http-server/src/Accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { SqlClient } from "@effect/sql"
import { Effect, Layer, Option, pipe } from "effect"
import { AccountsRepo } from "./Accounts/AccountsRepo.js"
import { UsersRepo } from "./Accounts/UsersRepo.js"
import { security } from "./Api/Security.js"
import type { AccessToken } from "./Domain/AccessToken.js"
import { accessTokenFromRedacted, accessTokenFromString } from "./Domain/AccessToken.js"
import { Account } from "./Domain/Account.js"
Expand Down
2 changes: 1 addition & 1 deletion examples/http-server/src/People.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { GroupId } from "./Domain/Group.js"
import type { PersonId } from "./Domain/Person.js"
import { Person, PersonNotFound } from "./Domain/Person.js"
import { policyRequire } from "./Domain/Policy.js"
import type { PeopleRepo } from "./People/Repo.js"
import { PeopleRepo } from "./People/Repo.js"
import { SqlLive } from "./Sql.js"

const make = Effect.gen(function*() {
Expand Down
2 changes: 1 addition & 1 deletion examples/http-server/src/Sql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { fileURLToPath } from "url"
import { makeTestLayer } from "./lib/Layer.js"

const ClientLive = SqliteClient.layer({
filename: Config.succeed("data/db.sqlite")
filename: Config.succeed("db.sqlite")
})

const MigratorLive = SqliteMigrator.layer({
Expand Down
2 changes: 1 addition & 1 deletion examples/http-server/src/Tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const TracingLive = Layer.unwrapEffect(
const apiKey = yield* Config.option(Config.redacted("HONEYCOMB_API_KEY"))
const dataset = yield* Config.withDefault(
Config.string("HONEYCOMB_DATASET"),
"stremio-effect"
"my-effect-app"
)
if (Option.isNone(apiKey)) {
const endpoint = yield* Config.option(
Expand Down
12 changes: 11 additions & 1 deletion packages/create-effect-app/src/Cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,20 @@ function createTemplate(config: TemplateConfig) {
]))

const filesToCheck = []
filesToCheck.push(path.join(config.projectName, "LICENSE"))
if (config.projectType.withChangesets) {
filesToCheck.push(path.join(config.projectName, ".changeset", "config.json"))
}
if (config.projectType.template === "monorepo") {
filesToCheck.push(path.join(config.projectName, "packages", "cli", "package.json"))
filesToCheck.push(path.join(config.projectName, "packages", "domain", "package.json"))
filesToCheck.push(path.join(config.projectName, "packages", "server", "package.json"))
filesToCheck.push(path.join(config.projectName, "packages", "cli", "LICENSE"))
filesToCheck.push(path.join(config.projectName, "packages", "domain", "LICENSE"))
filesToCheck.push(path.join(config.projectName, "packages", "server", "LICENSE"))
} else {
filesToCheck.push(path.join(config.projectName, "package.json"))
filesToCheck.push(path.join(config.projectName, "LICENSE"))
}

yield* Effect.logInfo(AnsiDoc.cats([
AnsiDoc.hsep([
Expand Down
11 changes: 7 additions & 4 deletions templates/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
"version": "0.0.0",
"type": "module",
"packageManager": "[email protected]",
"license": "MIT",
"description": "A basic Effect package",
"repository": {
"type": "git",
"url": "<PLACEHOLDER>"
},
"publishConfig": {
"access": "public",
"directory": "dist"
},
"description": "A basic Effect package",
"license": "MIT",
"scripts": {
"codegen": "build-utils prepare-v2",
"build": "pnpm build-esm && pnpm build-annotate && pnpm build-cjs && build-utils pack-v2",
Expand All @@ -34,10 +38,9 @@
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.8",
"@effect/build-utils": "^0.7.7",
"@effect/docgen": "^0.4.4",
"@effect/dtslint": "^0.1.0",
"@effect/eslint-plugin": "^0.2.0",
"@effect/language-service": "^0.1.0",
"@effect/vitest": "latest",
"@eslint/compat": "1.1.1",
"@eslint/eslintrc": "3.1.0",
"@eslint/js": "9.10.0",
Expand Down
3 changes: 1 addition & 2 deletions templates/basic/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/// <reference types="vitest" />
import path from "path"
import { defineConfig } from "vite"
import { defineConfig } from "vitest/config"

export default defineConfig({
plugins: [],
Expand Down
10 changes: 8 additions & 2 deletions templates/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
"version": "0.0.0",
"type": "module",
"packageManager": "[email protected]",
"license": "MIT",
"description": "A basic Effect CLI application",
"repository": {
"type": "git",
"url": "<REPLACE_ME>"
},
"publishConfig": {
"access": "public",
"directory": "dist"
},
"description": "An Effect CLI application",
"license": "MIT",
"scripts": {
"build": "tsup && pnpm copy-package-json",
"build:ts": "tsup",
Expand All @@ -30,6 +34,7 @@
"@effect/language-service": "^0.1.0",
"@effect/platform": "latest",
"@effect/platform-node": "latest",
"@effect/vitest": "latest",
"@eslint/compat": "1.1.1",
"@eslint/eslintrc": "3.1.0",
"@eslint/js": "9.10.0",
Expand All @@ -45,6 +50,7 @@
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-sort-destructure-keys": "^2.0.0",
"tsup": "^8.2.4",
"tsx": "^4.19.1",
"typescript": "^5.6.2",
"vitest": "^2.0.5"
},
Expand Down
14 changes: 10 additions & 4 deletions templates/cli/tsconfig.scripts.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@

{
"extends": "./tsconfig.base.json",
"include": ["scripts", "eslint.config.mjs", "tsup.config.ts", "vitest.config.ts"],
"include": [
"scripts",
"eslint.config.mjs",
"tsup.config.ts",
"vitest.config.ts"
],
"compilerOptions": {
"types": ["node"],
"types": [
"node"
],
"tsBuildInfoFile": ".tsbuildinfo/scripts.tsbuildinfo",
"rootDir": "scripts",
"rootDir": ".",
"noEmit": true
}
}
3 changes: 1 addition & 2 deletions templates/cli/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="vitest" />
import { defineConfig } from "vite"
import { defineConfig } from "vitest/config"

export default defineConfig({
test: {
Expand Down
2 changes: 2 additions & 0 deletions templates/monorepo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@
"@effect/build-utils": "^0.7.7",
"@effect/eslint-plugin": "^0.2.0",
"@effect/language-service": "^0.1.0",
"@effect/vitest": "latest",
"@eslint/compat": "1.1.1",
"@eslint/eslintrc": "3.1.0",
"@eslint/js": "9.10.0",
"@types/node": "^22.5.2",
"@typescript-eslint/eslint-plugin": "^8.4.0",
"@typescript-eslint/parser": "^8.4.0",
"babel-plugin-annotate-pure-calls": "^0.4.0",
"effect": "latest",
"eslint": "^9.10.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-codegen": "^0.28.0",
Expand Down
21 changes: 21 additions & 0 deletions templates/monorepo/packages/cli/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024-present <PLACEHOLDER>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
17 changes: 17 additions & 0 deletions templates/monorepo/packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
"version": "0.0.0",
"type": "module",
"license": "MIT",
"description": "The CLI template",
"repository": {
"type": "git",
"url": "<PLACEHOLDER>",
"directory": "packages/cli"
},
"publishConfig": {
"access": "public",
"directory": "dist"
},
"scripts": {
"codegen": "build-utils prepare-v2",
"build": "pnpm build-esm && pnpm build-annotate && pnpm build-cjs && build-utils pack-v2",
Expand All @@ -20,6 +30,13 @@
"@template/domain": "workspace:^",
"effect": "latest"
},
"devDependencies": {
"@effect/cli": "latest",
"@effect/platform": "latest",
"@effect/platform-node": "latest",
"@template/domain": "workspace:^",
"effect": "latest"
},
"effect": {
"generateExports": {
"include": [
Expand Down
21 changes: 21 additions & 0 deletions templates/monorepo/packages/domain/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024-present <PLACEHOLDER>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
12 changes: 11 additions & 1 deletion templates/monorepo/packages/domain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
"version": "0.0.0",
"type": "module",
"license": "MIT",
"description": "The domain template",
"repository": {
"type": "git",
"url": "<PLACEHOLDER>",
"directory": "packages/domain"
},
"publishConfig": {
"access": "public",
"directory": "dist"
},
"scripts": {
"codegen": "build-utils prepare-v2",
"build": "pnpm build-esm && pnpm build-annotate && pnpm build-cjs && build-utils pack-v2",
Expand All @@ -14,7 +24,7 @@
"coverage": "vitest --coverage"
},
"dependencies": {
"@effect/platform": "^0.64.0",
"@effect/platform": "latest",
"@effect/schema": "latest",
"@effect/sql": "latest",
"effect": "latest"
Expand Down
21 changes: 21 additions & 0 deletions templates/monorepo/packages/server/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024-present <PLACEHOLDER>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6 changes: 6 additions & 0 deletions templates/monorepo/packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
"version": "0.0.0",
"type": "module",
"license": "MIT",
"description": "The server template",
"repository": {
"type": "git",
"url": "<PLACEHOLDER>",
"directory": "packages/server"
},
"scripts": {
"codegen": "build-utils prepare-v2",
"build": "pnpm build-esm && pnpm build-annotate && pnpm build-cjs && build-utils pack-v2",
Expand Down