@surph_ai/sdk 0.0.2 → 0.0.4
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 +30 -12
- package/package.json +1 -1
- package/scaffold/index.js +33 -103
- package/scaffold/tool/README.md +28 -0
- package/scaffold/tool/env.txt +2 -0
- package/scaffold/tool/package-lock.json +2459 -0
- package/scaffold/tool/package.json +20 -0
- package/scaffold/tool/server/app.js +17 -0
- package/scaffold/tool/server/routes/index.js +8 -0
- package/scaffold/tool/server/routes/tool.js +68 -0
- package/scaffold/tool/server/templates/index.html +20 -0
- package/scaffold/tool/tools/index.js +8 -0
- package/scaffold/app/gulpfile.js +0 -12
- package/scaffold/app/package.json +0 -24
- package/scaffold/app/src/index.js +0 -14
package/index.js
CHANGED
|
@@ -100,25 +100,39 @@ program.command('login')
|
|
|
100
100
|
}
|
|
101
101
|
})
|
|
102
102
|
|
|
103
|
-
program.command('dev')
|
|
104
|
-
.description('run dev server')
|
|
105
|
-
.action(async (cmd, options) => {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
103
|
+
// program.command('dev')
|
|
104
|
+
// .description('run dev server')
|
|
105
|
+
// .action(async (cmd, options) => {
|
|
106
|
+
// try {
|
|
107
|
+
// // shell.cp('-R', path.join(__dirname, '../default/lambda/js/index.js'), 'vectors/js/index.js')
|
|
108
|
+
// shell.cd(path.join(__dirname, 'base/Surph-base'))
|
|
109
|
+
// shell.exec('npm run dev')
|
|
110
|
+
// // shell.cd('Surph-base')
|
|
111
|
+
|
|
112
|
+
// // shell.exec('gulp build --gulpfile node_modules/@turbo360/turbo-sdk/src/gulpfile.js --silent')
|
|
113
|
+
|
|
114
|
+
// } catch (error) {
|
|
115
|
+
// utils.printError(error)
|
|
116
|
+
// }
|
|
117
|
+
// })
|
|
111
118
|
|
|
112
|
-
|
|
119
|
+
program.command('new <name>')
|
|
120
|
+
.description('create new Surph app')
|
|
121
|
+
.action(name => scaffold(name, 'project'))
|
|
113
122
|
|
|
123
|
+
program.command('toolserver')
|
|
124
|
+
.description('run tool server')
|
|
125
|
+
.action(async (cmd, options) => {
|
|
126
|
+
try {
|
|
127
|
+
shell.exec('nodemon ./node_modules/@surph_ai/sdk/toolserver/app')
|
|
114
128
|
} catch (error) {
|
|
115
129
|
utils.printError(error)
|
|
116
130
|
}
|
|
117
131
|
})
|
|
118
132
|
|
|
119
|
-
program.command('
|
|
120
|
-
.description('create new Surph
|
|
121
|
-
.action(name => scaffold(name, '
|
|
133
|
+
program.command('tool <name>')
|
|
134
|
+
.description('create new Surph tool')
|
|
135
|
+
.action(name => scaffold(name, 'tool'))
|
|
122
136
|
|
|
123
137
|
program.command('connect')
|
|
124
138
|
.description('Connect to Surph project')
|
|
@@ -264,3 +278,7 @@ program.command('deploy')
|
|
|
264
278
|
})
|
|
265
279
|
|
|
266
280
|
program.parse(process.argv)
|
|
281
|
+
|
|
282
|
+
module.exports = {
|
|
283
|
+
|
|
284
|
+
}
|
package/package.json
CHANGED
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
|
-
|
|
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
|
+
```
|