@sequenceholdings/artifact-studio 0.1.2 → 0.1.4

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/bin.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/bin.js ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { runCli } from './cli.js';
3
+ runCli()
4
+ .then((code) => process.exit(code))
5
+ .catch((error) => {
6
+ console.error(error instanceof Error ? error.message : error);
7
+ process.exit(1);
8
+ });
package/dist/build.js CHANGED
@@ -1,16 +1,18 @@
1
1
  import { mkdir, writeFile } from 'node:fs/promises';
2
2
  import { createRequire } from 'node:module';
3
3
  import { dirname, resolve } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
4
5
  import { build as viteBuild } from 'vite';
5
6
  import { sha256Hex } from './hash.js';
6
7
  import { readArtifactStudioSource } from './project.js';
7
8
  const cliRequire = createRequire(import.meta.url);
9
+ const cliDir = dirname(fileURLToPath(import.meta.url));
8
10
  const reactDir = dirname(cliRequire.resolve('react/package.json'));
9
11
  const reactDomDir = dirname(cliRequire.resolve('react-dom/package.json'));
10
12
  const atlasUiDir = dirname(cliRequire.resolve('@sequenceholdings/atlas-ui/package.json'));
11
13
  const atlasUiDist = resolve(atlasUiDir, 'dist');
12
14
  const tailwindCssPath = resolve(dirname(cliRequire.resolve('tailwindcss/package.json')), 'index.css');
13
- const twAnimateCssPath = resolve(dirname(cliRequire.resolve('tw-animate-css/package.json')), 'dist', 'tw-animate.css');
15
+ const twAnimateCssPath = resolve(cliDir, '..', 'node_modules', 'tw-animate-css', 'dist', 'tw-animate.css');
14
16
  function isAssetOutput(value) {
15
17
  return value.type === 'asset';
16
18
  }
