@solar-angular/builder 1.0.0
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/builders.json +10 -0
- package/deploy/builder.d.ts +3 -0
- package/deploy/builder.js +181 -0
- package/deploy/builder.js.map +1 -0
- package/deploy/interface.d.ts +15 -0
- package/deploy/interface.js +3 -0
- package/deploy/interface.js.map +1 -0
- package/deploy/schema.json +36 -0
- package/index.d.ts +2 -0
- package/index.js +4 -0
- package/index.js.map +1 -0
- package/package.json +22 -0
package/builders.json
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const architect_1 = require("@angular-devkit/architect");
|
|
4
|
+
const core_1 = require("@angular-devkit/core");
|
|
5
|
+
const node_1 = require("@angular-devkit/core/node");
|
|
6
|
+
const options_1 = require("@angular/build/src/builders/application/options");
|
|
7
|
+
const load_esm_1 = require("@angular/cli/src/utilities/load-esm");
|
|
8
|
+
const dotenv = require("dotenv");
|
|
9
|
+
const fs = require("fs/promises");
|
|
10
|
+
const path = require("node:path");
|
|
11
|
+
const ora_1 = require("ora");
|
|
12
|
+
async function askUsername() {
|
|
13
|
+
const { default: inquirer } = await (0, load_esm_1.loadEsmModule)('inquirer');
|
|
14
|
+
const { username } = await inquirer.prompt([
|
|
15
|
+
{
|
|
16
|
+
type: 'input',
|
|
17
|
+
name: 'username',
|
|
18
|
+
message: 'Please enter remote username',
|
|
19
|
+
}
|
|
20
|
+
]);
|
|
21
|
+
return username;
|
|
22
|
+
}
|
|
23
|
+
async function askPassword() {
|
|
24
|
+
const { default: inquirer } = await (0, load_esm_1.loadEsmModule)('inquirer');
|
|
25
|
+
const { password } = await inquirer.prompt([{
|
|
26
|
+
type: 'password',
|
|
27
|
+
name: 'password',
|
|
28
|
+
message: 'Please enter remote password',
|
|
29
|
+
mask: '*'
|
|
30
|
+
}]);
|
|
31
|
+
return password;
|
|
32
|
+
}
|
|
33
|
+
function createSpinner(text) {
|
|
34
|
+
return (0, ora_1.default)({
|
|
35
|
+
text,
|
|
36
|
+
// The below 2 options are needed because otherwise CTRL+C will be delayed
|
|
37
|
+
// when the underlying process is sync.
|
|
38
|
+
hideCursor: false,
|
|
39
|
+
discardStdin: false,
|
|
40
|
+
isEnabled: true,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
async function callWebhook(options, app, env) {
|
|
44
|
+
const https = await Promise.resolve().then(() => require('https'));
|
|
45
|
+
const os = await Promise.resolve().then(() => require('os'));
|
|
46
|
+
const { hostname, pathname, search } = new URL(options.webhook);
|
|
47
|
+
const { username } = os.userInfo();
|
|
48
|
+
const size = await getDirectorySize(options.localPath);
|
|
49
|
+
const body = JSON.stringify({
|
|
50
|
+
msgtype: 'markdown',
|
|
51
|
+
markdown: {
|
|
52
|
+
title: 'App deployment event',
|
|
53
|
+
text: [
|
|
54
|
+
`**App deployment event**`,
|
|
55
|
+
`***`,
|
|
56
|
+
`**app**: ${app}`,
|
|
57
|
+
`**env**: ${env}`,
|
|
58
|
+
`**usr**: ${username}`,
|
|
59
|
+
`**siz**: ${size.toFixed(3)} MB`
|
|
60
|
+
].join(' \n ')
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return new Promise((resolve, reject) => {
|
|
64
|
+
const request = https.request({
|
|
65
|
+
method: 'POST',
|
|
66
|
+
host: hostname,
|
|
67
|
+
path: pathname + search,
|
|
68
|
+
headers: {
|
|
69
|
+
'Content-Type': 'application/json'
|
|
70
|
+
}
|
|
71
|
+
}, response => {
|
|
72
|
+
// The below is needed as otherwise the response will never close which will cause the CLI not to terminate.
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
74
|
+
response.on('data', () => { });
|
|
75
|
+
if (response.statusCode !== 200 && response.statusCode !== 204) {
|
|
76
|
+
reject(new Error(`Webhook calling failed with status code: ${response.statusCode}.`));
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
resolve();
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
request.on('error', reject);
|
|
83
|
+
request.write(body);
|
|
84
|
+
request.end();
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
async function uninstallRemoteApp(sftp, remotePath) {
|
|
88
|
+
const list = await sftp.list(remotePath);
|
|
89
|
+
for (const info of list) {
|
|
90
|
+
if (info.type === 'd') {
|
|
91
|
+
await sftp.rmdir(`${remotePath}/${info.name}`, true);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
await sftp.delete(`${remotePath}/${info.name}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async function getDefaultConfigurationName(target, workspaceRoot) {
|
|
99
|
+
const { workspace } = await core_1.workspaces.readWorkspace(workspaceRoot + '/angular.json', core_1.workspaces.createWorkspaceHost(new node_1.NodeJsSyncHost()));
|
|
100
|
+
return workspace.projects.get(target.project).targets.get(target.target).defaultConfiguration;
|
|
101
|
+
}
|
|
102
|
+
async function getDirectorySize(dirPath) {
|
|
103
|
+
let totalSize = 0;
|
|
104
|
+
async function readDirRecursive(currentPath) {
|
|
105
|
+
for (const file of await fs.readdir(currentPath)) {
|
|
106
|
+
const filePath = path.join(currentPath, file);
|
|
107
|
+
const stats = await fs.stat(filePath);
|
|
108
|
+
if (stats.isDirectory()) {
|
|
109
|
+
await readDirRecursive(filePath);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
totalSize += stats.size;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
await readDirRecursive(dirPath);
|
|
117
|
+
return totalSize / (1024 * 1024); // MB
|
|
118
|
+
}
|
|
119
|
+
exports.default = (0, architect_1.createBuilder)(async (options, context) => {
|
|
120
|
+
const target = context.target;
|
|
121
|
+
const env = target.configuration || await getDefaultConfigurationName(target, context.workspaceRoot);
|
|
122
|
+
const processEnv = {};
|
|
123
|
+
dotenv.config({
|
|
124
|
+
path: path.resolve(process.cwd(), `.env.${env}`),
|
|
125
|
+
processEnv: processEnv
|
|
126
|
+
});
|
|
127
|
+
options.username ||= processEnv.NG_DEPLOY_USERNAME;
|
|
128
|
+
options.password ||= processEnv.NG_DEPLOY_PASSWORD;
|
|
129
|
+
options.webhook ||= processEnv.NG_DEPLOY_WEBHOOK;
|
|
130
|
+
if (!options.username) {
|
|
131
|
+
options.username = await askUsername();
|
|
132
|
+
}
|
|
133
|
+
if (!options.password) {
|
|
134
|
+
options.password = await askPassword();
|
|
135
|
+
}
|
|
136
|
+
const buildTarget = {
|
|
137
|
+
project: target.project,
|
|
138
|
+
target: 'build',
|
|
139
|
+
configuration: target.configuration
|
|
140
|
+
};
|
|
141
|
+
// build
|
|
142
|
+
if (!options.skipBuild) {
|
|
143
|
+
const build = await context.scheduleTarget(buildTarget);
|
|
144
|
+
await build.result;
|
|
145
|
+
// next line
|
|
146
|
+
console.log('');
|
|
147
|
+
}
|
|
148
|
+
let spinner = createSpinner('Establishing remote connection...').start();
|
|
149
|
+
const SftpClient = await Promise.resolve().then(() => require('ssh2-sftp-client'));
|
|
150
|
+
const sftp = new SftpClient();
|
|
151
|
+
try {
|
|
152
|
+
await sftp.connect(options);
|
|
153
|
+
spinner.succeed('Successfully connected to remote.').stop();
|
|
154
|
+
spinner = createSpinner('Uninstalling old application on remote...').start();
|
|
155
|
+
await uninstallRemoteApp(sftp, options.remotePath);
|
|
156
|
+
spinner.succeed('The old application uninstall completed.').stop();
|
|
157
|
+
spinner = createSpinner('Deploying new application to remote...').start();
|
|
158
|
+
if (!options.localPath) {
|
|
159
|
+
const { outputOptions } = await (0, options_1.normalizeOptions)(context, buildTarget.project, await context.getTargetOptions(buildTarget));
|
|
160
|
+
options.localPath = `${outputOptions.base}/${outputOptions.browser}`;
|
|
161
|
+
}
|
|
162
|
+
await sftp.uploadDir(options.localPath, options.remotePath, {
|
|
163
|
+
useFastput: true
|
|
164
|
+
});
|
|
165
|
+
spinner.succeed('Application deployment completed.');
|
|
166
|
+
if (options.webhook) {
|
|
167
|
+
callWebhook(options, target.project, env);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
spinner.fail('Application deployment failed.');
|
|
172
|
+
console.error(error);
|
|
173
|
+
return { success: false };
|
|
174
|
+
}
|
|
175
|
+
finally {
|
|
176
|
+
sftp.end();
|
|
177
|
+
spinner.stop();
|
|
178
|
+
}
|
|
179
|
+
return { success: true };
|
|
180
|
+
});
|
|
181
|
+
//# sourceMappingURL=builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../../../packages/builder/src/deploy/builder.ts"],"names":[],"mappings":";;AAAA,yDAAiG;AACjG,+CAAkD;AAClD,oDAA2D;AAC3D,6EAAsH;AACtH,kEAAoE;AACpE,iCAAiC;AACjC,kCAAkC;AAClC,kCAAkC;AAClC,6BAAsB;AAItB,KAAK,UAAU,WAAW;IACxB,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAA,wBAAa,EAA4B,UAAU,CAAC,CAAC;IACzF,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QACzC;YACE,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,8BAA8B;SACxC;KACF,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,KAAK,UAAU,WAAW;IACxB,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAA,wBAAa,EAA4B,UAAU,CAAC,CAAC;IACzF,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC1C,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,8BAA8B;YACvC,IAAI,EAAE,GAAG;SACV,CAAC,CAAC,CAAC;IACJ,OA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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface Schema {
|
|
2
|
+
host: string;
|
|
3
|
+
port: number;
|
|
4
|
+
username?: string;
|
|
5
|
+
password?: string;
|
|
6
|
+
remotePath: string;
|
|
7
|
+
localPath?: string;
|
|
8
|
+
skipBuild?: boolean;
|
|
9
|
+
webhook?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface DeployEnv {
|
|
12
|
+
NG_DEPLOY_USERNAME?: string;
|
|
13
|
+
NG_DEPLOY_PASSWORD?: string;
|
|
14
|
+
NG_DEPLOY_WEBHOOK?: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../../packages/builder/src/deploy/interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "Schema",
|
|
4
|
+
"title": "schema",
|
|
5
|
+
"description": "Deployment of Angular applications to remote",
|
|
6
|
+
"properties": {
|
|
7
|
+
"host": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Remote host address"
|
|
10
|
+
},
|
|
11
|
+
"port": {
|
|
12
|
+
"type": "number",
|
|
13
|
+
"default": 22,
|
|
14
|
+
"description": "Remote host port"
|
|
15
|
+
},
|
|
16
|
+
"username": {
|
|
17
|
+
"type": "string"
|
|
18
|
+
},
|
|
19
|
+
"remotePath": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"default": "./"
|
|
22
|
+
},
|
|
23
|
+
"localPath": {
|
|
24
|
+
"type": "string"
|
|
25
|
+
},
|
|
26
|
+
"password": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
},
|
|
29
|
+
"skipBuild": {
|
|
30
|
+
"type": "boolean"
|
|
31
|
+
},
|
|
32
|
+
"webhook": {
|
|
33
|
+
"type": "string"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
package/index.d.ts
ADDED
package/index.js
ADDED
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/builder/src/index.ts"],"names":[],"mappings":";;AAAA,kBAAe,KAAK,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@solar-angular/builder",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"builders": "./builders.json",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"tslib": "^2.3.0",
|
|
11
|
+
"inquirer": "^12.0.0",
|
|
12
|
+
"ssh2-sftp-client": "^9.0.0",
|
|
13
|
+
"dotenv": "^16.4.0",
|
|
14
|
+
"ora": "^8.1.0"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/ssh2-sftp-client": "^9.0.0",
|
|
18
|
+
"@angular-devkit/architect": "^0.1802"
|
|
19
|
+
},
|
|
20
|
+
"types": "./index.d.ts",
|
|
21
|
+
"main": "./index.js"
|
|
22
|
+
}
|