@mongoosejs/studio 0.1.3 → 0.1.4

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/README.md CHANGED
@@ -62,11 +62,14 @@ Then, add `pages/api/studio.js` to your Next.js project to host the Mongoose Stu
62
62
  import db from '../../src/db';
63
63
  import studio from '@mongoosejs/studio/backend/next';
64
64
 
65
- const handler = studio({
66
- apiKey: process.env.MONGOOSE_STUDIO_API_KEY, // optional
67
- connection: db, // Optional: Connection or Mongoose global. If omitted, will use `import mongoose`
68
- connectToDB: async () => { /* connection logic here */ }, // Optional: if you need to call a function to connect to the database put it here
69
- });
65
+ const handler = studio(
66
+ db, // Mongoose connection or Mongoose global. Or null to use `import mongoose`.
67
+ {
68
+ apiKey: process.env.MONGOOSE_STUDIO_API_KEY, // optional
69
+ connection: db, // Optional: Connection or Mongoose global. If omitted, will use `import mongoose`
70
+ connectToDB: async () => { /* connection logic here */ }, // Optional: if you need to call a function to connect to the database put it here
71
+ }
72
+ );
70
73
 
71
74
  export default handler;
72
75
  ```
@@ -16609,7 +16609,7 @@ module.exports = function stringToParts(str) {
16609
16609
  /***/ ((module) => {
16610
16610
 
16611
16611
  "use strict";
16612
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@mongoosejs/studio","version":"0.1.3","description":"A sleek, powerful MongoDB UI with built-in dashboarding and auth, seamlessly integrated with your Express, Vercel, or Netlify app.","homepage":"https://studio.mongoosejs.io/","repository":{"type":"git","url":"https://github.com/mongoosejs/studio"},"license":"Apache-2.0","dependencies":{"archetype":"0.13.1","csv-stringify":"6.3.0","ejson":"^2.2.3","extrovert":"^0.1.0","marked":"15.0.12","node-inspect-extracted":"3.x","tailwindcss":"3.4.0","vanillatoasts":"^1.6.0","vue":"3.x","webpack":"5.x"},"peerDependencies":{"bson":"^5.5.1 || 6.x","express":"4.x","mongoose":"7.x || 8.x"},"devDependencies":{"@masteringjs/eslint-config":"0.1.1","axios":"1.2.2","dedent":"^1.6.0","eslint":"9.30.0","express":"4.x","mocha":"10.2.0","mongoose":"8.x"},"scripts":{"lint":"eslint .","tailwind":"tailwindcss -o ./frontend/public/tw.css","tailwind:watch":"tailwindcss -o ./frontend/public/tw.css --watch","test":"mocha test/*.test.js"}}');
16612
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@mongoosejs/studio","version":"0.1.4","description":"A sleek, powerful MongoDB UI with built-in dashboarding and auth, seamlessly integrated with your Express, Vercel, or Netlify app.","homepage":"https://studio.mongoosejs.io/","repository":{"type":"git","url":"https://github.com/mongoosejs/studio"},"license":"Apache-2.0","dependencies":{"archetype":"0.13.1","csv-stringify":"6.3.0","ejson":"^2.2.3","extrovert":"^0.1.0","marked":"15.0.12","node-inspect-extracted":"3.x","tailwindcss":"3.4.0","vanillatoasts":"^1.6.0","vue":"3.x","webpack":"5.x"},"peerDependencies":{"bson":"^5.5.1 || 6.x","express":"4.x","mongoose":"7.x || 8.x"},"devDependencies":{"@masteringjs/eslint-config":"0.1.1","axios":"1.2.2","dedent":"^1.6.0","eslint":"9.30.0","express":"4.x","mocha":"10.2.0","mongoose":"8.x"},"scripts":{"lint":"eslint .","tailwind":"tailwindcss -o ./frontend/public/tw.css","tailwind:watch":"tailwindcss -o ./frontend/public/tw.css --watch","test":"mocha test/*.test.js"}}');
16613
16613
 
16614
16614
  /***/ })
16615
16615
 
package/next.js CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const fs = require('fs');
4
+ const frontend = require('./frontend');
4
5
  const path = require('path');
5
6
 
6
7
  module.exports = withMongooseStudio;
@@ -15,6 +16,15 @@ module.exports = withMongooseStudio;
15
16
  function withMongooseStudio(nextConfig = {}) {
16
17
  const studioPath = normalizeBasePath(nextConfig.studioPath || '/studio');
17
18
 
19
+ try {
20
+ copyStudioFrontend(studioPath);
21
+ frontend('/api/studio', true)
22
+ .then(() => console.log(`✅ Mongoose Studio: copied frontend+config to public${studioPath}`))
23
+ .catch(err => console.error(`❌ Mongoose Studio: failed to copy frontend`, err));
24
+ } catch (err) {
25
+ console.error('❌ Mongoose Studio: failed to copy frontend', err);
26
+ }
27
+
18
28
  return {
19
29
  ...nextConfig,
20
30
 
@@ -32,24 +42,7 @@ function withMongooseStudio(nextConfig = {}) {
32
42
  };
33
43
 
34
44
  return [...userRedirects, studioRedirect];
35
- },
36
-
37
- webpack(config, { isServer }) {
38
- if (isServer) {
39
- try {
40
- copyStudioFrontend(studioPath);
41
- console.log(`✅ Mongoose Studio: copied frontend to public${studioPath}`);
42
- } catch (err) {
43
- console.error('❌ Mongoose Studio: failed to copy frontend', err);
44
- }
45
- }
46
-
47
- // Preserve user’s webpack config
48
- if (typeof nextConfig.webpack === 'function') {
49
- return nextConfig.webpack(config, { isServer });
50
- }
51
- return config;
52
- },
45
+ }
53
46
  };
54
47
  }
55
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mongoosejs/studio",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "A sleek, powerful MongoDB UI with built-in dashboarding and auth, seamlessly integrated with your Express, Vercel, or Netlify app.",
5
5
  "homepage": "https://studio.mongoosejs.io/",
6
6
  "repository": {