@cocreate/file 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 +67 -120
- package/CHANGELOG.md +17 -0
- package/demo/index.html +1 -1
- package/docs/index.html +1 -1
- package/package.json +5 -5
- package/src/server.js +14 -16
|
@@ -1,123 +1,70 @@
|
|
|
1
|
-
name: Automated
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
name: Automated Workflow
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- master
|
|
6
6
|
jobs:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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'
|
|
7
|
+
about:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
steps:
|
|
10
|
+
- name: Checkout
|
|
11
|
+
uses: actions/checkout@v3
|
|
12
|
+
- name: Setup Node.js
|
|
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
|
+
release:
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
- name: Checkout
|
|
25
|
+
uses: actions/checkout@v3
|
|
26
|
+
- name: Setup Node.js
|
|
27
|
+
uses: actions/setup-node@v3
|
|
28
|
+
with:
|
|
29
|
+
node-version: 14
|
|
30
|
+
- name: Semantic Release
|
|
31
|
+
uses: cycjimmy/semantic-release-action@v3
|
|
32
|
+
id: semantic
|
|
33
|
+
with:
|
|
34
|
+
extra_plugins: |
|
|
35
|
+
@semantic-release/changelog
|
|
36
|
+
@semantic-release/git
|
|
37
|
+
@semantic-release/github
|
|
49
38
|
env:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
source: ./dist
|
|
82
|
-
destination: /file/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
|
|
39
|
+
GITHUB_TOKEN: "${{ secrets.GITHUB }}"
|
|
40
|
+
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
|
|
41
|
+
outputs:
|
|
42
|
+
new_release_published: "${{ steps.semantic.outputs.new_release_published }}"
|
|
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
|
|
108
70
|
|
|
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 }}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
# [1.6.0](https://github.com/CoCreate-app/CoCreate-file/compare/v1.5.3...v1.6.0) (2023-08-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Update cocreate dependencies for the latest features and bug fixes ([2aab571](https://github.com/CoCreate-app/CoCreate-file/commit/2aab571f45cb35ef84a2df219c2a129299c918bd))
|
|
7
|
+
|
|
8
|
+
## [1.5.3](https://github.com/CoCreate-app/CoCreate-file/compare/v1.5.2...v1.5.3) (2023-08-21)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* /dist/CoCreate.js updated to https://CoCreate.app/dist/CoCreate.js ([0903b42](https://github.com/CoCreate-app/CoCreate-file/commit/0903b4285c3e798b5631e6bd251d58ff3bf9e619))
|
|
14
|
+
* removed handeling of resolving static configPath CoCreate.config.js ([53604bb](https://github.com/CoCreate-app/CoCreate-file/commit/53604bbdb25d8e89e53469d725ae90d90d1ab4d7))
|
|
15
|
+
* replace cdn with /dist ([b305020](https://github.com/CoCreate-app/CoCreate-file/commit/b305020846b839ac147f26b19c68f881c7b0b41c))
|
|
16
|
+
* update file uploader ([9fa12e8](https://github.com/CoCreate-app/CoCreate-file/commit/9fa12e8dd0c7a396778bb5aa7c71b745ef1945af))
|
|
17
|
+
|
|
1
18
|
## [1.5.2](https://github.com/CoCreate-app/CoCreate-file/compare/v1.5.1...v1.5.2) (2023-08-18)
|
|
2
19
|
|
|
3
20
|
|
package/demo/index.html
CHANGED
|
@@ -60,6 +60,6 @@
|
|
|
60
60
|
|
|
61
61
|
<!-- <script src="../dist/CoCreate-file.js"></script> -->
|
|
62
62
|
<script src="../../../CoCreateJS/dist/CoCreate.js"></script>
|
|
63
|
-
<!-- <script src="https://
|
|
63
|
+
<!-- <script src="https://CoCreate.app/dist/CoCreate.js"></script> -->
|
|
64
64
|
</body>
|
|
65
65
|
</html>
|
package/docs/index.html
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/file",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "A headless file uploader that uses HTML5 attributes for customization. Allows easy upload of files to server.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"file",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"webpack-log": "^3.0.1"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@cocreate/actions": "^1.
|
|
63
|
-
"@cocreate/config": "^1.
|
|
64
|
-
"@cocreate/render": "^1.
|
|
65
|
-
"@cocreate/utils": "^1.
|
|
62
|
+
"@cocreate/actions": "^1.10.2",
|
|
63
|
+
"@cocreate/config": "^1.4.0",
|
|
64
|
+
"@cocreate/render": "^1.26.1",
|
|
65
|
+
"@cocreate/utils": "^1.23.1"
|
|
66
66
|
}
|
|
67
67
|
}
|
package/src/server.js
CHANGED
|
@@ -77,16 +77,7 @@ const mimeTypes = {
|
|
|
77
77
|
".7z": "application/x-7z-compressed"
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
module.exports = async function file(CoCreateConfig) {
|
|
81
|
-
|
|
82
|
-
let configFile = path.resolve(process.cwd(), 'CoCreate.config.js');
|
|
83
|
-
if (fs.existsSync(configFile)) {
|
|
84
|
-
CoCreateConfig = require(configFile);
|
|
85
|
-
} else {
|
|
86
|
-
console.log('CoCreate.config.js could not be found.')
|
|
87
|
-
process.exit()
|
|
88
|
-
}
|
|
89
|
-
|
|
80
|
+
module.exports = async function file(CoCreateConfig, configPath) {
|
|
90
81
|
let { directories, sources } = CoCreateConfig;
|
|
91
82
|
let config = await Config({
|
|
92
83
|
organization_id: {
|
|
@@ -113,7 +104,7 @@ module.exports = async function file(CoCreateConfig) {
|
|
|
113
104
|
}
|
|
114
105
|
}
|
|
115
106
|
}
|
|
116
|
-
})
|
|
107
|
+
}, null, null, configPath)
|
|
117
108
|
|
|
118
109
|
if (!config.organization_id || !config.host || !config.key && (!config.password || config.email)) {
|
|
119
110
|
console.log('One or more required config params could not be found')
|
|
@@ -170,7 +161,15 @@ module.exports = async function file(CoCreateConfig) {
|
|
|
170
161
|
let files = fs.readdirSync(entry);
|
|
171
162
|
|
|
172
163
|
for (let file of files) {
|
|
173
|
-
|
|
164
|
+
let skip = false
|
|
165
|
+
for (let i = 0; i < exclude.length; i++) {
|
|
166
|
+
if (file.includes(exclude)) {
|
|
167
|
+
skip = true
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (skip) continue
|
|
172
|
+
|
|
174
173
|
|
|
175
174
|
let isDirectory = fs.existsSync(`${entry}/${file}`) && fs.lstatSync(`${entry}/${file}`).isDirectory();
|
|
176
175
|
let name = file
|
|
@@ -199,8 +198,6 @@ module.exports = async function file(CoCreateConfig) {
|
|
|
199
198
|
else
|
|
200
199
|
pathName = '/' + name
|
|
201
200
|
|
|
202
|
-
if (exclude && exclude.includes(pathName)) continue
|
|
203
|
-
|
|
204
201
|
if (isDirectory)
|
|
205
202
|
mimeType = "text/directory"
|
|
206
203
|
else
|
|
@@ -377,6 +374,8 @@ module.exports = async function file(CoCreateConfig) {
|
|
|
377
374
|
|
|
378
375
|
async function runStore(data) {
|
|
379
376
|
try {
|
|
377
|
+
if (data.object.name === 'prism-chunk.js')
|
|
378
|
+
console.log('prism-chunk.js')
|
|
380
379
|
let response;
|
|
381
380
|
if (!data.object._id && !data.filter) {
|
|
382
381
|
response = await crud.send({
|
|
@@ -424,9 +423,8 @@ module.exports = async function file(CoCreateConfig) {
|
|
|
424
423
|
|
|
425
424
|
delete newConfig.url
|
|
426
425
|
delete newConfig.broadcast
|
|
427
|
-
const write_str = `module.exports = ${JSON.stringify(newConfig, null, 4)};`;
|
|
428
426
|
|
|
429
|
-
fs.writeFileSync(
|
|
427
|
+
fs.writeFileSync(configPath, `module.exports = ${JSON.stringify(newConfig, null, 4)};`);
|
|
430
428
|
}
|
|
431
429
|
|
|
432
430
|
console.log('upload complete!');
|