@platformatic/nuxt 0.0.1 → 3.58.1
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/LICENSE +201 -0
- package/README.md +26 -0
- package/config.d.ts +749 -0
- package/eslint.config.js +3 -0
- package/index.d.ts +35 -0
- package/index.js +31 -0
- package/lib/capability.js +255 -0
- package/lib/schema.js +50 -0
- package/package.json +39 -18
- package/schema.json +2805 -0
- package/test/backlog.test.js +88 -0
- package/test/development.test.js +216 -0
- package/test/fetch.test.js +67 -0
- package/test/fixtures/composer-autodetect-prefix/package.json +10 -0
- package/test/fixtures/composer-autodetect-prefix/platformatic.runtime.json +24 -0
- package/test/fixtures/composer-autodetect-prefix/services/frontend/app.vue +8 -0
- package/test/fixtures/composer-autodetect-prefix/services/frontend/nuxt.config.js +16 -0
- package/test/fixtures/composer-autodetect-prefix/services/frontend/package.json +9 -0
- package/test/fixtures/composer-autodetect-prefix/services/frontend/platformatic.application.json +6 -0
- package/test/fixtures/composer-custom-commands/package.json +11 -0
- package/test/fixtures/composer-custom-commands/platformatic.runtime.json +24 -0
- package/test/fixtures/composer-custom-commands/services/frontend/app.vue +8 -0
- package/test/fixtures/composer-custom-commands/services/frontend/nuxt.config.js +16 -0
- package/test/fixtures/composer-custom-commands/services/frontend/package.json +16 -0
- package/test/fixtures/composer-custom-commands/services/frontend/platformatic.application.json +11 -0
- package/test/fixtures/composer-with-prefix/package.json +10 -0
- package/test/fixtures/composer-with-prefix/platformatic.runtime.json +24 -0
- package/test/fixtures/composer-with-prefix/services/frontend/app.vue +8 -0
- package/test/fixtures/composer-with-prefix/services/frontend/nuxt.config.js +16 -0
- package/test/fixtures/composer-with-prefix/services/frontend/package.json +9 -0
- package/test/fixtures/composer-with-prefix/services/frontend/platformatic.application.json +6 -0
- package/test/fixtures/composer-without-prefix/package.json +10 -0
- package/test/fixtures/composer-without-prefix/platformatic.runtime.json +24 -0
- package/test/fixtures/composer-without-prefix/services/frontend/app.vue +8 -0
- package/test/fixtures/composer-without-prefix/services/frontend/nuxt.config.js +13 -0
- package/test/fixtures/composer-without-prefix/services/frontend/package.json +9 -0
- package/test/fixtures/composer-without-prefix/services/frontend/platformatic.application.json +3 -0
- package/test/fixtures/fetch-test/package.json +10 -0
- package/test/fixtures/fetch-test/platformatic.runtime.json +24 -0
- package/test/fixtures/fetch-test/services/frontend/app.vue +29 -0
- package/test/fixtures/fetch-test/services/frontend/nuxt.config.js +15 -0
- package/test/fixtures/fetch-test/services/frontend/package.json +9 -0
- package/test/fixtures/fetch-test/services/frontend/platformatic.application.json +6 -0
- package/test/fixtures/logger/package.json +8 -0
- package/test/fixtures/logger/platformatic.runtime.json +15 -0
- package/test/fixtures/logger/services/frontend/app.vue +12 -0
- package/test/fixtures/logger/services/frontend/logger-formatters.js +7 -0
- package/test/fixtures/logger/services/frontend/nuxt.config.js +12 -0
- package/test/fixtures/logger/services/frontend/package.json +9 -0
- package/test/fixtures/logger/services/frontend/platformatic.application.json +14 -0
- package/test/fixtures/metrics/package.json +10 -0
- package/test/fixtures/metrics/platformatic.runtime.json +25 -0
- package/test/fixtures/metrics/services/backend/package.json +6 -0
- package/test/fixtures/metrics/services/backend/platformatic.json +16 -0
- package/test/fixtures/metrics/services/backend/plugins/example.js +3 -0
- package/test/fixtures/metrics/services/backend/routes/root.js +30 -0
- package/test/fixtures/metrics/services/composer/package.json +6 -0
- package/test/fixtures/metrics/services/composer/platformatic.json +14 -0
- package/test/fixtures/metrics/services/frontend/app.vue +8 -0
- package/test/fixtures/metrics/services/frontend/nuxt.config.js +15 -0
- package/test/fixtures/metrics/services/frontend/package.json +9 -0
- package/test/fixtures/metrics/services/frontend/platformatic.application.json +6 -0
- package/test/fixtures/ssr-autodetect-prefix/package.json +10 -0
- package/test/fixtures/ssr-autodetect-prefix/platformatic.runtime.json +24 -0
- package/test/fixtures/ssr-autodetect-prefix/services/frontend/app.vue +8 -0
- package/test/fixtures/ssr-autodetect-prefix/services/frontend/nuxt.config.js +15 -0
- package/test/fixtures/ssr-autodetect-prefix/services/frontend/package.json +9 -0
- package/test/fixtures/ssr-autodetect-prefix/services/frontend/platformatic.application.json +6 -0
- package/test/fixtures/ssr-custom-commands/package.json +11 -0
- package/test/fixtures/ssr-custom-commands/platformatic.runtime.json +24 -0
- package/test/fixtures/ssr-custom-commands/services/frontend/app.vue +8 -0
- package/test/fixtures/ssr-custom-commands/services/frontend/nuxt.config.js +15 -0
- package/test/fixtures/ssr-custom-commands/services/frontend/package.json +16 -0
- package/test/fixtures/ssr-custom-commands/services/frontend/platformatic.application.json +11 -0
- package/test/fixtures/ssr-standalone/package.json +8 -0
- package/test/fixtures/ssr-standalone/platformatic.runtime.json +15 -0
- package/test/fixtures/ssr-standalone/services/frontend/app.vue +8 -0
- package/test/fixtures/ssr-standalone/services/frontend/nuxt.config.js +12 -0
- package/test/fixtures/ssr-standalone/services/frontend/package.json +9 -0
- package/test/fixtures/ssr-standalone/services/frontend/platformatic.application.json +3 -0
- package/test/fixtures/ssr-with-prefix/package.json +10 -0
- package/test/fixtures/ssr-with-prefix/platformatic.runtime.json +24 -0
- package/test/fixtures/ssr-with-prefix/services/frontend/app.vue +8 -0
- package/test/fixtures/ssr-with-prefix/services/frontend/nuxt.config.js +15 -0
- package/test/fixtures/ssr-with-prefix/services/frontend/package.json +9 -0
- package/test/fixtures/ssr-with-prefix/services/frontend/platformatic.application.json +6 -0
- package/test/fixtures/ssr-without-prefix/package.json +10 -0
- package/test/fixtures/ssr-without-prefix/platformatic.runtime.json +24 -0
- package/test/fixtures/ssr-without-prefix/services/frontend/app.vue +8 -0
- package/test/fixtures/ssr-without-prefix/services/frontend/nuxt.config.js +12 -0
- package/test/fixtures/ssr-without-prefix/services/frontend/package.json +9 -0
- package/test/fixtures/ssr-without-prefix/services/frontend/platformatic.application.json +3 -0
- package/test/fixtures/standalone/package.json +8 -0
- package/test/fixtures/standalone/platformatic.runtime.json +15 -0
- package/test/fixtures/standalone/services/frontend/app.vue +8 -0
- package/test/fixtures/standalone/services/frontend/nuxt.config.js +13 -0
- package/test/fixtures/standalone/services/frontend/package.json +9 -0
- package/test/fixtures/standalone/services/frontend/platformatic.application.json +3 -0
- package/test/helper.js +1 -0
- package/test/https.test.js +43 -0
- package/test/logger.test.js +31 -0
- package/test/metrics.test.js +46 -0
- package/test/miscellaneous.test.js +33 -0
- package/test/production.test.js +153 -0
- package/test/types/index.tst.ts +34 -0
- package/test/version-check.test.js +29 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://schemas.platformatic.dev/@platformatic/runtime/2.0.0.json",
|
|
3
|
+
"entrypoint": "composer",
|
|
4
|
+
"services": [
|
|
5
|
+
{
|
|
6
|
+
"id": "frontend",
|
|
7
|
+
"config": "platformatic.application.json",
|
|
8
|
+
"path": "./services/frontend"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"id": "backend",
|
|
12
|
+
"config": "platformatic.json",
|
|
13
|
+
"path": "./services/backend"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"id": "composer",
|
|
17
|
+
"config": "platformatic.json",
|
|
18
|
+
"path": "./services/composer"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"logger": {
|
|
22
|
+
"level": "error"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineNuxtConfig } from 'nuxt/config'
|
|
2
|
+
|
|
3
|
+
export default defineNuxtConfig({
|
|
4
|
+
app: {
|
|
5
|
+
baseURL: '/frontend/'
|
|
6
|
+
},
|
|
7
|
+
compatibilityDate: '2026-06-15',
|
|
8
|
+
telemetry: false,
|
|
9
|
+
devtools: { enabled: false },
|
|
10
|
+
vite: {
|
|
11
|
+
server: {
|
|
12
|
+
allowedHosts: ['.plt.local']
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://schemas.platformatic.dev/@platformatic/runtime/2.0.0.json",
|
|
3
|
+
"entrypoint": "composer",
|
|
4
|
+
"services": [
|
|
5
|
+
{
|
|
6
|
+
"id": "frontend",
|
|
7
|
+
"config": "platformatic.application.json",
|
|
8
|
+
"path": "./services/frontend"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"id": "backend",
|
|
12
|
+
"config": "platformatic.json",
|
|
13
|
+
"path": "./services/backend"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"id": "composer",
|
|
17
|
+
"config": "platformatic.json",
|
|
18
|
+
"path": "./services/composer"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"logger": {
|
|
22
|
+
"level": "error"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://schemas.platformatic.dev/@platformatic/runtime/2.0.0.json",
|
|
3
|
+
"entrypoint": "frontend",
|
|
4
|
+
"services": [
|
|
5
|
+
{
|
|
6
|
+
"id": "frontend",
|
|
7
|
+
"config": "platformatic.application.json",
|
|
8
|
+
"path": "./services/frontend"
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"logger": {
|
|
12
|
+
"level": "info"
|
|
13
|
+
},
|
|
14
|
+
"restartOnError": false
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineNuxtConfig } from 'nuxt/config'
|
|
2
|
+
|
|
3
|
+
export default defineNuxtConfig({
|
|
4
|
+
ssr: false,
|
|
5
|
+
compatibilityDate: '2026-06-15',
|
|
6
|
+
telemetry: false,
|
|
7
|
+
devtools: { enabled: false },
|
|
8
|
+
vite: {
|
|
9
|
+
server: {
|
|
10
|
+
allowedHosts: ['.plt.local']
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
})
|
package/test/helper.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const additionalDependencies = ['nuxt', 'vue', 'vite']
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ok } from 'node:assert'
|
|
2
|
+
import { resolve } from 'node:path'
|
|
3
|
+
import { test } from 'node:test'
|
|
4
|
+
import {
|
|
5
|
+
buildRuntime,
|
|
6
|
+
configureHTTPS,
|
|
7
|
+
createHTTPSDispatcher,
|
|
8
|
+
prepareRuntime,
|
|
9
|
+
setAdditionalDependencies,
|
|
10
|
+
setFixturesDir,
|
|
11
|
+
startRuntime,
|
|
12
|
+
verifyHTMLViaHTTPS
|
|
13
|
+
} from '../../basic/test/helper.js'
|
|
14
|
+
import { additionalDependencies } from './helper.js'
|
|
15
|
+
|
|
16
|
+
setFixturesDir(resolve(import.meta.dirname, './fixtures'))
|
|
17
|
+
setAdditionalDependencies(additionalDependencies)
|
|
18
|
+
|
|
19
|
+
async function startHTTPSRuntime (t, production) {
|
|
20
|
+
const { runtime, root } = await prepareRuntime(t, 'standalone', production, null, configureHTTPS)
|
|
21
|
+
|
|
22
|
+
if (production) {
|
|
23
|
+
await buildRuntime(root)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const url = await startRuntime(t, runtime)
|
|
27
|
+
ok(url.startsWith('https://'))
|
|
28
|
+
return url
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
test('supports https server options in development mode', async t => {
|
|
32
|
+
const dispatcher = createHTTPSDispatcher(t)
|
|
33
|
+
const url = await startHTTPSRuntime(t, false)
|
|
34
|
+
|
|
35
|
+
await verifyHTMLViaHTTPS(url, '/', ['<script>window.__NUXT__={}'], dispatcher)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
test('supports https server options in production mode', async t => {
|
|
39
|
+
const dispatcher = createHTTPSDispatcher(t)
|
|
40
|
+
const url = await startHTTPSRuntime(t, true)
|
|
41
|
+
|
|
42
|
+
await verifyHTMLViaHTTPS(url, '/', ['<script>window.__NUXT__={}'], dispatcher)
|
|
43
|
+
})
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { strict as assert } from 'node:assert'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { test } from 'node:test'
|
|
4
|
+
import { request } from 'undici'
|
|
5
|
+
import { createRuntime, getLogsFromFile } from '../../basic/test/helper.js'
|
|
6
|
+
|
|
7
|
+
test('logger options', async t => {
|
|
8
|
+
const { url, root, runtime } = await createRuntime({
|
|
9
|
+
t,
|
|
10
|
+
root: path.resolve(import.meta.dirname, './fixtures/logger'),
|
|
11
|
+
build: true,
|
|
12
|
+
production: true
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
await request(`${url}/`, { headers: { Authorization: 'token' } })
|
|
16
|
+
await runtime.close()
|
|
17
|
+
|
|
18
|
+
const logs = await getLogsFromFile(root)
|
|
19
|
+
|
|
20
|
+
assert.ok(
|
|
21
|
+
logs.find(log => {
|
|
22
|
+
return (
|
|
23
|
+
log.stdout &&
|
|
24
|
+
log.stdout.name === 'nuxt' &&
|
|
25
|
+
log.stdout.level === 'INFO' &&
|
|
26
|
+
log.stdout.time.length === 24 &&
|
|
27
|
+
log.stdout.msg === 'Log from Nuxt App page'
|
|
28
|
+
)
|
|
29
|
+
})
|
|
30
|
+
)
|
|
31
|
+
})
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import assert from 'node:assert'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { test } from 'node:test'
|
|
4
|
+
import { request } from 'undici'
|
|
5
|
+
import { createRuntime } from '../../basic/test/helper.js'
|
|
6
|
+
import { assertMetric, expectedMetrics } from '../../metrics/test/helper.js'
|
|
7
|
+
|
|
8
|
+
const envs = {
|
|
9
|
+
production: {
|
|
10
|
+
build: true,
|
|
11
|
+
production: true
|
|
12
|
+
},
|
|
13
|
+
dev: {
|
|
14
|
+
build: false,
|
|
15
|
+
production: false
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
for (const [env, options] of Object.entries(envs)) {
|
|
20
|
+
test(`Nuxt application properly collects metrics ${env}`, async t => {
|
|
21
|
+
const { url } = await createRuntime({
|
|
22
|
+
t,
|
|
23
|
+
root: path.resolve(import.meta.dirname, './fixtures/metrics'),
|
|
24
|
+
build: options.build,
|
|
25
|
+
production: options.production
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
{
|
|
29
|
+
const res = await request(`${url}/`)
|
|
30
|
+
const body = await res.body.text()
|
|
31
|
+
|
|
32
|
+
assert.ok(body.length > 0)
|
|
33
|
+
assert.strictEqual(res.statusCode, 200)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
{
|
|
37
|
+
const hostname = new URL(url).hostname
|
|
38
|
+
const res = await request(`http://${hostname}:9090/metrics`)
|
|
39
|
+
const metrics = await res.body.text()
|
|
40
|
+
|
|
41
|
+
for (const metric of expectedMetrics) {
|
|
42
|
+
assertMetric(metrics, metric)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { deepStrictEqual, ok } from 'node:assert'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { test } from 'node:test'
|
|
4
|
+
import { request } from 'undici'
|
|
5
|
+
import { createRuntime, getLogsFromFile } from '../../basic/test/helper.js'
|
|
6
|
+
|
|
7
|
+
test('should not show start in handle mode in production', async t => {
|
|
8
|
+
const { url, root, runtime } = await createRuntime({
|
|
9
|
+
t,
|
|
10
|
+
root: path.resolve(import.meta.dirname, './fixtures/standalone'),
|
|
11
|
+
build: true,
|
|
12
|
+
production: true
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
{
|
|
16
|
+
const { statusCode } = await request(url + '/')
|
|
17
|
+
deepStrictEqual(statusCode, 200)
|
|
18
|
+
await runtime.close()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const logs = await getLogsFromFile(root)
|
|
22
|
+
|
|
23
|
+
ok(
|
|
24
|
+
!logs.find(
|
|
25
|
+
entry =>
|
|
26
|
+
entry.level === 40 &&
|
|
27
|
+
entry.name === 'frontend' &&
|
|
28
|
+
entry.msg.startsWith(
|
|
29
|
+
'A listener has been added for the "process.uncaughtException" event. This listener will be never triggered as Watt default behavior will kill the process before.'
|
|
30
|
+
)
|
|
31
|
+
)
|
|
32
|
+
)
|
|
33
|
+
})
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { resolve } from 'node:path'
|
|
2
|
+
import {
|
|
3
|
+
internalApplicationsFiles,
|
|
4
|
+
setAdditionalDependencies,
|
|
5
|
+
setFixturesDir,
|
|
6
|
+
verifyBuildAndProductionMode,
|
|
7
|
+
verifyFrontendOnAutodetectedPrefix,
|
|
8
|
+
verifyFrontendOnPrefix,
|
|
9
|
+
verifyFrontendOnRoot,
|
|
10
|
+
verifyHTMLViaHTTP,
|
|
11
|
+
verifyPlatformaticGateway,
|
|
12
|
+
verifyPlatformaticService,
|
|
13
|
+
} from '../../basic/test/helper.js'
|
|
14
|
+
import { additionalDependencies } from './helper.js'
|
|
15
|
+
|
|
16
|
+
process.setMaxListeners(100)
|
|
17
|
+
setFixturesDir(resolve(import.meta.dirname, './fixtures'))
|
|
18
|
+
setAdditionalDependencies(additionalDependencies)
|
|
19
|
+
|
|
20
|
+
const files = ['services/frontend/.output/server/index.mjs']
|
|
21
|
+
|
|
22
|
+
const htmlContents = ['<script>window.__NUXT__={}']
|
|
23
|
+
|
|
24
|
+
function verifyStandalone (_, url) {
|
|
25
|
+
return verifyHTMLViaHTTP(url, '/', [htmlContents])
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function verifyComposerOnPrefix (_, url) {
|
|
29
|
+
await verifyHTMLViaHTTP(url, '/frontend', [htmlContents])
|
|
30
|
+
await verifyHTMLViaHTTP(url, '/frontend/', [htmlContents])
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function verifyComposerOnAutodetectedPrefix (_, url) {
|
|
34
|
+
await verifyHTMLViaHTTP(url, '/nested/base/dir', [htmlContents])
|
|
35
|
+
await verifyHTMLViaHTTP(url, '/nested/base/dir/', [htmlContents])
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const configurations = [
|
|
39
|
+
{
|
|
40
|
+
id: 'standalone',
|
|
41
|
+
name: 'Nuxt (standalone)',
|
|
42
|
+
files,
|
|
43
|
+
checks: [verifyStandalone],
|
|
44
|
+
language: 'js',
|
|
45
|
+
prefix: '',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 'composer-with-prefix',
|
|
49
|
+
name: 'Nuxt (in composer with prefix)',
|
|
50
|
+
files: [...files, ...internalApplicationsFiles],
|
|
51
|
+
checks: [
|
|
52
|
+
verifyComposerOnPrefix,
|
|
53
|
+
verifyPlatformaticGateway,
|
|
54
|
+
verifyPlatformaticService,
|
|
55
|
+
],
|
|
56
|
+
language: 'ts',
|
|
57
|
+
prefix: '/frontend',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 'composer-without-prefix',
|
|
61
|
+
name: 'Nuxt (in composer without prefix)',
|
|
62
|
+
files,
|
|
63
|
+
checks: [
|
|
64
|
+
verifyStandalone,
|
|
65
|
+
verifyPlatformaticGateway,
|
|
66
|
+
verifyPlatformaticService,
|
|
67
|
+
],
|
|
68
|
+
language: 'js',
|
|
69
|
+
prefix: '',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: 'composer-autodetect-prefix',
|
|
73
|
+
name: 'Nuxt (in composer with autodetected prefix)',
|
|
74
|
+
files,
|
|
75
|
+
checks: [
|
|
76
|
+
verifyComposerOnAutodetectedPrefix,
|
|
77
|
+
verifyPlatformaticGateway,
|
|
78
|
+
verifyPlatformaticService,
|
|
79
|
+
],
|
|
80
|
+
language: 'js',
|
|
81
|
+
prefix: '/nested/base/dir',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: 'composer-custom-commands',
|
|
85
|
+
name: 'Nuxt (in composer with prefix using custom commands)',
|
|
86
|
+
files,
|
|
87
|
+
checks: [
|
|
88
|
+
verifyComposerOnPrefix,
|
|
89
|
+
verifyPlatformaticGateway,
|
|
90
|
+
verifyPlatformaticService,
|
|
91
|
+
],
|
|
92
|
+
language: 'js',
|
|
93
|
+
prefix: '/frontend',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: 'ssr-standalone',
|
|
97
|
+
name: 'Nuxt SSR (standalone)',
|
|
98
|
+
files,
|
|
99
|
+
checks: [verifyFrontendOnRoot],
|
|
100
|
+
language: 'js',
|
|
101
|
+
prefix: '',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: 'ssr-with-prefix',
|
|
105
|
+
name: 'Nuxt SSR (in composer with prefix)',
|
|
106
|
+
files: [...files, ...internalApplicationsFiles],
|
|
107
|
+
checks: [
|
|
108
|
+
verifyFrontendOnPrefix,
|
|
109
|
+
verifyPlatformaticGateway,
|
|
110
|
+
verifyPlatformaticService,
|
|
111
|
+
],
|
|
112
|
+
language: 'ts',
|
|
113
|
+
prefix: '/frontend',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: 'ssr-without-prefix',
|
|
117
|
+
name: 'Nuxt SSR (in composer without prefix)',
|
|
118
|
+
files,
|
|
119
|
+
checks: [
|
|
120
|
+
verifyFrontendOnRoot,
|
|
121
|
+
verifyPlatformaticGateway,
|
|
122
|
+
verifyPlatformaticService,
|
|
123
|
+
],
|
|
124
|
+
language: 'js',
|
|
125
|
+
prefix: '',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
id: 'ssr-autodetect-prefix',
|
|
129
|
+
name: 'Nuxt SSR (in composer with autodetected prefix)',
|
|
130
|
+
files,
|
|
131
|
+
checks: [
|
|
132
|
+
verifyFrontendOnAutodetectedPrefix,
|
|
133
|
+
verifyPlatformaticGateway,
|
|
134
|
+
verifyPlatformaticService,
|
|
135
|
+
],
|
|
136
|
+
language: 'js',
|
|
137
|
+
prefix: '/nested/base/dir',
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: 'ssr-custom-commands',
|
|
141
|
+
name: 'Nuxt SSR (in composer with prefix using custom commands)',
|
|
142
|
+
files,
|
|
143
|
+
checks: [
|
|
144
|
+
verifyFrontendOnPrefix,
|
|
145
|
+
verifyPlatformaticGateway,
|
|
146
|
+
verifyPlatformaticService,
|
|
147
|
+
],
|
|
148
|
+
language: 'js',
|
|
149
|
+
prefix: '/frontend',
|
|
150
|
+
},
|
|
151
|
+
]
|
|
152
|
+
|
|
153
|
+
verifyBuildAndProductionMode(configurations)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Configuration } from '@platformatic/foundation'
|
|
2
|
+
import type { JSONSchemaType } from 'ajv'
|
|
3
|
+
import { expect, test } from 'tstyche'
|
|
4
|
+
import {
|
|
5
|
+
NuxtCapability,
|
|
6
|
+
type PlatformaticNuxtConfig,
|
|
7
|
+
create,
|
|
8
|
+
loadConfiguration,
|
|
9
|
+
packageJson,
|
|
10
|
+
schema,
|
|
11
|
+
schemaComponents,
|
|
12
|
+
supportedVersions,
|
|
13
|
+
version
|
|
14
|
+
} from '../../index.js'
|
|
15
|
+
|
|
16
|
+
test('Nuxt types', () => {
|
|
17
|
+
const config = {} as PlatformaticNuxtConfig
|
|
18
|
+
|
|
19
|
+
expect(loadConfiguration('/tmp', config)).type.toBe<Promise<Configuration<PlatformaticNuxtConfig>>>()
|
|
20
|
+
expect(create('/tmp', config)).type.toBe<Promise<NuxtCapability>>()
|
|
21
|
+
expect(create(config)).type.toBe<Promise<NuxtCapability>>()
|
|
22
|
+
|
|
23
|
+
expect(loadConfiguration).type.toBeCallableWith('/tmp', config)
|
|
24
|
+
expect(create).type.toBeCallableWith('/tmp', config)
|
|
25
|
+
|
|
26
|
+
expect(loadConfiguration('/tmp', config, {} as Parameters<typeof loadConfiguration>[2])).type.toBe<Promise<Configuration<PlatformaticNuxtConfig>>>()
|
|
27
|
+
|
|
28
|
+
expect(schema).type.toBe<JSONSchemaType<PlatformaticNuxtConfig>>()
|
|
29
|
+
expect(schemaComponents).type.toBe<{ nuxt: unknown }>()
|
|
30
|
+
expect(packageJson).type.toBe<Record<string, unknown>>()
|
|
31
|
+
expect(version).type.toBe<string>()
|
|
32
|
+
expect(supportedVersions).type.toBe<string>()
|
|
33
|
+
expect(new NuxtCapability('/tmp', config)).type.toBe<NuxtCapability>()
|
|
34
|
+
})
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ok, rejects } from 'node:assert'
|
|
2
|
+
import { resolve } from 'node:path'
|
|
3
|
+
import { test } from 'node:test'
|
|
4
|
+
import { swapVersion } from '../../basic/test/helper-version.js'
|
|
5
|
+
import { getLogsFromFile, prepareRuntime, setFixturesDir } from '../../basic/test/helper.js'
|
|
6
|
+
|
|
7
|
+
setFixturesDir(resolve(import.meta.dirname, './fixtures'))
|
|
8
|
+
|
|
9
|
+
test('Nuxt version is checked in development', async t => {
|
|
10
|
+
const { runtime, root } = await prepareRuntime(t, 'standalone', false, null, async () => {
|
|
11
|
+
await swapVersion(t, import.meta.dirname, 'nuxt', '', '3.0.0')
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
await rejects(runtime.start())
|
|
15
|
+
const logs = await getLogsFromFile(root)
|
|
16
|
+
|
|
17
|
+
ok(logs.some(l => l.err?.message.includes('nuxt version 3.0.0 is not supported')))
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
test('Nuxt version is not checked in production', async t => {
|
|
21
|
+
const { runtime, root } = await prepareRuntime(t, 'standalone', true, null, async () => {
|
|
22
|
+
await swapVersion(t, import.meta.dirname, 'nuxt', '', '3.0.0')
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
await rejects(runtime.start())
|
|
26
|
+
const logs = await getLogsFromFile(root)
|
|
27
|
+
|
|
28
|
+
ok(!logs.some(l => l.err?.message.includes('nuxt version 3.0.0 is not supported')))
|
|
29
|
+
})
|