Skip to content

Commit cc5b9cb

Browse files
authored
Ensure packages als is functional (#1280)
Fixes: #1266
1 parent 037bd3b commit cc5b9cb

File tree

6 files changed

+63
-3
lines changed

6 files changed

+63
-3
lines changed

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fund=false

packages/ansible-language-server/changelog.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Ansible Language Server Change Log
44

5-
## v1.2.2
5+
## v1.2.3
66

77
- No notable changes
88

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "test-als",
3+
"version": "0.0.1",
4+
"description": "Test als package",
5+
"main": "index.js",
6+
"repository": {
7+
"type": "git",
8+
"url": "the repositories url"
9+
},
10+
"author": "your name",
11+
"license": "N/A"
12+
}

packages/ansible-language-server/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"displayName": "Ansible",
55
"description": "Ansible language server",
66
"license": "MIT",
7-
"version": "1.2.2",
7+
"version": "1.2.3",
88
"contributors": [
99
{
1010
"name": "Tomasz Maciążek",
@@ -32,7 +32,7 @@
3232
"types": "./out/server/src/server.d.ts",
3333
"files": [
3434
"icon.png",
35-
"out/server/src"
35+
"./out/server/src/**/*"
3636
],
3737
"categories": [
3838
"Programming Languages"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import * as cp from "child_process";
2+
import * as rpc from "vscode-jsonrpc/node";
3+
4+
const lspProcess = cp.spawn("npx", ["ansible-language-server", "--stdio"]);
5+
6+
export type LanguageServer = rpc.MessageConnection;
7+
8+
export const exit = async (languageServer: rpc.MessageConnection) => {
9+
const ret = new Promise((resolve) => {
10+
languageServer.onClose(() => {
11+
languageServer.dispose();
12+
resolve(null);
13+
});
14+
});
15+
16+
const notification = new rpc.NotificationType<string>("exit");
17+
languageServer.sendNotification(notification);
18+
19+
return ret;
20+
};
21+
22+
// Use stdin and stdout for communication:
23+
const connection = rpc.createMessageConnection(
24+
new rpc.StreamMessageReader(lspProcess.stdout),
25+
new rpc.StreamMessageWriter(lspProcess.stdin),
26+
);
27+
28+
const notification = new rpc.NotificationType<string>(
29+
"update/ansible-metadata",
30+
);
31+
32+
connection.listen();
33+
connection.sendNotification(notification);
34+
35+
exit(connection);
36+
console.log("Apparently ALS initialized successfully.");

packages/ansible-language-server/tools/can-release.sh

+11
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
99
done
1010
DIR=$( cd -P "$( dirname "$SOURCE" )" > /dev/null 2>&1 && pwd )
1111

12+
# installs the package inside an isolated project and executes its entry point
13+
# in order to check if we packaged everything needed.
14+
pushd "${DIR}/../out/test-als"
15+
git checkout HEAD -- package.json
16+
npm add ../../@ansible-ansible-language-server-*.tgz
17+
npm install
18+
git checkout HEAD -- package.json
19+
npx ts-node ../../test/validate-ls.ts
20+
popd
21+
22+
1223
VERSION=$(jq -r '.version' "${DIR}/../package.json")
1324
# VIEW=$(npm view "@ansible/ansible-language-server@${VERSION}")
1425

0 commit comments

Comments
 (0)