@cocreate/config 1.0.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/FUNDING.yml +3 -0
- package/.github/workflows/automated.yml +123 -0
- package/.github/workflows/manual.yml +44 -0
- package/CHANGELOG.md +7 -0
- package/CONTRIBUTING.md +111 -0
- package/CoCreate.config.js +25 -0
- package/LICENSE +21 -0
- package/README.md +85 -0
- package/demo/index.html +56 -0
- package/docs/index.html +383 -0
- package/package.json +65 -0
- package/release.config.js +22 -0
- package/src/client.js +0 -0
- package/src/index.js +14 -0
- package/src/server.js +136 -0
- package/webpack.config.js +84 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
name: Automated
|
|
2
|
+
"on":
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- master
|
|
6
|
+
jobs:
|
|
7
|
+
about:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
steps:
|
|
10
|
+
- name: Checkout
|
|
11
|
+
uses: actions/checkout@v3
|
|
12
|
+
- name: setup nodejs
|
|
13
|
+
uses: actions/setup-node@v3
|
|
14
|
+
with:
|
|
15
|
+
node-version: 16
|
|
16
|
+
- name: Jaid/action-sync-node-meta
|
|
17
|
+
uses: jaid/action-sync-node-meta@v1.4.0
|
|
18
|
+
with:
|
|
19
|
+
direction: overwrite-github
|
|
20
|
+
githubToken: "${{ secrets.GITHUB }}"
|
|
21
|
+
|
|
22
|
+
release:
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
- name: Checkout
|
|
26
|
+
uses: actions/checkout@v3
|
|
27
|
+
- name: setup nodejs
|
|
28
|
+
uses: actions/setup-node@v3
|
|
29
|
+
with:
|
|
30
|
+
node-version: 14
|
|
31
|
+
- name: Semantic Release
|
|
32
|
+
uses: cycjimmy/semantic-release-action@v3
|
|
33
|
+
id: semantic
|
|
34
|
+
with:
|
|
35
|
+
extra_plugins: |
|
|
36
|
+
@semantic-release/changelog
|
|
37
|
+
@semantic-release/git
|
|
38
|
+
@semantic-release/github
|
|
39
|
+
env:
|
|
40
|
+
GITHUB_TOKEN: "${{ secrets.GITHUB }}"
|
|
41
|
+
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
|
|
42
|
+
outputs:
|
|
43
|
+
new_release_published: "${{ steps.semantic.outputs.new_release_published }}"
|
|
44
|
+
new_release_version: "${{ steps.semantic.outputs.new_release_version }}"
|
|
45
|
+
cdn:
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
needs: release
|
|
48
|
+
if: needs.release.outputs.new_release_published == 'true'
|
|
49
|
+
env:
|
|
50
|
+
VERSION: "${{ needs.release.outputs.new_release_version }}"
|
|
51
|
+
steps:
|
|
52
|
+
- name: Checkout
|
|
53
|
+
uses: actions/checkout@v3
|
|
54
|
+
- name: setup nodejs
|
|
55
|
+
uses: actions/setup-node@v3
|
|
56
|
+
with:
|
|
57
|
+
node-version: 16
|
|
58
|
+
- name: yarn install
|
|
59
|
+
run: >
|
|
60
|
+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >
|
|
61
|
+
.npmrc
|
|
62
|
+
|
|
63
|
+
yarn install
|
|
64
|
+
- name: yarn build
|
|
65
|
+
run: yarn build
|
|
66
|
+
- name: upload bundle as version
|
|
67
|
+
uses: CoCreate-app/CoCreate-s3@master
|
|
68
|
+
with:
|
|
69
|
+
aws-key-id: "${{ secrets.AWSACCESSKEYID }}"
|
|
70
|
+
aws-access-key: "${{ secrets.AWSSECERTACCESSKEY }}"
|
|
71
|
+
bucket: testcrudbucket
|
|
72
|
+
source: ./dist
|
|
73
|
+
destination: "/config/${{env.VERSION}}"
|
|
74
|
+
acl: public-read
|
|
75
|
+
- name: upload bundle as latest
|
|
76
|
+
uses: CoCreate-app/CoCreate-s3@master
|
|
77
|
+
with:
|
|
78
|
+
aws-key-id: "${{ secrets.AWSACCESSKEYID }}"
|
|
79
|
+
aws-access-key: "${{ secrets.AWSSECERTACCESSKEY }}"
|
|
80
|
+
bucket: testcrudbucket
|
|
81
|
+
source: ./dist
|
|
82
|
+
destination: /config/latest
|
|
83
|
+
acl: public-read
|
|
84
|
+
invalidations: true
|
|
85
|
+
upload:
|
|
86
|
+
runs-on: ubuntu-latest
|
|
87
|
+
|
|
88
|
+
steps:
|
|
89
|
+
- name: Checkout
|
|
90
|
+
uses: actions/checkout@v3
|
|
91
|
+
|
|
92
|
+
- name: Setup Node.js
|
|
93
|
+
uses: actions/setup-node@v3
|
|
94
|
+
with:
|
|
95
|
+
node-version: 16
|
|
96
|
+
|
|
97
|
+
- name: Get Environment Variables
|
|
98
|
+
run: |
|
|
99
|
+
echo "organization_id=${{ secrets.COCREATE_ORGANIZATION_ID }}" >> $GITHUB_ENV
|
|
100
|
+
echo "key=${{ secrets.COCREATE_KEY }}" >> $GITHUB_ENV
|
|
101
|
+
echo "host=${{ secrets.COCREATE_HOST }}" >> $GITHUB_ENV
|
|
102
|
+
|
|
103
|
+
- name: Install @cocreate/cli
|
|
104
|
+
run: npm install -g @cocreate/cli
|
|
105
|
+
|
|
106
|
+
- name: CoCreate CLI Upload
|
|
107
|
+
run: coc upload
|
|
108
|
+
|
|
109
|
+
# docs:
|
|
110
|
+
# runs-on: ubuntu-latest
|
|
111
|
+
# steps:
|
|
112
|
+
# - name: Checkout
|
|
113
|
+
# uses: actions/checkout@v3
|
|
114
|
+
# - name: setup nodejs
|
|
115
|
+
# uses: actions/setup-node@v3
|
|
116
|
+
# with:
|
|
117
|
+
# node-version: 16
|
|
118
|
+
# - name: update documentation
|
|
119
|
+
# uses: CoCreate-app/CoCreate-docs@master
|
|
120
|
+
# env:
|
|
121
|
+
# organization_id: ${{ secrets.COCREATE_ORGANIZATION_ID }}
|
|
122
|
+
# key: ${{ secrets.COCREATE_KEY }}
|
|
123
|
+
# host: ${{ secrets.COCREATE_HOST }}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Manual Workflow
|
|
2
|
+
on:
|
|
3
|
+
workflow_dispatch:
|
|
4
|
+
inputs:
|
|
5
|
+
invalidations:
|
|
6
|
+
description: |
|
|
7
|
+
If set to 'true', invalidates previous upload.
|
|
8
|
+
default: "true"
|
|
9
|
+
required: true
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
cdn:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
env:
|
|
15
|
+
DRY_RUN: ${{ github.event.inputs.dry_run }}
|
|
16
|
+
GITHUB_TOKEN: "${{ secrets.GITHUB }}"
|
|
17
|
+
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- name: Checkout
|
|
21
|
+
uses: actions/checkout@v3
|
|
22
|
+
- name: setup nodejs
|
|
23
|
+
uses: actions/setup-node@v3
|
|
24
|
+
with:
|
|
25
|
+
node-version: 16
|
|
26
|
+
- name: yarn install
|
|
27
|
+
run: >
|
|
28
|
+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >
|
|
29
|
+
.npmrc
|
|
30
|
+
|
|
31
|
+
yarn install
|
|
32
|
+
- name: yarn build
|
|
33
|
+
run: yarn build
|
|
34
|
+
- name: upload latest bundle
|
|
35
|
+
uses: CoCreate-app/CoCreate-s3@master
|
|
36
|
+
with:
|
|
37
|
+
aws-key-id: "${{ secrets.AWSACCESSKEYID }}"
|
|
38
|
+
aws-access-key: "${{ secrets.AWSSECERTACCESSKEY }}"
|
|
39
|
+
distributionId: "${{ secrets.DISTRIBUTION_ID }}"
|
|
40
|
+
bucket: testcrudbucket
|
|
41
|
+
source: ./dist
|
|
42
|
+
destination: /config/latest
|
|
43
|
+
acl: public-read
|
|
44
|
+
invalidations: ${{ github.event.inputs.invalidations }}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# 1.0.0 (2023-06-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Initial release ([570f2c7](https://github.com/CoCreate-app/CoCreate-config/commit/570f2c7180fe25a006d9d971b9f29bce90148229))
|
|
7
|
+
* option variable boolean treats value as a variable that is consumable byt other keys ([963115c](https://github.com/CoCreate-app/CoCreate-config/commit/963115c282a2ab514c6901351c1ac6c3a984e1c8))
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Contributing to CoCreate-config
|
|
2
|
+
|
|
3
|
+
This project is work of [many contributors](https://github.com/CoCreate-app/CoCreate-config/graphs/contributors).
|
|
4
|
+
You're encouraged to submit [pull requests](https://github.com/CoCreate-app/CoCreate-config/pulls),
|
|
5
|
+
[propose features and discuss issues](https://github.com/CoCreate-app/CoCreate-config/issues).
|
|
6
|
+
|
|
7
|
+
In the examples below, substitute your Github username for `contributor` in URLs.
|
|
8
|
+
|
|
9
|
+
## Fork the Project
|
|
10
|
+
|
|
11
|
+
Fork the [project on Github](https://github.com/CoCreate-app/CoCreate-config) and check out your copy.
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
git clone https://github.com/contributor/CoCreate-config.git
|
|
15
|
+
cd CoCreate-config
|
|
16
|
+
git remote add upstream https://github.com/CoCreate-app/CoCreate-config.git
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Create a Topic Branch
|
|
20
|
+
|
|
21
|
+
Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
git checkout master
|
|
25
|
+
git pull upstream master
|
|
26
|
+
git checkout -b my-feature-branch
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Write Tests
|
|
30
|
+
|
|
31
|
+
Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build.
|
|
32
|
+
Add to [spec](spec).
|
|
33
|
+
|
|
34
|
+
We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
|
|
35
|
+
|
|
36
|
+
## Write Code
|
|
37
|
+
|
|
38
|
+
Implement your feature or bug fix.
|
|
39
|
+
|
|
40
|
+
## Write Documentation
|
|
41
|
+
|
|
42
|
+
Document any external behavior in the [README](README.md).
|
|
43
|
+
|
|
44
|
+
## Update Changelog
|
|
45
|
+
|
|
46
|
+
Add a line to [CHANGELOG](CHANGELOG.md) under _Next Release_.
|
|
47
|
+
Make it look like every other line, including your name and link to your Github account.
|
|
48
|
+
|
|
49
|
+
## Commit Changes
|
|
50
|
+
|
|
51
|
+
Make sure git knows your name and email address:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
git config --global user.name "Your Name"
|
|
55
|
+
git config --global user.email "contributor@example.com"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Writing good commit logs is important. A commit log should describe what changed and why.
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
git add ...
|
|
62
|
+
git commit
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Push
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
git push origin my-feature-branch
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Make a Pull Request
|
|
72
|
+
|
|
73
|
+
Go to [https://github.com/CoCreate-app/CoCreate-config](https://github.com/CoCreate-app/CoCreate-config) and select your feature branch.
|
|
74
|
+
Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
|
|
75
|
+
|
|
76
|
+
## Rebase
|
|
77
|
+
|
|
78
|
+
If you've been working on a change for a while, rebase with upstream/master.
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
git fetch upstream
|
|
82
|
+
git rebase upstream/master
|
|
83
|
+
git push origin my-feature-branch -f
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Update CHANGELOG Again
|
|
87
|
+
|
|
88
|
+
Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
* [#123](https://github.com/CoCreate-app/CoCreate-industry/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Amend your previous commit and force push the changes.
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
git commit --amend
|
|
98
|
+
git push origin my-feature-branch -f
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Check on Your Pull Request
|
|
102
|
+
|
|
103
|
+
Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
|
|
104
|
+
|
|
105
|
+
## Be Patient
|
|
106
|
+
|
|
107
|
+
It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang on there!
|
|
108
|
+
|
|
109
|
+
## Thank You
|
|
110
|
+
|
|
111
|
+
Please do know that we really appreciate and value your time and work. We love you, really.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
"organization_id": "",
|
|
3
|
+
"key": "",
|
|
4
|
+
"host": "",
|
|
5
|
+
"sources": [
|
|
6
|
+
{
|
|
7
|
+
"collection": "files",
|
|
8
|
+
"document": {
|
|
9
|
+
"_id": "61a12db2a8b6b4001a9f5a2e",
|
|
10
|
+
"name": "index.html",
|
|
11
|
+
"path": "/docs/config/index.html",
|
|
12
|
+
"src": "{{./docs/index.html}}",
|
|
13
|
+
"host": [
|
|
14
|
+
"*",
|
|
15
|
+
"general.cocreate.app"
|
|
16
|
+
],
|
|
17
|
+
"directory": "/docs/config",
|
|
18
|
+
"parentDirectory": "{{parentDirectory}}",
|
|
19
|
+
"content-type": "{{content-type}}",
|
|
20
|
+
"public": "true",
|
|
21
|
+
"website_id": "644d4bff8036fb9d1d1fd69c"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
};
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 CoCreate LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# CoCreate-action
|
|
2
|
+
|
|
3
|
+
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. Take it for a spin in our [playground!](https://cocreate.app/docs/config)
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+

|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
## [Docs & Demo](https://cocreate.app/docs/config)
|
|
15
|
+
|
|
16
|
+
For a complete guide and working demo refer to the [doumentation](https://cocreate.app/docs/config)
|
|
17
|
+
|
|
18
|
+
## CDN
|
|
19
|
+
|
|
20
|
+
```html
|
|
21
|
+
<script src="https://cdn.cocreate.app/config/latest/CoCreate-config.min.js"></script>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```html
|
|
25
|
+
<script src="https://cdn.cocreate.app/config/latest/CoCreate-config.min.css"></script>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## NPM
|
|
29
|
+
|
|
30
|
+
```shell
|
|
31
|
+
$ npm i @cocreate/config
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## yarn
|
|
35
|
+
|
|
36
|
+
```shell
|
|
37
|
+
$ yarn install @cocreate/config
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
# Table of Contents
|
|
41
|
+
|
|
42
|
+
- [Table of Contents](#table-of-contents)
|
|
43
|
+
- [Announcements](#announcements)
|
|
44
|
+
- [Roadmap](#roadmap)
|
|
45
|
+
- [How to Contribute](#how-to-contribute)
|
|
46
|
+
- [About](#about)
|
|
47
|
+
- [License](#license)
|
|
48
|
+
|
|
49
|
+
<a name="announcements"></a>
|
|
50
|
+
|
|
51
|
+
# Announcements
|
|
52
|
+
|
|
53
|
+
All updates to this library are documented in our [CHANGELOG](https://github.com/CoCreate-app/CoCreate-config/blob/master/CHANGELOG.md) and [releases](https://github.com/CoCreate-app/CoCreate-config/releases). You may also subscribe to email for releases and breaking changes.
|
|
54
|
+
|
|
55
|
+
<a name="roadmap"></a>
|
|
56
|
+
|
|
57
|
+
# Roadmap
|
|
58
|
+
|
|
59
|
+
If you are interested in the future direction of this project, please take a look at our open [issues](https://github.com/CoCreate-app/CoCreate-config/issues) and [pull requests](https://github.com/CoCreate-app/CoCreate-config/pulls). We would love to hear your feedback.
|
|
60
|
+
|
|
61
|
+
<a name="about"></a>
|
|
62
|
+
|
|
63
|
+
# About
|
|
64
|
+
|
|
65
|
+
CoCreate-config is guided and supported by the CoCreate Developer Experience Team.
|
|
66
|
+
|
|
67
|
+
Please Email the Developer Experience Team [here](mailto:develop@cocreate.app) in case of any queries.
|
|
68
|
+
|
|
69
|
+
CoCreate-config is maintained and funded by CoCreate. The names and logos for CoCreate are trademarks of CoCreate, LLC.
|
|
70
|
+
|
|
71
|
+
<a name="contribute"></a>
|
|
72
|
+
|
|
73
|
+
# How to Contribute
|
|
74
|
+
|
|
75
|
+
We encourage contribution to our libraries (you might even score some nifty swag), please see our [CONTRIBUTING](https://github.com/CoCreate-app/CoCreate-config/blob/master/CONTRIBUTING.md) guide for details.
|
|
76
|
+
|
|
77
|
+
We want this library to be community-driven, and CoCreate led. We need your help to realize this goal. To help make sure we are building the right things in the right order, we ask that you create [issues](https://github.com/CoCreate-app/CoCreate-config/issues) and [pull requests](https://github.com/CoCreate-app/CoCreate-config/pulls) or merely upvote or comment on existing issues or pull requests.
|
|
78
|
+
|
|
79
|
+
We appreciate your continued support, thank you!
|
|
80
|
+
|
|
81
|
+
<a name="license"></a>
|
|
82
|
+
|
|
83
|
+
# License
|
|
84
|
+
|
|
85
|
+
[The MIT License (MIT)](https://github.com/CoCreate-app/CoCreate-config/blob/master/LICENSE)
|
package/demo/index.html
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<title>config | CoCreateJS</title>
|
|
5
|
+
|
|
6
|
+
<!-- CoCreate Favicon -->
|
|
7
|
+
<link
|
|
8
|
+
rel="icon"
|
|
9
|
+
href="https://cdn.cocreate.app/favicon.ico"
|
|
10
|
+
type="image/ico"
|
|
11
|
+
sizes="16x16" />
|
|
12
|
+
<link rel="manifest" href="/manifest.webmanifest" />
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<form>
|
|
16
|
+
<button
|
|
17
|
+
type="button"
|
|
18
|
+
id="id-one"
|
|
19
|
+
config="timeout(12000), action(#id-two)">
|
|
20
|
+
click
|
|
21
|
+
</button>
|
|
22
|
+
</form>
|
|
23
|
+
<form>
|
|
24
|
+
<button
|
|
25
|
+
type="button"
|
|
26
|
+
config="timeout(1000), timeout(2000), timeout(5000)">
|
|
27
|
+
click
|
|
28
|
+
</button>
|
|
29
|
+
</form>
|
|
30
|
+
|
|
31
|
+
<form>
|
|
32
|
+
<input render-key="render.company" value="Paper Company" />
|
|
33
|
+
<button
|
|
34
|
+
id="id-two"
|
|
35
|
+
type="button"
|
|
36
|
+
config="timeout(1000), action(#id-three)"
|
|
37
|
+
hidden>
|
|
38
|
+
click
|
|
39
|
+
</button>
|
|
40
|
+
</form>
|
|
41
|
+
|
|
42
|
+
<form>
|
|
43
|
+
<input render-key="render.name" value="Micheal Scott" />
|
|
44
|
+
<button
|
|
45
|
+
id="id-three"
|
|
46
|
+
type="button"
|
|
47
|
+
config="timeout(4000), renderKey"
|
|
48
|
+
hidden>
|
|
49
|
+
click
|
|
50
|
+
</button>
|
|
51
|
+
</form>
|
|
52
|
+
|
|
53
|
+
<!--<script src="../dist/CoCreate-config.js" ></script>-->
|
|
54
|
+
<script src="https://cdn.cocreate.app/latest/CoCreate.min.js"></script>
|
|
55
|
+
</body>
|
|
56
|
+
</html>
|
package/docs/index.html
ADDED
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
<title>CoCreate-config Documentation | CoCreateJS</title>
|
|
8
|
+
<link
|
|
9
|
+
rel="icon"
|
|
10
|
+
type="image/png"
|
|
11
|
+
sizes="32x32"
|
|
12
|
+
href="https://cocreate.app/images/favicon.ico" />
|
|
13
|
+
<meta
|
|
14
|
+
name="description"
|
|
15
|
+
content="A convenient chain handler allows user to chain multiple components together. When one config is complete next one will start untill all config completed." />
|
|
16
|
+
<meta
|
|
17
|
+
name="keywords"
|
|
18
|
+
content="helper classes, utility classes, css framework, css library, inline style classes" />
|
|
19
|
+
<meta name="robots" content="index,follow" />
|
|
20
|
+
<meta
|
|
21
|
+
property="og:image"
|
|
22
|
+
content="https://cdn.cocreate.app/docs/config.png" />
|
|
23
|
+
|
|
24
|
+
<!-- CoCreate CSS -->
|
|
25
|
+
<link
|
|
26
|
+
rel="stylesheet"
|
|
27
|
+
href="https://cdn.cocreate.app/latest/CoCreate.min.css"
|
|
28
|
+
type="text/css" />
|
|
29
|
+
<link
|
|
30
|
+
rel="stylesheet"
|
|
31
|
+
href="/docs/index.css"
|
|
32
|
+
collection="files"
|
|
33
|
+
document_id="60888216117c640e7596303f"
|
|
34
|
+
name="src"
|
|
35
|
+
type="text/css"
|
|
36
|
+
save="true" />
|
|
37
|
+
<link rel="manifest" href="/manifest.webmanifest" />
|
|
38
|
+
</head>
|
|
39
|
+
|
|
40
|
+
<body>
|
|
41
|
+
<nav
|
|
42
|
+
class="nav display:flex align-items:center left:0px background:whitesmoke padding-top:10px padding-bottom:10px"
|
|
43
|
+
content_id="content"
|
|
44
|
+
scroll="sticky-nav,hide-nav"
|
|
45
|
+
scroll-up="10"
|
|
46
|
+
scroll-down="10"
|
|
47
|
+
collection="files"
|
|
48
|
+
document_id="60395ef42b3ac232657040fd"
|
|
49
|
+
name="src"></nav>
|
|
50
|
+
<sidenav
|
|
51
|
+
id="menuL"
|
|
52
|
+
class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl"
|
|
53
|
+
resizable
|
|
54
|
+
resize-target="[content_id='content']"
|
|
55
|
+
resize-property="margin-left"
|
|
56
|
+
resize-value="width">
|
|
57
|
+
<menu
|
|
58
|
+
collection="files"
|
|
59
|
+
document_id="603717b07de7fb350ae9fec8"
|
|
60
|
+
name="src"></menu>
|
|
61
|
+
<div resize="right"></div>
|
|
62
|
+
</sidenav>
|
|
63
|
+
<main
|
|
64
|
+
class="padding-top:15px padding:15px@lg@xl"
|
|
65
|
+
content_id="content"
|
|
66
|
+
id="cocreate-config">
|
|
67
|
+
<div
|
|
68
|
+
class="display:flex flex-wrap:wrap justify-content:space-between position:relative margin:10px">
|
|
69
|
+
<div class="display:flex align-items:center">
|
|
70
|
+
<h2>CoCreate-config</h2>
|
|
71
|
+
</div>
|
|
72
|
+
<div
|
|
73
|
+
class="display:flex align-items:center font-size:20px position:absolute right:0 padding:5px background:white">
|
|
74
|
+
<div
|
|
75
|
+
class="display:flex align-items:center transition:0.3s padding-left:10px"
|
|
76
|
+
share-network="true"
|
|
77
|
+
share-text="A convenient chain handler allows user to chain multiple components together. When one config is complete next one will start untill all config completed."
|
|
78
|
+
share-title="CoCreate config"
|
|
79
|
+
share-height="600"
|
|
80
|
+
share-width="700"
|
|
81
|
+
share-media="https://cdn.cocreate.app/docs/config.png"
|
|
82
|
+
hover="display:block!important"
|
|
83
|
+
hover-target=".social-networks">
|
|
84
|
+
<div class="display:none social-networks">
|
|
85
|
+
<a
|
|
86
|
+
class="margin-right:15px"
|
|
87
|
+
share-network="twitter"
|
|
88
|
+
title="Share on twitter"
|
|
89
|
+
><i
|
|
90
|
+
class="height:20px fill:#505050"
|
|
91
|
+
src="/assets/svg/twitter.svg"></i
|
|
92
|
+
></a>
|
|
93
|
+
<a
|
|
94
|
+
class="margin-right:15px"
|
|
95
|
+
share-network="facebook"
|
|
96
|
+
title="Share on Facebook"
|
|
97
|
+
><i
|
|
98
|
+
class="height:20px fill:#505050"
|
|
99
|
+
src="/assets/svg/facebook.svg"></i
|
|
100
|
+
></a>
|
|
101
|
+
<a
|
|
102
|
+
class="margin-right:15px"
|
|
103
|
+
share-network="instagram"
|
|
104
|
+
title="Share on instagram"
|
|
105
|
+
><i
|
|
106
|
+
class="height:20px fill:#505050"
|
|
107
|
+
src="/assets/svg/instagram.svg"></i
|
|
108
|
+
></a>
|
|
109
|
+
</div>
|
|
110
|
+
<a
|
|
111
|
+
class="margin-right:15px"
|
|
112
|
+
share-network="share"
|
|
113
|
+
title="Share on share"
|
|
114
|
+
><i
|
|
115
|
+
class="height:20px fill:#505050"
|
|
116
|
+
src="/assets/svg/share-alt.svg"></i
|
|
117
|
+
></a>
|
|
118
|
+
</div>
|
|
119
|
+
<a
|
|
120
|
+
class="margin-right:15px"
|
|
121
|
+
share-network="share"
|
|
122
|
+
title="Share on share"
|
|
123
|
+
><i
|
|
124
|
+
class="height:20px fill:#505050"
|
|
125
|
+
src="/assets/svg/share-alt.svg"></i
|
|
126
|
+
></a>
|
|
127
|
+
</div>
|
|
128
|
+
<a
|
|
129
|
+
href="https://github.com/CoCreate-app/CoCreate-config"
|
|
130
|
+
target="_blank"
|
|
131
|
+
class=""
|
|
132
|
+
><i
|
|
133
|
+
class="height:20px fill:#505050"
|
|
134
|
+
src="/assets/svg/github.svg"></i
|
|
135
|
+
></a>
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
<h1
|
|
139
|
+
class="max-width:500px margin:20px_10px line-height:1.5 font-size:16px font-weight:100">
|
|
140
|
+
A convenient chain handler allows user to chain multiple
|
|
141
|
+
CoCreate components together. When one config is complete next
|
|
142
|
+
one will start. The sequence goes untill all config completed.
|
|
143
|
+
Grounded on Vanilla javascript, easily configured using HTML5
|
|
144
|
+
attributes and/or JavaScript API.
|
|
145
|
+
</h1>
|
|
146
|
+
<div id="config-section" class="display:flex flex-wrap:wrap">
|
|
147
|
+
<div
|
|
148
|
+
class="flex-grow:1 width:400px width:300px@xs padding:0px_10px margin-top:60px">
|
|
149
|
+
<div
|
|
150
|
+
id="config-install"
|
|
151
|
+
class="border-bottom:1px_solid_lightgrey"
|
|
152
|
+
scroll
|
|
153
|
+
scroll-intersect="color:dodgerblue"
|
|
154
|
+
scroll-target="#config-install-section">
|
|
155
|
+
<span
|
|
156
|
+
class="display:flex align-items:center width:fit-content"
|
|
157
|
+
hover="display:block!important"
|
|
158
|
+
hover-target="[href='#config-install']">
|
|
159
|
+
<h2 class="padding:5px_0px">Install</h2>
|
|
160
|
+
<a
|
|
161
|
+
class="margin-left:10px display:none"
|
|
162
|
+
href="#config-install"
|
|
163
|
+
><i
|
|
164
|
+
class="height:20px fill:#505050"
|
|
165
|
+
src="/assets/svg/link.svg"></i
|
|
166
|
+
></a>
|
|
167
|
+
</span>
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
<pre><code class="language-bash">npm i @cocreate/config</code></pre>
|
|
171
|
+
<p class="padding:10px_0px line-height:1.5">
|
|
172
|
+
Or you can use cdn link:
|
|
173
|
+
</p>
|
|
174
|
+
<pre><code class="language-html"><script>https://cdn.cocreate.app/config/latest/CoCreate-config.min.js</script></code></pre>
|
|
175
|
+
|
|
176
|
+
<div
|
|
177
|
+
id="config-usage"
|
|
178
|
+
class="margin-top:80px border-bottom:1px_solid_lightgrey"
|
|
179
|
+
scroll
|
|
180
|
+
scroll-intersect="color:dodgerblue"
|
|
181
|
+
scroll-target="#config-usage-section">
|
|
182
|
+
<span
|
|
183
|
+
class="display:flex align-items:center width:fit-content"
|
|
184
|
+
hover="display:block!important"
|
|
185
|
+
hover-target="[href='#config-usage']">
|
|
186
|
+
<h2 class="padding:5px_0px">Usage</h2>
|
|
187
|
+
<a
|
|
188
|
+
class="margin-left:10px display:none"
|
|
189
|
+
href="#config-usage"
|
|
190
|
+
><i
|
|
191
|
+
class="height:20px fill:#505050"
|
|
192
|
+
src="/assets/svg/link.svg"></i
|
|
193
|
+
></a>
|
|
194
|
+
</span>
|
|
195
|
+
</div>
|
|
196
|
+
<div class="">
|
|
197
|
+
<p class="padding:10px_0px line-height:1.5">
|
|
198
|
+
This is config usage
|
|
199
|
+
</p>
|
|
200
|
+
|
|
201
|
+
<div class="flex-grow:1 min-width:300px width:100%">
|
|
202
|
+
<pre><code class="language-html"><div></div></code></pre>
|
|
203
|
+
</div>
|
|
204
|
+
<p class="padding:10px_0px line-height:1.5">
|
|
205
|
+
This is config usage
|
|
206
|
+
</p>
|
|
207
|
+
<p class="padding:10px_0px line-height:1.5">
|
|
208
|
+
This is config usage
|
|
209
|
+
</p>
|
|
210
|
+
</div>
|
|
211
|
+
|
|
212
|
+
<div
|
|
213
|
+
id="config-attributes"
|
|
214
|
+
class="margin-top:80px border-bottom:1px_solid_lightgrey"
|
|
215
|
+
scroll
|
|
216
|
+
scroll-intersect="color:dodgerblue"
|
|
217
|
+
scroll-target="#config-attributes-section">
|
|
218
|
+
<span
|
|
219
|
+
class="display:flex align-items:center width:fit-content"
|
|
220
|
+
hover="display:block!important"
|
|
221
|
+
hover-target="[href='#config-attributes']">
|
|
222
|
+
<h2 class="padding:5px_0px">Attributes</h2>
|
|
223
|
+
<a
|
|
224
|
+
class="margin-left:10px display:none"
|
|
225
|
+
href="#config-attributes"
|
|
226
|
+
><i
|
|
227
|
+
class="height:20px fill:#505050"
|
|
228
|
+
src="/assets/svg/link.svg"></i
|
|
229
|
+
></a>
|
|
230
|
+
</span>
|
|
231
|
+
</div>
|
|
232
|
+
|
|
233
|
+
<ul class="list-style-type:none">
|
|
234
|
+
<li
|
|
235
|
+
class="padding:15px_0px border-bottom:1px_solid_lightgrey">
|
|
236
|
+
<h4>
|
|
237
|
+
<span>config</span>
|
|
238
|
+
<span class="cocreate-badge success"
|
|
239
|
+
>string</span
|
|
240
|
+
>
|
|
241
|
+
<span class="cocreate-badge warning"
|
|
242
|
+
>optional</span
|
|
243
|
+
>
|
|
244
|
+
</h4>
|
|
245
|
+
<p>config-attribute</p>
|
|
246
|
+
</li>
|
|
247
|
+
<li
|
|
248
|
+
class="padding:15px_0px border-bottom:1px_solid_lightgrey">
|
|
249
|
+
<h4>
|
|
250
|
+
<span>config</span>
|
|
251
|
+
<span class="cocreate-badge success"
|
|
252
|
+
>string</span
|
|
253
|
+
>
|
|
254
|
+
<span class="cocreate-badge warning"
|
|
255
|
+
>optional</span
|
|
256
|
+
>
|
|
257
|
+
</h4>
|
|
258
|
+
<p>config-attribute</p>
|
|
259
|
+
</li>
|
|
260
|
+
</ul>
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
<div
|
|
264
|
+
class="flex-grow:1 width:300px padding:0px_10px margin-top:60px border-bottom:1px_solid_lightgrey">
|
|
265
|
+
<!-- SandBox -->
|
|
266
|
+
<div
|
|
267
|
+
id="config-demo"
|
|
268
|
+
class="border-bottom:1px_solid_lightgrey"
|
|
269
|
+
scroll
|
|
270
|
+
scroll-intersect="color:dodgerblue"
|
|
271
|
+
scroll-target="#config-demo-section">
|
|
272
|
+
<span
|
|
273
|
+
class="display:flex align-items:center width:fit-content"
|
|
274
|
+
hover="display:block!important"
|
|
275
|
+
hover-target="[href='#config-demo']">
|
|
276
|
+
<h2 class="padding:5px_0px">Demo</h2>
|
|
277
|
+
<a
|
|
278
|
+
class="margin-left:10px display:none"
|
|
279
|
+
href="#config-demo"
|
|
280
|
+
><i
|
|
281
|
+
class="height:20px fill:#505050"
|
|
282
|
+
src="/assets/svg/link.svg"></i
|
|
283
|
+
></a>
|
|
284
|
+
</span>
|
|
285
|
+
</div>
|
|
286
|
+
|
|
287
|
+
<div
|
|
288
|
+
class="position:sticky top:0 padding:15px_0px height:100vh">
|
|
289
|
+
<!-- SandBox -->
|
|
290
|
+
<div
|
|
291
|
+
class="display:flex flex-direction:column position:relative overflow:hidden card border-radius:2px width:auto height:600px margin-top:20px"
|
|
292
|
+
id="playground">
|
|
293
|
+
<div
|
|
294
|
+
id="demo-code"
|
|
295
|
+
resizable
|
|
296
|
+
class="position:relative height:50%">
|
|
297
|
+
<textarea
|
|
298
|
+
type="code"
|
|
299
|
+
lang="html"
|
|
300
|
+
collection="demos"
|
|
301
|
+
document_id=""
|
|
302
|
+
name="demo"
|
|
303
|
+
save="false"
|
|
304
|
+
id="demo"
|
|
305
|
+
class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
|
|
306
|
+
<div
|
|
307
|
+
resize="bottom"
|
|
308
|
+
class="background:lightgrey"></div>
|
|
309
|
+
</div>
|
|
310
|
+
|
|
311
|
+
<div
|
|
312
|
+
id="demo-preview"
|
|
313
|
+
class="position:relative overflow:auto background-color:white">
|
|
314
|
+
<div class="demopreview padding:20px"></div>
|
|
315
|
+
</div>
|
|
316
|
+
|
|
317
|
+
<div
|
|
318
|
+
class="font-size:20px position:absolute top:10px right:10px opacity:0.6">
|
|
319
|
+
<a
|
|
320
|
+
class="margin-right:10px"
|
|
321
|
+
id="eye"
|
|
322
|
+
show="#eye-slash"
|
|
323
|
+
hide="#eye, #demo-preview"
|
|
324
|
+
toggle="code-height"
|
|
325
|
+
toggle-target="#demo-code"
|
|
326
|
+
><i
|
|
327
|
+
class="height:18px fill:#505050"
|
|
328
|
+
src="/assets/svg/eye.svg"></i
|
|
329
|
+
></a>
|
|
330
|
+
<a
|
|
331
|
+
class="margin-right:10px"
|
|
332
|
+
hidden
|
|
333
|
+
id="eye-slash"
|
|
334
|
+
show="#eye, #demo-preview"
|
|
335
|
+
hide="#eye-slash"
|
|
336
|
+
toggle="code-height"
|
|
337
|
+
toggle-target="#demo-code"
|
|
338
|
+
><i
|
|
339
|
+
class="height:20px fill:#505050"
|
|
340
|
+
src="/assets/svg/eye-slash.svg"></i
|
|
341
|
+
></a>
|
|
342
|
+
<a
|
|
343
|
+
class="margin-right:10px"
|
|
344
|
+
id="code"
|
|
345
|
+
show="#code-slash"
|
|
346
|
+
hide="#code, #demo-code"
|
|
347
|
+
><i
|
|
348
|
+
class="height:20px fill:#505050"
|
|
349
|
+
src="/assets/svg/code.svg"></i
|
|
350
|
+
></a>
|
|
351
|
+
<a
|
|
352
|
+
class="margin-right:10px"
|
|
353
|
+
hidden
|
|
354
|
+
id="code-slash"
|
|
355
|
+
show="#code, #demo-code"
|
|
356
|
+
hide="#code-slash"
|
|
357
|
+
><i
|
|
358
|
+
class="display:flex height:18px fill:#505050"
|
|
359
|
+
src="/assets/svg/code.svg"></i
|
|
360
|
+
></a>
|
|
361
|
+
<a
|
|
362
|
+
class="margin-right:5px"
|
|
363
|
+
fullscreen
|
|
364
|
+
fullscreen-target="#playground"></a>
|
|
365
|
+
</div>
|
|
366
|
+
</div>
|
|
367
|
+
<!-- End SandBox -->
|
|
368
|
+
</div>
|
|
369
|
+
</div>
|
|
370
|
+
</div>
|
|
371
|
+
<button
|
|
372
|
+
href="https://github.com/CoCreate-app/CoCreate-config/tree/master/docs/index.html?message=docs%3A%20describe%20your%20change..."
|
|
373
|
+
target="_blank"
|
|
374
|
+
class="position:fixed bottom:15px right:15px padding:15px background:dodgerblue color:#fff font-size:1.5rem grow-hover border-radius:50% border-width:0 box-shadow:0px_2px_10px_0px_rgba(0,_0,_0,_0.4)">
|
|
375
|
+
<i
|
|
376
|
+
class="height:20px fill:#505050"
|
|
377
|
+
src="/assets/svg/pencil-alt.svg"></i>
|
|
378
|
+
</button>
|
|
379
|
+
</main>
|
|
380
|
+
<script src="/apikey.js"></script>
|
|
381
|
+
<script src="https://cdn.cocreate.app/latest/CoCreate.min.js"></script>
|
|
382
|
+
</body>
|
|
383
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cocreate/config",
|
|
3
|
+
"version": "1.0.0",
|
|
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
|
+
"keywords": [
|
|
6
|
+
"config",
|
|
7
|
+
"chain-functions",
|
|
8
|
+
"cocreate",
|
|
9
|
+
"low-code-framework",
|
|
10
|
+
"no-code-framework",
|
|
11
|
+
"cocreatejs",
|
|
12
|
+
"cocreatejs-component",
|
|
13
|
+
"cocreate-framework",
|
|
14
|
+
"no-code",
|
|
15
|
+
"low-code",
|
|
16
|
+
"collaborative-framework",
|
|
17
|
+
"realtime",
|
|
18
|
+
"realtime-framework",
|
|
19
|
+
"collaboration",
|
|
20
|
+
"shared-editing",
|
|
21
|
+
"html5-framework",
|
|
22
|
+
"javascript-framework"
|
|
23
|
+
],
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"start": "npx webpack --config webpack.config.js",
|
|
29
|
+
"build": "NODE_ENV=production npx webpack --config webpack.config.js",
|
|
30
|
+
"dev": "npx webpack --config webpack.config.js --watch",
|
|
31
|
+
"postinstall": "node -e \"const { execSync } = require('child_process'); try { execSync('coc --version', { stdio: 'ignore' }); } catch (error) { try { execSync('npm install -g @cocreate/cli', { stdio: 'inherit' }); console.log('Installed \"@cocreate/cli\" globally.'); } catch (error) { console.error('Failed to install \"@cocreate/cli\" globally:', error); } }\""
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/CoCreate-app/CoCreate-config.git"
|
|
36
|
+
},
|
|
37
|
+
"author": "CoCreate LLC",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/CoCreate-app/CoCreate-config/issues"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://cocreate.app/docs/config",
|
|
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/cli": "^1.33.8",
|
|
63
|
+
"@cocreate/utils": "^1.21.14"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +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
|
+
],
|
|
22
|
+
};
|
package/src/client.js
ADDED
|
File without changes
|
package/src/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
(function (root, factory) {
|
|
2
|
+
if (typeof define === 'function' && define.amd) {
|
|
3
|
+
define(["./client"], function (CoCreateConfig) {
|
|
4
|
+
return factory(CoCreateConfig)
|
|
5
|
+
});
|
|
6
|
+
} else if (typeof module === 'object' && module.exports) {
|
|
7
|
+
const CoCreateConfig = require("./server.js")
|
|
8
|
+
module.exports = factory(CoCreateConfig);
|
|
9
|
+
} else {
|
|
10
|
+
root.returnExports = factory(root["./client.js"]);
|
|
11
|
+
}
|
|
12
|
+
}(typeof self !== 'undefined' ? self : this, function (CoCreateConfig) {
|
|
13
|
+
return CoCreateConfig;
|
|
14
|
+
}));
|
package/src/server.js
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
const readline = require('readline');
|
|
2
|
+
const os = require('os');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const { dotNotationToObject } = require('@cocreate/utils');
|
|
6
|
+
|
|
7
|
+
module.exports = async function (items, env = true, global = true) {
|
|
8
|
+
async function promptForInput(question) {
|
|
9
|
+
const rl = readline.createInterface({
|
|
10
|
+
input: process.stdin,
|
|
11
|
+
output: process.stdout
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
return new Promise((resolve) => {
|
|
15
|
+
rl.question(question, (answer) => {
|
|
16
|
+
rl.close();
|
|
17
|
+
resolve(answer.trim());
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const filterEmptyValues = (obj) => {
|
|
23
|
+
return Object.fromEntries(
|
|
24
|
+
Object.entries(obj).filter(([_, value]) => {
|
|
25
|
+
if (typeof value === 'object' && !Array.isArray(value)) {
|
|
26
|
+
return Object.keys(value).length > 0;
|
|
27
|
+
} else if (Array.isArray(value)) {
|
|
28
|
+
return value.length > 0;
|
|
29
|
+
} else {
|
|
30
|
+
return value !== '';
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
let config = {};
|
|
37
|
+
let update = false;
|
|
38
|
+
let variables = {};
|
|
39
|
+
|
|
40
|
+
async function getConfig(items) {
|
|
41
|
+
for (let key of Object.keys(items)) {
|
|
42
|
+
let { value, prompt, choices, variable } = items[key];
|
|
43
|
+
|
|
44
|
+
const placeholders = key.match(/{{\s*([\w\W]+?)\s*}}/g);
|
|
45
|
+
if (placeholders && placeholders.length) {
|
|
46
|
+
for (let placeholder of placeholders) {
|
|
47
|
+
placeholder.trim()
|
|
48
|
+
if (variables[placeholder])
|
|
49
|
+
key = key.replace(placeholder, variables[placeholder])
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (choices) {
|
|
54
|
+
if (!prompt && prompt !== '' || !choices) continue;
|
|
55
|
+
for (let choice of Object.keys(choices)) {
|
|
56
|
+
let choiceKey = choices[choice].key
|
|
57
|
+
if (process.env[choiceKey]) {
|
|
58
|
+
config[choiceKey] = process.env[choiceKey];
|
|
59
|
+
return;
|
|
60
|
+
} else if (localConfig[choiceKey]) {
|
|
61
|
+
config[choiceKey] = localConfig[choiceKey];
|
|
62
|
+
return;
|
|
63
|
+
|
|
64
|
+
} else if (globalConfig[choiceKey]) {
|
|
65
|
+
config[choiceKey] = globalConfig[choiceKey];
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const answer = await promptForInput(prompt || `${key}: `);
|
|
71
|
+
const choice = choices[answer];
|
|
72
|
+
if (choice) {
|
|
73
|
+
await getConfig(choice);
|
|
74
|
+
}
|
|
75
|
+
} else if (variable) {
|
|
76
|
+
variables[`{{${key}}}`] = value || await promptForInput(prompt || `${key}: `);
|
|
77
|
+
} else {
|
|
78
|
+
// TODO: handle dotnotation
|
|
79
|
+
if (value || value === "") {
|
|
80
|
+
config[key] = value;
|
|
81
|
+
if (global)
|
|
82
|
+
update = true;
|
|
83
|
+
} else if (process.env[key]) {
|
|
84
|
+
config[key] = process.env[key];
|
|
85
|
+
} else {
|
|
86
|
+
if (localConfig[key]) {
|
|
87
|
+
config[key] = localConfig[key];
|
|
88
|
+
} else if (globalConfig[key]) {
|
|
89
|
+
config[key] = globalConfig[key];
|
|
90
|
+
} else if (prompt || prompt === '') {
|
|
91
|
+
config[key] = await promptForInput(prompt || `${key}: `);
|
|
92
|
+
if (global) update = true;
|
|
93
|
+
}
|
|
94
|
+
if (env) {
|
|
95
|
+
if (typeof config[key] === 'object')
|
|
96
|
+
process.env[key] = JSON.stringify(config[key]);
|
|
97
|
+
else
|
|
98
|
+
process.env[key] = config[key];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
let localConfig = {};
|
|
106
|
+
const localConfigPath = path.resolve(process.cwd(), 'CoCreate.config.js');
|
|
107
|
+
if (fs.existsSync(localConfigPath)) {
|
|
108
|
+
localConfig = require(localConfigPath);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
let globalConfig = {};
|
|
112
|
+
const globalConfigPath = path.resolve(os.homedir(), 'CoCreate.config.js');
|
|
113
|
+
if (fs.existsSync(globalConfigPath)) {
|
|
114
|
+
globalConfig = require(globalConfigPath);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (items) {
|
|
118
|
+
await getConfig(items);
|
|
119
|
+
|
|
120
|
+
if (update) {
|
|
121
|
+
let updatedGlobalConfig = filterEmptyValues(
|
|
122
|
+
dotNotationToObject(config, globalConfig)
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
const globalConfigString = `module.exports = ${JSON.stringify(updatedGlobalConfig, null, 2)};`;
|
|
126
|
+
fs.writeFileSync(globalConfigPath, globalConfigString);
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
config = {
|
|
130
|
+
...filterEmptyValues(globalConfig),
|
|
131
|
+
...filterEmptyValues(localConfig)
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return config;
|
|
136
|
+
}
|
|
@@ -0,0 +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-config": "./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", "config"],
|
|
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
|
+
}
|