@ossy/cli 0.0.1-alpha → 0.0.2-alpha

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cms/cli.js +5 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ossy/cli",
3
- "version": "0.0.1-alpha",
3
+ "version": "0.0.2-alpha",
4
4
  "description": "Command line tool that makes it easier to interact with our APIs",
5
5
  "source": "./src/index.js",
6
6
  "main": "./src/index.js",
package/src/cms/cli.js CHANGED
@@ -10,9 +10,6 @@ const config = {
10
10
  // apiUrl: 'http://localhost:3001/api/v0'
11
11
  }
12
12
 
13
- const getTokenPayload = token =>
14
- JSON.parse(Buffer.from(token.split('.')[1], 'base64').toString())
15
-
16
13
  const importResourceTemplates = options => {
17
14
 
18
15
  const parsedArgs = arg({
@@ -25,8 +22,11 @@ const importResourceTemplates = options => {
25
22
 
26
23
  logInfo({ message: '[CMS] reading files' })
27
24
  const token = parsedArgs['--authentication']
28
- const tokenPayload = getTokenPayload(token)
29
- const ossyfile = JSON.parse(readFileSync(resolve(parsedArgs['--ossy-file']), 'utf8'))
25
+ const filePath = resolve(parsedArgs['--ossy-file'])
26
+
27
+ const ossyfile = filePath.endsWith('json')
28
+ ? JSON.parse(readFileSync(filePath), 'utf8')
29
+ : require(filePath)
30
30
 
31
31
  if (!token) return logError({ message: '[CMS] No token provided with --authentication'})
32
32
  if (!ossyfile?.workspaceId) return logError({ message: '[CMS] No workspaceId provided in ossy.json'})