@nuasite/cli 0.32.0 → 0.35.0
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/index.js +32554 -224
- package/dist/tailwindcss-oxide.linux-x64-gnu-mvf0mxqy.node +0 -0
- package/dist/tailwindcss-oxide.linux-x64-musl-6h64xcrm.node +0 -0
- package/dist/types/migrate.d.ts +7 -0
- package/dist/types/migrate.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/src/index.ts +18 -6
- package/src/migrate.ts +41 -0
- package/src/tsconfig.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuasite/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"prepack": "bun run ../../scripts/workspace-deps/resolve-deps.ts"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@nuasite/agent-summary": "0.
|
|
26
|
+
"@nuasite/agent-summary": "0.35.0",
|
|
27
|
+
"@nuasite/cms": "0.35.0",
|
|
27
28
|
"astro": "6.1.4",
|
|
28
29
|
"stacktracey": "2.2.0"
|
|
29
30
|
},
|
package/src/index.ts
CHANGED
|
@@ -35,12 +35,13 @@ function proxyToAstroCLI(command: string, args: string[]) {
|
|
|
35
35
|
function printUsage() {
|
|
36
36
|
console.log('Usage: nua <command> [options]')
|
|
37
37
|
console.log('\nCommands:')
|
|
38
|
-
console.log(' build
|
|
39
|
-
console.log(' dev
|
|
40
|
-
console.log(' preview
|
|
41
|
-
console.log(' init
|
|
42
|
-
console.log(' clean
|
|
43
|
-
console.log('
|
|
38
|
+
console.log(' build Run astro build with the Nua defaults')
|
|
39
|
+
console.log(' dev Run astro dev with the Nua defaults')
|
|
40
|
+
console.log(' preview Run astro preview with the Nua defaults')
|
|
41
|
+
console.log(' init Convert a standard Astro project to use Nua')
|
|
42
|
+
console.log(' clean Eject to a standard Astro project (remove @nuasite/* deps)')
|
|
43
|
+
console.log(' migrate <target> Run a content migration. Targets: astro-image')
|
|
44
|
+
console.log(' help Show this message')
|
|
44
45
|
console.log('\nAll Astro CLI options are supported.\n')
|
|
45
46
|
}
|
|
46
47
|
|
|
@@ -105,6 +106,17 @@ if (canProxyDirectly && command && ['build', 'dev', 'preview'].includes(command)
|
|
|
105
106
|
})
|
|
106
107
|
break
|
|
107
108
|
}
|
|
109
|
+
case 'migrate': {
|
|
110
|
+
const target = args.find(a => !a.startsWith('-'))
|
|
111
|
+
if (!target) {
|
|
112
|
+
console.error('Usage: nua migrate <target> [--dry-run]')
|
|
113
|
+
console.error('Available targets: astro-image')
|
|
114
|
+
process.exit(1)
|
|
115
|
+
}
|
|
116
|
+
const { migrate } = await import('./migrate')
|
|
117
|
+
await migrate({ target, dryRun: args.includes('--dry-run') })
|
|
118
|
+
break
|
|
119
|
+
}
|
|
108
120
|
case 'help':
|
|
109
121
|
case '--help':
|
|
110
122
|
case '-h':
|
package/src/migrate.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { migrateAstroImages } from '@nuasite/cms'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
|
|
4
|
+
interface MigrateArgs {
|
|
5
|
+
target: string
|
|
6
|
+
dryRun: boolean
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export async function migrate(args: MigrateArgs): Promise<void> {
|
|
10
|
+
if (args.target !== 'astro-image') {
|
|
11
|
+
console.error(`Unknown migrate target: ${args.target}`)
|
|
12
|
+
console.error('Available targets: astro-image')
|
|
13
|
+
process.exit(1)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (args.dryRun) console.log('Dry run — no files will be modified.\n')
|
|
17
|
+
|
|
18
|
+
const result = await migrateAstroImages({ dryRun: args.dryRun })
|
|
19
|
+
|
|
20
|
+
if (result.migrations.length === 0) {
|
|
21
|
+
console.log('No entries needed migration.')
|
|
22
|
+
} else {
|
|
23
|
+
console.log(`${result.migrations.length} field(s) to migrate:\n`)
|
|
24
|
+
for (const m of result.migrations) {
|
|
25
|
+
console.log(` ${m.entrySourcePath}`)
|
|
26
|
+
console.log(` ${m.fieldName}: ${m.originalValue} → ${m.newValue}`)
|
|
27
|
+
console.log(` copy: ${path.relative(process.cwd(), m.copiedFrom)} → ${path.relative(process.cwd(), m.copiedTo)}`)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (result.skipped.length > 0) {
|
|
32
|
+
console.log(`\n${result.skipped.length} skipped:`)
|
|
33
|
+
for (const s of result.skipped) {
|
|
34
|
+
console.log(` ${s.entrySourcePath} ${s.fieldName}: ${s.reason}`)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (!args.dryRun && result.migrations.length > 0) {
|
|
39
|
+
console.log('\nDone. Run your dev server and verify Astro processes the images correctly.')
|
|
40
|
+
}
|
|
41
|
+
}
|
package/src/tsconfig.json
CHANGED