@platformatic/node 2.64.0 → 2.65.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/index.js CHANGED
@@ -72,7 +72,7 @@ export class NodeStackable extends BaseStackable {
72
72
 
73
73
  const config = this.configManager.current
74
74
 
75
- if (!this.isProduction && await isServiceBuildable(this.root, config)) {
75
+ if (!this.isProduction && (await isServiceBuildable(this.root, config))) {
76
76
  this.logger.info(`Building "${this.serviceId}" before starting, in dev`)
77
77
  try {
78
78
  await this.build()
@@ -434,6 +434,7 @@ export async function buildStackable (opts) {
434
434
  return new NodeStackable(opts, root, configManager)
435
435
  }
436
436
 
437
+ export { Generator } from './lib/generator.js'
437
438
  export { schema, schemaComponents } from './lib/schema.js'
438
439
 
439
440
  export default {
@@ -0,0 +1,71 @@
1
+ 'use strict'
2
+
3
+ import { BaseGenerator } from '@platformatic/generators'
4
+
5
+ const indexFile = `
6
+ import { createServer } from 'node:http'
7
+
8
+ export function create() {
9
+ return createServer((req, res) => {
10
+ res.writeHead(200, { 'content-type': 'application/json', connection: 'close' })
11
+ res.end(JSON.stringify({ hello: 'world' }))
12
+ })
13
+ }
14
+ `
15
+
16
+ export class Generator extends BaseGenerator {
17
+ constructor (opts = {}) {
18
+ super({
19
+ ...opts,
20
+ module: '@platformatic/node'
21
+ })
22
+ }
23
+
24
+ async prepare () {
25
+ if (this.config.isUpdating) {
26
+ return
27
+ }
28
+
29
+ await this.getPlatformaticVersion()
30
+
31
+ this.addFile({ path: '', file: 'index.js', contents: indexFile.trim() + '\n' })
32
+
33
+ this.addFile({
34
+ path: '',
35
+ file: 'package.json',
36
+ contents: JSON.stringify(
37
+ {
38
+ name: `${this.config.serviceName}`,
39
+ main: 'index.js',
40
+ scripts: {
41
+ start: 'node index.js'
42
+ },
43
+ dependencies: {
44
+ '@platformatic/node': `^${this.platformaticVersion}`
45
+ }
46
+ },
47
+ null,
48
+ 2
49
+ )
50
+ })
51
+
52
+ this.addFile({
53
+ path: '',
54
+ file: 'watt.json',
55
+ contents: JSON.stringify(
56
+ {
57
+ $schema: `https://schemas.platformatic.dev/@platformatic/node/${this.platformaticVersion}.json`
58
+ },
59
+ null,
60
+ 2
61
+ )
62
+ })
63
+
64
+ return {
65
+ targetDirectory: this.targetDirectory,
66
+ env: this.config.env
67
+ }
68
+ }
69
+
70
+ async _getConfigFileContents () {}
71
+ }
package/lib/schema.js CHANGED
@@ -4,6 +4,8 @@ import { readFileSync } from 'node:fs'
4
4
 
5
5
  export const packageJson = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf-8'))
6
6
 
7
+ export const version = packageJson.version
8
+
7
9
  const node = {
8
10
  type: 'object',
9
11
  properties: {
@@ -31,7 +33,7 @@ const node = {
31
33
  export const schemaComponents = { node }
32
34
 
33
35
  export const schema = {
34
- $id: `https://schemas.platformatic.dev/@platformatic/node/${packageJson.version}.json`,
36
+ $id: `https://schemas.platformatic.dev/@platformatic/node/${version}.json`,
35
37
  $schema: 'http://json-schema.org/draft-07/schema#',
36
38
  title: 'Platformatic Node.js Stackable',
37
39
  type: 'object',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/node",
3
- "version": "2.64.0",
3
+ "version": "2.65.1",
4
4
  "description": "Platformatic Node.js Stackable",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -17,9 +17,10 @@
17
17
  "dependencies": {
18
18
  "json5": "^2.2.3",
19
19
  "light-my-request": "^6.0.0",
20
- "@platformatic/basic": "2.64.0",
21
- "@platformatic/utils": "2.64.0",
22
- "@platformatic/config": "2.64.0"
20
+ "@platformatic/basic": "2.65.1",
21
+ "@platformatic/config": "2.65.1",
22
+ "@platformatic/generators": "2.65.1",
23
+ "@platformatic/utils": "2.65.1"
23
24
  },
24
25
  "devDependencies": {
25
26
  "borp": "^0.20.0",
@@ -31,8 +32,8 @@
31
32
  "neostandard": "^0.12.0",
32
33
  "tsx": "^4.19.0",
33
34
  "typescript": "^5.5.4",
34
- "@platformatic/composer": "2.64.0",
35
- "@platformatic/service": "2.64.0"
35
+ "@platformatic/composer": "2.65.1",
36
+ "@platformatic/service": "2.65.1"
36
37
  },
37
38
  "scripts": {
38
39
  "test": "pnpm run lint && borp --concurrency=1 --no-timeout",
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/node/2.64.0.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/node/2.65.1.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Node.js Stackable",
5
5
  "type": "object",