@cocreate/config 1.5.2 → 1.6.0
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/workflows/automated.yml +0 -26
- package/CHANGELOG.md +7 -0
- package/CoCreate.config.js +23 -23
- package/docs/index.html +0 -1
- package/package.json +2 -2
- package/src/client.js +41 -0
|
@@ -41,30 +41,4 @@ jobs:
|
|
|
41
41
|
outputs:
|
|
42
42
|
new_release_published: "${{ steps.semantic.outputs.new_release_published }}"
|
|
43
43
|
new_release_version: "${{ steps.semantic.outputs.new_release_version }}"
|
|
44
|
-
upload:
|
|
45
|
-
runs-on: ubuntu-latest
|
|
46
|
-
needs: release
|
|
47
|
-
if: needs.release.outputs.new_release_published == 'true'
|
|
48
|
-
env:
|
|
49
|
-
VERSION: "${{ needs.release.outputs.new_release_version }}"
|
|
50
|
-
steps:
|
|
51
|
-
- name: Checkout
|
|
52
|
-
uses: actions/checkout@v3
|
|
53
|
-
- name: Setup Node.js
|
|
54
|
-
uses: actions/setup-node@v3
|
|
55
|
-
with:
|
|
56
|
-
node-version: 16
|
|
57
|
-
- name: Set npm registry auth
|
|
58
|
-
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
|
|
59
|
-
- name: Install dependencies
|
|
60
|
-
run: yarn install
|
|
61
|
-
- name: Build
|
|
62
|
-
run: yarn build
|
|
63
|
-
- name: Set Environment Variables
|
|
64
|
-
run: |
|
|
65
|
-
echo "organization_id=${{ secrets.COCREATE_ORGANIZATION_ID }}" >> $GITHUB_ENV
|
|
66
|
-
echo "key=${{ secrets.COCREATE_KEY }}" >> $GITHUB_ENV
|
|
67
|
-
echo "host=${{ secrets.COCREATE_HOST }}" >> $GITHUB_ENV
|
|
68
|
-
- name: CoCreate Upload
|
|
69
|
-
run: coc upload
|
|
70
44
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.6.0](https://github.com/CoCreate-app/CoCreate-config/compare/v1.5.2...v1.6.0) (2023-10-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Persists config data in the client ([3904abd](https://github.com/CoCreate-app/CoCreate-config/commit/3904abdedd997ae1b47cd6613cdae2405680f96a))
|
|
7
|
+
|
|
1
8
|
## [1.5.2](https://github.com/CoCreate-app/CoCreate-config/compare/v1.5.1...v1.5.2) (2023-09-18)
|
|
2
9
|
|
|
3
10
|
|
package/CoCreate.config.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"organization_id": "",
|
|
3
|
-
"key": "",
|
|
4
|
-
"host": "",
|
|
5
|
-
"sources": [
|
|
6
|
-
{
|
|
7
|
-
"array": "files",
|
|
8
|
-
"object": {
|
|
9
|
-
"_id": "61a12db2a8b6b4001a9f5a2e",
|
|
10
|
-
"name": "index.html",
|
|
11
|
-
"path": "/docs/config",
|
|
12
|
-
"pathname": "/docs/config/index.html",
|
|
13
|
-
"src": "{{./docs/index.html}}",
|
|
14
|
-
"host": [
|
|
15
|
-
"*",
|
|
16
|
-
"general.cocreate.app"
|
|
17
|
-
],
|
|
18
|
-
"directory": "config",
|
|
19
|
-
"content-type": "{{content-type}}",
|
|
20
|
-
"public": "true"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
]
|
|
1
|
+
module.exports = {
|
|
2
|
+
"organization_id": "",
|
|
3
|
+
"key": "",
|
|
4
|
+
"host": "",
|
|
5
|
+
"sources": [
|
|
6
|
+
{
|
|
7
|
+
"array": "files",
|
|
8
|
+
"object": {
|
|
9
|
+
"_id": "61a12db2a8b6b4001a9f5a2e",
|
|
10
|
+
"name": "index.html",
|
|
11
|
+
"path": "/docs/config",
|
|
12
|
+
"pathname": "/docs/config/index.html",
|
|
13
|
+
"src": "{{./docs/index.html}}",
|
|
14
|
+
"host": [
|
|
15
|
+
"*",
|
|
16
|
+
"general.cocreate.app"
|
|
17
|
+
],
|
|
18
|
+
"directory": "config",
|
|
19
|
+
"content-type": "{{content-type}}",
|
|
20
|
+
"public": "true"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
24
|
};
|
package/docs/index.html
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "A convenient chain handler allows user to chain multiple CoCreate components together. When one action is complete next one will start. The sequence goes untill all config completed. Grounded on Vanilla javascript, easily configured using HTML5 attributes and/or JavaScript API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"config",
|
|
@@ -59,6 +59,6 @@
|
|
|
59
59
|
"webpack-log": "^3.0.1"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@cocreate/utils": "^1.24.
|
|
62
|
+
"@cocreate/utils": "^1.24.2"
|
|
63
63
|
}
|
|
64
64
|
}
|
package/src/client.js
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import localStorage from '@cocreate/local-storage'
|
|
2
|
+
|
|
3
|
+
// Function to get a value by key from localStorage or cookies
|
|
4
|
+
function get(key) {
|
|
5
|
+
let value
|
|
6
|
+
value = localStorage.getItem(key)
|
|
7
|
+
|
|
8
|
+
if (window.CoCreateConfig && window.CoCreateConfig[key])
|
|
9
|
+
return window.CoCreateConfig[key]
|
|
10
|
+
else if (value = localStorage.getItem(key)) {
|
|
11
|
+
return value
|
|
12
|
+
} else {
|
|
13
|
+
const cookies = document.cookie.split("; ");
|
|
14
|
+
for (const cookie of cookies) {
|
|
15
|
+
const [cookieName, cookieValue] = cookie.split("=");
|
|
16
|
+
if (cookieName === key) {
|
|
17
|
+
return decodeURIComponent(cookieValue);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Function to set a key-value pair in localStorage or cookies
|
|
24
|
+
function set(key, value) {
|
|
25
|
+
if (!window.CoCreateConfig)
|
|
26
|
+
window.CoCreateConfig = { [key]: value }
|
|
27
|
+
else
|
|
28
|
+
window.CoCreateConfig[key] = value
|
|
29
|
+
localStorage.setItem(key, value)
|
|
30
|
+
document.cookie = `${key}=${encodeURIComponent(value)}`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Function to delete a key-value pair from localStorage or cookies
|
|
34
|
+
function remove(key) {
|
|
35
|
+
if (!window.CoCreateConfig)
|
|
36
|
+
delete window.CoCreateConfig[key]
|
|
37
|
+
localStorage.removeItem(key)
|
|
38
|
+
document.cookie = `${key}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default { get, set, remove }
|