Skip to content

Commit

Permalink
rel2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
wisotzky committed Jun 13, 2024
1 parent c7f8b48 commit 44ebd1f
Show file tree
Hide file tree
Showing 8 changed files with 318 additions and 233 deletions.
22 changes: 22 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**@type {import('eslint').Linter.Config} */
// eslint-disable-next-line no-undef
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
],
rules: {
'semi': [2, "always"],
'@typescript-eslint/no-unused-vars': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-non-null-assertion': 0,
'no-inner-declarations': 0,
'@typescript-eslint/no-namespace': 0
}
};
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.vscode
.vscode/
node_modules/
out/
dist/
*.vsix
package-lock.json
.DS_Store/
8 changes: 8 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.git/**
.vscode/**
src/**
out/**
tsconfig.json
.gitignore
.DS_Store
.eslintrc.js
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,16 @@ Experimental:
Known limitations:
* Intent decoration is automatically updated by audit/sync methods to reduce server.
In some error scenarios the displayed alignment state does not reflect the server state.

## [2.1.1]

Fixes:
* Upload intents and views from local machine (drag'n drop, copy/paste)
* Sanitized code for lint conformance
* Optimized build script

Updates:
* Allow updating `meta-info.json` for signed intent-types. Change was requested to remove label `ArtifactAdmin`
after an intent-type was cloned or a new version have been created.
* New command to upload intents from local system.

52 changes: 51 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,55 @@ limited number of intent-types and instances, but it is not designed to work in
Extensive logging is available for all communication between this vsCode plugin and NSP IM.
Check "OUTPUT" for more details.

## Build VSIX

Please make sure, you've got the following installed in your environment:

```
# npm install -g typescript
# npm install -g @vscode/vsce
```

Installation can be validated like this:

```
% npm list -g
/usr/local/lib/node_modules/node/lib
├── @vscode/vsce@2.27.0
└── typescript@5.4.5
```

Before you compile and build the distribution, make sure all depended modules
are installed:

```
% npm install .
% npm list
nokia-intent-manager@2.1.1 ~/dev/vscode-intent-manager
├── @types/node@18.19.34
├── @types/vscode@1.90.0
├── @typescript-eslint/eslint-plugin@6.21.0
├── @typescript-eslint/parser@6.21.0
├── @vscode/codicons@0.0.36
├── base-64@1.0.0
├── esbuild@0.21.5
├── eslint@8.57.0
├── lodash@4.17.21
├── node-fetch@2.7.0
├── nunjucks@3.2.4
├── typescript@5.4.5
├── vscode-uri@3.0.8
├── vse@0.5.1
└── yaml@2.4.5
```

To see all dependencies, you can run `npm list --all`.
In cases of any issues, visit the `npm doctor`.

To compile and generate the VSIX for installation, run:

vsce package

## Extension Settings

To make the extension work, make sure you configure the following attributes in the extension settings:
Expand All @@ -66,6 +115,7 @@ See release changes in Changelog.

## Important links

* [Developer portal](https://network.developer.nokia.com/learn/23_4/network-programmability-automation-frameworks)
### NOKIA | Network Developer Portal
* [NSP Programmable Automation Frameworks](https://network.developer.nokia.com/learn/24_4/network-programmability-automation-frameworks)

**Enjoy!**
71 changes: 37 additions & 34 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nokia-intent-manager",
"displayName": "NOKIA_IM",
"description": "NOKIA IM vsCode Developer Plugin",
"version": "2.1.0",
"version": "2.1.1",
"icon": "media/NSP_Logo.png",
"publisher": "Nokia",
"repository": "http://github.com/nokia/vscode-intent-manager",
Expand All @@ -16,7 +16,7 @@
"onFileSystem:im",
"onStartupFinished"
],
"main": "./out/main.js",
"main": "./dist/main.js",
"contributes": {
"snippets": [
{
Expand Down Expand Up @@ -62,11 +62,17 @@
"icon": "$(home)"
},
{
"command": "nokia-intent-manager.uploadLocal",
"command": "nokia-intent-manager.uploadIntentType",
"category": "IntentManager",
"title": "Upload intent-type",
"icon": "$(cloud-upload)"
},
{
"command": "nokia-intent-manager.uploadIntents",
"category": "IntentManager",
"title": "Upload intent(s)",
"icon": "$(cloud-upload)"
},
{
"command": "workbench.files.action.compareWithSaved",
"category": "IntentManager",
Expand Down Expand Up @@ -99,7 +105,7 @@
"editor/title": [
{
"when": "resourceScheme != im && resourceFilename == meta-info.json || resourceFilename == script-content.js || resourceFilename == script-content.mjs",
"command": "nokia-intent-manager.uploadLocal",
"command": "nokia-intent-manager.uploadIntentType",
"group": "navigation"
},
{
Expand Down Expand Up @@ -140,10 +146,15 @@
],
"explorer/context": [
{
"command": "nokia-intent-manager.uploadLocal",
"command": "nokia-intent-manager.uploadIntentType",
"group": "nokia_im",
"when": "resource =~ /^file:.*\\/intent\\-[a-z][a-z0-9_\\-]*\\-v\\d+/ || resource =~ /^file:.*\\/[a-z][a-z0-9_\\-]*_v\\d+/"
},
{
"command": "nokia-intent-manager.uploadIntents",
"group": "nokia_im",
"when": "resource =~ /^file:.*\\/[a-z][a-z0-9_\\-]*_v\\d+\\/intents\\/.+\\.json/"
},
{
"command": "nokia-intent-manager.newIntentType",
"group": "nokia_im",
Expand Down Expand Up @@ -251,47 +262,39 @@
"scope": "application",
"default": false,
"description": "Enable parallel intent operations (EXPERIMENTAL)"
}
}
}
}
},
"scripts": {
"vscode:prepublish": "npm run esbuild-base -- --minify",
"build": "./node_modules/typescript/bin/tsc",
"compile": "./node_modules/typescript/bin/tsc -p ./",
"watch": "./node_modules/typescript/bin/tsc -watch -p ./",
"pretest": "npm run compile && npm run lint",
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js",
"esbuild-base": "esbuild ./src/extension.ts --bundle --outfile=out/main.js --external:vscode --format=cjs --platform=node --packages=external",
"esbuild": "npm run esbuild-base -- --sourcemap",
"vscode:prepublish": "npm run esbuild -- --minify",
"compile": "tsc -p ./ --sourceMap",
"lint": "eslint \"src/**/*.ts\"",
"clean": "rm -rf node_modules out",
"watch": "tsc -watch -p ./",
"build": "tsc",
"esbuild-base": "esbuild ./src/extension.ts --bundle --outfile=dist/main.js --external:vscode --format=cjs --platform=node --packages=external",
"esbuild-watch": "npm run esbuild-base -- --sourcemap --watch",
"test-compile": "./node_modules/typescript/bin/tsc -p ./"
"esbuild": "npm run esbuild-base -- --sourcemap"
},
"devDependencies": {
"@types/glob": "^8.0.0",
"@types/mocha": "^10.0.1",
"@types/node": "16.x",
"@types/node": "18.x",
"@types/vscode": "^1.75.0",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"@vscode/test-electron": "^2.2.0",
"eslint": "^8.28.0",
"glob": "^8.0.3",
"mocha": "^10.1.0",
"typescript": "^4.9.3"
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
"esbuild": "^0.21.5",
"eslint": "^8.26.0",
"typescript": "5.x"
},
"dependencies": {
"@vscode/codicons": "0.0.20",
"@vscode/vsce": "^2.25.0",
"@vscode/codicons": "^0.0.36",
"base-64": "^1.0.0",
"esbuild": "^0.20.2",
"lodash": "^4.17.0",
"node-fetch": "2.6.6",
"lodash": "^4.17.21",
"node-fetch": "^2.7.0",
"npm": "^10.8.1",
"nunjucks": "^3.2.0",
"vsce": "^2.15.0",
"vscode-uri": "^3.0.0",
"vscode-uri": "^3.0.8",
"vse": "^0.5.1",
"yaml": "^2.2.0"
"yaml": "^2.4.5"
}
}
16 changes: 8 additions & 8 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(vscode.commands.registerCommand('nokia-intent-manager.openInBrowser', async (...args) => imProvider.openInBrowser(args)));
context.subscriptions.push(vscode.commands.registerCommand('nokia-intent-manager.newIntent', async (...args) => imProvider.newIntent(args)));

