@coreframe/config 0.1.7 → 0.1.9
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.d.ts +3 -45
- package/dist/worker.d.ts +1 -1
- package/dist/worker.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ type DatabaseConfig = {
|
|
|
32
32
|
/** Database engine used by project workflows. */dialect: DatabaseDialect; /** Project-relative module that seeds the database. */
|
|
33
33
|
seed?: string;
|
|
34
34
|
};
|
|
35
|
-
type DevPlatform = "android" | "
|
|
35
|
+
type DevPlatform = "android" | "ios" | "linux" | "macos" | "web" | "webext" | "windows";
|
|
36
36
|
type DevConfig = {
|
|
37
37
|
/** Platforms started by the development command. */platforms?: DevPlatform[];
|
|
38
38
|
};
|
|
@@ -104,47 +104,6 @@ type DeployContext = {
|
|
|
104
104
|
url: string; /** Version assigned to the release. */
|
|
105
105
|
version: string;
|
|
106
106
|
};
|
|
107
|
-
type TauriReleasePlatform = "macos" | "windows" | "linux" | "ios" | "android";
|
|
108
|
-
type TauriReleasePlatformConfig = {
|
|
109
|
-
/** Glob patterns used to find build artifacts for the platform. */artifactGlobs?: string[]; /** Arguments passed to the Tauri build command for the platform. */
|
|
110
|
-
buildArgs?: string[]; /** Rust target triple used to build the platform. */
|
|
111
|
-
targetTriple?: string; /** Platform key written to the Tauri updater manifest. */
|
|
112
|
-
updatePlatform?: string;
|
|
113
|
-
};
|
|
114
|
-
type TauriReleaseConfig = {
|
|
115
|
-
/** Local directory into which remote workflow artifacts are downloaded. */artifactDownloadDir?: string; /** Backblaze B2 bucket that receives release files. */
|
|
116
|
-
b2Bucket?: string; /** Local path where the latest updater manifest is written. */
|
|
117
|
-
latestManifestPath?: string; /** Platforms built on the machine running the deploy command. */
|
|
118
|
-
localPlatforms?: TauriReleasePlatform[];
|
|
119
|
-
/**
|
|
120
|
-
* Per-platform artifact discovery and build overrides.
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* defineConfig({
|
|
124
|
-
* deploy: {
|
|
125
|
-
* tauriRelease: {
|
|
126
|
-
* platform: {
|
|
127
|
-
* macos: {
|
|
128
|
-
* artifactGlobs: ["src-tauri/target/release/bundle/macos/*.sig"],
|
|
129
|
-
* targetTriple: "aarch64-apple-darwin",
|
|
130
|
-
* },
|
|
131
|
-
* },
|
|
132
|
-
* },
|
|
133
|
-
* },
|
|
134
|
-
* })
|
|
135
|
-
*/
|
|
136
|
-
platform?: Partial<Record<TauriReleasePlatform, TauriReleasePlatformConfig>>; /** Public base URL used to construct release download URLs. */
|
|
137
|
-
publicBaseUrl?: string; /** Path prefix added to public release download URLs. */
|
|
138
|
-
publicPathPrefix?: string; /** Project-relative path to the release notes file. */
|
|
139
|
-
releaseNotesPath?: string; /** Remote path under which versioned release files are stored. */
|
|
140
|
-
releasePath?: string; /** Local directory containing release files ready for upload. */
|
|
141
|
-
releaseUploadDir?: string; /** Platforms built by the remote release workflow. */
|
|
142
|
-
workflowPlatforms?: TauriReleasePlatform[]; /** GitHub Actions workflow used to build remote release artifacts. */
|
|
143
|
-
workflowName?: string; /** Delay in milliseconds between remote workflow status checks. */
|
|
144
|
-
workflowPollIntervalMs?: number; /** Git ref on which the remote release workflow runs. */
|
|
145
|
-
workflowRef?: string; /** Maximum time in milliseconds to wait for the remote workflow. */
|
|
146
|
-
workflowTimeoutMs?: number;
|
|
147
|
-
};
|
|
148
107
|
type DeploySmokeCheck = {
|
|
149
108
|
/** Label used to identify the check in deployment output. */name: string; /** Application-relative path checked after deployment. */
|
|
150
109
|
path?: string; /** Absolute URL checked after deployment instead of an application path. */
|
|
@@ -195,8 +154,7 @@ type DeployConfig = {
|
|
|
195
154
|
* },
|
|
196
155
|
* })
|
|
197
156
|
*/
|
|
198
|
-
stagingHostname?: StagingHostnameConfig;
|
|
199
|
-
tauriRelease?: TauriReleaseConfig;
|
|
157
|
+
stagingHostname?: StagingHostnameConfig;
|
|
200
158
|
};
|
|
201
159
|
declare function defineConfig(config: CoreframeConfig): CoreframeConfig;
|
|
202
160
|
declare function readProjectConfig({
|
|
@@ -207,4 +165,4 @@ declare function readProjectConfig({
|
|
|
207
165
|
declare function importProjectModule<T>(path: string, cwd?: string): Promise<T>;
|
|
208
166
|
declare function importProjectDependency<T>(specifier: string, cwd?: string): Promise<T>;
|
|
209
167
|
//#endregion
|
|
210
|
-
export { AssetsConfig, CoreframeConfig, DatabaseConfig, DatabaseDialect, DeployConfig, DeployContext, DeployEnvironment, DeployEnvironmentConfig, DeploySmokeCheck, DevConfig, DevPlatform, FlutterConfig, FlutterDeepLinkConfig, I18nConfig, JsonObject, JsonValue, PreviewConfig, PreviewTunnelConfig, PreviewWorkerConfig, PrimaryWorkerContributions, PrimaryWorkerEnvironment, StagingHostnameConfig,
|
|
168
|
+
export { AssetsConfig, CoreframeConfig, DatabaseConfig, DatabaseDialect, DeployConfig, DeployContext, DeployEnvironment, DeployEnvironmentConfig, DeploySmokeCheck, DevConfig, DevPlatform, FlutterConfig, FlutterDeepLinkConfig, I18nConfig, JsonObject, JsonValue, PreviewConfig, PreviewTunnelConfig, PreviewWorkerConfig, PrimaryWorkerContributions, PrimaryWorkerEnvironment, StagingHostnameConfig, WorkerConfig, WorkerDeployEnvironment, WorkerEnvironmentDeclaration, WorkerEnvironmentKind, WorkerEnvironmentVariableConfig, WranglerConfig, coreframeGeneratedWorkerVariables, coreframeLocalWorkerVariables, coreframeManagedWorkerSecrets, defineConfig, derivePrimaryWorkerConfig, importProjectDependency, importProjectModule, normalizeWorkerEnvironment, primaryWorkerConfigPath, primaryWorkerEnvironments, readProjectConfig, validateWorkerInventoryOwnership, workerBindingNames, wranglerEnvironmentNames };
|
package/dist/worker.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare const primaryWorkerConfigPath = "wrangler.jsonc";
|
|
|
7
7
|
declare const primaryWorkerEnvironments: readonly ["development", "staging", "production"];
|
|
8
8
|
declare const coreframeGeneratedWorkerVariables: readonly ["DEPLOY_ENV", "POSTHOG_RELEASE"];
|
|
9
9
|
declare const coreframeManagedWorkerSecrets: readonly ["COREFRAME_ACCESS_TOKEN_SECRET", "DASHBOARD_PASSWORD"];
|
|
10
|
-
declare const coreframeLocalWorkerVariables: readonly ["PGDATABASE", "PGHOST", "PGPASSWORD", "PGPORT", "PGUSER", "PORTLESS_URL", "TURSO_AUTH_TOKEN", "TURSO_DATABASE_URL"];
|
|
10
|
+
declare const coreframeLocalWorkerVariables: readonly ["COREFRAME_DEV_JOBS_TOKEN", "PGDATABASE", "PGHOST", "PGPASSWORD", "PGPORT", "PGUSER", "PORTLESS_URL", "TURSO_AUTH_TOKEN", "TURSO_DATABASE_URL"];
|
|
11
11
|
type PrimaryWorkerEnvironment = (typeof primaryWorkerEnvironments)[number];
|
|
12
12
|
type WorkerDeployEnvironment = Exclude<PrimaryWorkerEnvironment, "development">;
|
|
13
13
|
type WorkerEnvironmentKind = "secret" | "variable" | "generated";
|
package/dist/worker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=`wrangler.jsonc`,t=[`development`,`staging`,`production`],n=[`DEPLOY_ENV`,`POSTHOG_RELEASE`],r=[`COREFRAME_ACCESS_TOKEN_SECRET`,`DASHBOARD_PASSWORD`],i=[`PGDATABASE`,`PGHOST`,`PGPASSWORD`,`PGPORT`,`PGUSER`,`PORTLESS_URL`,`TURSO_AUTH_TOKEN`,`TURSO_DATABASE_URL`],a=/^[A-Z][A-Z0-9_]*$/;function o(e){return n.some(t=>t===e)}function s(e){return Object.entries(e??{}).map(([e,t])=>{if(!a.test(e))throw Error(`Invalid Worker environment name ${JSON.stringify(e)} in coreframe.config.ts. Use uppercase letters, numbers, and underscores.`);let n=[...new Set(t.requiredIn??[])];if(t.kind===`generated`&&!o(e))throw Error(`${e} is declared as generated, but Coreframe does not generate it. Use kind "variable" or "secret".`);if(o(e)&&t.kind!==`generated`)throw Error(`${e} is generated by Coreframe and must use kind "generated".`);return{...t,name:e,requiredIn:n}}).sort((e,t)=>e.name.localeCompare(t.name))}function c({config:e,environment:t,contributions:n={}}){let r=structuredClone(e),i=h(r.env,`env`),a=h(i[t],`env.${t}`),o=h(a.vars,`env.${t}.vars`),s=h(a.secrets,`env.${t}.secrets`),c=g(s.required,`env.${t}.secrets.required`),l=n.generatedValues??{},u=[...new Set(n.requiredSecrets??[])].sort();p(`variable`,Object.keys(o),Object.keys(l),t),p(`secret`,c,u,t);let d=n.bindings??{},{env:_,...v}=r,y=m(v,a),b=m(d);p(`binding`,[...y],[...b],t);let x=f(a,d,`env.${t}`);return Object.keys(l).length>0&&(x.vars={...o,...l}),u.length>0&&(x.secrets={...s,required:[...c,...u].sort()}),r.env={...i,[t]:x},r}function l(e){return m(e)}function u(e){let t=m(e),n=e=>{if(!_(e))return;let n=_(e.vars)?e.vars:{};Object.keys(n).forEach(e=>t.add(e));let r=_(e.secrets)?e.secrets:{};(Array.isArray(r.required)?r.required:[]).forEach(e=>{typeof e==`string`&&t.add(e)})};return n(e),_(e.env)&&Object.values(e.env).forEach(n),t}function d(e,t){let n=s(t),r=new Map(n.map(e=>[e.name,e])),i=[...m(e)].filter(e=>r.has(e)).sort(),a=new Set,o=new Set,c=e=>{_(e)&&(_(e.vars)&&Object.keys(e.vars).forEach(e=>{r.get(e)?.kind===`secret`&&a.add(e)}),_(e.secrets)&&Array.isArray(e.secrets.required)&&e.secrets.required.forEach(e=>{typeof e==`string`&&r.get(e)?.kind!==`secret`&&r.has(e)&&o.add(e)}))};c(e),_(e.env)&&Object.values(e.env).forEach(c);let l=[...i.map(e=>`${e} (native binding)`),...[...a].sort().map(e=>`${e} (plain variable)`),...[...o].sort().map(e=>`${e} (required secret)`)];if(l.length>0)throw Error(`Worker inventory ownership conflicts with wrangler.jsonc: ${l.join(`, `)}. Keep string metadata in coreframe.config.ts and native binding topology in wrangler.jsonc.`)}function f(e,t,n){let r={...e};for(let[i,a]of Object.entries(t)){if(i in e)throw Error(`Coreframe cannot contribute ${n}.${i}; wrangler.jsonc already owns it.`);r[i]=structuredClone(a)}return r}function p(e,t,n,r){let i=n.filter(e=>t.includes(e)).sort();if(i.length>0)throw Error(`Coreframe ${e} ownership conflicts in Wrangler environment ${r}: ${i.join(`, `)}. Remove the duplicate declarations from wrangler.jsonc.`)}function m(...e){let t=new Set,n=e=>{if(Array.isArray(e)){e.forEach(n);return}_(e)&&(typeof e.binding==`string`&&t.add(e.binding),Object.values(e).forEach(n))};return e.forEach(n),t}function h(e,t){if(e===void 0)return{};if(!_(e))throw Error(`${t} in wrangler.jsonc must be an object.`);return e}function g(e,t){if(e===void 0)return[];if(!Array.isArray(e)||!e.every(e=>typeof e==`string`))throw Error(`${t} in wrangler.jsonc must be an array of strings.`);return e}function _(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{n as coreframeGeneratedWorkerVariables,i as coreframeLocalWorkerVariables,r as coreframeManagedWorkerSecrets,c as derivePrimaryWorkerConfig,s as normalizeWorkerEnvironment,e as primaryWorkerConfigPath,t as primaryWorkerEnvironments,d as validateWorkerInventoryOwnership,l as workerBindingNames,u as wranglerEnvironmentNames};
|
|
1
|
+
const e=`wrangler.jsonc`,t=[`development`,`staging`,`production`],n=[`DEPLOY_ENV`,`POSTHOG_RELEASE`],r=[`COREFRAME_ACCESS_TOKEN_SECRET`,`DASHBOARD_PASSWORD`],i=[`COREFRAME_DEV_JOBS_TOKEN`,`PGDATABASE`,`PGHOST`,`PGPASSWORD`,`PGPORT`,`PGUSER`,`PORTLESS_URL`,`TURSO_AUTH_TOKEN`,`TURSO_DATABASE_URL`],a=/^[A-Z][A-Z0-9_]*$/;function o(e){return n.some(t=>t===e)}function s(e){return Object.entries(e??{}).map(([e,t])=>{if(!a.test(e))throw Error(`Invalid Worker environment name ${JSON.stringify(e)} in coreframe.config.ts. Use uppercase letters, numbers, and underscores.`);let n=[...new Set(t.requiredIn??[])];if(t.kind===`generated`&&!o(e))throw Error(`${e} is declared as generated, but Coreframe does not generate it. Use kind "variable" or "secret".`);if(o(e)&&t.kind!==`generated`)throw Error(`${e} is generated by Coreframe and must use kind "generated".`);return{...t,name:e,requiredIn:n}}).sort((e,t)=>e.name.localeCompare(t.name))}function c({config:e,environment:t,contributions:n={}}){let r=structuredClone(e),i=h(r.env,`env`),a=h(i[t],`env.${t}`),o=h(a.vars,`env.${t}.vars`),s=h(a.secrets,`env.${t}.secrets`),c=g(s.required,`env.${t}.secrets.required`),l=n.generatedValues??{},u=[...new Set(n.requiredSecrets??[])].sort();p(`variable`,Object.keys(o),Object.keys(l),t),p(`secret`,c,u,t);let d=n.bindings??{},{env:_,...v}=r,y=m(v,a),b=m(d);p(`binding`,[...y],[...b],t);let x=f(a,d,`env.${t}`);return Object.keys(l).length>0&&(x.vars={...o,...l}),u.length>0&&(x.secrets={...s,required:[...c,...u].sort()}),r.env={...i,[t]:x},r}function l(e){return m(e)}function u(e){let t=m(e),n=e=>{if(!_(e))return;let n=_(e.vars)?e.vars:{};Object.keys(n).forEach(e=>t.add(e));let r=_(e.secrets)?e.secrets:{};(Array.isArray(r.required)?r.required:[]).forEach(e=>{typeof e==`string`&&t.add(e)})};return n(e),_(e.env)&&Object.values(e.env).forEach(n),t}function d(e,t){let n=s(t),r=new Map(n.map(e=>[e.name,e])),i=[...m(e)].filter(e=>r.has(e)).sort(),a=new Set,o=new Set,c=e=>{_(e)&&(_(e.vars)&&Object.keys(e.vars).forEach(e=>{r.get(e)?.kind===`secret`&&a.add(e)}),_(e.secrets)&&Array.isArray(e.secrets.required)&&e.secrets.required.forEach(e=>{typeof e==`string`&&r.get(e)?.kind!==`secret`&&r.has(e)&&o.add(e)}))};c(e),_(e.env)&&Object.values(e.env).forEach(c);let l=[...i.map(e=>`${e} (native binding)`),...[...a].sort().map(e=>`${e} (plain variable)`),...[...o].sort().map(e=>`${e} (required secret)`)];if(l.length>0)throw Error(`Worker inventory ownership conflicts with wrangler.jsonc: ${l.join(`, `)}. Keep string metadata in coreframe.config.ts and native binding topology in wrangler.jsonc.`)}function f(e,t,n){let r={...e};for(let[i,a]of Object.entries(t)){if(i in e)throw Error(`Coreframe cannot contribute ${n}.${i}; wrangler.jsonc already owns it.`);r[i]=structuredClone(a)}return r}function p(e,t,n,r){let i=n.filter(e=>t.includes(e)).sort();if(i.length>0)throw Error(`Coreframe ${e} ownership conflicts in Wrangler environment ${r}: ${i.join(`, `)}. Remove the duplicate declarations from wrangler.jsonc.`)}function m(...e){let t=new Set,n=e=>{if(Array.isArray(e)){e.forEach(n);return}_(e)&&(typeof e.binding==`string`&&t.add(e.binding),Object.values(e).forEach(n))};return e.forEach(n),t}function h(e,t){if(e===void 0)return{};if(!_(e))throw Error(`${t} in wrangler.jsonc must be an object.`);return e}function g(e,t){if(e===void 0)return[];if(!Array.isArray(e)||!e.every(e=>typeof e==`string`))throw Error(`${t} in wrangler.jsonc must be an array of strings.`);return e}function _(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{n as coreframeGeneratedWorkerVariables,i as coreframeLocalWorkerVariables,r as coreframeManagedWorkerSecrets,c as derivePrimaryWorkerConfig,s as normalizeWorkerEnvironment,e as primaryWorkerConfigPath,t as primaryWorkerEnvironments,d as validateWorkerInventoryOwnership,l as workerBindingNames,u as wranglerEnvironmentNames};
|