Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI

on:
push:
branches: [master]
pull_request:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run lint
- run: npm run format:check
- run: npm run typecheck
- run: npm test
# vscode:prepublish cleans out/, builds, and skips analytics config since no GA secrets are set here.
- name: Package
id: package
run: |
npx vsce package --out nativescript.vsix
echo "version=$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: nativescript-${{ steps.package.outputs.version }}-${{ github.sha }}
path: nativescript.vsix
if-no-files-found: error
186 changes: 186 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
name: Release

# push to master -> release-please updates the release PR; if that push merged the release PR it
# publishes the stable version, otherwise it publishes a pre-release
# workflow_dispatch -> pre-release from the selected ref
#
# Publishing only runs when the repo variable ENABLE_RELEASE is 'true'; until then the workflow
# builds and tests only. See RELEASING.md for the required variables and secrets.

on:
push:
branches: [master]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: release
cancel-in-progress: false

jobs:
release-please:
name: Release PR
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
# PRs opened with GITHUB_TOKEN don't trigger CI; an App token makes the release PR run ci.yml.
- name: Mint App token
id: app-token
if: ${{ vars.APP_CLIENT_ID != '' }}
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
with:
client-id: ${{ vars.APP_CLIENT_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
id: release
with:
token: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json

build:
name: Build
needs: release-please
if: ${{ !cancelled() && (github.event_name == 'workflow_dispatch' || needs.release-please.result == 'success') }}
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
channel: ${{ steps.version.outputs.channel }}
vsix: ${{ steps.version.outputs.vsix }}
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
# Dependency caching is a cache-poisoning vector in jobs that feed a publish.
package-manager-cache: false
- run: npm ci
- run: npm run lint
- run: npm run typecheck
- run: npm test
- name: Resolve version
id: version
env:
RELEASE_CREATED: ${{ needs.release-please.outputs.release_created }}
RUN_NUMBER: ${{ github.run_number }}
run: |
if [ "$RELEASE_CREATED" = "true" ]; then
channel=stable
version=$(node -p "require('./package.json').version")
else
# The Marketplace only accepts X.Y.Z and serves the highest version, so pre-releases use
# patch numbers >= 1000 that stable releases (chosen by release-please) never reach.
channel=prerelease
version=$(node -p "const [major, minor] = require('./package.json').version.split('.'); major + '.' + minor + '.' + (1000 + Number(process.env.RUN_NUMBER))")
npm version "$version" --no-git-tag-version --allow-same-version
fi
{
echo "version=$version"
echo "channel=$channel"
echo "vsix=nativescript-$version.vsix"
} >> "$GITHUB_OUTPUT"
- name: Package
env:
GA_MEASUREMENT_ID: ${{ vars.GA_MEASUREMENT_ID }}
GA_API_SECRET: ${{ secrets.GA_API_SECRET }}
CHANNEL: ${{ steps.version.outputs.channel }}
VSIX: ${{ steps.version.outputs.vsix }}
run: |
if [ "$CHANNEL" = "prerelease" ]; then
npx vsce package --pre-release --out "$VSIX"
else
npx vsce package --out "$VSIX"
fi
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: vsix
path: ${{ steps.version.outputs.vsix }}
if-no-files-found: error

publish-marketplace:
name: Publish to VS Code Marketplace
needs: build
if: ${{ vars.ENABLE_RELEASE == 'true' }}
runs-on: ubuntu-latest
environment: release
permissions:
contents: read
id-token: write
env:
CHANNEL: ${{ needs.build.outputs.channel }}
VSIX: ${{ needs.build.outputs.vsix }}
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
package-manager-cache: false
- run: npm ci
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: vsix
# Marketplace Trusted Publishing: the publisher's policy must name this repo, release.yml and the
# 'release' environment.
- name: Publish
run: |
if [ "$CHANNEL" = "prerelease" ]; then
npx vsce publish --oidc --skip-duplicate --pre-release --packagePath "$VSIX"
else
npx vsce publish --oidc --skip-duplicate --packagePath "$VSIX"
fi

github-release:
name: GitHub release
needs: [release-please, build, publish-marketplace]
# !cancelled() lets this run when release-please was skipped (manual pre-release runs).
if: ${{ !cancelled() && vars.ENABLE_RELEASE == 'true' && needs.build.result == 'success' && needs.publish-marketplace.result == 'success' }}
runs-on: ubuntu-latest
permissions:
contents: write
env:
GH_TOKEN: ${{ github.token }}
CHANNEL: ${{ needs.build.outputs.channel }}
VERSION: ${{ needs.build.outputs.version }}
VSIX: ${{ needs.build.outputs.vsix }}
STABLE_TAG: ${{ needs.release-please.outputs.tag_name }}
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: vsix
- name: Attach the .vsix
run: |
if [ "$CHANNEL" = "stable" ]; then
# release-please already created the release and its notes.
gh release upload "$STABLE_TAG" "$VSIX" --clobber --repo "$GITHUB_REPOSITORY"
else
gh release create "v$VERSION" "$VSIX" --prerelease --generate-notes \
--target "$GITHUB_SHA" --title "v$VERSION" --repo "$GITHUB_REPOSITORY"
fi
13 changes: 5 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
.DS_Store
out/
node_modules/
src/typings/
src/tests/config/custom.json
src/tests/testdata/JSApp
src/tests/testdata/TSApp
src/tests/testdata/**/node_modules
src/tests/testdata/**/platforms
npm-debug.log
nativescript-*.vsix
/.vscode/
nativescript-*.vsix
/.vscode/
nativescript.vsix
.env
.env.*
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
out/
node_modules/
package-lock.json
CHANGELOG.md
*.vsix
*.md
.travis.yml
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"singleQuote": true,
"printWidth": 120,
"tabWidth": 2,
"useTabs": false
}
1 change: 1 addition & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ ".": "0.12.5" }
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

63 changes: 19 additions & 44 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,20 @@
{
"version": "0.1.0",
"configurations": [
{
"name": "Launch as server",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/out/debug-adapter/nativeScriptDebug.js",
"runtimeArgs": ["--nolazy"],
"args": [ "--server=4712" ],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [ "${workspaceFolder}/out/**/*.js" ],
"cwd": "${workspaceFolder}"
},
{
"name": "Launch in extension host",
"type": "extensionHost",
"request": "launch",
// Path to VSCode executablensDebugClient
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [ "${workspaceFolder}/out/**/*.js" ]
},
{
"name": "Run tests",
"type": "node",
"request": "launch",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run", "test", "--"
]
}
],
"compounds": [
{
"name": "Extension + Server",
"configurations": [ "Launch in extension host", "Launch as server" ]
}
]
}
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Run Tests",
"type": "node",
"request": "launch",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "test", "--"]
}
]
}
46 changes: 21 additions & 25 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
{
"version": "2.0.0",
"windows": {
"command": ".\\node_modules\\.bin\\tsc"
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "npm",
"script": "build",
"problemMatcher": "$tsc",
"group": {
"kind": "build",
"isDefault": true
}
},
"command": "./node_modules/.bin/tsc",
"args": [
"-p",
"./src"
],
"problemMatcher": "$tsc",
"tasks": [
{
"label": "./node_modules/.bin/tsc",
"type": "shell",
"args": [
"-p",
"./src"
],
"problemMatcher": "$tsc",
"group": {
"_id": "build",
"isDefault": false
}
}
]
}
{
"label": "watch",
"type": "npm",
"script": "build:watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"group": "build"
}
]
}
Loading
Loading