@cocreate/organizations 1.15.2 → 1.15.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/.github/FUNDING.yml +3 -3
- package/.github/workflows/automated.yml +95 -95
- package/.github/workflows/manual.yml +44 -44
- package/CHANGELOG.md +1550 -1536
- package/CONTRIBUTING.md +96 -96
- package/CoCreate.config.js +26 -26
- package/LICENSE +21 -21
- package/README.md +85 -85
- package/demo/CoCreate-createUser.html +65 -65
- package/demo/index.html +131 -131
- package/demo/industries/industries.html +123 -123
- package/demo/industries/industry-datatable.html +146 -146
- package/demo/industries/industry-documents-datatable.1.html +137 -137
- package/docs/index.html +357 -357
- package/package.json +68 -68
- package/release.config.js +21 -21
- package/src/client.js +59 -59
- package/src/index.js +13 -13
- package/src/server.js +75 -75
- package/webpack.config.js +84 -84
package/package.json
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@cocreate/organizations",
|
|
3
|
-
"version": "1.15.
|
|
4
|
-
"description": "A simple organizations component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"organizations",
|
|
7
|
-
"cocreate",
|
|
8
|
-
"low-code-framework",
|
|
9
|
-
"no-code-framework",
|
|
10
|
-
"cocreatejs",
|
|
11
|
-
"cocreatejs-component",
|
|
12
|
-
"cocreate-framework",
|
|
13
|
-
"no-code",
|
|
14
|
-
"low-code",
|
|
15
|
-
"collaborative-framework",
|
|
16
|
-
"realtime",
|
|
17
|
-
"realtime-framework",
|
|
18
|
-
"collaboration",
|
|
19
|
-
"shared-editing",
|
|
20
|
-
"html5-framework",
|
|
21
|
-
"javascript-framework"
|
|
22
|
-
],
|
|
23
|
-
"publishConfig": {
|
|
24
|
-
"access": "public"
|
|
25
|
-
},
|
|
26
|
-
"scripts": {
|
|
27
|
-
"start": "npx webpack --config webpack.config.js",
|
|
28
|
-
"build": "NODE_ENV=production npx webpack --config webpack.config.js",
|
|
29
|
-
"dev": "npx webpack --config webpack.config.js --watch",
|
|
30
|
-
"docs": "node ./node_modules/@cocreate/docs/src/index.js",
|
|
31
|
-
"hosting": "node ./node_modules/@cocreate/hosting/src/index.js"
|
|
32
|
-
},
|
|
33
|
-
"repository": {
|
|
34
|
-
"type": "git",
|
|
35
|
-
"url": "git+https://github.com/CoCreate-app/CoCreate-organizations.git"
|
|
36
|
-
},
|
|
37
|
-
"author": "CoCreate LLC",
|
|
38
|
-
"license": "MIT",
|
|
39
|
-
"bugs": {
|
|
40
|
-
"url": "https://github.com/CoCreate-app/CoCreate-organizations/issues"
|
|
41
|
-
},
|
|
42
|
-
"homepage": "https://cocreate.app/docs/organizations",
|
|
43
|
-
"funding": {
|
|
44
|
-
"type": "GitHub Sponsors ❤",
|
|
45
|
-
"url": "https://github.com/sponsors/CoCreate-app"
|
|
46
|
-
},
|
|
47
|
-
"main": "./src/index.js",
|
|
48
|
-
"devDependencies": {
|
|
49
|
-
"@babel/core": "^7.9.6",
|
|
50
|
-
"@babel/preset-env": "^7.9.6",
|
|
51
|
-
"babel-loader": "^8.1.0",
|
|
52
|
-
"clean-webpack-plugin": "^3.0.0",
|
|
53
|
-
"file-loader": "^6.2.0",
|
|
54
|
-
"mini-css-extract-plugin": "^1.5.0",
|
|
55
|
-
"style-loader": "^3.3.1",
|
|
56
|
-
"terser-webpack-plugin": "^5.1.1",
|
|
57
|
-
"webpack": "^5.24.4",
|
|
58
|
-
"webpack-cli": "^4.5.0",
|
|
59
|
-
"webpack-log": "^3.0.1"
|
|
60
|
-
},
|
|
61
|
-
"dependencies": {
|
|
62
|
-
"@cocreate/actions": "^1.8.12",
|
|
63
|
-
"@cocreate/crud-client": "^1.21.5",
|
|
64
|
-
"@cocreate/docs": "^1.7.13",
|
|
65
|
-
"@cocreate/form": "^1.14.12",
|
|
66
|
-
"@cocreate/indexeddb": "^1.10.2"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@cocreate/organizations",
|
|
3
|
+
"version": "1.15.4",
|
|
4
|
+
"description": "A simple organizations component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"organizations",
|
|
7
|
+
"cocreate",
|
|
8
|
+
"low-code-framework",
|
|
9
|
+
"no-code-framework",
|
|
10
|
+
"cocreatejs",
|
|
11
|
+
"cocreatejs-component",
|
|
12
|
+
"cocreate-framework",
|
|
13
|
+
"no-code",
|
|
14
|
+
"low-code",
|
|
15
|
+
"collaborative-framework",
|
|
16
|
+
"realtime",
|
|
17
|
+
"realtime-framework",
|
|
18
|
+
"collaboration",
|
|
19
|
+
"shared-editing",
|
|
20
|
+
"html5-framework",
|
|
21
|
+
"javascript-framework"
|
|
22
|
+
],
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"start": "npx webpack --config webpack.config.js",
|
|
28
|
+
"build": "NODE_ENV=production npx webpack --config webpack.config.js",
|
|
29
|
+
"dev": "npx webpack --config webpack.config.js --watch",
|
|
30
|
+
"docs": "node ./node_modules/@cocreate/docs/src/index.js",
|
|
31
|
+
"hosting": "node ./node_modules/@cocreate/hosting/src/index.js"
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/CoCreate-app/CoCreate-organizations.git"
|
|
36
|
+
},
|
|
37
|
+
"author": "CoCreate LLC",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/CoCreate-app/CoCreate-organizations/issues"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://cocreate.app/docs/organizations",
|
|
43
|
+
"funding": {
|
|
44
|
+
"type": "GitHub Sponsors ❤",
|
|
45
|
+
"url": "https://github.com/sponsors/CoCreate-app"
|
|
46
|
+
},
|
|
47
|
+
"main": "./src/index.js",
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@babel/core": "^7.9.6",
|
|
50
|
+
"@babel/preset-env": "^7.9.6",
|
|
51
|
+
"babel-loader": "^8.1.0",
|
|
52
|
+
"clean-webpack-plugin": "^3.0.0",
|
|
53
|
+
"file-loader": "^6.2.0",
|
|
54
|
+
"mini-css-extract-plugin": "^1.5.0",
|
|
55
|
+
"style-loader": "^3.3.1",
|
|
56
|
+
"terser-webpack-plugin": "^5.1.1",
|
|
57
|
+
"webpack": "^5.24.4",
|
|
58
|
+
"webpack-cli": "^4.5.0",
|
|
59
|
+
"webpack-log": "^3.0.1"
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"@cocreate/actions": "^1.8.12",
|
|
63
|
+
"@cocreate/crud-client": "^1.21.5",
|
|
64
|
+
"@cocreate/docs": "^1.7.13",
|
|
65
|
+
"@cocreate/form": "^1.14.12",
|
|
66
|
+
"@cocreate/indexeddb": "^1.10.2"
|
|
67
|
+
}
|
|
68
|
+
}
|
package/release.config.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
dryRun: false,
|
|
3
|
-
branches: ["master"],
|
|
4
|
-
plugins: [
|
|
5
|
-
"@semantic-release/commit-analyzer",
|
|
6
|
-
"@semantic-release/release-notes-generator",
|
|
7
|
-
[
|
|
8
|
-
"@semantic-release/changelog",
|
|
9
|
-
{
|
|
10
|
-
changelogFile: "CHANGELOG.md",
|
|
11
|
-
},
|
|
12
|
-
],
|
|
13
|
-
"@semantic-release/npm",
|
|
14
|
-
"@semantic-release/github",
|
|
15
|
-
[
|
|
16
|
-
"@semantic-release/git",
|
|
17
|
-
{
|
|
18
|
-
assets: ["CHANGELOG.md", "package.json"],
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
],
|
|
1
|
+
module.exports = {
|
|
2
|
+
dryRun: false,
|
|
3
|
+
branches: ["master"],
|
|
4
|
+
plugins: [
|
|
5
|
+
"@semantic-release/commit-analyzer",
|
|
6
|
+
"@semantic-release/release-notes-generator",
|
|
7
|
+
[
|
|
8
|
+
"@semantic-release/changelog",
|
|
9
|
+
{
|
|
10
|
+
changelogFile: "CHANGELOG.md",
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
"@semantic-release/npm",
|
|
14
|
+
"@semantic-release/github",
|
|
15
|
+
[
|
|
16
|
+
"@semantic-release/git",
|
|
17
|
+
{
|
|
18
|
+
assets: ["CHANGELOG.md", "package.json"],
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
],
|
|
22
22
|
};
|
package/src/client.js
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import crud from '@cocreate/crud-client';
|
|
2
|
-
import indexeddb from '@cocreate/indexeddb';
|
|
3
|
-
import action from '@cocreate/actions';
|
|
4
|
-
import form from '@cocreate/form';
|
|
5
|
-
|
|
6
|
-
const CoCreateOrganization = {
|
|
7
|
-
|
|
8
|
-
createOrganization: async function (btn) {
|
|
9
|
-
let formEl = btn.closest("form");
|
|
10
|
-
if (!formEl) return;
|
|
11
|
-
|
|
12
|
-
let organization = form.getData(formEl, 'organizations')
|
|
13
|
-
let user = form.getData(formEl, 'users')
|
|
14
|
-
|
|
15
|
-
if (!organization || !organization.document)
|
|
16
|
-
return
|
|
17
|
-
if (!user || !user.document)
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
if (!organization.document._id && !user.document._id) {
|
|
21
|
-
let documents = await indexeddb.generateDB(organization, user)
|
|
22
|
-
if (!documents)
|
|
23
|
-
return
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
form.setDocumentId(formEl, organization)
|
|
27
|
-
form.setDocumentId(formEl, user)
|
|
28
|
-
|
|
29
|
-
organization = organization.document[0]
|
|
30
|
-
user = user.document[0]
|
|
31
|
-
|
|
32
|
-
let organization_id = organization._id
|
|
33
|
-
|
|
34
|
-
if (crud.socket.organization !== true) {
|
|
35
|
-
crud.socket.organization = true
|
|
36
|
-
crud.socket.create({ organization_id })
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
let response = await crud.socket.send('createOrganization', {
|
|
40
|
-
organization,
|
|
41
|
-
user,
|
|
42
|
-
broadcastBrowser: false,
|
|
43
|
-
organization_id
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
document.dispatchEvent(new CustomEvent('createdOrganization', {
|
|
47
|
-
detail: response
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
action.init({
|
|
53
|
-
name: "createOrganization",
|
|
54
|
-
endEvent: "createdOrganization",
|
|
55
|
-
callback: (btn) => {
|
|
56
|
-
CoCreateOrganization.createOrganization(btn);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
1
|
+
import crud from '@cocreate/crud-client';
|
|
2
|
+
import indexeddb from '@cocreate/indexeddb';
|
|
3
|
+
import action from '@cocreate/actions';
|
|
4
|
+
import form from '@cocreate/form';
|
|
5
|
+
|
|
6
|
+
const CoCreateOrganization = {
|
|
7
|
+
|
|
8
|
+
createOrganization: async function (btn) {
|
|
9
|
+
let formEl = btn.closest("form");
|
|
10
|
+
if (!formEl) return;
|
|
11
|
+
|
|
12
|
+
let organization = form.getData(formEl, 'organizations')
|
|
13
|
+
let user = form.getData(formEl, 'users')
|
|
14
|
+
|
|
15
|
+
if (!organization || !organization.document)
|
|
16
|
+
return
|
|
17
|
+
if (!user || !user.document)
|
|
18
|
+
return
|
|
19
|
+
|
|
20
|
+
if (!organization.document._id && !user.document._id) {
|
|
21
|
+
let documents = await indexeddb.generateDB(organization, user)
|
|
22
|
+
if (!documents)
|
|
23
|
+
return
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
form.setDocumentId(formEl, organization)
|
|
27
|
+
form.setDocumentId(formEl, user)
|
|
28
|
+
|
|
29
|
+
organization = organization.document[0]
|
|
30
|
+
user = user.document[0]
|
|
31
|
+
|
|
32
|
+
let organization_id = organization._id
|
|
33
|
+
|
|
34
|
+
if (crud.socket.organization !== true) {
|
|
35
|
+
crud.socket.organization = true
|
|
36
|
+
crud.socket.create({ organization_id })
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let response = await crud.socket.send('createOrganization', {
|
|
40
|
+
organization,
|
|
41
|
+
user,
|
|
42
|
+
broadcastBrowser: false,
|
|
43
|
+
organization_id
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
document.dispatchEvent(new CustomEvent('createdOrganization', {
|
|
47
|
+
detail: response
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
action.init({
|
|
53
|
+
name: "createOrganization",
|
|
54
|
+
endEvent: "createdOrganization",
|
|
55
|
+
callback: (btn) => {
|
|
56
|
+
CoCreateOrganization.createOrganization(btn);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
60
|
export default CoCreateOrganization;
|
package/src/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
(function (root, factory) {
|
|
2
|
-
if (typeof define === 'function' && define.amd) {
|
|
3
|
-
define(["./client"], function(CoCreateOrganization) {
|
|
4
|
-
return factory(CoCreateOrganization)
|
|
5
|
-
});
|
|
6
|
-
} else if (typeof module === 'object' && module.exports) {
|
|
7
|
-
const CoCreateOrganization = require("./server.js")
|
|
8
|
-
module.exports = factory(CoCreateOrganization);
|
|
9
|
-
} else {
|
|
10
|
-
root.returnExports = factory(root["./client.js"]);
|
|
11
|
-
}
|
|
12
|
-
}(typeof self !== 'undefined' ? self : this, function (CoCreateOrganization) {
|
|
13
|
-
return CoCreateOrganization;
|
|
1
|
+
(function (root, factory) {
|
|
2
|
+
if (typeof define === 'function' && define.amd) {
|
|
3
|
+
define(["./client"], function(CoCreateOrganization) {
|
|
4
|
+
return factory(CoCreateOrganization)
|
|
5
|
+
});
|
|
6
|
+
} else if (typeof module === 'object' && module.exports) {
|
|
7
|
+
const CoCreateOrganization = require("./server.js")
|
|
8
|
+
module.exports = factory(CoCreateOrganization);
|
|
9
|
+
} else {
|
|
10
|
+
root.returnExports = factory(root["./client.js"]);
|
|
11
|
+
}
|
|
12
|
+
}(typeof self !== 'undefined' ? self : this, function (CoCreateOrganization) {
|
|
13
|
+
return CoCreateOrganization;
|
|
14
14
|
}));
|
package/src/server.js
CHANGED
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
class CoCreateOrganization {
|
|
2
|
-
constructor(crud) {
|
|
3
|
-
this.wsManager = crud.wsManager
|
|
4
|
-
this.crud = crud
|
|
5
|
-
this.platformSocket = {
|
|
6
|
-
config: {
|
|
7
|
-
organization_id: process.env.organization_id,
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
this.init()
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
init() {
|
|
14
|
-
if (this.wsManager) {
|
|
15
|
-
this.wsManager.on('createOrganization', (socket, data) =>
|
|
16
|
-
this.createOrganization(socket, data)
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async createOrganization(socket, data) {
|
|
22
|
-
try {
|
|
23
|
-
if (!data.organization || !data.organization._id) return
|
|
24
|
-
if (!data.user || !data.user._id || !data.user.email || !data.user.password) return
|
|
25
|
-
|
|
26
|
-
const organization = {
|
|
27
|
-
_id: data.organization._id,
|
|
28
|
-
name: data.organization.name || 'untitled',
|
|
29
|
-
hosts: data.organization.hosts || [],
|
|
30
|
-
owner: data.user._id
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// TODO: check if user exist and confirm credentials
|
|
34
|
-
const user = {
|
|
35
|
-
_id: data.user._id,
|
|
36
|
-
firstname: data.user.firtname || 'Admin',
|
|
37
|
-
lastname: data.user.lastname || ''
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const userKey = {
|
|
41
|
-
type: "user",
|
|
42
|
-
key: user._id,
|
|
43
|
-
roles: ['user'],
|
|
44
|
-
email: user.document.email,
|
|
45
|
-
password: user.document.password || btoa('0000'),
|
|
46
|
-
user: {
|
|
47
|
-
collection: 'users'
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const Data = {}
|
|
52
|
-
Data.database = process.env.organization_id
|
|
53
|
-
Data.organization_id = process.env.organization_id
|
|
54
|
-
|
|
55
|
-
if (organization) {
|
|
56
|
-
const response = await this.crud.createDocument({ ...Data, collection: 'organizations', document: organization })
|
|
57
|
-
this.wsManager.broadcast(this.platformSocket, 'createDocument', response);
|
|
58
|
-
}
|
|
59
|
-
if (user) {
|
|
60
|
-
const response = await this.crud.createDocument({ ...Data, collection: 'users', document: user })
|
|
61
|
-
this.wsManager.broadcast(this.platformSocket, 'createDocument', response);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (userKey) {
|
|
65
|
-
const response = await this.crud.createDocument({ ...Data, collection: 'keys', document: userKey })
|
|
66
|
-
this.wsManager.broadcast(this.platformSocket, 'createDocument', response);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
this.wsManager.send(socket, 'createOrganization', data);
|
|
70
|
-
} catch (error) {
|
|
71
|
-
console.log('createDocument error', error);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
1
|
+
class CoCreateOrganization {
|
|
2
|
+
constructor(crud) {
|
|
3
|
+
this.wsManager = crud.wsManager
|
|
4
|
+
this.crud = crud
|
|
5
|
+
this.platformSocket = {
|
|
6
|
+
config: {
|
|
7
|
+
organization_id: process.env.organization_id,
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
this.init()
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
init() {
|
|
14
|
+
if (this.wsManager) {
|
|
15
|
+
this.wsManager.on('createOrganization', (socket, data) =>
|
|
16
|
+
this.createOrganization(socket, data)
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async createOrganization(socket, data) {
|
|
22
|
+
try {
|
|
23
|
+
if (!data.organization || !data.organization._id) return
|
|
24
|
+
if (!data.user || !data.user._id || !data.user.email || !data.user.password) return
|
|
25
|
+
|
|
26
|
+
const organization = {
|
|
27
|
+
_id: data.organization._id,
|
|
28
|
+
name: data.organization.name || 'untitled',
|
|
29
|
+
hosts: data.organization.hosts || [],
|
|
30
|
+
owner: data.user._id
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// TODO: check if user exist and confirm credentials
|
|
34
|
+
const user = {
|
|
35
|
+
_id: data.user._id,
|
|
36
|
+
firstname: data.user.firtname || 'Admin',
|
|
37
|
+
lastname: data.user.lastname || ''
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const userKey = {
|
|
41
|
+
type: "user",
|
|
42
|
+
key: user._id,
|
|
43
|
+
roles: ['user'],
|
|
44
|
+
email: user.document.email,
|
|
45
|
+
password: user.document.password || btoa('0000'),
|
|
46
|
+
user: {
|
|
47
|
+
collection: 'users'
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const Data = {}
|
|
52
|
+
Data.database = process.env.organization_id
|
|
53
|
+
Data.organization_id = process.env.organization_id
|
|
54
|
+
|
|
55
|
+
if (organization) {
|
|
56
|
+
const response = await this.crud.createDocument({ ...Data, collection: 'organizations', document: organization })
|
|
57
|
+
this.wsManager.broadcast(this.platformSocket, 'createDocument', response);
|
|
58
|
+
}
|
|
59
|
+
if (user) {
|
|
60
|
+
const response = await this.crud.createDocument({ ...Data, collection: 'users', document: user })
|
|
61
|
+
this.wsManager.broadcast(this.platformSocket, 'createDocument', response);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (userKey) {
|
|
65
|
+
const response = await this.crud.createDocument({ ...Data, collection: 'keys', document: userKey })
|
|
66
|
+
this.wsManager.broadcast(this.platformSocket, 'createDocument', response);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
this.wsManager.send(socket, 'createOrganization', data);
|
|
70
|
+
} catch (error) {
|
|
71
|
+
console.log('createDocument error', error);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
76
|
module.exports = CoCreateOrganization;
|
package/webpack.config.js
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
const path = require("path")
|
|
2
|
-
const TerserPlugin = require("terser-webpack-plugin")
|
|
3
|
-
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
|
|
4
|
-
let isProduction = process.env.NODE_ENV === "production"
|
|
5
|
-
const { CleanWebpackPlugin } = require("clean-webpack-plugin")
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
entry: {
|
|
9
|
-
"CoCreate-organizations": "./src/index.js",
|
|
10
|
-
},
|
|
11
|
-
output: {
|
|
12
|
-
path: path.resolve(__dirname, "dist"),
|
|
13
|
-
filename: isProduction ? "[name].min.js" : "[name].js",
|
|
14
|
-
libraryTarget: "umd",
|
|
15
|
-
libraryExport: "default",
|
|
16
|
-
library: ["CoCreate", "organizations"],
|
|
17
|
-
globalObject: "this",
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
plugins: [
|
|
21
|
-
new CleanWebpackPlugin(),
|
|
22
|
-
new MiniCssExtractPlugin({
|
|
23
|
-
filename: "[name].css",
|
|
24
|
-
}),
|
|
25
|
-
],
|
|
26
|
-
// Default mode for Webpack is production.
|
|
27
|
-
// Depending on mode Webpack will apply different things
|
|
28
|
-
// on final bundle. For now we don't need production's JavaScript
|
|
29
|
-
// minifying and other thing so let's set mode to development
|
|
30
|
-
mode: isProduction ? "production" : "development",
|
|
31
|
-
module: {
|
|
32
|
-
rules: [
|
|
33
|
-
{
|
|
34
|
-
test: /.js$/,
|
|
35
|
-
exclude: /(node_modules)/,
|
|
36
|
-
use: {
|
|
37
|
-
loader: "babel-loader",
|
|
38
|
-
options: {
|
|
39
|
-
plugins: ["@babel/plugin-transform-modules-commonjs"],
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
test: /.css$/i,
|
|
45
|
-
use: [
|
|
46
|
-
{ loader: "style-loader", options: { injectType: "linkTag" } },
|
|
47
|
-
"file-loader",
|
|
48
|
-
],
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
// add source map
|
|
54
|
-
...(isProduction ? {} : { devtool: "eval-source-map" }),
|
|
55
|
-
|
|
56
|
-
optimization: {
|
|
57
|
-
minimize: true,
|
|
58
|
-
minimizer: [
|
|
59
|
-
new TerserPlugin({
|
|
60
|
-
extractComments: true,
|
|
61
|
-
// cache: true,
|
|
62
|
-
parallel: true,
|
|
63
|
-
// sourceMap: true, // Must be set to true if using source-maps in production
|
|
64
|
-
terserOptions: {
|
|
65
|
-
// https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
|
|
66
|
-
// extractComments: 'all',
|
|
67
|
-
compress: {
|
|
68
|
-
drop_console: true,
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
}),
|
|
72
|
-
],
|
|
73
|
-
splitChunks: {
|
|
74
|
-
chunks: "all",
|
|
75
|
-
minSize: 200,
|
|
76
|
-
// maxSize: 99999,
|
|
77
|
-
//minChunks: 1,
|
|
78
|
-
|
|
79
|
-
cacheGroups: {
|
|
80
|
-
defaultVendors: false,
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
}
|
|
1
|
+
const path = require("path")
|
|
2
|
+
const TerserPlugin = require("terser-webpack-plugin")
|
|
3
|
+
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
|
|
4
|
+
let isProduction = process.env.NODE_ENV === "production"
|
|
5
|
+
const { CleanWebpackPlugin } = require("clean-webpack-plugin")
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
entry: {
|
|
9
|
+
"CoCreate-organizations": "./src/index.js",
|
|
10
|
+
},
|
|
11
|
+
output: {
|
|
12
|
+
path: path.resolve(__dirname, "dist"),
|
|
13
|
+
filename: isProduction ? "[name].min.js" : "[name].js",
|
|
14
|
+
libraryTarget: "umd",
|
|
15
|
+
libraryExport: "default",
|
|
16
|
+
library: ["CoCreate", "organizations"],
|
|
17
|
+
globalObject: "this",
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
plugins: [
|
|
21
|
+
new CleanWebpackPlugin(),
|
|
22
|
+
new MiniCssExtractPlugin({
|
|
23
|
+
filename: "[name].css",
|
|
24
|
+
}),
|
|
25
|
+
],
|
|
26
|
+
// Default mode for Webpack is production.
|
|
27
|
+
// Depending on mode Webpack will apply different things
|
|
28
|
+
// on final bundle. For now we don't need production's JavaScript
|
|
29
|
+
// minifying and other thing so let's set mode to development
|
|
30
|
+
mode: isProduction ? "production" : "development",
|
|
31
|
+
module: {
|
|
32
|
+
rules: [
|
|
33
|
+
{
|
|
34
|
+
test: /.js$/,
|
|
35
|
+
exclude: /(node_modules)/,
|
|
36
|
+
use: {
|
|
37
|
+
loader: "babel-loader",
|
|
38
|
+
options: {
|
|
39
|
+
plugins: ["@babel/plugin-transform-modules-commonjs"],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
test: /.css$/i,
|
|
45
|
+
use: [
|
|
46
|
+
{ loader: "style-loader", options: { injectType: "linkTag" } },
|
|
47
|
+
"file-loader",
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
// add source map
|
|
54
|
+
...(isProduction ? {} : { devtool: "eval-source-map" }),
|
|
55
|
+
|
|
56
|
+
optimization: {
|
|
57
|
+
minimize: true,
|
|
58
|
+
minimizer: [
|
|
59
|
+
new TerserPlugin({
|
|
60
|
+
extractComments: true,
|
|
61
|
+
// cache: true,
|
|
62
|
+
parallel: true,
|
|
63
|
+
// sourceMap: true, // Must be set to true if using source-maps in production
|
|
64
|
+
terserOptions: {
|
|
65
|
+
// https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
|
|
66
|
+
// extractComments: 'all',
|
|
67
|
+
compress: {
|
|
68
|
+
drop_console: true,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
],
|
|
73
|
+
splitChunks: {
|
|
74
|
+
chunks: "all",
|
|
75
|
+
minSize: 200,
|
|
76
|
+
// maxSize: 99999,
|
|
77
|
+
//minChunks: 1,
|
|
78
|
+
|
|
79
|
+
cacheGroups: {
|
|
80
|
+
defaultVendors: false,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
}
|