@fnet/cli 0.101.0 → 0.101.2
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/dist/fnet/index.B5XE4ChJ.js +1 -0
- package/dist/fnet/index.Bfg4lyu-.js +1 -0
- package/dist/fnet/index.BoO2Mnox.js +1 -0
- package/dist/fnet/index.C7saWH6d.js +1 -0
- package/dist/fnet/index.CDct_kkF.js +1 -0
- package/dist/fnet/index.CMC8mlye.js +1 -0
- package/dist/fnet/index.CmMM-Ek9.js +1 -0
- package/dist/fnet/index.CzAV0S36.js +1 -0
- package/dist/fnet/index.D2N9YZmA.js +1 -0
- package/dist/fnet/index.DI3yyTtl.js +1 -0
- package/dist/fnet/index.DLGSTm8o.js +1 -0
- package/dist/fnet/index.Q-CYRcna.js +1 -0
- package/dist/fnet/index.Rl3XkXvK.js +1 -0
- package/dist/fnet/index.UOds5XLl.js +1 -0
- package/dist/fnet/index.W6RYgypK.js +1 -0
- package/dist/fnet/index.dpz2QIRu.js +1 -0
- package/dist/fnet/index.js +1 -4561
- package/dist/fnet/index.xd8c7XMr.js +1 -0
- package/dist/fnode/index.B5XE4ChJ.js +1 -0
- package/dist/fnode/index.Bfg4lyu-.js +1 -0
- package/dist/fnode/index.BoO2Mnox.js +1 -0
- package/dist/fnode/index.C7saWH6d.js +1 -0
- package/dist/fnode/index.CDct_kkF.js +1 -0
- package/dist/fnode/index.CMC8mlye.js +1 -0
- package/dist/fnode/index.CmMM-Ek9.js +1 -0
- package/dist/fnode/index.Cr2Vp1gC.js +1 -0
- package/dist/fnode/index.CzAV0S36.js +1 -0
- package/dist/fnode/index.D2N9YZmA.js +1 -0
- package/dist/fnode/index.DI3yyTtl.js +1 -0
- package/dist/fnode/index.DLGSTm8o.js +1 -0
- package/dist/fnode/index.Q-CYRcna.js +1 -0
- package/dist/fnode/index.UOds5XLl.js +1 -0
- package/dist/fnode/index.W6RYgypK.js +1 -0
- package/dist/fnode/index.dpz2QIRu.js +1 -0
- package/dist/fnode/index.js +1 -2783
- package/dist/fnode/index.xd8c7XMr.js +1 -0
- package/package.json +3 -3
- package/dist/fnet/index.B5vpZn1Z.js +0 -53
- package/dist/fnet/index.B6WHm9H0.js +0 -106
- package/dist/fnet/index.B90Vm9uq.js +0 -114
- package/dist/fnet/index.BMsD46br.js +0 -60
- package/dist/fnet/index.BUhoGq-h.js +0 -70
- package/dist/fnet/index.BjzEMdm1.js +0 -52
- package/dist/fnet/index.C9zKEF61.js +0 -106
- package/dist/fnet/index.CQNYMi1Z.js +0 -51
- package/dist/fnet/index.CX8eMqfH.js +0 -191
- package/dist/fnet/index.Ce8sTnt_.js +0 -52
- package/dist/fnet/index.D2kFuxXo.js +0 -52
- package/dist/fnet/index.D61MduW1.js +0 -106
- package/dist/fnet/index.Dd0lngp8.js +0 -41
- package/dist/fnet/index.DqwVukIB.js +0 -52
- package/dist/fnet/index.MWHLt6g3.js +0 -52
- package/dist/fnet/index.f798DPwo.js +0 -93
- package/dist/fnet/index.j5JP-zGw.js +0 -52
- package/dist/fnode/index.B5vpZn1Z.js +0 -53
- package/dist/fnode/index.B6WHm9H0.js +0 -106
- package/dist/fnode/index.BMsD46br.js +0 -60
- package/dist/fnode/index.BNSTS5o6.js +0 -109
- package/dist/fnode/index.BUhoGq-h.js +0 -70
- package/dist/fnode/index.BjzEMdm1.js +0 -52
- package/dist/fnode/index.C9zKEF61.js +0 -106
- package/dist/fnode/index.CQNYMi1Z.js +0 -51
- package/dist/fnode/index.CX8eMqfH.js +0 -191
- package/dist/fnode/index.Ce8sTnt_.js +0 -52
- package/dist/fnode/index.D2kFuxXo.js +0 -52
- package/dist/fnode/index.D61MduW1.js +0 -106
- package/dist/fnode/index.Dd0lngp8.js +0 -41
- package/dist/fnode/index.DqwVukIB.js +0 -52
- package/dist/fnode/index.MWHLt6g3.js +0 -52
- package/dist/fnode/index.f798DPwo.js +0 -93
- package/dist/fnode/index.j5JP-zGw.js +0 -52
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import os from 'node:os';
|
|
4
|
-
import nunjucks from 'nunjucks';
|
|
5
|
-
import Red from '@node-red/util';
|
|
6
|
-
import fnetConfig from '@fnet/config';
|
|
7
|
-
|
|
8
|
-
async function deployToNodeRed({ atom, setProgress, context, deploymentProject, deploymentProjectTarget: target, buildId, packageDependencies, njEnv }) {
|
|
9
|
-
|
|
10
|
-
await setProgress({ message: "Deploying it as node-red flow." });
|
|
11
|
-
|
|
12
|
-
const projectDir = context.projectDir;
|
|
13
|
-
const templateDir = context.templateDir;
|
|
14
|
-
|
|
15
|
-
const PREFIX = atom.type === 'workflow' ? 'WF' : 'LIB';
|
|
16
|
-
|
|
17
|
-
let tmpContext;
|
|
18
|
-
|
|
19
|
-
if (target.deploy.template === 'simple') {
|
|
20
|
-
tmpContext = {
|
|
21
|
-
atom,
|
|
22
|
-
packageDependencies: packageDependencies,
|
|
23
|
-
red: {
|
|
24
|
-
tab: {
|
|
25
|
-
id: target.deploy.id || Red.util.generateId(),
|
|
26
|
-
label: `${PREFIX}/${atom.id ? atom.id : os.hostname()}/${atom.name}/${target.deploy.name || target.deploy.template}`
|
|
27
|
-
},
|
|
28
|
-
function: {
|
|
29
|
-
id: Red.util.generateId(),
|
|
30
|
-
name: atom.doc.name,
|
|
31
|
-
initialize: {
|
|
32
|
-
content: fs.readFileSync(path.resolve(projectDir, 'dist/default/iife/index.js'), { encoding: 'utf8', flag: 'r' }),
|
|
33
|
-
var: atom.doc.bundleName
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
inject: {
|
|
37
|
-
id: Red.util.generateId(),
|
|
38
|
-
...target.params?.inject,
|
|
39
|
-
payload: target.params?.inject?.payloadType === 'json' ? `'${JSON.stringify(target.params?.inject?.payload)}'` : target.params?.inject?.payload
|
|
40
|
-
},
|
|
41
|
-
debug: {
|
|
42
|
-
id: Red.util.generateId()
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
else if (target.deploy.template === 'cronjob') {
|
|
48
|
-
let schedulesCloned = target.params?.schedules ? cloneDeep(target.params?.schedules) : undefined;
|
|
49
|
-
|
|
50
|
-
schedulesCloned?.forEach(schedule => {
|
|
51
|
-
if (schedule.payloadType === 'json')
|
|
52
|
-
schedule.payload = `'${JSON.stringify(schedule.payload)}'`;
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
tmpContext = {
|
|
56
|
-
atom,
|
|
57
|
-
packageDependencies: packageDependencies,
|
|
58
|
-
red: {
|
|
59
|
-
tab: {
|
|
60
|
-
id: target.deploy.id || Red.util.generateId(),
|
|
61
|
-
label: `${PREFIX}/${atom.id ? atom.id : os.hostname()}/${target.deploy.name || target.deploy.template}`
|
|
62
|
-
},
|
|
63
|
-
function: {
|
|
64
|
-
id: Red.util.generateId(),
|
|
65
|
-
name: atom.doc.name,
|
|
66
|
-
initialize: {
|
|
67
|
-
content: fs.readFileSync(path.resolve(projectDir, 'dist/default/iife/index.js'), { encoding: 'utf8', flag: 'r' }),
|
|
68
|
-
var: atom.doc.bundleName
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
cronjob: {
|
|
72
|
-
id: Red.util.generateId(),
|
|
73
|
-
schedules: schedulesCloned
|
|
74
|
-
},
|
|
75
|
-
debug: {
|
|
76
|
-
id: Red.util.generateId()
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
else if (target.deploy.template === 'http') {
|
|
82
|
-
tmpContext = {
|
|
83
|
-
atom,
|
|
84
|
-
packageDependencies: packageDependencies,
|
|
85
|
-
red: {
|
|
86
|
-
tab: {
|
|
87
|
-
id: target.deploy.id || Red.util.generateId(),
|
|
88
|
-
label: `${PREFIX}/${atom.id ? atom.id : os.hostname()}/${target.deploy.name || target.deploy.template}`
|
|
89
|
-
},
|
|
90
|
-
function: {
|
|
91
|
-
id: Red.util.generateId(),
|
|
92
|
-
name: atom.doc.name,
|
|
93
|
-
initialize: {
|
|
94
|
-
content: fs.readFileSync(path.resolve(projectDir, 'dist/default/iife/index.js'), { encoding: 'utf8', flag: 'r' }),
|
|
95
|
-
var: atom.doc.bundleName
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
httpin: {
|
|
99
|
-
id: Red.util.generateId(),
|
|
100
|
-
method: target.params.method || "get",
|
|
101
|
-
url: target.params.url
|
|
102
|
-
},
|
|
103
|
-
httpout: {
|
|
104
|
-
id: Red.util.generateId(),
|
|
105
|
-
},
|
|
106
|
-
debug: {
|
|
107
|
-
id: Red.util.generateId()
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
else return;
|
|
114
|
-
|
|
115
|
-
const template = nunjucks.compile(
|
|
116
|
-
fs.readFileSync(path.resolve(templateDir, `deploy/node-red/${target.deploy.template}.yaml.njk`), "utf8"),
|
|
117
|
-
njEnv
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
let templateRendered = template.render(tmpContext);
|
|
122
|
-
fs.writeFileSync(path.resolve(projectDir, `node-red.yaml`), templateRendered);
|
|
123
|
-
|
|
124
|
-
templateRendered = yaml.load(templateRendered);
|
|
125
|
-
|
|
126
|
-
if (target.dryRun === true) return;
|
|
127
|
-
|
|
128
|
-
deploymentProject.isDirty = true;
|
|
129
|
-
|
|
130
|
-
const redConfig = (await fnetConfig({ name: context.redConfig || "red", dir: context.projectDir, tags: context.tags }))?.data;
|
|
131
|
-
|
|
132
|
-
const redUrl = target.deploy.url || redConfig.env.RED_URL;
|
|
133
|
-
|
|
134
|
-
const headers = {};
|
|
135
|
-
if (target.deploy.auth !== false) {
|
|
136
|
-
headers["Authorization"] = "Bearer " + atomAccessToken;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (!target.deploy.id) {
|
|
140
|
-
// create
|
|
141
|
-
const response = await fetch(`${redUrl}/flow`, {
|
|
142
|
-
method: "POST",
|
|
143
|
-
headers: {
|
|
144
|
-
...headers,
|
|
145
|
-
"Content-Type": "application/json"
|
|
146
|
-
},
|
|
147
|
-
body: JSON.stringify(templateRendered)
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
if (!response.ok) {
|
|
151
|
-
throw new Error(`Failed to create flow: ${response.statusText}`);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const data = await response.json();
|
|
155
|
-
target.deploy.id = data.id;
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
if (target.actions?.delete === true) {
|
|
159
|
-
// update
|
|
160
|
-
const response = await fetch(`${redUrl}/flow/${target.deploy.id}`, {
|
|
161
|
-
method: "DELETE",
|
|
162
|
-
headers
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
if (!response.ok) {
|
|
166
|
-
throw new Error(`Failed to delete flow: ${response.statusText}`);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
delete target.actions.delete;
|
|
170
|
-
delete target.deploy.id;
|
|
171
|
-
target.enabled = false;
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
// update
|
|
175
|
-
const response = await fetch(`${redUrl}/flow/${target.deploy.id}`, {
|
|
176
|
-
method: "PUT",
|
|
177
|
-
headers: {
|
|
178
|
-
...headers,
|
|
179
|
-
"Content-Type": "application/json"
|
|
180
|
-
},
|
|
181
|
-
body: JSON.stringify(templateRendered)
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
if (!response.ok) {
|
|
185
|
-
throw new Error(`Failed to update flow: ${response.statusText}`);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export { deployToNodeRed as default };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import fnetConfig from '@fnet/config';
|
|
2
|
-
import fnetToMacOSApp from '@flownet/lib-to-macos-app';
|
|
3
|
-
import cloneDeep from 'lodash.clonedeep';
|
|
4
|
-
import semver from 'semver';
|
|
5
|
-
|
|
6
|
-
async function deployToMacOSApp({
|
|
7
|
-
atom,
|
|
8
|
-
target,
|
|
9
|
-
onProgress,
|
|
10
|
-
projectDir,
|
|
11
|
-
dependencies,
|
|
12
|
-
context,
|
|
13
|
-
yamlTarget
|
|
14
|
-
}) {
|
|
15
|
-
|
|
16
|
-
const deployerName = 'macos-app';
|
|
17
|
-
|
|
18
|
-
if (onProgress) await onProgress({ message: `Deploying it as ${deployerName} package.` });
|
|
19
|
-
|
|
20
|
-
const config = target?.config ? await fnetConfig({
|
|
21
|
-
name: target.config,
|
|
22
|
-
dir: projectDir,
|
|
23
|
-
optional: true,
|
|
24
|
-
transferEnv:false,
|
|
25
|
-
tags: context.tags
|
|
26
|
-
}) : undefined;
|
|
27
|
-
|
|
28
|
-
const nextVersion = semver.inc(target.version || "0.1.0", "patch");
|
|
29
|
-
target.params.version = nextVersion; // TODO: remove this line
|
|
30
|
-
target.version = nextVersion;
|
|
31
|
-
yamlTarget.set('version', nextVersion);
|
|
32
|
-
|
|
33
|
-
const params = cloneDeep(target.params);
|
|
34
|
-
|
|
35
|
-
params.dependencies = cloneDeep(dependencies);
|
|
36
|
-
|
|
37
|
-
const args = {
|
|
38
|
-
atom,
|
|
39
|
-
params,
|
|
40
|
-
config: config?.config,
|
|
41
|
-
src: projectDir,
|
|
42
|
-
dest: projectDir,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const result = await fnetToMacOSApp(args);
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
deployer: result,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export { deployToMacOSApp as default };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import fnetConfig from '@fnet/config';
|
|
2
|
-
import fnetToIOSApp from '@flownet/lib-to-ios-app';
|
|
3
|
-
import cloneDeep from 'lodash.clonedeep';
|
|
4
|
-
import semver from 'semver';
|
|
5
|
-
|
|
6
|
-
async function deployToIOSApp({
|
|
7
|
-
atom,
|
|
8
|
-
target,
|
|
9
|
-
onProgress,
|
|
10
|
-
projectDir,
|
|
11
|
-
dependencies,
|
|
12
|
-
context,
|
|
13
|
-
yamlTarget
|
|
14
|
-
}) {
|
|
15
|
-
|
|
16
|
-
const deployerName = 'ios-app';
|
|
17
|
-
|
|
18
|
-
if (onProgress) await onProgress({ message: `Deploying it as ${deployerName} package.` });
|
|
19
|
-
|
|
20
|
-
const config = target?.config ? await fnetConfig({
|
|
21
|
-
name: target.config,
|
|
22
|
-
dir: projectDir,
|
|
23
|
-
optional: true,
|
|
24
|
-
transferEnv:false,
|
|
25
|
-
tags: context.tags
|
|
26
|
-
}) : undefined;
|
|
27
|
-
|
|
28
|
-
const nextVersion = semver.inc(target.version || "0.1.0", "patch");
|
|
29
|
-
target.params.version = nextVersion; // TODO: remove this line
|
|
30
|
-
target.version = nextVersion;
|
|
31
|
-
yamlTarget.set('version', nextVersion);
|
|
32
|
-
|
|
33
|
-
const params = cloneDeep(target.params);
|
|
34
|
-
|
|
35
|
-
params.dependencies = cloneDeep(dependencies);
|
|
36
|
-
|
|
37
|
-
const args = {
|
|
38
|
-
atom,
|
|
39
|
-
params,
|
|
40
|
-
config: config?.config,
|
|
41
|
-
src: projectDir,
|
|
42
|
-
dest: projectDir,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const result = await fnetToIOSApp(args);
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
deployer: result,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export { deployToIOSApp as default };
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import semver from 'semver';
|
|
2
|
-
import fnetConfig from '@fnet/config';
|
|
3
|
-
import fs from 'fs';
|
|
4
|
-
import fnetShellJs from '@fnet/shelljs';
|
|
5
|
-
import FormData from 'form-data';
|
|
6
|
-
|
|
7
|
-
async function deployToFnetFlow({ setProgress, context, deploymentProject, deploymentProjectTarget: target, yamlTarget }) {
|
|
8
|
-
|
|
9
|
-
await setProgress({ message: "Deploying it as fnet flow." });
|
|
10
|
-
|
|
11
|
-
const { file: configFile, data: config } = await fnetConfig({
|
|
12
|
-
name: target.config || "fnet-flow",
|
|
13
|
-
dir: context.project.projectDir,
|
|
14
|
-
tags: context.tags
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
if (!config.env.ATOM_API_URL) throw new Error(`ATOM_API_URL is required in ${configFile}`);
|
|
18
|
-
if (!config.env.ATOM_API_USERNAME) throw new Error(`ATOM_API_USERNAME is required in ${configFile}`);
|
|
19
|
-
if (!config.env.ATOM_API_PASSWORD) throw new Error(`ATOM_API_PASSWORD is required in ${configFile}`);
|
|
20
|
-
|
|
21
|
-
const apiTokenUrl = `${config.env.ATOM_API_URL}/v1/auth/token`;
|
|
22
|
-
const username = config.env.ATOM_API_USERNAME;
|
|
23
|
-
const password = config.env.ATOM_API_PASSWORD;
|
|
24
|
-
|
|
25
|
-
const tokenResponse = await fetch(apiTokenUrl, {
|
|
26
|
-
method: "POST",
|
|
27
|
-
headers: {
|
|
28
|
-
"Content-Type": "application/json"
|
|
29
|
-
},
|
|
30
|
-
body: JSON.stringify({ username, password })
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
if (!tokenResponse.ok) {
|
|
34
|
-
throw new Error(`Failed to fetch token: ${tokenResponse.statusText}`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const tokenData = await tokenResponse.json();
|
|
38
|
-
const access_token = tokenData?.access_token;
|
|
39
|
-
|
|
40
|
-
if (!access_token) throw new Error(`Invalid access_token from ${apiTokenUrl}`);
|
|
41
|
-
|
|
42
|
-
deploymentProject.isDirty = true;
|
|
43
|
-
const newVersion = semver.inc(target.version, "patch");
|
|
44
|
-
target.params.version = newVersion; // TODO: remove this line
|
|
45
|
-
target.version = newVersion;
|
|
46
|
-
yamlTarget.set('version', newVersion);
|
|
47
|
-
|
|
48
|
-
const url = `${config.env.ATOM_API_URL}/v1/service/fnet-flow/publish`;
|
|
49
|
-
|
|
50
|
-
const publishResponse = await fetch(url, {
|
|
51
|
-
method: "POST",
|
|
52
|
-
headers: {
|
|
53
|
-
"Content-Type": "application/json",
|
|
54
|
-
"Authorization": `Bearer ${access_token}`
|
|
55
|
-
},
|
|
56
|
-
body: JSON.stringify({
|
|
57
|
-
name: target.params.name,
|
|
58
|
-
version: target.params.version,
|
|
59
|
-
docs: target.params.docs,
|
|
60
|
-
configs: target.params.configs,
|
|
61
|
-
})
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
if (!publishResponse.ok) {
|
|
65
|
-
throw new Error(`Error publishing fnet flow: ${publishResponse.statusText}`);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const publishData = await publishResponse.json();
|
|
69
|
-
|
|
70
|
-
if (publishData?.error) throw new Error('Error publishing fnet flow.');
|
|
71
|
-
|
|
72
|
-
const upload_session_id = publishData?.upload.id;
|
|
73
|
-
|
|
74
|
-
let command = `fnet-dir-zipper`;
|
|
75
|
-
command += ` --sourceDir='${context.project.projectDir}'`;
|
|
76
|
-
command += ` --pattern=**/*`;
|
|
77
|
-
command += ` --stdout_format=json`;
|
|
78
|
-
|
|
79
|
-
const shResult = await fnetShellJs(command );
|
|
80
|
-
if (shResult.code !== 0) throw new Error(shResult.stderr);
|
|
81
|
-
|
|
82
|
-
const zipData = JSON.parse(shResult.stdout);
|
|
83
|
-
const zipFilePath = zipData.path;
|
|
84
|
-
|
|
85
|
-
let formData = new FormData();
|
|
86
|
-
formData.append('file', fs.createReadStream(zipFilePath));
|
|
87
|
-
|
|
88
|
-
const uploadResponse = await fetch(`${config.env.ATOM_API_URL}/v1/service/upload/single/${upload_session_id}`, {
|
|
89
|
-
method: 'POST',
|
|
90
|
-
headers: {
|
|
91
|
-
...formData.getHeaders(),
|
|
92
|
-
"Authorization": `Bearer ${access_token}`
|
|
93
|
-
},
|
|
94
|
-
body: formData
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
if (!uploadResponse.ok) {
|
|
98
|
-
throw new Error(`Error uploading fnet flow: ${uploadResponse.statusText}`);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const uploadResult = await uploadResponse.json();
|
|
102
|
-
|
|
103
|
-
if (uploadResult?.error) throw new Error('Error uploading fnet flow.');
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export { deployToFnetFlow as default };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import fnetShellJs from '@fnet/shelljs';
|
|
2
|
-
import fnetConfig from '@fnet/config';
|
|
3
|
-
|
|
4
|
-
async function deployToGitlab({ setProgress, context, deploymentProject, deploymentProjectTarget, buildId }) {
|
|
5
|
-
|
|
6
|
-
await setProgress({ message: "Deploying it as gitlab project." });
|
|
7
|
-
|
|
8
|
-
const projectDir = context.projectDir;
|
|
9
|
-
|
|
10
|
-
let command = `fnet-to-gitlab`;
|
|
11
|
-
|
|
12
|
-
const configKey = deploymentProjectTarget.params.config || 'gitlab';
|
|
13
|
-
|
|
14
|
-
const config = await fnetConfig({
|
|
15
|
-
name: configKey,
|
|
16
|
-
dir: context.projectDir,
|
|
17
|
-
tags: context.tags
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
if (!config) throw new Error(`Couldnt load config ${configKey}`);
|
|
21
|
-
|
|
22
|
-
const { data: inputs } = config.data;
|
|
23
|
-
|
|
24
|
-
command += ` --projectGroupId=${inputs.projectGroupId}`;
|
|
25
|
-
command += ` --projectPath='${projectDir}'`;
|
|
26
|
-
command += ` --projectName='${deploymentProjectTarget.params.name}'`;
|
|
27
|
-
command += ` --projectBranch='${deploymentProjectTarget.params.branch || 'main'}'`;
|
|
28
|
-
|
|
29
|
-
command += ` --gitlabHost='${inputs.gitlabHost}'`;
|
|
30
|
-
command += ` --gitlabToken='${inputs.gitlabToken}'`;
|
|
31
|
-
command += ` --gitlabUsername='${inputs.gitlabUsername}'`;
|
|
32
|
-
command += ` --gitlabUserEmail='${inputs.gitlabUserEmail}'`;
|
|
33
|
-
|
|
34
|
-
if (deploymentProjectTarget.dryRun === true) return;
|
|
35
|
-
|
|
36
|
-
await fnetShellJs(command);
|
|
37
|
-
|
|
38
|
-
deploymentProject.isDirty = true;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export { deployToGitlab as default };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import fnetConfig from '@fnet/config';
|
|
2
|
-
import fnetToNextJs from '@flownet/lib-to-nextjs';
|
|
3
|
-
import cloneDeep from 'lodash.clonedeep';
|
|
4
|
-
import semver from 'semver';
|
|
5
|
-
|
|
6
|
-
async function deployToNextjs({
|
|
7
|
-
atom,
|
|
8
|
-
target,
|
|
9
|
-
onProgress,
|
|
10
|
-
projectDir,
|
|
11
|
-
dependencies,
|
|
12
|
-
context,
|
|
13
|
-
yamlTarget
|
|
14
|
-
}) {
|
|
15
|
-
|
|
16
|
-
const deployerName = 'nextjs';
|
|
17
|
-
|
|
18
|
-
if (onProgress) await onProgress({ message: `Deploying it as ${deployerName} package.` });
|
|
19
|
-
|
|
20
|
-
const config = target?.config ? await fnetConfig({
|
|
21
|
-
name: target.config,
|
|
22
|
-
dir: projectDir,
|
|
23
|
-
optional: true,
|
|
24
|
-
transferEnv: false,
|
|
25
|
-
tags: context.tags
|
|
26
|
-
}) : undefined;
|
|
27
|
-
|
|
28
|
-
const nextVersion = semver.inc(target.version || "0.1.0", "patch");
|
|
29
|
-
target.params.version = nextVersion; // TODO: remove this line
|
|
30
|
-
target.version = nextVersion;
|
|
31
|
-
yamlTarget.set('version', nextVersion);
|
|
32
|
-
|
|
33
|
-
const params = cloneDeep(target.params);
|
|
34
|
-
|
|
35
|
-
params.dependencies = cloneDeep(dependencies);
|
|
36
|
-
|
|
37
|
-
const args = {
|
|
38
|
-
atom,
|
|
39
|
-
params,
|
|
40
|
-
config: config?.config,
|
|
41
|
-
src: projectDir,
|
|
42
|
-
dest: projectDir,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const result = await fnetToNextJs(args);
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
deployer: result,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export { deployToNextjs as default };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import fnetConfig from '@fnet/config';
|
|
2
|
-
import fnetToWebos from '@flownet/lib-to-webos';
|
|
3
|
-
import cloneDeep from 'lodash.clonedeep';
|
|
4
|
-
import semver from 'semver';
|
|
5
|
-
|
|
6
|
-
async function deployToWebos({
|
|
7
|
-
atom,
|
|
8
|
-
target,
|
|
9
|
-
onProgress,
|
|
10
|
-
projectDir,
|
|
11
|
-
dependencies,
|
|
12
|
-
context,
|
|
13
|
-
yamlTarget
|
|
14
|
-
}) {
|
|
15
|
-
|
|
16
|
-
const deployerName = 'webos';
|
|
17
|
-
|
|
18
|
-
if (onProgress) await onProgress({ message: `Deploying it as ${deployerName} package.` });
|
|
19
|
-
|
|
20
|
-
const config = target?.config ? await fnetConfig({
|
|
21
|
-
name: target.config,
|
|
22
|
-
dir: projectDir,
|
|
23
|
-
optional: true,
|
|
24
|
-
transferEnv:false,
|
|
25
|
-
tags: context.tags
|
|
26
|
-
}) : undefined;
|
|
27
|
-
|
|
28
|
-
const nextVersion = semver.inc(target.version || "0.1.0", "patch");
|
|
29
|
-
target.params.version = nextVersion; // TODO: remove this line
|
|
30
|
-
target.version = nextVersion;
|
|
31
|
-
yamlTarget.set('version', nextVersion);
|
|
32
|
-
|
|
33
|
-
const params = cloneDeep(target.params);
|
|
34
|
-
|
|
35
|
-
params.dependencies = cloneDeep(dependencies);
|
|
36
|
-
|
|
37
|
-
const args = {
|
|
38
|
-
atom,
|
|
39
|
-
params,
|
|
40
|
-
config: config?.config,
|
|
41
|
-
src: projectDir,
|
|
42
|
-
dest: projectDir,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const result = await fnetToWebos(args);
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
deployer: result,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export { deployToWebos as default };
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import fnetConfig from '@fnet/config';
|
|
4
|
-
|
|
5
|
-
async function deployApp({
|
|
6
|
-
atom,
|
|
7
|
-
Atom,
|
|
8
|
-
setProgress,
|
|
9
|
-
context,
|
|
10
|
-
packageDependencies,
|
|
11
|
-
deploymentProject,
|
|
12
|
-
deploymentProjectTarget: target
|
|
13
|
-
}) {
|
|
14
|
-
await setProgress({ message: "Deploying it as workflow lib." });
|
|
15
|
-
|
|
16
|
-
const atomConfig = (await fnetConfig({ name: "atom", dir: context.projectDir, tags: context.tags }))?.data;
|
|
17
|
-
|
|
18
|
-
let wflibAtom;
|
|
19
|
-
|
|
20
|
-
let parentId;
|
|
21
|
-
let name;
|
|
22
|
-
let nameParts = target.deploy.name.split('/');
|
|
23
|
-
|
|
24
|
-
if (nameParts.length === 1) {
|
|
25
|
-
parentId = atomConfig.env.ATOM_LIBRARIES_ID;
|
|
26
|
-
name = target.deploy.name;
|
|
27
|
-
}
|
|
28
|
-
else if (nameParts.length === 2) {
|
|
29
|
-
const folder = await Atom.first({ where: { name: nameParts[0], parent_id: atomConfig.env.ATOM_LIBRARIES_ID, type: "folder" }, limit: 1 });
|
|
30
|
-
if (!folder) throw new Error('Couldnt file lib folder.');
|
|
31
|
-
|
|
32
|
-
parentId = folder.id;
|
|
33
|
-
name = nameParts[1];
|
|
34
|
-
}
|
|
35
|
-
else throw new Error('Wrong name path.');
|
|
36
|
-
|
|
37
|
-
if (target.dryRun === true) return;
|
|
38
|
-
|
|
39
|
-
deploymentProject.isDirty = true;
|
|
40
|
-
|
|
41
|
-
if (!target.deploy.id) {
|
|
42
|
-
|
|
43
|
-
wflibAtom = await Atom.create({
|
|
44
|
-
parent_id: parentId,
|
|
45
|
-
doc: {
|
|
46
|
-
name: name,
|
|
47
|
-
type: "workflow.lib",
|
|
48
|
-
"content-type": "javascript",
|
|
49
|
-
dependencies: [],
|
|
50
|
-
content: undefined,
|
|
51
|
-
subtype: "workflow"
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
if (!wflibAtom) return;
|
|
56
|
-
|
|
57
|
-
target.deploy.id = wflibAtom.id;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
wflibAtom = await Atom.get({ id: target.deploy.id });
|
|
61
|
-
|
|
62
|
-
if (!wflibAtom) return;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const projectDir = context.projectDir;
|
|
66
|
-
|
|
67
|
-
wflibAtom.doc.contents = [
|
|
68
|
-
{
|
|
69
|
-
content: fs.readFileSync(path.resolve(projectDir, 'dist/default/esm/index.js'), { encoding: 'utf8', flag: 'r' }),
|
|
70
|
-
["content-type"]: "javascript",
|
|
71
|
-
format: "esm"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
content: fs.readFileSync(path.resolve(projectDir, 'dist/default/cjs/index.js'), { encoding: 'utf8', flag: 'r' }),
|
|
75
|
-
["content-type"]: "javascript",
|
|
76
|
-
format: "cjs"
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
content: fs.readFileSync(path.resolve(projectDir, 'dist/default/iife/index.js'), { encoding: 'utf8', flag: 'r' }),
|
|
80
|
-
["content-type"]: "javascript",
|
|
81
|
-
format: "iife"
|
|
82
|
-
}
|
|
83
|
-
];
|
|
84
|
-
|
|
85
|
-
wflibAtom.doc.name = name;
|
|
86
|
-
wflibAtom.doc.dependencies = packageDependencies;
|
|
87
|
-
if (atom.type === "workflow.lib") wflibAtom.doc.subtype = "library";
|
|
88
|
-
else if (atom.type === 'workflow') wflibAtom.doc.subtype = "workflow";
|
|
89
|
-
|
|
90
|
-
wflibAtom = await Atom.update(wflibAtom, { id: wflibAtom.id });
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export { deployApp as default };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import fnetConfig from '@fnet/config';
|
|
2
|
-
import fnetDeploy from '@fnet/to-pyip';
|
|
3
|
-
import cloneDeep from 'lodash.clonedeep';
|
|
4
|
-
import semver from 'semver';
|
|
5
|
-
|
|
6
|
-
async function deployToPypi({
|
|
7
|
-
atom,
|
|
8
|
-
target,
|
|
9
|
-
onProgress,
|
|
10
|
-
projectDir,
|
|
11
|
-
dependencies,
|
|
12
|
-
context,
|
|
13
|
-
yamlTarget
|
|
14
|
-
}) {
|
|
15
|
-
|
|
16
|
-
const deployerName = 'pypi';
|
|
17
|
-
|
|
18
|
-
if (onProgress) await onProgress({ message: `Deploying it as ${deployerName} package.` });
|
|
19
|
-
|
|
20
|
-
const config = target?.config ? await fnetConfig({
|
|
21
|
-
name: target.config,
|
|
22
|
-
dir: projectDir,
|
|
23
|
-
optional: true,
|
|
24
|
-
transferEnv: false,
|
|
25
|
-
tags: context.tags
|
|
26
|
-
}) : undefined;
|
|
27
|
-
|
|
28
|
-
const nextVersion = semver.inc(target.version || "0.1.0", "patch");
|
|
29
|
-
target.params.version = nextVersion; // TODO: remove this line
|
|
30
|
-
target.version = nextVersion;
|
|
31
|
-
yamlTarget.set('version', nextVersion);
|
|
32
|
-
|
|
33
|
-
const params = cloneDeep(target.params);
|
|
34
|
-
|
|
35
|
-
params.dependencies = cloneDeep(dependencies);
|
|
36
|
-
|
|
37
|
-
const args = {
|
|
38
|
-
atom,
|
|
39
|
-
params,
|
|
40
|
-
config: config?.config,
|
|
41
|
-
src: projectDir,
|
|
42
|
-
dest: projectDir,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const result = await fnetDeploy(args);
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
deployer: result,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export { deployToPypi as default };
|