fimo 0.3.2 → 0.3.3-staging.23

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.
@@ -7,5 +7,5 @@ export { Boolean } from './components/Boolean.js';
7
7
  export { RichText } from './components/RichText.js';
8
8
  export { useLabels, useTranslations } from './translations.js';
9
9
  export { FimoString, FimoDate, FimoMedia, FimoBoolean, FimoRichText, type FimoSource, type FimoPart, type FimoRichTextContent, type FimoRichTextNodeProps, type FimoRichTextMarkProps, type FimoRichTextComponents, FIMO_SOURCE, FIMO_PARTS, isFimoString, isFimoDate, hasFimoSource, getFimoSource, getFimoParts, fimo, useFimoLiveValue, } from './lib/index.js';
10
- export type { BoolOps, DateOps, FilterFor, NullOnlyOps, NumberOps, Query, ScalarOps, Sort, SortField, StringOps, Where, } from './lib/index.js';
10
+ export type { BoolOps, DateOps, Field, Fields, FilterFor, NullOnlyOps, NumberOps, Projected, Query, ScalarOps, Sort, SortField, StringOps, Where, } from './lib/index.js';
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/primitives/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAG/D,OAAO,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,WAAW,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AAgB,CAAC;AAExB,YAAY,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,MAAM,EACN,SAAS,EACT,WAAW,EACX,SAAS,EACT,SAAS,EACT,KAAK,EACL,SAAS,EACT,IAAI,EACJ,SAAS,EACT,SAAS,EACT,KAAK,GACN,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=public-surface.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-surface.test.d.ts","sourceRoot":"","sources":["../../../src/runtime/primitives/public-surface.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import { describe, expectTypeOf, it } from 'vitest';
2
+ describe('fimo/ui public type surface', () => {
3
+ it('supports the projected query pattern emitted into generated schemas', () => {
4
+ expectTypeOf().toEqualTypeOf();
5
+ expectTypeOf().toEqualTypeOf();
6
+ const query = {
7
+ where: { name: 'BASIC' },
8
+ sort: '-price',
9
+ limit: 10,
10
+ };
11
+ expectTypeOf(query.fields).toEqualTypeOf();
12
+ expectTypeOf().toEqualTypeOf();
13
+ });
14
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fimo",
3
- "version": "0.3.2",
3
+ "version": "0.3.3-staging.23",
4
4
  "description": "Fimo CLI - create, deploy, and manage Fimo projects",
5
5
  "bin": {
6
6
  "fimo": "dist/cli/index.js"
package/release.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "source": "npm",
3
- "apiUrl": "https://api.fimo.ai",
4
- "webUrl": "https://fimo.ai"
3
+ "apiUrl": "https://api.staging.fimo.team",
4
+ "webUrl": "https://staging.fimo.team"
5
5
  }
@@ -10,20 +10,25 @@
10
10
  // What it does:
11
11
  // 1. Resolves the channel from the shared table (lib/channels.mjs).
12
12
  // 2. Guards: @latest refuses to publish outside CI unless --bootstrap.
13
- // 3. Bakes a channel-appropriate release.json (lib/release-core.mjs) —
14
- // staging URLs for experimental/staging, prod for latest. Never a tunnel.
15
- // 4. For prerelease channels, synthesizes a disposable X.Y.Z-<tag>.<n> version.
16
- // 5. Runs `npm publish --tag <distTag>` (no --provenance — strapi/fimo is private).
13
+ // 3. Builds in place (clean → build → build:bundle) with the workspace
14
+ // manifest UNTOUCHED, then `npm pack`s straight into a temp stage dir.
15
+ // 4. Mutates ONLY the extracted stage copy: synthesized X.Y.Z-<tag>.<n>
16
+ // version, template fimo pin, channel release.json (allowlist-enforced —
17
+ // staging URLs for experimental/staging, prod for latest, never a tunnel).
18
+ // 5. Runs `npm publish --tag <distTag>` from the stage (no --provenance —
19
+ // strapi/fimo is private).
17
20
  // 6. On real experimental publishes, records the exact version in repo-root
18
21
  // .fimo/dev.json for local source-checkout deploys.
19
- // 7. Restores package.json + removes the transient release.json.
20
22
  //
21
- // `npm publish` triggers prepublishOnly (clean → build → build:bundle), so the
22
- // bundled tarball is always fresh.
23
+ // The workspace is never mutated: no transient package.json version, no
24
+ // release.json, no template rewrites — a crash or a long OTP prompt can't
25
+ // leave the repo dirty (it used to sit mutated for the whole multi-minute
26
+ // build + 2FA window).
23
27
 
24
28
  import { spawnSync } from 'node:child_process';
25
- import { existsSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
26
- import { dirname, resolve } from 'node:path';
29
+ import { mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs';
30
+ import { tmpdir } from 'node:os';
31
+ import { dirname, join, resolve } from 'node:path';
27
32
  import { fileURLToPath } from 'node:url';
28
33
 
29
34
  import { resolveChannel } from './lib/channels.mjs';
@@ -38,7 +43,6 @@ import {
38
43
  const HERE = dirname(fileURLToPath(import.meta.url));
39
44
  const CLI_ROOT = resolve(HERE, '..');
40
45
  const PKG_PATH = resolve(CLI_ROOT, 'package.json');
41
- const RELEASE_PATH = resolve(CLI_ROOT, 'release.json');
42
46
 
43
47
  function parseArgs(argv) {
44
48
  const args = { channel: null, dryRun: false, bootstrap: false, plan: false };
@@ -57,6 +61,15 @@ function parseArgs(argv) {
57
61
  return args;
58
62
  }
59
63
 
64
+ function run(cmd, args, cwd) {
65
+ console.log(`[publish-npm] $ ${cmd} ${args.join(' ')}`);
66
+ const result = spawnSync(cmd, args, { cwd, stdio: 'inherit' });
67
+ if (result.status !== 0) {
68
+ console.error(`[publish-npm] ${cmd} ${args[0]} failed (exit ${result.status}).`);
69
+ process.exit(result.status ?? 1);
70
+ }
71
+ }
72
+
60
73
  const { channel: channelName, dryRun, bootstrap, plan } = parseArgs(process.argv.slice(2));
61
74
 
62
75
  if (!channelName) {
@@ -93,38 +106,40 @@ if (plan) {
93
106
  process.exit(0);
94
107
  }
95
108
 
96
- let versionMutated = false;
97
- let restoreTemplate = () => {};
98
- let restoreLockfile = () => {};
109
+ const stageRoot = mkdtempSync(join(tmpdir(), 'fimo-publish-'));
99
110
  try {
100
- // 1. Set the synthesized version for prerelease channels.
101
- if (publishVersion !== baseVersion) {
102
- writeFileSync(PKG_PATH, JSON.stringify({ ...pkg, version: publishVersion }, null, 2) + '\n');
103
- versionMutated = true;
111
+ // 1. Build in place — the build output doesn't depend on the version, so
112
+ // the workspace manifest stays untouched.
113
+ run('pnpm', ['run', 'prepublishOnly'], CLI_ROOT);
114
+
115
+ // 2. Pack the workspace tarball (honors the `files` whitelist) directly
116
+ // into the stage dir; --ignore-scripts because we just built.
117
+ run('npm', ['pack', '--ignore-scripts', '--pack-destination', stageRoot], CLI_ROOT);
118
+ const tarball = readdirSync(stageRoot).find((name) => name.endsWith('.tgz'));
119
+ if (!tarball) {
120
+ console.error(`[publish-npm] npm pack produced no tarball in ${stageRoot}.`);
121
+ process.exit(1);
104
122
  }
105
-
106
- // 2. Pin the bundled template's fimo dep to the exact version, and drop its
107
- // lockfile (can't pin an unpublished version; create regenerates it).
108
- restoreTemplate = pinTemplateFimo(CLI_ROOT, publishVersion);
109
- restoreLockfile = stripTemplateLockfile(CLI_ROOT);
110
-
111
- // 3. Bake release.json (allowlist-enforced).
112
- writeReleaseJson(CLI_ROOT, channel);
113
-
114
- // 4. Publish. No --provenance: sigstore provenance requires a PUBLIC source
115
- // repo, and strapi/fimo is private (npm returns 422 otherwise). Trusted
116
- // Publishing (OIDC auth) works regardless of repo visibility — it's only
117
- // the attestation that's public-repo-only.
118
- const publishArgs = ['publish', '--access', 'public', '--tag', channel.distTag];
123
+ run('tar', ['-xzf', join(stageRoot, tarball), '-C', stageRoot], stageRoot);
124
+ const stage = join(stageRoot, 'package');
125
+
126
+ // 3. Mutate ONLY the stage copy: synthesized version, template pin,
127
+ // channel release.json.
128
+ const stagePkg = JSON.parse(readFileSync(join(stage, 'package.json'), 'utf8'));
129
+ writeFileSync(join(stage, 'package.json'), JSON.stringify({ ...stagePkg, version: publishVersion }, null, 2) + '\n');
130
+ pinTemplateFimo(stage, publishVersion);
131
+ stripTemplateLockfile(stage);
132
+ writeReleaseJson(stage, channel);
133
+
134
+ // 4. Publish from the stage. No --provenance: sigstore provenance requires
135
+ // a PUBLIC source repo, and strapi/fimo is private (npm returns 422
136
+ // otherwise). Trusted Publishing (OIDC auth) works regardless of repo
137
+ // visibility — it's only the attestation that's public-only.
138
+ const publishArgs = ['publish', '--access', 'public', '--tag', channel.distTag, '--ignore-scripts'];
119
139
  if (dryRun) {
120
140
  publishArgs.push('--dry-run');
121
141
  }
122
- console.log(`[publish-npm] $ npm ${publishArgs.join(' ')}`);
123
- const result = spawnSync('npm', publishArgs, { cwd: CLI_ROOT, stdio: 'inherit' });
124
- if (result.status !== 0) {
125
- console.error(`[publish-npm] npm publish failed (exit ${result.status}).`);
126
- process.exit(result.status ?? 1);
127
- }
142
+ run('npm', publishArgs, stage);
128
143
 
129
144
  if (!dryRun && channel.distTag === 'experimental') {
130
145
  const devStatePath = writeDevReleaseState(CLI_ROOT, {
@@ -134,16 +149,7 @@ try {
134
149
  console.log(`[publish-npm] wrote ${devStatePath}`);
135
150
  }
136
151
  } finally {
137
- // Restore the workspace: package.json version, template fimo pin, and remove
138
- // the transient release.json so local `fimo` runs fall back to localhost.
139
- if (versionMutated) {
140
- writeFileSync(PKG_PATH, JSON.stringify(pkg, null, 2) + '\n');
141
- }
142
- restoreTemplate();
143
- restoreLockfile();
144
- if (existsSync(RELEASE_PATH)) {
145
- rmSync(RELEASE_PATH, { force: true });
146
- }
152
+ rmSync(stageRoot, { recursive: true, force: true });
147
153
  }
148
154
 
149
155
  console.log(`[publish-npm] done${dryRun ? ' (dry-run — nothing published)' : ''}.`);
@@ -21,7 +21,7 @@
21
21
  "cmdk": "^1.1.1",
22
22
  "date-fns": "^4.1.0",
23
23
  "embla-carousel-react": "^8.6.0",
24
- "fimo": "0.3.2",
24
+ "fimo": "0.3.3-staging.23",
25
25
  "input-otp": "^1.4.2",
26
26
  "isbot": "^5",
27
27
  "lucide-react": "^0.577.0",