@surph_ai/sdk 0.0.2 → 0.0.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.
package/index.js CHANGED
@@ -120,6 +120,10 @@ program.command('new <name>')
120
120
  .description('create new Surph app')
121
121
  .action(name => scaffold(name, 'project'))
122
122
 
123
+ program.command('tool <name>')
124
+ .description('create new Surph tool')
125
+ .action(name => scaffold(name, 'tool'))
126
+
123
127
  program.command('connect')
124
128
  .description('Connect to Surph project')
125
129
  .action(async (cmd, options) => {
@@ -264,3 +268,7 @@ program.command('deploy')
264
268
  })
265
269
 
266
270
  program.parse(process.argv)
271
+
272
+ module.exports = {
273
+
274
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surph_ai/sdk",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
package/scaffold/index.js CHANGED
@@ -19,47 +19,6 @@ const nextSteps = function(name){
19
19
  console.log('For full documentation, visit https://docs.turbo360.co\n')
20
20
  }
21
21
 
22
- /*
23
- var importVectors = function(shell){
24
- shell.mkdir('-p', 'vectors')
25
- shell.mkdir('-p', 'vectors/js')
26
- shell.mkdir('-p', 'vectors/py')
27
- shell.cp('-R', path.join(__dirname, '../default/lambda/js/index.js'), 'vectors/js/index.js')
28
- shell.cp('-R', path.join(__dirname, '../default/lambda/py/requirements.txt'), 'vectors/py/requirements.txt')
29
- shell.cp('-R', path.join(__dirname, '../default/lambda/py/app.py'), 'vectors/py/app.py')
30
- }
31
-
32
- var currentConfig = function(format){
33
- if (format == null)
34
- format = 'vertex'
35
-
36
- var filename = null
37
- if (format == 'vertex')
38
- filename = 'vertex-package.json'
39
-
40
- return new Promise(function(resolve, reject){
41
- utils.getRequest('https://cdn.turbo360-dev.com/dist/config/'+filename, null)
42
- .then(function(response){
43
- // console.log('CONFIG: ' + JSON.stringify(data))
44
- if (response.confirmation != 'success'){
45
- throw new Error('')
46
- return
47
- }
48
-
49
- resolve(response.data)
50
- })
51
- .catch(function(err){
52
- // don't reject this promise. if error, return static
53
- // value from above.
54
- resolve({
55
- vertexVersion: VERTEX_NPM_VERSION,
56
- turboVersion: TURBO_NPM_VERSION
57
- })
58
- })
59
- })
60
- }
61
- */
62
-
63
22
 
64
23
  module.exports = (name, type = 'app') => {
65
24
  /*
@@ -72,17 +31,7 @@ module.exports = (name, type = 'app') => {
72
31
 
73
32
  const { platform } = process
74
33
 
75
- if (type === 'app') {
76
- shell.mkdir('-p', name)
77
- shell.cd(name)
78
-
79
- shell.cp('-R', path.join(__dirname, 'app/package.json'), 'package.json')
80
-
81
- // www:
82
- shell.mkdir('-p', 'src')
83
- shell.cp('-R', path.join(__dirname, `app/src/*`), 'src/')
84
- }
85
-
34
+ /*
86
35
  if (type === 'project') {
87
36
  console.log('create project: ' + name)
88
37
  shell.mkdir('-p', name)
@@ -115,57 +64,38 @@ module.exports = (name, type = 'app') => {
115
64
  const pkgJson = JSON.parse(pkgJsonStr)
116
65
  pkgJson.name = name
117
66
  utils.write('package.json', JSON.stringify(pkgJson, null, 2) + '\n')
67
+ }
68
+ */
69
+
70
+ if (type === 'tool') {
71
+ console.log('create tool: ' + name)
72
+ shell.mkdir('-p', name)
73
+ shell.cd(name)
74
+
75
+ shell.mkdir('-p', 'server')
76
+ shell.cp('-R', path.join(__dirname, 'tool/server/app.js'), 'server/app.js')
77
+ shell.cp('-R', path.join(__dirname, 'tool/package.json'), 'package.json')
78
+
79
+ // routes:
80
+ shell.mkdir('-p', 'server/routes')
81
+ shell.cp('-R', path.join(__dirname, `tool/server/routes/*`), 'server/routes/')
82
+
83
+ // views:
84
+ shell.mkdir('-p', 'server/templates')
85
+ shell.cp('-R', path.join(__dirname, `tool/server/templates/*`), 'server/templates/')
86
+ // shell.cd('server/templates')
87
+
88
+ const pkgJsonStr = utils.readFile(path.join(__dirname, 'tool/package.json'))
89
+ const pkgJson = JSON.parse(pkgJsonStr)
90
+ pkgJson.name = name
91
+ utils.write('package.json', JSON.stringify(pkgJson, null, 2) + '\n')
92
+
93
+ const envStr = utils.readFile(path.join(__dirname, 'tool/env.txt'))
94
+ utils.write('.env', envStr)
95
+
96
+ shell.mkdir('-p', 'tools')
97
+ shell.cp('-R', path.join(__dirname, `tool/tools/*`), 'tools/')
118
98
 
119
- /*
120
- const scripts = {
121
- start: 'node ./www/bin',
122
- test: '',
123
- build: '',
124
- postinstall: 'saxa postinstall'
125
- }
126
-
127
- const devDependencies = {
128
- nodemon: '^2.0.1',
129
- rimraf: '^2.6.2'
130
- }
131
-
132
- const dependencies = {
133
- 'content-type': '^1.0.4',
134
- 'cookie-signature': '1.0.6',
135
- 'escape-html': '^1.0.3',
136
- 'express': '^4.17.1',
137
- 'finalhandler': '1.1.1',
138
- 'fresh': '0.5.2',
139
- 'merge-descriptors': '1.0.1',
140
- 'methods': '^1.1.2',
141
- 'on-finished': '^2.3.0',
142
- 'parseurl': '^1.3.2',
143
- 'path-to-regexp': '0.1.7',
144
- 'proxy-addr': '^2.0.3',
145
- 'qs': '6.11.1',
146
- 'range-parser': '^1.2.0',
147
- 'saxa': '0.0.26',
148
- 'safe-buffer': '5.1.1',
149
- 'send': '0.16.2',
150
- 'serve-static': '1.13.2',
151
- 'setprototypeof': '1.1.0',
152
- 'statuses': '^1.4.0',
153
- 'type-is': '^1.6.16',
154
- 'utils-merge': '1.0.1',
155
- 'vary': '^1.1.2'
156
- }
157
-
158
- // package.json
159
- const pkg = {
160
- name,
161
- version: '0.0.0',
162
- private: true,
163
- scripts,
164
- dependencies,
165
- devDependencies,
166
- }
167
-
168
- utils.write('package.json', JSON.stringify(pkg, null, 2) + '\n')
169
- */
170
99
  }
100
+
171
101
  }
@@ -0,0 +1,28 @@
1
+ # demo
2
+
3
+ This project was built with Saxa Labs. To learn more, click here: https://www.saxalabs.com
4
+
5
+ ## Instructions
6
+ After cloning into repo, cd to project root directory and install dependencies:
7
+
8
+ ```
9
+ $ npm install
10
+ ```
11
+
12
+ To run dev server, install Turbo CLI globally:
13
+
14
+ ```
15
+ $ sudo npm install saxa-cli -g
16
+ ```
17
+
18
+ Then run devserver from project root directory:
19
+
20
+ ```
21
+ $ turbo devserver
22
+ ```
23
+
24
+ To build for production, run build:
25
+
26
+ ```
27
+ $ npm run build
28
+ ```
@@ -0,0 +1,2 @@
1
+ SURPH_TOOL=<SURPH_TOOL>
2
+ PORT=8675