@ossy/cli 0.1.4 → 0.1.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ossy/cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ossy-se/packages.git"
@@ -24,5 +24,9 @@
24
24
  "access": "public",
25
25
  "registry": "https://registry.npmjs.org"
26
26
  },
27
- "gitHead": "d5cd2ad89b32cdc9cd31a27ff53b71a9c3226799"
27
+ "files": [
28
+ "/build",
29
+ "README.md"
30
+ ],
31
+ "gitHead": "b13ae79ee733d5934fc4fefa3b50e30a7b566ac9"
28
32
  }
package/CHANGELOG.md DELETED
@@ -1,174 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## 0.1.4 (2025-10-31)
7
-
8
-
9
- ### Bug Fixes
10
-
11
- * **app:** add @babel/preset-env ([#7](https://github.com/ossy-se/packages/issues/7)) ([252b41a](https://github.com/ossy-se/packages/commit/252b41a6d4e3d7d3750661091c97186b0d9cdde2))
12
-
13
-
14
-
15
-
16
-
17
- ## 0.1.3 (2025-10-31)
18
-
19
- **Note:** Version bump only for package @ossy/cli
20
-
21
-
22
-
23
-
24
-
25
- ## 0.1.2 (2025-10-31)
26
-
27
- **Note:** Version bump only for package @ossy/cli
28
-
29
-
30
-
31
-
32
-
33
- ## 0.1.1 (2025-10-31)
34
-
35
- **Note:** Version bump only for package @ossy/cli
36
-
37
-
38
-
39
-
40
-
41
- # 0.1.0 (2025-10-30)
42
-
43
-
44
- ### Features
45
-
46
- * **sdk:** get current workspace ([#4](https://github.com/ossy-se/packages/issues/4)) ([afce7d5](https://github.com/ossy-se/packages/commit/afce7d5787af42691f62c9eba672ea1be000e19e))
47
-
48
-
49
-
50
-
51
-
52
- ## 0.0.21 (2025-10-30)
53
-
54
- **Note:** Version bump only for package @ossy/cli
55
-
56
-
57
-
58
-
59
-
60
- ## 0.0.20 (2025-10-27)
61
-
62
- **Note:** Version bump only for package @ossy/cli
63
-
64
-
65
-
66
-
67
-
68
- ## 0.0.19 (2025-10-27)
69
-
70
- **Note:** Version bump only for package @ossy/cli
71
-
72
-
73
-
74
-
75
-
76
- ## 0.0.18 (2025-10-27)
77
-
78
- **Note:** Version bump only for package @ossy/cli
79
-
80
-
81
-
82
-
83
-
84
- ## 0.0.17 (2025-10-27)
85
-
86
- **Note:** Version bump only for package @ossy/cli
87
-
88
-
89
-
90
-
91
-
92
- ## 0.0.16 (2025-10-27)
93
-
94
- **Note:** Version bump only for package @ossy/cli
95
-
96
-
97
-
98
-
99
-
100
- ## 0.0.15 (2025-10-25)
101
-
102
- **Note:** Version bump only for package @ossy/cli
103
-
104
-
105
-
106
-
107
-
108
- ## 0.0.14 (2025-10-25)
109
-
110
- **Note:** Version bump only for package @ossy/cli
111
-
112
-
113
-
114
-
115
-
116
- ## 0.0.13 (2025-10-25)
117
-
118
- **Note:** Version bump only for package @ossy/cli
119
-
120
-
121
-
122
-
123
-
124
- ## 0.0.12 (2025-10-25)
125
-
126
- **Note:** Version bump only for package @ossy/cli
127
-
128
-
129
-
130
-
131
-
132
- ## [0.0.11](https://github.com/ossy-se/packages/compare/@ossy/cli@0.0.10...@ossy/cli@0.0.11) (2025-10-25)
133
-
134
- **Note:** Version bump only for package @ossy/cli
135
-
136
-
137
-
138
-
139
-
140
- ## 0.0.10 (2025-10-25)
141
-
142
- **Note:** Version bump only for package @ossy/cli
143
-
144
-
145
-
146
-
147
-
148
- ## 0.0.9 (2025-10-25)
149
-
150
- **Note:** Version bump only for package @ossy/cli
151
-
152
-
153
-
154
-
155
-
156
- ## 0.0.8 (2025-10-25)
157
-
158
- **Note:** Version bump only for package @ossy/cli
159
-
160
-
161
-
162
-
163
-
164
- ## 0.0.7 (2025-10-25)
165
-
166
- **Note:** Version bump only for package @ossy/cli
167
-
168
-
169
-
170
-
171
-
172
- ## 0.0.6 (2025-10-25)
173
-
174
- **Note:** Version bump only for package @ossy/cli
package/src/cms/cli.js DELETED
@@ -1,67 +0,0 @@
1
- #!/usr/bin/env node
2
- import { resolve } from 'path'
3
- import { readFileSync } from 'fs'
4
- import arg from 'arg'
5
- import fetch from 'node-fetch'
6
- import { logInfo, logError, logErrorAndReject, logDebug } from '../log.js'
7
-
8
- const Api = {
9
- uploadResourceTemplates: (apiUrl, token, workspaceId, resourceTemplates) => {
10
- const endpoint = `${apiUrl}/workspaces/${workspaceId}/resource-templates`
11
-
12
- const fetchOptions = {
13
- method: 'POST',
14
- headers: { 'Authorization': token, 'Content-Type': 'application/json' },
15
- body: JSON.stringify(resourceTemplates)
16
- }
17
-
18
- return fetch(endpoint, fetchOptions)
19
- }
20
- }
21
-
22
- const resolveConfigImport = path => path.endsWith('json')
23
- ? Promise.resolve(JSON.parse(readFileSync(path), 'utf8'))
24
- : import(path)
25
-
26
- const importResourceTemplates = options => {
27
-
28
- const parsedArgs = arg({
29
- '--authentication': String,
30
- '--a': '--authentication',
31
-
32
- '--config': String,
33
- '-c': '--config',
34
- }, { argv: options })
35
-
36
- logInfo({ message: '[CMS] reading files' })
37
- const token = parsedArgs['--authentication'];
38
- const filePath = resolve(parsedArgs['--config'])
39
-
40
- if (!token) return logErrorAndReject({ message: '[CMS] No token provided with --authentication'})
41
-
42
- return resolveConfigImport(filePath)
43
- .then(module => {
44
- const config = module?.default
45
- const apiUrl = config?.apiUrl || 'https://api.ossy.se/api/v0'
46
- const workspaceId = config?.workspaceId
47
- const resourceTemplates = config?.resourceTemplates
48
-
49
- if (!workspaceId) return logErrorAndReject({ message: '[CMS] No workspaceId provided in ossy.json'})
50
- if (!resourceTemplates) return logErrorAndReject({ message: '[CMS] No resource templates provided in ossy.json'})
51
-
52
- logInfo({ message: '[CMS] uploading resource templates' })
53
-
54
- Api.uploadResourceTemplates(apiUrl, token, workspaceId, resourceTemplates)
55
- .then(response => {
56
- logInfo({ message: '[CMS] Done' })
57
- })
58
- .catch(error => logError({ message: '[CMS] Error', error }))
59
- })
60
-
61
- }
62
-
63
- export const handler = ([command, ...options]) => {
64
- !!command
65
- ? { 'import-resource-templates': importResourceTemplates }[command](options)
66
- : logError({ message: '[CMS] No command provided' })
67
- }
package/src/log.js DELETED
@@ -1,44 +0,0 @@
1
- // interface LogInput {
2
- // type: TypeOfMessage;
3
- // message: string;
4
- // data?: any;
5
- // dataPrefix: string;
6
- // }
7
-
8
- const TypeOfMessage = {
9
- Info: 'INFO',
10
- Error: 'ERROR',
11
- Debug: 'DEBUG'
12
- }
13
-
14
-
15
- export const log = (...params) => { console.log(...params) }
16
- const prefixTo = (prefix, message) => `[${prefix}]${message.startsWith('[') ? '' : ': '}`
17
-
18
- export const logInfo = logInput => {
19
- const messagePrefix = prefixTo(TypeOfMessage.Info, logInput.message)
20
- log(`${messagePrefix}${logInput.message}`)
21
- }
22
-
23
- export const logError = logInput => {
24
- const messagePrefix = prefixTo(TypeOfMessage.Error, logInput.message)
25
- log('\n')
26
- log(`${messagePrefix}${logInput.message}`)
27
- logInput.error && log('[Reason]:', logInput.error)
28
- log('\n')
29
- }
30
-
31
- export const logDebug = logInput => {
32
- const isDebugOn = process.env.DEBUG || true
33
- if (!isDebugOn) return
34
- const messagePrefix = prefixTo(TypeOfMessage.Debug, logInput.message)
35
- log('\n')
36
- log(`${messagePrefix}${logInput.message}`)
37
- logInput.data && log('[DEBUG DATA]:', logInput.data)
38
- log('\n')
39
- }
40
-
41
- export const logErrorAndReject = logInput => {
42
- logError(logInput)
43
- return Promise.reject(logInput.error)
44
- }