@cocreate/file 1.5.2 → 1.5.3

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.
@@ -1,123 +1,70 @@
1
- name: Automated
2
- "on":
3
- push:
4
- branches:
5
- - master
1
+ name: Automated Workflow
2
+ on:
3
+ push:
4
+ branches:
5
+ - master
6
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'
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
- 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: "/file/${{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: /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,13 @@
1
+ ## [1.5.3](https://github.com/CoCreate-app/CoCreate-file/compare/v1.5.2...v1.5.3) (2023-08-21)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * /dist/CoCreate.js updated to https://CoCreate.app/dist/CoCreate.js ([0903b42](https://github.com/CoCreate-app/CoCreate-file/commit/0903b4285c3e798b5631e6bd251d58ff3bf9e619))
7
+ * removed handeling of resolving static configPath CoCreate.config.js ([53604bb](https://github.com/CoCreate-app/CoCreate-file/commit/53604bbdb25d8e89e53469d725ae90d90d1ab4d7))
8
+ * replace cdn with /dist ([b305020](https://github.com/CoCreate-app/CoCreate-file/commit/b305020846b839ac147f26b19c68f881c7b0b41c))
9
+ * update file uploader ([9fa12e8](https://github.com/CoCreate-app/CoCreate-file/commit/9fa12e8dd0c7a396778bb5aa7c71b745ef1945af))
10
+
1
11
  ## [1.5.2](https://github.com/CoCreate-app/CoCreate-file/compare/v1.5.1...v1.5.2) (2023-08-18)
2
12
 
3
13
 
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://cdn.cocreate.app/latest/CoCreate.min.js"></script> -->
63
+ <!-- <script src="https://CoCreate.app/dist/CoCreate.js"></script> -->
64
64
  </body>
65
65
  </html>
package/docs/index.html CHANGED
@@ -378,6 +378,6 @@
378
378
  </button>
379
379
  </main>
380
380
  <script src="/apikey.js"></script>
381
- <script src="https://cdn.cocreate.app/latest/CoCreate.min.js"></script>
381
+ <script src="https://CoCreate.app/dist/CoCreate.js"></script>
382
382
  </body>
383
383
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/file",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
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",
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
- if (exclude && exclude.includes(file)) continue
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(configFile, write_str);
427
+ fs.writeFileSync(configPath, `module.exports = ${JSON.stringify(newConfig, null, 4)};`);
430
428
  }
431
429
 
432
430
  console.log('upload complete!');