context.subscriptions.push(vscode.commands.registerCommand('nokia-intent-manager.uploadLocal', async (...args) => imProvider.uploadLocal(args)));
context.subscriptions.push(vscode.commands.registerCommand('nokia-intent-manager.clone', async (...args) => imProvider.clone(args)));
context.subscriptions.push(vscode.commands.registerCommand('nokia-intent-manager.newVersion', async (...args) => imProvider.newVersion(args)));
context.subscriptions.push(vscode.commands.registerCommand('nokia-intent-manager.newIntentType', async (...args) => imProvider.newIntentTypeFromTemplate(args)));
context.subscriptions.push(vscode.commands.registerCommand('nokia-intent-manager.uploadIntentType', async (...args) => imProvider.uploadIntentType(args)));
context.subscriptions.push(vscode.commands.registerCommand('nokia-intent-manager.uploadIntents', async (...args) => imProvider.uploadIntents(args)));
context.subscriptions.push(vscode.commands.registerCommand('nokia-intent-manager.clone', async (...args) => imProvider.clone(args)));
context.subscriptions.push(vscode.commands.registerCommand('nokia-intent-manager.newVersion', async (...args) => imProvider.newVersion(args)));
context.subscriptions.push(vscode.commands.registerCommand('nokia-intent-manager.newIntentType', async (...args) => imProvider.newIntentTypeFromTemplate(args)));

vscode.commands.registerCommand('nokia-intent-manager.setPassword', async () => {
const passwordInput: string = await vscode.window.showInputBox({password: true, title: "Password"}) ?? '';
Expand All @@ -36,7 +37,7 @@ export function activate(context: vscode.ExtensionContext) {

function updateStatusBarItem(){
const editor = vscode.window.activeTextEditor;
let sbar = imProvider.getStatusBarItem();
const sbar = imProvider.getStatusBarItem();

if (editor) {
const document = editor.document;
Expand Down Expand Up @@ -67,10 +68,9 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(imProvider.getStatusBarItem());
context.subscriptions.push(vscode.languages.registerCodeLensProvider({scheme: 'im'}, imProvider));

let fileAssociations : {[key: string]: string} = vscode.workspace.getConfiguration('files').get('associations') || {};
const fileAssociations : {[key: string]: string} = vscode.workspace.getConfiguration('files').get('associations') || {};
fileAssociations["/*_v*/views/*"] = "json";
fileAssociations["/*_v*/intents/*"] = "json";
vscode.workspace.getConfiguration('files').update('associations', fileAssociations);

vscode.workspace.updateWorkspaceFolders(vscode.workspace.workspaceFolders ? vscode.workspace.workspaceFolders.length : 0, null, { uri: vscode.Uri.parse('im:/'), name: "Intent Manager" });
}
Loading

0 comments on commit 44ebd1f

Please sign in to comment.