@open-mercato/cli 0.5.1-develop.2681.c559bb2bc3 → 0.5.1-develop.2691.d8a0934b37
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/.turbo/turbo-build.log +2 -2
- package/build.mjs +54 -122
- package/package.json +5 -5
package/.turbo/turbo-build.log
CHANGED
package/build.mjs
CHANGED
|
@@ -1,130 +1,62 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { glob } from 'glob'
|
|
3
|
-
import { readFileSync, writeFileSync, chmodSync, existsSync, cpSync, mkdirSync, readdirSync } from 'node:fs'
|
|
1
|
+
import { chmodSync, cpSync, existsSync, mkdirSync, readdirSync, readFileSync } from 'node:fs'
|
|
4
2
|
import { dirname, join } from 'node:path'
|
|
5
3
|
import { fileURLToPath } from 'node:url'
|
|
4
|
+
import { atomicWriteFileSync } from '../../scripts/lib/add-js-extension.mjs'
|
|
5
|
+
import { buildPackage } from '../../scripts/build-package.mjs'
|
|
6
|
+
|
|
7
|
+
const packageDir = dirname(fileURLToPath(import.meta.url))
|
|
8
|
+
|
|
9
|
+
await buildPackage(packageDir, {
|
|
10
|
+
name: 'cli',
|
|
11
|
+
entryPoints: 'src/**/*.ts',
|
|
12
|
+
rewriteOptions: {
|
|
13
|
+
// Generated code templates keep `.ts` suffixes and template-literal placeholders
|
|
14
|
+
// (`${...}`) inside import strings; those must survive the rewrite untouched.
|
|
15
|
+
skipExtensions: ['.js', '.json', '.ts'],
|
|
16
|
+
skipTemplateLiterals: true,
|
|
17
|
+
},
|
|
18
|
+
afterBuild: async ({ outdir }) => {
|
|
19
|
+
// Prepend shebang + make bin.js executable. Use atomic write so concurrent
|
|
20
|
+
// consumers (turbo, yarn test:ephemeral pipeline) never observe a half-written file.
|
|
21
|
+
const binPath = join(outdir, 'bin.js')
|
|
22
|
+
const binContent = readFileSync(binPath, 'utf-8')
|
|
23
|
+
atomicWriteFileSync(binPath, '#!/usr/bin/env node\n' + binContent)
|
|
24
|
+
chmodSync(binPath, 0o755)
|
|
25
|
+
|
|
26
|
+
// Copy agentic source files from create-app so generators can read them at runtime.
|
|
27
|
+
const agenticSrc = join(packageDir, '..', 'create-app', 'agentic')
|
|
28
|
+
if (existsSync(agenticSrc)) {
|
|
29
|
+
cpSync(agenticSrc, join(outdir, 'agentic'), { recursive: true })
|
|
30
|
+
console.log('Copied create-app/agentic/ → dist/agentic/')
|
|
31
|
+
}
|
|
6
32
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
console.log(`Found ${entryPoints.length} entry points`)
|
|
21
|
-
|
|
22
|
-
// Plugin to add .js extension to relative imports
|
|
23
|
-
const addJsExtension = {
|
|
24
|
-
name: 'add-js-extension',
|
|
25
|
-
setup(build) {
|
|
26
|
-
build.onEnd(async (result) => {
|
|
27
|
-
if (result.errors.length > 0) return
|
|
28
|
-
const outputFiles = await glob('dist/**/*.js', { cwd: __dirname, absolute: true })
|
|
29
|
-
for (const file of outputFiles) {
|
|
30
|
-
const fileDir = dirname(file)
|
|
31
|
-
let content = readFileSync(file, 'utf-8')
|
|
32
|
-
// Add .js to relative imports that don't have an extension
|
|
33
|
-
content = content.replace(
|
|
34
|
-
/from\s+["'](\.[^"']+)["']/g,
|
|
35
|
-
(match, path) => {
|
|
36
|
-
// Skip paths that already have an extension (including .ts for generated code templates)
|
|
37
|
-
if (path.endsWith('.js') || path.endsWith('.json') || path.endsWith('.ts')) return match
|
|
38
|
-
// Skip paths containing template literal placeholders (code generation templates)
|
|
39
|
-
if (path.includes('${')) return match
|
|
40
|
-
// Check if it's a directory with index.js
|
|
41
|
-
const resolvedPath = join(fileDir, path)
|
|
42
|
-
if (existsSync(resolvedPath) && existsSync(join(resolvedPath, 'index.js'))) {
|
|
43
|
-
return `from "${path}/index.js"`
|
|
44
|
-
}
|
|
45
|
-
return `from "${path}.js"`
|
|
46
|
-
}
|
|
47
|
-
)
|
|
48
|
-
content = content.replace(
|
|
49
|
-
/import\s*\(\s*["'](\.[^"']+)["']\s*\)/g,
|
|
50
|
-
(match, path) => {
|
|
51
|
-
// Skip paths that already have an extension (including .ts for generated code templates)
|
|
52
|
-
if (path.endsWith('.js') || path.endsWith('.json') || path.endsWith('.ts')) return match
|
|
53
|
-
// Skip paths containing template literal placeholders (code generation templates)
|
|
54
|
-
if (path.includes('${')) return match
|
|
55
|
-
// Check if it's a directory with index.js
|
|
56
|
-
const resolvedPath = join(fileDir, path)
|
|
57
|
-
if (existsSync(resolvedPath) && existsSync(join(resolvedPath, 'index.js'))) {
|
|
58
|
-
return `import("${path}/index.js")`
|
|
59
|
-
}
|
|
60
|
-
return `import("${path}.js")`
|
|
61
|
-
}
|
|
62
|
-
)
|
|
63
|
-
writeFileSync(file, content)
|
|
33
|
+
// Discover standalone guides across sibling packages.
|
|
34
|
+
const packagesDir = join(packageDir, '..')
|
|
35
|
+
const guidesDestDir = join(outdir, 'agentic', 'guides')
|
|
36
|
+
mkdirSync(guidesDestDir, { recursive: true })
|
|
37
|
+
|
|
38
|
+
let guidesFound = 0
|
|
39
|
+
for (const pkg of readdirSync(packagesDir)) {
|
|
40
|
+
const guideSource = join(packagesDir, pkg, 'agentic', 'standalone-guide.md')
|
|
41
|
+
if (existsSync(guideSource)) {
|
|
42
|
+
cpSync(guideSource, join(guidesDestDir, `${pkg}.md`))
|
|
43
|
+
guidesFound++
|
|
64
44
|
}
|
|
65
|
-
})
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const outdir = join(__dirname, 'dist')
|
|
70
|
-
|
|
71
|
-
const result = await esbuild.build({
|
|
72
|
-
entryPoints,
|
|
73
|
-
outdir,
|
|
74
|
-
outbase: join(__dirname, 'src'),
|
|
75
|
-
format: 'esm',
|
|
76
|
-
platform: 'node',
|
|
77
|
-
target: 'node18',
|
|
78
|
-
sourcemap: true,
|
|
79
|
-
bundle: false,
|
|
80
|
-
write: true,
|
|
81
|
-
plugins: [addJsExtension],
|
|
82
|
-
})
|
|
83
45
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
process.exit(1)
|
|
87
|
-
}
|
|
46
|
+
const modulesDir = join(packagesDir, pkg, 'src', 'modules')
|
|
47
|
+
if (!existsSync(modulesDir)) continue
|
|
88
48
|
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const agenticSrc = join(__dirname, '..', 'create-app', 'agentic')
|
|
97
|
-
if (existsSync(agenticSrc)) {
|
|
98
|
-
cpSync(agenticSrc, join(outdir, 'agentic'), { recursive: true })
|
|
99
|
-
console.log('Copied create-app/agentic/ → dist/agentic/')
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const packagesDir = join(__dirname, '..')
|
|
103
|
-
const guidesDestDir = join(outdir, 'agentic', 'guides')
|
|
104
|
-
mkdirSync(guidesDestDir, { recursive: true })
|
|
105
|
-
|
|
106
|
-
let guidesFound = 0
|
|
107
|
-
for (const pkg of readdirSync(packagesDir)) {
|
|
108
|
-
const guideSource = join(packagesDir, pkg, 'agentic', 'standalone-guide.md')
|
|
109
|
-
if (existsSync(guideSource)) {
|
|
110
|
-
cpSync(guideSource, join(guidesDestDir, `${pkg}.md`))
|
|
111
|
-
guidesFound++
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const modulesDir = join(packagesDir, pkg, 'src', 'modules')
|
|
115
|
-
if (!existsSync(modulesDir)) continue
|
|
116
|
-
|
|
117
|
-
for (const mod of readdirSync(modulesDir)) {
|
|
118
|
-
const moduleGuideSource = join(modulesDir, mod, 'agentic', 'standalone-guide.md')
|
|
119
|
-
if (existsSync(moduleGuideSource)) {
|
|
120
|
-
cpSync(moduleGuideSource, join(guidesDestDir, `${pkg}.${mod}.md`))
|
|
121
|
-
guidesFound++
|
|
49
|
+
for (const mod of readdirSync(modulesDir)) {
|
|
50
|
+
const moduleGuideSource = join(modulesDir, mod, 'agentic', 'standalone-guide.md')
|
|
51
|
+
if (existsSync(moduleGuideSource)) {
|
|
52
|
+
cpSync(moduleGuideSource, join(guidesDestDir, `${pkg}.${mod}.md`))
|
|
53
|
+
guidesFound++
|
|
54
|
+
}
|
|
55
|
+
}
|
|
122
56
|
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (guidesFound > 0) {
|
|
127
|
-
console.log(`Discovered ${guidesFound} standalone guides → dist/agentic/guides/`)
|
|
128
|
-
}
|
|
129
57
|
|
|
130
|
-
|
|
58
|
+
if (guidesFound > 0) {
|
|
59
|
+
console.log(`Discovered ${guidesFound} standalone guides → dist/agentic/guides/`)
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-mercato/cli",
|
|
3
|
-
"version": "0.5.1-develop.
|
|
3
|
+
"version": "0.5.1-develop.2691.d8a0934b37",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"@mikro-orm/core": "^6.6.10",
|
|
59
59
|
"@mikro-orm/migrations": "^6.6.10",
|
|
60
60
|
"@mikro-orm/postgresql": "^6.6.10",
|
|
61
|
-
"@open-mercato/queue": "0.5.1-develop.
|
|
62
|
-
"@open-mercato/shared": "0.5.1-develop.
|
|
61
|
+
"@open-mercato/queue": "0.5.1-develop.2691.d8a0934b37",
|
|
62
|
+
"@open-mercato/shared": "0.5.1-develop.2691.d8a0934b37",
|
|
63
63
|
"cross-spawn": "^7.0.6",
|
|
64
64
|
"pg": "8.20.0",
|
|
65
65
|
"semver": "^7.7.4",
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
"typescript": "^5.9.3"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@open-mercato/shared": "0.5.1-develop.
|
|
72
|
+
"@open-mercato/shared": "0.5.1-develop.2691.d8a0934b37"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@open-mercato/shared": "0.5.1-develop.
|
|
75
|
+
"@open-mercato/shared": "0.5.1-develop.2691.d8a0934b37",
|
|
76
76
|
"@types/jest": "^30.0.0",
|
|
77
77
|
"jest": "^30.3.0",
|
|
78
78
|
"ts-jest": "^29.4.9"
|