@open-workspace/create 0.4.0 → 0.4.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/templates.ts +25 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-workspace/create",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Create an OpenWorkspace deployment (`bun create @open-workspace`), and import people and mail into one.",
5
5
  "homepage": "https://openworkspace.dev",
6
6
  "license": "Apache-2.0",
package/templates.ts CHANGED
@@ -14,7 +14,7 @@ export type ProjectAnswers = {
14
14
  };
15
15
 
16
16
  export const versions = {
17
- openWorkspace: "0.4.0",
17
+ openWorkspace: "0.4.2",
18
18
  alchemy: "2.0.0-beta.85",
19
19
  effect: "4.1.3",
20
20
  typescript: "7.0.2",
@@ -114,28 +114,22 @@ function aiOption(ai: ProjectAnswers["ai"]) {
114
114
  }
115
115
 
116
116
  export function alchemyRunTs(answers: ProjectAnswers) {
117
+ // The options sit one level deeper here, inside Effect.gen.
118
+ const ai = aiOption(answers.ai).replaceAll("\n", "\n ");
119
+
117
120
  return `import * as Cloudflare from "@alchemy.run/cloudflare";
118
121
  import * as Alchemy from "alchemy";
122
+ import * as Effect from "effect/Effect";
119
123
  import { OpenWorkspace, providers } from "@open-workspace/core/alchemy";
120
124
  import { Email } from "@open-workspace/email/alchemy";
121
125
 
122
126
  export default Alchemy.Stack(
123
127
  ${JSON.stringify(stackName(answers.name))},
124
128
  { providers: providers(), state: Cloudflare.state() },
125
- OpenWorkspace({
126
- // Required. Where the app is served: a hostname in a zone of this account.
127
- // https://<hostname> is the OIDC issuer, the SAML IdP, and where passkeys work.
128
- hostname: ${JSON.stringify(answers.hostname)},
129
- // Mail domains, primary first. Every address is on one of them.
130
- // Email() turns on Email Routing and Email Sending for each.
131
- mailDomains: ${JSON.stringify(answers.mailDomains)},${aiOption(answers.ai)}
132
- modules: [Email()],
133
- // \`bun run dev\` serves the workspace at http://localhost:5173, where
134
- // passkeys work too; the hostname above is only for the deploy.
135
- dev: { port: 5173 },
129
+ Effect.gen(function* () {
136
130
  // Single sign-on apps can be declared here instead of in the admin UI,
137
131
  // SCIM provisioning included (the token is a secret from .env, never a
138
- // plain string). Wrap this call in Effect.gen to create them first:
132
+ // plain string), and passed to OpenWorkspace as apps: [grafana]:
139
133
  // const grafana = yield* OidcClient("Grafana", {
140
134
  // name: "Grafana",
141
135
  // redirectUris: ["https://grafana.example.com/login/generic_oauth"],
@@ -145,9 +139,24 @@ export default Alchemy.Stack(
145
139
  // token: yield* Config.Redacted("GRAFANA_SCIM_TOKEN"),
146
140
  // },
147
141
  // });
148
- // and pass apps: [grafana]. OpenWorkspace returns the workspace's OIDC and
149
- // SAML endpoints for wiring up the other side, e.g. a Cloudflare Access
150
- // login method (see @open-workspace/core's README).
142
+
143
+ const workspace = yield* OpenWorkspace({
144
+ // Required. Where the app is served: a hostname in a zone of this account.
145
+ // https://<hostname> is the OIDC issuer, the SAML IdP, and where passkeys work.
146
+ hostname: ${JSON.stringify(answers.hostname)},
147
+ // Mail domains, primary first. Every address is on one of them.
148
+ // Email() turns on Email Routing and Email Sending for each.
149
+ mailDomains: ${JSON.stringify(answers.mailDomains)},${ai}
150
+ modules: [Email()],
151
+ // \`bun run dev\` serves the workspace at http://localhost:5173, where
152
+ // passkeys work too; the hostname above is only for the deploy.
153
+ dev: { port: 5173 },
154
+ });
155
+
156
+ // \`workspace\` also holds the OIDC and SAML endpoints and certificate, for
157
+ // wiring up other resources such as a Cloudflare Access login method
158
+ // (https://openworkspace.dev/docs/sso). The deploy prints only the URL.
159
+ return { url: workspace.url };
151
160
  }),
152
161
  );
153
162
  `;