@antigenic-oss/paint 0.2.6 → 0.2.7

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.
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('node:fs')
4
+ const os = require('node:os')
5
+ const path = require('node:path')
6
+ const { spawnSync } = require('node:child_process')
7
+
8
+ const APP_ROOT = path.resolve(__dirname, '..')
9
+ const PORT = '4210'
10
+
11
+ function runOrFail(cmd, args, opts = {}) {
12
+ const result = spawnSync(cmd, args, {
13
+ cwd: opts.cwd || APP_ROOT,
14
+ env: opts.env || process.env,
15
+ stdio: 'inherit',
16
+ })
17
+ if (result.status !== 0) {
18
+ process.exit(result.status || 1)
19
+ }
20
+ }
21
+
22
+ function run(cmd, args, opts = {}) {
23
+ return spawnSync(cmd, args, {
24
+ cwd: opts.cwd || APP_ROOT,
25
+ env: opts.env || process.env,
26
+ stdio: 'inherit',
27
+ })
28
+ }
29
+
30
+ function main() {
31
+ const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'paint-packed-smoke-'))
32
+ const packDir = path.join(tempRoot, 'pack')
33
+ const extractDir = path.join(tempRoot, 'extract')
34
+ const fakeHome = path.join(tempRoot, 'home')
35
+ fs.mkdirSync(packDir, { recursive: true })
36
+ fs.mkdirSync(extractDir, { recursive: true })
37
+ fs.mkdirSync(fakeHome, { recursive: true })
38
+
39
+ runOrFail('npm', ['pack', '--silent', '--pack-destination', packDir])
40
+
41
+ const tarball = fs
42
+ .readdirSync(packDir)
43
+ .find((name) => name.endsWith('.tgz'))
44
+ if (!tarball) {
45
+ console.error('Smoke test failed: npm pack produced no tarball.')
46
+ process.exit(1)
47
+ }
48
+
49
+ runOrFail('tar', ['-xzf', path.join(packDir, tarball), '-C', extractDir])
50
+
51
+ const packedRoot = path.join(extractDir, 'package')
52
+ const packedNodeModules = path.join(packedRoot, 'node_modules')
53
+ if (!fs.existsSync(packedNodeModules)) {
54
+ fs.symlinkSync(path.join(APP_ROOT, 'node_modules'), packedNodeModules, 'dir')
55
+ }
56
+
57
+ const env = {
58
+ ...process.env,
59
+ HOME: fakeHome,
60
+ USERPROFILE: fakeHome,
61
+ PAINT_SKIP_POSTINSTALL_BUILD: '1',
62
+ }
63
+
64
+ let started = false
65
+ try {
66
+ runOrFail('node', [path.join(packedRoot, 'bin', 'paint.js'), 'start', '--rebuild', '--port', PORT], {
67
+ cwd: packedRoot,
68
+ env,
69
+ })
70
+ started = true
71
+ } finally {
72
+ if (started) {
73
+ run('node', [path.join(packedRoot, 'bin', 'paint.js'), 'stop'], {
74
+ cwd: packedRoot,
75
+ env,
76
+ })
77
+ }
78
+ }
79
+ }
80
+
81
+ main()
package/next.config.mjs CHANGED
@@ -1,4 +1,14 @@
1
+ import path from 'node:path'
2
+
1
3
  const nextConfig = {
4
+ webpack(config) {
5
+ config.resolve = config.resolve || {}
6
+ config.resolve.alias = config.resolve.alias || {}
7
+ // Force runtime alias resolution even if tsconfig path loading is skipped.
8
+ config.resolve.alias['@'] = path.resolve(process.cwd(), 'src')
9
+ return config
10
+ },
11
+
2
12
  async headers() {
3
13
  return [
4
14
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antigenic-oss/paint",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Visual editor for localhost web projects with a global paint CLI",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/Antigenic-OSS/pAInt",
@@ -47,11 +47,13 @@
47
47
  "dev:all": "node ./bin/terminal-server.js & node ./bin/bridge-server.js & next dev --port 4000 --turbopack",
48
48
  "bridge": "node ./bin/bridge-server.js",
49
49
  "postinstall": "node ./bin/postinstall.js",
50
- "build": "next build",
50
+ "build": "next build --webpack",
51
51
  "start": "next start --port 4000",
52
52
  "lint": "biome lint .",
53
53
  "lint:fix": "biome lint --write .",
54
54
  "format": "biome format --write .",
55
+ "smoke:packed-global": "node ./bin/smoke-packed-global.js",
56
+ "prepublishOnly": "npm run smoke:packed-global",
55
57
  "changeset": "changeset",
56
58
  "version-packages": "changeset version",
57
59
  "release": "changeset publish"