Skip to content

Commit b88f7c2

Browse files
committed
chore: oidc workflow and readme
1 parent 2040a5e commit b88f7c2

File tree

4 files changed

+98
-26
lines changed

4 files changed

+98
-26
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,5 @@ lib/common/test-reports.xml
8787
!lib/common/test-scripts/**
8888
!lib/common/scripts/**
8989
config/test-deps-versions-generated.json
90+
!scripts/get-next-version.js
91+
!scripts/get-npm-tag.js

README.md

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11

22
<h1 id="nativescript-command-line-interface" align="center">
3-
<br>
4-
<a href="https://www.npmjs.com/package/nativescript"><img src="https://art.nativescript.org/logo/export/NativeScript_Logo_Wide_White_Blue_Rounded_Blue.svg" alt="Nativescript Logo" width="200"></a>
5-
<br>
6-
<br>
7-
NativeScript Command-Line Interface
8-
<br>
3+
<a href="https://www.npmjs.com/package/nativescript"><img src="https://raw.githubusercontent.com/NativeScript/artwork/main/logo/export/NativeScript_Logo_Dark_Transparent.png" alt="Nativescript Logo" width="200"></a>
94
</h1>
105

116
<h4 align="center">The NativeScript CLI lets you create, build, and deploy <a href="https://docs.nativescript.org/" target="_blank">NativeScript</a> apps.</h4>
@@ -14,7 +9,11 @@
149

1510
---
1611

17-
[![nativescript -> npm](https://github.com/NativeScript/nativescript-cli/actions/workflows/npm_release_cli.yml/badge.svg)](https://github.com/NativeScript/nativescript-cli/actions/workflows/npm_release_cli.yml)
12+
<p align="center">
13+
<a href="https://www.npmjs.com/package/nativescript"><img src="https://img.shields.io/npm/v/nativescript.svg" alt="npm version"></a>
14+
<a href="https://github.com/NativeScript/NativeScript/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="license"></a>
15+
<a href="https://www.npmjs.com/package/nativescript"><img src="https://img.shields.io/npm/dm/nativescript.svg" alt="downloads"></a>
16+
</p>
1817

1918
Get it using: `npm install -g nativescript`
2019

@@ -67,10 +66,7 @@ Some popular use cases:
6766
To learn more about NativeScript, you can check the following resources:
6867

6968
* [The NativeScript web page][2]
70-
* [NativeScript - a Technical Overview][7]
71-
* [Announcing NativeScript - cross-platform framework for building native mobile applications][8]
72-
* The NativeScript [Documentation repo][3] and [Documentation portal][4]
73-
* [The NativeScript FAQ][6]
69+
* The NativeScript [Documentation][4] and contributing to [docs via the repo](https://github.com/NativeScript/docs)
7470

7571
[Back to Top][1]
7672

@@ -104,9 +100,9 @@ System Requirements
104100

105101
You can install and run the NativeScript CLI on Windows, macOS or Linux.
106102

107-
* [Windows](https://docs.nativescript.org/start/ns-setup-win)
108-
* [macOS](https://docs.nativescript.org/start/ns-setup-os-x)
109-
* [Linux](https://docs.nativescript.org/start/ns-setup-linux)
103+
* [Windows](https://docs.nativescript.org/setup/windows)
104+
* [macOS](https://docs.nativescript.org/setup/macos)
105+
* [Linux](https://docs.nativescript.org/setup/linux)
110106

111107
Installation
112108
===
@@ -224,14 +220,14 @@ The CLI places the project in a new directory in the current directory. The newl
224220

225221
```
226222
MyApp/
227-
├── app
228-
├── App_Resources
223+
├── App_Resources
224+
├── src
229225
│ └── ...
230226
└── platforms
231227
└── ...
232228
```
233229

234-
* The `app` directory is the **development space for your application**. You should modify all common and platform-specific code within this directory. When you run `prepare <Platform>`, the NativeScript CLI prepares relevant content to the platform-specific folders for each target platform.
230+
* The `src` directory (or sometimes `app` folder) is the **development space for your application**. You should modify all common and platform-specific code within this directory. When you run `prepare <Platform>`, the NativeScript CLI prepares relevant content to the platform-specific folders for each target platform.
235231
* The `platforms` directory is created empty. When you add a target platform to your project, the NativeScript CLI creates a new subdirectory with the platform name. The subdirectory contains the ready-to-build resources of your app. When you run `prepare <Platform>`, the NativeScript CLI prepares relevant content from the `app` directory to the platform-specific subdirectory for each target platform.
236232

237233
[Back to Top][1]
@@ -263,13 +259,13 @@ You can develop shared functionality or design in common files. To indicate that
263259

264260
### Modifying Configuration Files
265261

266-
The NativeScript CLI respects any platform configuration files placed inside `app/App_Resources`.
262+
The NativeScript CLI respects any platform configuration files placed inside `App_Resources`.
267263

268264
### Modifying Entitlements File (iOS only)
269265

270-
To specify which capabilities are required by your App - Maps, Push Notifications, Wallet etc. you can add or edit the `app.entitlements` file placed inside `app/App_Resources/iOS`. When building the project, the default `app/App_Resources/iOS/app.entitlements` file gets merged with all Plugins entitlement files and a new `yourAppName.entitlements` is created in the platforms directory. The path would be `app/platforms/ios/<application name>/<application name>.entitlements` and will be linked in the `build.xcconfig` file.
266+
To specify which capabilities are required by your App - Maps, Push Notifications, Wallet etc. you can add or edit the `app.entitlements` file placed inside `App_Resources/iOS`. When building the project, the default `App_Resources/iOS/app.entitlements` file gets merged with all Plugins entitlement files and a new `yourAppName.entitlements` is created in the platforms directory. The path would be `platforms/ios/<application name>/<application name>.entitlements` and will be linked in the `build.xcconfig` file.
271267

272-
You can always override the generated entitlements file, by pointing to your own entitlements file by setting the `CODE_SIGN_ENTITLEMENTS` property in the `app/App_Resources/iOS/build.xcconfig` file.
268+
You can always override the generated entitlements file, by pointing to your own entitlements file by setting the `CODE_SIGN_ENTITLEMENTS` property in the `App_Resources/iOS/build.xcconfig` file.
273269

274270
[Back to Top][1]
275271

@@ -314,11 +310,11 @@ ns run ios
314310
Extending the CLI
315311
===
316312

317-
The NativeScript CLI lets you extend its behavior and customize it to fit your needs by using [hooks](https://en.wikipedia.org/wiki/Hooking).
313+
The NativeScript CLI lets you extend its behavior and customize it to fit your needs by using [hooks](https://docs.nativescript.org/guide/hooks).
318314

319315
When you run one of the extendable commands (for example, `ns build`), the CLI checks for hooks and executes them. Plugins can also use hooks to control the compilation of the application package.
320316

321-
For more information, see the [Extending the CLI document](https://github.com/NativeScript/nativescript-cli/blob/master/extending-cli.md)
317+
For more information, see the [Extending the CLI document](https://github.com/NativeScript/nativescript-cli/blob/main/extending-cli.md)
322318

323319
[Back to Top][1]
324320

@@ -354,6 +350,7 @@ How to Build
354350
git clone https://github.com/NativeScript/nativescript-cli
355351
cd nativescript-cli
356352
npm run setup
353+
npm run build
357354
```
358355

359356
To use the locally built CLI instead of `ns` you can call `PATH_TO_CLI_FOLDER/bin/ns`. For example:
@@ -379,7 +376,4 @@ This software is licensed under the Apache 2.0 license, quoted <a href="LICENSE"
379376
[2]: https://nativescript.org
380377
[3]: https://github.com/nativescript/docs
381378
[4]: https://docs.nativescript.org/
382-
[5]: https://docs.nativescript.org/api-reference
383-
[6]: https://www.nativescript.org/faq
384-
[7]: https://docs.nativescript.org/core-concepts/technical-overview
385-
[8]: https://www.telerik.com/blogs/announcing-nativescript---cross-platform-framework-for-building-native-mobile-applications
379+
[5]: https://docs.nativescript.org/api/

scripts/get-next-version.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
const semver = require("semver");
2+
const child_process = require("child_process");
3+
const dayjs = require("dayjs");
4+
const fs = require("fs");
5+
6+
const currentVersion =
7+
process.env.NPM_VERSION || require("../package.json").version;
8+
9+
if (!currentVersion) {
10+
throw new Error("Invalid current version");
11+
}
12+
const currentTag = process.env.NPM_TAG || "next";
13+
const runID = process.env.GITHUB_RUN_ID || 0;
14+
15+
let prPrerelease = "";
16+
17+
if (currentTag === "pr" && process.env.GITHUB_EVENT_PATH) {
18+
try {
19+
const ev = JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, "utf8"));
20+
const prNum = ev.pull_request.number;
21+
// add extra PR number to version-pr.PRNUM-....
22+
prPrerelease = `${prNum}-`;
23+
} catch (e) {
24+
// don't add pr prerelease
25+
}
26+
}
27+
28+
const preRelease = `${currentTag}.${prPrerelease}${dayjs().format("YYYY-MM-DD")}-${runID}`;
29+
30+
let lastTagVersion = (
31+
process.env.LAST_TAGGED_VERSION ||
32+
child_process
33+
.spawnSync("git", ["describe", "--tags", "--abbrev=0", "--match=v*"])
34+
.stdout.toString()
35+
)
36+
.trim()
37+
.substring(1);
38+
if (!semver.parse(lastTagVersion)) {
39+
throw new Error("Invalid last tag version");
40+
}
41+
42+
function setPreRelease(version) {
43+
const parsed = semver.parse(version);
44+
return semver.parse(
45+
`${parsed.major}.${parsed.minor}.${parsed.patch}-${preRelease}`
46+
);
47+
}
48+
49+
let nextVersion = setPreRelease(currentVersion);
50+
51+
// bump patch if the current version is lower or equal to the last tagged version
52+
if (semver.lte(nextVersion, lastTagVersion)) {
53+
nextVersion = semver.inc(lastTagVersion, "patch");
54+
nextVersion = setPreRelease(nextVersion);
55+
}
56+
57+
console.log(nextVersion.version);

scripts/get-npm-tag.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const semver = require("semver");
2+
3+
const currentVersion =
4+
process.env.NPM_VERSION || require("../package.json").version;
5+
6+
function validateNpmTag(version) {
7+
const parsed = semver.parse(version);
8+
return (
9+
parsed.prerelease.length === 0 || /^[a-zA-Z]+$/.test(parsed.prerelease[0])
10+
);
11+
}
12+
13+
function getNpmTag(version) {
14+
if (!validateNpmTag(version)) throw new Error("Invalid npm tag");
15+
const parsed = semver.parse(version);
16+
return parsed.prerelease[0] || "latest";
17+
}
18+
19+
console.log(getNpmTag(currentVersion));

0 commit comments

Comments
 (0)