Browse Source

Add commonJS fields to package.json for client and standard components so the server can require them

master
Andrew Kingston 6 years ago
parent
commit
99258da2df
  1. 4
      packages/client/package.json
  2. 8
      packages/server/src/utilities/fileSystem/index.js
  3. 2
      packages/standard-components/package.json

4
packages/client/package.json

@ -3,11 +3,13 @@
"version": "0.8.9", "version": "0.8.9",
"license": "MPL-2.0", "license": "MPL-2.0",
"module": "dist/budibase-client.js", "module": "dist/budibase-client.js",
"main": "dist/budibase-client.js",
"type": "module", "type": "module",
"svelte": "src/index.js", "svelte": "src/index.js",
"exports": { "exports": {
".": { ".": {
"import": "./dist/budibase-client.js" "import": "./dist/budibase-client.js",
"require": "./dist/budibase-client.js"
}, },
"./package.json": "./package.json" "./package.json": "./package.json"
}, },

8
packages/server/src/utilities/fileSystem/index.js

@ -165,7 +165,13 @@ exports.downloadTemplate = async (type, name) => {
exports.getComponentLibraryManifest = async (appId, library) => { exports.getComponentLibraryManifest = async (appId, library) => {
const filename = "manifest.json" const filename = "manifest.json"
/* istanbul ignore next */ /* istanbul ignore next */
if (env.isTest() || env.isDev()) { // when testing in cypress and so on we need to get the package
// as the environment may not be fully fleshed out for dev or prod
if (env.isTest()) {
const lib = library.split("/")[1]
const path = require.resolve(library).split(lib)[0]
return require(join(path, lib, filename))
} else if (env.isDev()) {
const path = join( const path = join(
NODE_MODULES_PATH, NODE_MODULES_PATH,
"@budibase", "@budibase",

2
packages/standard-components/package.json

@ -1,10 +1,12 @@
{ {
"name": "@budibase/standard-components", "name": "@budibase/standard-components",
"module": "dist/standard-components.es.js", "module": "dist/standard-components.es.js",
"main": "dist/standard-components.es.js",
"svelte": "src/index.js", "svelte": "src/index.js",
"exports": { "exports": {
".": { ".": {
"import": "./dist/standard-components.es.js" "import": "./dist/standard-components.es.js"
"require": "./dist/standard-components.es.js"
}, },
"./package.json": "./package.json", "./package.json": "./package.json",
"./manifest.json": "./manifest.json" "./manifest.json": "./manifest.json"

Loading…
Cancel
Save