r2-explorer 0.2.0 → 0.2.1

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,7 +1,8 @@
1
1
  #! /usr/bin/env node
2
2
  var fs = require('fs');
3
3
 
4
- const projectName = process.argv.slice(1) || 'r2-explorer';
4
+ const args = process.argv.slice(2);
5
+ const projectName = args[0] || 'r2-explorer';
5
6
 
6
7
  const dir = `./${projectName}`
7
8
  if (!fs.existsSync(dir)) {
@@ -17,6 +18,23 @@ main = "src/index.js"
17
18
  binding = 'my-bucket-name'
18
19
  bucket_name = 'my-bucket-name'
19
20
  preview_bucket_name = 'my-bucket-name'
21
+ `);
22
+ fs.writeFileSync(`${dir}/package.json`,
23
+ `{
24
+ "name": "${projectName}",
25
+ "version": "0.0.1",
26
+ "private": true,
27
+ "devDependencies": {
28
+ "wrangler": "^2.4.2"
29
+ },
30
+ "scripts": {
31
+ "publish": "wrangler publish"
32
+ },
33
+ "dependencies": {
34
+ "r2-explorer": "^0.2.0"
35
+ }
36
+ }
37
+
20
38
  `);
21
39
 
22
40
  const srcDir = `${dir}/src`
@@ -39,7 +57,9 @@ export default {
39
57
 
40
58
  console.log(`Project ${projectName} successfully created!`);
41
59
  console.log('----------------------------');
42
- console.log(`Update the ${projectName}/wrangler.toml file with your R2 Buckets`);
43
- console.log(`Run 'cd ${projectName} && wrangler publish' to deploy your R2-Explorer!`);
60
+ console.log('Next steps:');
61
+ console.log(` 1. Run 'cd ${projectName} && npm install'`);
62
+ console.log(' 2. Update the \'wrangler.toml\' file with your R2 Buckets');
63
+ console.log(' 3. Run \'wrangler publish\' to deploy your own R2-Explorer!');
44
64
 
45
65
  process.exit(0); //no errors occurred
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "r2-explorer",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "devDependencies": {
5
5
  "@rollup/plugin-commonjs": "^17.0.0",
6
6
  "@rollup/plugin-dynamic-import-vars": "^2.0.1",
@@ -18,14 +18,12 @@
18
18
  "wrangler": "^2.4.2"
19
19
  },
20
20
  "scripts": {
21
- "serve": "wrangler dev",
22
- "publish": "wrangler publish",
23
21
  "build": "rollup --config rollup.config.js"
24
22
  },
25
23
  "dependencies": {
26
24
  "itty-router": "^2.6.1"
27
25
  },
28
26
  "bin": {
29
- "r2-explorer": "./bin/r2-explorer.js"
27
+ "r2-explorer": "bin/r2-explorer.js"
30
28
  }
31
29
  }
package/src/index.js CHANGED
@@ -10,7 +10,7 @@ import html from 'explorer:index.html'
10
10
  import app from 'explorer:js/app.js'
11
11
  import favicon from 'explorer:favicon.png'
12
12
 
13
- export function r2explorer() {
13
+ export function R2Explorer() {
14
14
  const router = Router();
15
15
 
16
16
  router.get('/', () => {