-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Task; extract and create npm package #6172
base: task/extension/remove-kiota-interop-tight-coupling
Are you sure you want to change the base?
Task; extract and create npm package #6172
Conversation
@@ -610,7 +610,7 @@ extends: | |||
displayName: "Set version suffix" | |||
- pwsh: $(Build.SourcesDirectory)/scripts/get-version-from-csproj.ps1 | |||
displayName: "Get Kiota's version-number from .csproj" | |||
- pwsh: $(Build.SourcesDirectory)/scripts/update-vscode-releases.ps1 -version $(artifactVersion)$(versionSuffix) -packageJsonFilePath $(Build.SourcesDirectory)/vscode/microsoft-kiota/package.json -runtimeFilePath $(Build.SourcesDirectory)/vscode/microsoft-kiota/src/kiotaInterop/runtime.json -binaryFolderPath $(Build.ArtifactStagingDirectory)/Binaries | |||
- pwsh: $(Build.SourcesDirectory)/scripts/update-vscode-releases.ps1 -version $(artifactVersion)$(versionSuffix) -packageJsonFilePath $(Build.SourcesDirectory)/vscode/microsoft-kiota/package.json -runtimeFilePath $(Build.SourcesDirectory)/vscode/npm-package/runtime.json -binaryFolderPath $(Build.ArtifactStagingDirectory)/Binaries | |||
displayName: "Update VSCode extension version-number" | |||
- script: npm i -g @vscode/vsce | |||
displayName: "Install vsce" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll need additional steps to publish the package as well.
@@ -0,0 +1,34 @@ | |||
import stylisticTs from '@stylistic/eslint-plugin-ts'; | |||
import typescriptEslint from "@typescript-eslint/eslint-plugin"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also add the microsoft graph eslint configuration? (see kiota-typescript or graph TS)
…o task/extension/extract-and-create-npm-package
"$schema": "node_modules/lerna/schemas/lerna-schema.json", | ||
"version": "0.0.0", | ||
"packages": [ | ||
"microsoft-kiota", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the need to match what's in the package.json name. Aslo using more explicit names would probably help people running the commands
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this... it uses the folder name not the name of the package.
Also what would be the names we would give? Plus it would increase the number of code changes to rename the folders
…o task/extension/extract-and-create-npm-package
…o task/extension/extract-and-create-npm-package
ae83aa1
to
c5f3828
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put a few structural comments in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIlename snake case?
vscode/npm-package/.npmignore
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel like the npm-package folder should live under vscode as it should have no dependencies on vscode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would another location allow the extension to share the npm-package from elsewhere?
"typescript": "^5.7.3" | ||
}, | ||
"workspaces": [ | ||
"microsoft-kiota", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the general pattern is to create a kind of fake minimal package at the top level to define the workspace
|
…o task/extension/extract-and-create-npm-package
Overview
Folder Visualisation
vscode
├── microsoft-kiota/
├── npm-package/
│ ├── lib/
│ │ ├── generateClient.ts
│ │ ├── generatePlugin.ts
│ │ └── ...
│ ├── tests/
│ │ ├── generateClient.spec.ts
│ │ └── ...
│ ├── connect.ts
│ ├── install.ts
│ ├── ...
│ ├── runtime.json
│ ├── readme.md
│ └── index.ts
├── node_modules/
├── ...
├── lerna.json
└── package.json
Testing the npm package
.tgz
filemicrosoft-kiota-1.0.0.tgz
.cd vscode/npm-package npm pack
Initialize a new Node.js project. The default is (commonjs), but you can change it later to ES6 modules by setting
"module": "ES6"
in yourtsconfig.json
file and reinstall the kiota npm packageindex.ts
at the root of the project and add the following code:index.ts
file into JavaScript and run the compiled code:The expected result is:
Hello, World! 1.23.0