@@ -24,10 +26,13 @@ export async function buildArtifactStudioProject(rootDir) {
24
26
  plugins: [
25
27
  artifactSdkVirtualModule(),
26
28
  atlasUiCssResolverPlugin(),
29
+ nextStubPlugin(),
27
30
  (await import('@tailwindcss/vite')).default(),
28
31
  ],
29
32
  resolve: {
30
33
  alias: {
34
+ 'react/jsx-runtime': resolve(reactDir, 'jsx-runtime.js'),
35
+ 'react/jsx-dev-runtime': resolve(reactDir, 'jsx-dev-runtime.js'),
31
36
  react: reactDir,
32
37
  'react-dom/client': resolve(reactDomDir, 'client'),
33
38
  'react-dom': reactDomDir,
@@ -86,6 +91,25 @@ function artifactSdkVirtualModule() {
86
91
  },
87
92
  };
88
93
  }
94
+ // Atlas-ui re-exports a few Next-only components (EditorSideNav etc) that
95
+ // import from `next/*`. Artifacts don't have Next installed and don't use
96
+ // those components, but rolldown still resolves all imports before
97
+ // tree-shaking. Stub `next/*` so resolution succeeds; the unused exports
98
+ // drop out of the final bundle.
99
+ function nextStubPlugin() {
100
+ const resolved = '\0next-stub';
101
+ return {
102
+ name: 'sequence-next-stub',
103
+ resolveId(id) {
104
+ return id === 'next' || id.startsWith('next/') ? resolved : undefined;
105
+ },
106
+ load(id) {
107
+ if (id !== resolved)
108
+ return undefined;
109
+ return 'const stub = () => null; export default stub; export const useLinkStatus = () => ({});';
110
+ },
111
+ };
112
+ }
89
113
  function collectEntryJavaScript(output) {
90
114
  const entryChunks = output.filter((chunk) => chunk.type === 'chunk' && chunk.isEntry);
91
115
  if (entryChunks.length === 0)
package/dist/cli.d.ts CHANGED
@@ -1,2 +1 @@
1
- #!/usr/bin/env node
2
1
  export declare function runCli(argv?: string[]): Promise<number>;
package/dist/cli.js CHANGED
@@ -1,8 +1,6 @@
1
- #!/usr/bin/env node
2
1
  import { cp, mkdir, writeFile } from 'node:fs/promises';
3
2
  import { existsSync } from 'node:fs';
4
- import { createRequire } from 'node:module';
5
- import { dirname, join, relative, resolve } from 'node:path';
3
+ import { dirname, join, resolve } from 'node:path';
6
4
  import { execFileSync } from 'node:child_process';
7
5
  import { fileURLToPath } from 'node:url';
8
6
  import { getJson, getJsonOr404, postJson } from './api.js';
@@ -94,20 +92,10 @@ async function initCommand(args) {
94
92
  await replaceInFile(join(dir, 'artifact.bundle.yml'), /\{\{slug\}\}/g, slug);
95
93
  await replaceInFile(join(dir, 'artifact.bundle.yml'), /\{\{title\}\}/g, titleize(slug));
96
94
  await replaceInFile(join(dir, 'package.json'), /\{\{slug\}\}/g, slug);
97
- const pkgJson = join(dir, 'package.json');
98
- const atlasUiVersion = readPackageVersion('@sequenceholdings/atlas-ui');
99
- const artifactStudioVersion = readPackageVersion('@sequenceholdings/artifact-studio');
100
- await replaceInFile(pkgJson, /"@sequenceholdings\/atlas-ui": "workspace:\*"/, `"@sequenceholdings/atlas-ui": "^${atlasUiVersion}"`);
101
- await replaceInFile(pkgJson, /"@sequenceholdings\/artifact-studio": "workspace:\*"/, `"@sequenceholdings/artifact-studio": "^${artifactStudioVersion}"`);
102
95
  console.log(`[artifact-studio] initialized ${dir}`);
103
- const relativeDir = relative(process.cwd(), dir) || '.';
104
- console.log(`Next: cd ${relativeDir} && pnpm install && artifact-studio login && artifact-studio dev --env staging`);
96
+ console.log('Next: artifact-studio login && artifact-studio dev --env staging');
105
97
  return 0;
106
98
  }
107
- function readPackageVersion(packageName) {
108
- const req = createRequire(import.meta.url);
109
- return req(`${packageName}/package.json`).version;
110
- }
111
99
  async function loginCommand(args) {
112
100
  const token = typeof args.flags.token === 'string' ? args.flags.token : undefined;
113
101
  if (token) {
@@ -464,9 +452,9 @@ function slugify(value) {
464
452
  function titleize(slug) {
465
453
  return slug.split('-').map((part) => part ? part[0].toUpperCase() + part.slice(1) : '').join(' ');
466
454
  }
467
- runCli()
468
- .then((code) => process.exit(code))
469
- .catch((error) => {
470
- console.error(error instanceof Error ? error.message : error);
471
- process.exit(1);
472
- });
455
+ // Phase 2 of the seq-lattice rollout (see
456
+ // shared/services/lattice-cli/README.md): this module is now a pure
457
+ // library export. The CLI entry point lives in `bin.ts` and is what the
458
+ // `artifact-studio` binary points at. seq-lattice imports `runCli` from
459
+ // `@sequenceholdings/artifact-studio/cli` and re-invokes it after injecting a
460
+ // shared base URL + Bearer token.
package/dist/config.js CHANGED
@@ -41,6 +41,17 @@ export async function writeTokenConfig(config) {
41
41
  }
42
42
  export function resolveEnvironment(name, fallback) {
43
43
  const envName = name ?? fallback;
44
+ // Allow `seq-lattice artifact` (and any other embedder that wants to
45
+ // route artifact-studio through a centrally-managed env map) to
46
+ // override the base URL without monkey-patching this file. The env
47
+ // name remains the user-supplied one so log lines / project records
48
+ // still see e.g. "staging" rather than "<unset>".
49
+ const overrideUrl = process.env['ARTIFACT_STUDIO_BASE_URL']?.trim() || undefined;
50
+ if (overrideUrl) {
51
+ if (!envName)
52
+ throw new Error('--env must be one of: local, staging, production, banksouth');
53
+ return { name: envName, url: overrideUrl };
54
+ }
44
55
  const url = envName ? ENV_URLS[envName] : undefined;
45
56
  if (!envName || !url)
46
57
  throw new Error('--env must be one of: local, staging, production, banksouth');
@@ -21,11 +21,11 @@ This is a sandboxed iframe SPA that runs inside Atlas and talks to Atlas backend
21
21
 
22
22
  ## Prerequisite
23
23
 
24
- `artifact-studio init` requires the Sequence monorepo checked out locally. The CLI rewrites `"@sequenceholdings/atlas-ui": "workspace:*"` and the `@sequenceholdings/artifact-studio` entry in this `package.json` to local `link:` paths against the monorepo's `shared/services/atlas-ui` and `shared/services/artifact-studio`. Without the monorepo the rewrite no-ops, and `pnpm install` then fails on the unresolved `workspace:*` — those two packages aren't published to the public npm registry yet. Run init from inside the monorepo, e.g. `pnpm --dir atlas artifact-studio init <dir>`.
24
+ `artifact-studio init` requires the Sequence monorepo checked out locally. The CLI rewrites `"@sequenceholdings/atlas-ui": "workspace:*"` and the `@sequenceholdings/artifact-studio` version in this `package.json` to local `file:` paths against the monorepo's `shared/services/atlas-ui` and `shared/services/artifact-studio`. Without the monorepo the rewrite no-ops, and `npm install` fails with `EUNSUPPORTEDPROTOCOL` on `workspace:*` — those two packages aren't published to npm. Run init from inside the monorepo, e.g. `pnpm --dir atlas artifact-studio init <dir>`.
25
25
 
26
- ## Package manager: pnpm
26
+ ## Package manager: npm, not pnpm
27
27
 
28
- This scaffold declares `"packageManager": "pnpm@10.28.2"` and the CLI writes both `@sequenceholdings/atlas-ui` and `@sequenceholdings/artifact-studio` as **`link:` deps** (not `file:`). `link:` is pnpm-specific: it tells pnpm to symlink the package without re-resolving its transitive `workspace:*` deps. That matters because the linked `@sequenceholdings/artifact-studio` package still carries `"@sequenceholdings/atlas-ui": "workspace:*"` in its own `package.json`; with `file:` pnpm would try to resolve that protocol against the standalone scaffold and fail with `ERR_PNPM_WORKSPACE_PKG_NOT_FOUND`. Always `pnpm install` npm doesn't understand `link:`.
28
+ Once the CLI has rewritten the deps, use `npm install`, not `pnpm install`. The linked `@sequenceholdings/artifact-studio` package carries `"@sequenceholdings/atlas-ui": "workspace:*"` in its own `package.json`; npm tolerates an unresolved `workspace:*` inside a file-linked dep, pnpm errors with `ERR_PNPM_WORKSPACE_PKG_NOT_FOUND`. If a `pnpm-lock.yaml` already exists, `rm -rf node_modules pnpm-lock.yaml` before `npm install`.
29
29
 
30
30
  ## Key files
31
31
 
@@ -2,14 +2,13 @@
2
2
  "name": "{{slug}}",
3
3
  "private": true,
4
4
  "type": "module",
5
- "packageManager": "pnpm@10.28.2",
6
5
  "scripts": {
7
6
  "dev": "vite",
8
7
  "build": "vite build",
9
8
  "preview": "vite preview"
10
9
  },
11
10
  "dependencies": {
12
- "@sequenceholdings/artifact-studio": "workspace:*",
11
+ "@sequenceholdings/artifact-studio": "^0.1.0",
13
12
  "@sequenceholdings/atlas-ui": "workspace:*",
14
13
  "@tanstack/react-query": "^4.36.1",
15
14
  "react": "^18.2.0",
@@ -1,4 +1,3 @@
1
1
  @import "tailwindcss";
2
2
  @import "tw-animate-css";
3
3
  @import "@sequenceholdings/atlas-ui/tokens.css";
4
- @source "../node_modules/@sequenceholdings/atlas-ui/dist/**/*.mjs";
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "@sequenceholdings/artifact-studio",
3
- "version": "0.1.2",
3
+ "publishConfig": {
4
+ "access": "restricted"
5
+ },
6
+ "version": "0.1.4",
4
7
  "description": "CLI and SDK types for building Artifact Studio apps",
5
8
  "type": "module",
6
9
  "bin": {
7
- "artifact-studio": "./dist/cli.js"
10
+ "artifact-studio": "./dist/bin.js"
8
11
  },
9
12
  "exports": {
10
13
  ".": {
@@ -14,17 +17,12 @@
14
17
  "./cli": {
15
18
  "types": "./dist/cli.d.ts",
16
19
  "default": "./dist/cli.js"
17
- },
18
- "./package.json": "./package.json"
20
+ }
19
21
  },
20
22
  "files": [
21
23
  "dist",
22
24
  "templates"
23
25
  ],
24
- "publishConfig": {
25
- "access": "public",
26
- "registry": "https://registry.npmjs.org"
27
- },
28
26
  "dependencies": {
29
27
  "@tailwindcss/postcss": "^4.1.8",
30
28
  "@tailwindcss/vite": "^4.1.8",
@@ -35,7 +33,7 @@
35
33
  "tw-animate-css": "^1.4.0",
36
34
  "vite": "8.0.8",
37
35
  "zod": "^4.1.13",
38
- "@sequenceholdings/atlas-ui": "0.1.1"
36
+ "@sequenceholdings/atlas-ui": "0.1.2"
39
37
  },
40
38
  "devDependencies": {
41
39
  "@types/js-yaml": "^4.0.9",
@@ -21,11 +21,11 @@ This is a sandboxed iframe SPA that runs inside Atlas and talks to Atlas backend
21
21
 
22
22
  ## Prerequisite
23
23
 
24
- `artifact-studio init` requires the Sequence monorepo checked out locally. The CLI rewrites `"@sequenceholdings/atlas-ui": "workspace:*"` and the `@sequenceholdings/artifact-studio` entry in this `package.json` to local `link:` paths against the monorepo's `shared/services/atlas-ui` and `shared/services/artifact-studio`. Without the monorepo the rewrite no-ops, and `pnpm install` then fails on the unresolved `workspace:*` — those two packages aren't published to the public npm registry yet. Run init from inside the monorepo, e.g. `pnpm --dir atlas artifact-studio init <dir>`.
24
+ `artifact-studio init` requires the Sequence monorepo checked out locally. The CLI rewrites `"@sequenceholdings/atlas-ui": "workspace:*"` and the `@sequenceholdings/artifact-studio` version in this `package.json` to local `file:` paths against the monorepo's `shared/services/atlas-ui` and `shared/services/artifact-studio`. Without the monorepo the rewrite no-ops, and `npm install` fails with `EUNSUPPORTEDPROTOCOL` on `workspace:*` — those two packages aren't published to npm. Run init from inside the monorepo, e.g. `pnpm --dir atlas artifact-studio init <dir>`.
25
25
 
26
- ## Package manager: pnpm
26
+ ## Package manager: npm, not pnpm
27
27
 
28
- This scaffold declares `"packageManager": "pnpm@10.28.2"` and the CLI writes both `@sequenceholdings/atlas-ui` and `@sequenceholdings/artifact-studio` as **`link:` deps** (not `file:`). `link:` is pnpm-specific: it tells pnpm to symlink the package without re-resolving its transitive `workspace:*` deps. That matters because the linked `@sequenceholdings/artifact-studio` package still carries `"@sequenceholdings/atlas-ui": "workspace:*"` in its own `package.json`; with `file:` pnpm would try to resolve that protocol against the standalone scaffold and fail with `ERR_PNPM_WORKSPACE_PKG_NOT_FOUND`. Always `pnpm install` npm doesn't understand `link:`.
28
+ Once the CLI has rewritten the deps, use `npm install`, not `pnpm install`. The linked `@sequenceholdings/artifact-studio` package carries `"@sequenceholdings/atlas-ui": "workspace:*"` in its own `package.json`; npm tolerates an unresolved `workspace:*` inside a file-linked dep, pnpm errors with `ERR_PNPM_WORKSPACE_PKG_NOT_FOUND`. If a `pnpm-lock.yaml` already exists, `rm -rf node_modules pnpm-lock.yaml` before `npm install`.
29
29
 
30
30
  ## Key files
31
31
 
@@ -2,15 +2,14 @@
2
2
  "name": "{{slug}}",
3
3
  "private": true,
4
4
  "type": "module",
5
- "packageManager": "pnpm@10.28.2",
6
5
  "scripts": {
7
6
  "dev": "vite",
8
7
  "build": "vite build",
9
8
  "preview": "vite preview"
10
9
  },
11
10
  "dependencies": {
12
- "@sequenceholdings/artifact-studio": "workspace:*",
13
- "@sequenceholdings/atlas-ui": "workspace:*",
11
+ "@sequenceholdings/artifact-studio": "^0.1.0",
12
+ "@sequenceholdings/atlas-ui": "^0.1.0",
14
13
  "@tanstack/react-query": "^4.36.1",
15
14
  "react": "^18.2.0",
16
15
  "react-dom": "^18.2.0"
@@ -1,4 +1,3 @@
1
1
  @import "tailwindcss";
2
2
  @import "tw-animate-css";
3
3
  @import "@sequenceholdings/atlas-ui/tokens.css";
4
- @source "../node_modules/@sequenceholdings/atlas-ui/dist/**/*.mjs";