mango-cms 0.1.13 → 0.1.14

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.
Files changed (2) hide show
  1. package/package.json +5 -2
  2. package/webpack.config.js +14 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mango-cms",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "main": "index.js",
5
5
  "author": "Colton Neifert",
6
6
  "license": "ISC",
@@ -8,7 +8,10 @@
8
8
  "mango": "./cli.js"
9
9
  },
10
10
  "scripts": {
11
- "postinstall": ""
11
+ "postinstall": "",
12
+ "build": "npx webpack",
13
+ "watch": "NODE_OPTIONS='--trace-warnings' npx webpack --watch --mode development",
14
+ "dev": "NODE_OPTIONS='--trace-warnings' npx webpack --watch --mode development"
12
15
  },
13
16
  "dependencies": {
14
17
  "@aws-sdk/client-s3": "^3.423.0",
package/webpack.config.js CHANGED
@@ -3,23 +3,32 @@ const webpack = require('webpack');
3
3
  const nodeExternals = require('webpack-node-externals');
4
4
  const NodemonPlugin = require('nodemon-webpack-plugin');
5
5
 
6
+
6
7
  // Get the user's project root from the execution context (passed via CLI or fallback to cwd)
7
8
  process.env.PROJECT_ROOT = process.env.PROJECT_ROOT || process.cwd();
8
9
  process.env.MANGO_ROOT = process.env.MANGO_ROOT || __dirname;
10
+ let moduleLocation = process.env.PROJECT_ROOT
11
+
12
+ let legacyMode = process.env.PROJECT_ROOT == process.env.MANGO_ROOT
13
+ if (legacyMode) {
14
+ moduleLocation = __dirname
15
+ process.env.PROJECT_ROOT = path.join(__dirname, '..')
16
+ }
17
+ console.log('env', process.env.PROJECT_ROOT, process.env.MANGO_ROOT, legacyMode, path.resolve(moduleLocation, 'node_modules'))
18
+
9
19
  const userProjectRoot = process.env.PROJECT_ROOT
10
20
  const mangoRoot = process.env.MANGO_ROOT
21
+ const buildPath = legacyMode ? mangoRoot : userProjectRoot
11
22
 
12
- console.log('mangoRoot', mangoRoot)
23
+ console.log('moduleLocation', moduleLocation)
13
24
 
14
25
  module.exports = {
15
26
  mode: 'production',
16
27
  resolve: {
17
28
  alias: {
18
- // CMS source code lives in @mango-cms/core/src/cms
19
29
  '@mango': path.resolve(mangoRoot),
20
30
  '@cms': path.resolve(mangoRoot, 'src/cms'),
21
31
  '@fields': path.resolve(mangoRoot, 'src/cms/1. build/fields'),
22
- // Config folder is in the user's project root
23
32
  '@config': path.resolve(userProjectRoot, 'config'),
24
33
  },
25
34
  },
@@ -28,7 +37,7 @@ module.exports = {
28
37
  server: path.resolve(mangoRoot, 'src/main.js'), // Entry point in @mango-cms/core
29
38
  },
30
39
  output: {
31
- path: path.resolve(userProjectRoot, 'build'), // Output to user's project root
40
+ path: path.resolve(buildPath, 'build'), // Change to build in mango directory
32
41
  filename: 'index.js',
33
42
  },
34
43
  target: 'node',
@@ -41,7 +50,7 @@ module.exports = {
41
50
  nodeExternals(),
42
51
  // Also check for externals in the mango package
43
52
  nodeExternals({
44
- modulesDir: path.resolve(userProjectRoot, 'node_modules')
53
+ modulesDir: path.resolve(moduleLocation, 'node_modules')
45
54
  })
46
55
  ],
47
56
  };