@sequenceholdings/artifact-studio 0.1.3 → 0.1.5
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 +2 -0
- package/dist/bin.js +8 -0
- package/dist/build.js +25 -15
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +8 -20
- package/dist/config.js +11 -0
- package/dist/templates/react-vite/CLAUDE.md +3 -3
- package/dist/templates/react-vite/package.json +2 -3
- package/dist/templates/react-vite/src/styles.css +0 -1
- package/package.json +7 -9
- package/templates/react-vite/CLAUDE.md +3 -3
- package/templates/react-vite/package.json +2 -3
- package/templates/react-vite/src/styles.css +0 -1
package/dist/bin.d.ts
ADDED
package/dist/bin.js
ADDED
package/dist/build.js
CHANGED
|
@@ -1,30 +1,18 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
2
1
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
3
2
|
import { createRequire } from 'node:module';
|
|
4
3
|
import { dirname, resolve } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
5
|
import { build as viteBuild } from 'vite';
|
|
6
6
|
import { sha256Hex } from './hash.js';
|
|
7
7
|
import { readArtifactStudioSource } from './project.js';
|
|
8
8
|
const cliRequire = createRequire(import.meta.url);
|
|
9
|
+
const cliDir = dirname(fileURLToPath(import.meta.url));
|
|
9
10
|
const reactDir = dirname(cliRequire.resolve('react/package.json'));
|
|
10
11
|
const reactDomDir = dirname(cliRequire.resolve('react-dom/package.json'));
|
|
11
12
|
const atlasUiDir = dirname(cliRequire.resolve('@sequenceholdings/atlas-ui/package.json'));
|
|
12
13
|
const atlasUiDist = resolve(atlasUiDir, 'dist');
|
|
13
14
|
const tailwindCssPath = resolve(dirname(cliRequire.resolve('tailwindcss/package.json')), 'index.css');
|
|
14
|
-
|
|
15
|
-
// (its only exports are CSS files via the `style` condition), so the
|
|
16
|
-
// `cliRequire.resolve('<pkg>/package.json')` trick that works for tailwindcss
|
|
17
|
-
// errors with ERR_PACKAGE_PATH_NOT_EXPORTED. Walk the module search paths
|
|
18
|
-
// and probe for the dist file directly instead.
|
|
19
|
-
const twAnimateCssPath = (() => {
|
|
20
|
-
const searchPaths = cliRequire.resolve.paths('tw-animate-css') ?? [];
|
|
21
|
-
for (const base of searchPaths) {
|
|
22
|
-
const candidate = resolve(base, 'tw-animate-css', 'dist', 'tw-animate.css');
|
|
23
|
-
if (existsSync(candidate))
|
|
24
|
-
return candidate;
|
|
25
|
-
}
|
|
26
|
-
throw new Error('Could not resolve tw-animate-css/dist/tw-animate.css in module search paths');
|
|
27
|
-
})();
|
|
15
|
+
const twAnimateCssPath = resolve(cliDir, '..', 'node_modules', 'tw-animate-css', 'dist', 'tw-animate.css');
|
|
28
16
|
function isAssetOutput(value) {
|
|
29
17
|
return value.type === 'asset';
|
|
30
18
|
}
|
|
@@ -38,10 +26,13 @@ export async function buildArtifactStudioProject(rootDir) {
|
|
|
38
26
|
plugins: [
|
|
39
27
|
artifactSdkVirtualModule(),
|
|
40
28
|
atlasUiCssResolverPlugin(),
|
|
29
|
+
nextStubPlugin(),
|
|
41
30
|
(await import('@tailwindcss/vite')).default(),
|
|
42
31
|
],
|
|
43
32
|
resolve: {
|
|
44
33
|
alias: {
|
|
34
|
+
'react/jsx-runtime': resolve(reactDir, 'jsx-runtime.js'),
|
|
35
|
+
'react/jsx-dev-runtime': resolve(reactDir, 'jsx-dev-runtime.js'),
|
|
45
36
|
react: reactDir,
|
|
46
37
|
'react-dom/client': resolve(reactDomDir, 'client'),
|
|
47
38
|
'react-dom': reactDomDir,
|
|
@@ -100,6 +91,25 @@ function artifactSdkVirtualModule() {
|
|
|
100
91
|
},
|
|
101
92
|
};
|
|
102
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
|
+
}
|
|
103
113
|
function collectEntryJavaScript(output) {
|
|
104
114
|
const entryChunks = output.filter((chunk) => chunk.type === 'chunk' && chunk.isEntry);
|
|
105
115
|
if (entryChunks.length === 0)
|
package/dist/cli.d.ts
CHANGED
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 {
|
|
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
|
-
|
|
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
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
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`
|
|
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
|
-
|
|
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": "
|
|
13
|
-
"@sequenceholdings/atlas-ui": "
|
|
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"
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sequenceholdings/artifact-studio",
|
|
3
|
-
"
|
|
3
|
+
"publishConfig": {
|
|
4
|
+
"access": "restricted"
|
|
5
|
+
},
|
|
6
|
+
"version": "0.1.5",
|
|
4
7
|
"description": "CLI and SDK types for building Artifact Studio apps",
|
|
5
8
|
"type": "module",
|
|
6
9
|
"bin": {
|
|
7
|
-
"artifact-studio": "./dist/
|
|
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.
|
|
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`
|
|
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
|
-
|
|
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": "
|
|
13
|
-
"@sequenceholdings/atlas-ui": "
|
|
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"
|