promptslide 0.3.7 → 0.3.8
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/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/commands/publish.mjs +30 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.8](https://github.com/prompticeu/promptslide/compare/promptslide-v0.3.7...promptslide-v0.3.8) (2026-03-23)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* include layouts and theme in deck registryDependencies ([#81](https://github.com/prompticeu/promptslide/issues/81)) ([4dbd699](https://github.com/prompticeu/promptslide/commit/4dbd699480d692625cf65dd32c556cfe62fc529a))
|
|
9
|
+
* sanitize deck slug from lockfile to match validation rules ([#79](https://github.com/prompticeu/promptslide/issues/79)) ([8692313](https://github.com/prompticeu/promptslide/commit/869231362e9485d3f177ca5337d3a5ff92743f47))
|
|
10
|
+
|
|
3
11
|
## [0.3.7](https://github.com/prompticeu/promptslide/compare/promptslide-v0.3.6...promptslide-v0.3.7) (2026-03-19)
|
|
4
12
|
|
|
5
13
|
|
package/package.json
CHANGED
package/src/commands/publish.mjs
CHANGED
|
@@ -15,12 +15,17 @@ const CLI_VERSION = JSON.parse(readFileSync(join(__dirname, "..", "..", "package
|
|
|
15
15
|
function readDeckSlug(cwd) {
|
|
16
16
|
const lock = readLockfile(cwd)
|
|
17
17
|
// Prefer stored deck slug — migrate old two-part format (e.g. "my-deck/name" → "my-deck")
|
|
18
|
-
|
|
18
|
+
// Sanitize to match validation rules (lowercase alphanumeric + hyphens only)
|
|
19
|
+
if (lock.deckSlug) return sanitizeSlug(lock.deckSlug.split("/")[0])
|
|
19
20
|
// Migrate legacy deckPrefix (old lockfiles stored prefix separately)
|
|
20
|
-
if (lock.deckPrefix) return lock.deckPrefix
|
|
21
|
+
if (lock.deckPrefix) return sanitizeSlug(lock.deckPrefix)
|
|
21
22
|
return ""
|
|
22
23
|
}
|
|
23
24
|
|
|
25
|
+
function sanitizeSlug(raw) {
|
|
26
|
+
return raw.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "")
|
|
27
|
+
}
|
|
28
|
+
|
|
24
29
|
function defaultDeckSlug(cwd) {
|
|
25
30
|
const dirName = basename(cwd)
|
|
26
31
|
return dirName.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "")
|
|
@@ -91,6 +96,24 @@ function detectRegistryDeps(content) {
|
|
|
91
96
|
return deps
|
|
92
97
|
}
|
|
93
98
|
|
|
99
|
+
/** Detect sibling layout imports — both relative ("./foo") and absolute ("@/layouts/foo"). */
|
|
100
|
+
function detectLayoutSiblingDeps(content) {
|
|
101
|
+
const deps = []
|
|
102
|
+
// Relative imports: import ... from "./shared-footer"
|
|
103
|
+
const relativeRegex = /import\s+.*?\s+from\s+["']\.\/([^"']+)["']/g
|
|
104
|
+
for (const match of content.matchAll(relativeRegex)) {
|
|
105
|
+
const name = match[1].replace(/\.tsx?$/, "")
|
|
106
|
+
deps.push(name)
|
|
107
|
+
}
|
|
108
|
+
// Absolute imports: import ... from "@/layouts/shared-footer"
|
|
109
|
+
const absoluteRegex = /import\s+.*?\s+from\s+["']@\/layouts\/([^"']+)["']/g
|
|
110
|
+
for (const match of content.matchAll(absoluteRegex)) {
|
|
111
|
+
const name = match[1].replace(/\.tsx?$/, "")
|
|
112
|
+
if (!deps.includes(name)) deps.push(name)
|
|
113
|
+
}
|
|
114
|
+
return deps
|
|
115
|
+
}
|
|
116
|
+
|
|
94
117
|
/**
|
|
95
118
|
* Discover shared source files under src/ that aren't slides, layouts, or theme.
|
|
96
119
|
* These are files in directories like src/components/, src/lib/, src/hooks/, etc.
|
|
@@ -708,8 +731,9 @@ export async function publish(args) {
|
|
|
708
731
|
|
|
709
732
|
const assetDeps = detectAssetDepsInContent(content, deckSlug, publicFileSet)
|
|
710
733
|
const npmDeps = detectNpmDeps(content)
|
|
734
|
+
const siblingDeps = detectLayoutSiblingDeps(content).map(d => `${deckSlug}/${d}`)
|
|
711
735
|
const regDeps = hasTheme ? [`${deckSlug}/theme`] : []
|
|
712
|
-
regDeps.push(...assetDeps)
|
|
736
|
+
regDeps.push(...siblingDeps, ...assetDeps)
|
|
713
737
|
|
|
714
738
|
try {
|
|
715
739
|
const result = await publishToRegistry({
|
|
@@ -793,9 +817,11 @@ export async function publish(args) {
|
|
|
793
817
|
|
|
794
818
|
// ── Phase 5: Deck manifest (includes shared source modules) ──
|
|
795
819
|
itemIndex++
|
|
820
|
+
const themeSlugs = hasTheme ? [`${deckSlug}/theme`] : []
|
|
821
|
+
const layoutSlugs = layoutEntries.map(f => `${deckSlug}/${f.replace(/\.tsx?$/, "")}`)
|
|
796
822
|
const slideSlugs = slideEntries.map(f => `${deckSlug}/${f.replace(/\.tsx?$/, "")}`)
|
|
797
823
|
const assetSlugs = publicAssets.map(a => assetFileToSlug(deckSlug, a.relativePath))
|
|
798
|
-
const allDeckDeps = [...slideSlugs, ...assetSlugs]
|
|
824
|
+
const allDeckDeps = [...themeSlugs, ...layoutSlugs, ...slideSlugs, ...assetSlugs]
|
|
799
825
|
|
|
800
826
|
// Bundle shared source files with the deck item so preview/install can resolve @/ imports
|
|
801
827
|
const sharedFiles = sharedSources.map(s => ({
|