From 1a849f93028c6936d978956541093fdc644f794c Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Thu, 12 Nov 2020 21:23:03 +0100 Subject: [PATCH 1/8] fix: Prior PR (#8904) has bad path for trace modules * Fix trace path issue * another path fix --- packages/core/animation-frame/index.ts | 2 +- packages/core/utils/macrotask-scheduler.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/animation-frame/index.ts b/packages/core/animation-frame/index.ts index e39983ae0..722f2e2f2 100644 --- a/packages/core/animation-frame/index.ts +++ b/packages/core/animation-frame/index.ts @@ -1,7 +1,7 @@ import { queueMacrotask } from '../utils/macrotask-scheduler'; import { FPSCallback } from '../fps-meter/fps-native'; import { getTimeInFrameBase } from './animation-native'; -import { Trace } from 'trace'; +import { Trace } from '../trace'; export interface FrameRequestCallback { (time: number): void; diff --git a/packages/core/utils/macrotask-scheduler.ts b/packages/core/utils/macrotask-scheduler.ts index dfd477e9d..862d8f58d 100644 --- a/packages/core/utils/macrotask-scheduler.ts +++ b/packages/core/utils/macrotask-scheduler.ts @@ -1,4 +1,4 @@ -import { Trace } from 'trace'; +import { Trace } from '../trace'; import { dispatchToMainThread } from './mainthread-helper'; let scheduled = false; From 6902770d90213016d61ca465c1198c37672e1b8b Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Thu, 12 Nov 2020 22:55:22 +0100 Subject: [PATCH 2/8] fix: rollback regexp eslint changes (#9028) * fix: rollback regexp eslint changes * fix: rollback animation lint which would break promise context * fix: more rollbacks --- .eslintrc.json | 1 + packages/core/css/parser.ts | 14 +++++++------- packages/core/profiling/index.ts | 13 +++++++------ packages/core/ui/animation/animation-common.ts | 10 ++++++---- packages/core/ui/builder/binding-builder.ts | 2 +- packages/core/utils/utils-common.ts | 2 +- 6 files changed, 23 insertions(+), 19 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index a2495852f..8d58bdb49 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -25,6 +25,7 @@ "no-prototype-builtins": "off", "no-inner-declarations": "off", "no-constant-condition": "off", + "no-useless-escape": "off", "@nrwl/nx/enforce-module-boundaries": [ "error", { diff --git a/packages/core/css/parser.ts b/packages/core/css/parser.ts index c6725ca5d..1de8de2f2 100644 --- a/packages/core/css/parser.ts +++ b/packages/core/css/parser.ts @@ -237,7 +237,7 @@ export function parseRepeat(value: string, start = 0, keyword = parseKeyword(val return null; } -const unitRegEx = /\s*([+-]?(?:\d+\.\d+|\d+|\.\d+)(?:[eE][+-]?\d+)?)([a-zA-Z]+|%)?\s*/gy; +const unitRegEx = /\s*([\+\-]?(?:\d+\.\d+|\d+|\.\d+)(?:[eE][\+\-]?\d+)?)([a-zA-Z]+|%)?\s*/gy; export function parseUnit(text: string, start = 0): Parsed> { unitRegEx.lastIndex = start; const result = unitRegEx.exec(text); @@ -743,7 +743,7 @@ export function parseSimpleIdentifierSelector(text: string, start = 0): Parsed { attributeSelectorRegEx.lastIndex = start; const result = attributeSelectorRegEx.exec(text); @@ -852,13 +852,13 @@ export interface QualifiedRule { const whitespaceRegEx = /[\s\t\n\r\f]*/gmy; -const singleQuoteStringRegEx = /'((?:[^\n\r\f']|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))*)(:?'|$)/gmy; // Besides $n, parse escape -const doubleQuoteStringRegEx = /"((?:[^\n\r\f"]|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))*)(:?"|$)/gmy; // Besides $n, parse escape +const singleQuoteStringRegEx = /'((?:[^\n\r\f\']|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))*)(:?'|$)/gmy; // Besides $n, parse escape +const doubleQuoteStringRegEx = /"((?:[^\n\r\f\"]|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))*)(:?"|$)/gmy; // Besides $n, parse escape -const commentRegEx = /(\/\*(?:[^*]|\*[^/])*\*\/)/gmy; -const numberRegEx = /[+-]?(?:\d+\.\d+|\d+|\.\d+)(?:[eE][+-]?\d+)?/gmy; +const commentRegEx = /(\/\*(?:[^\*]|\*[^\/])*\*\/)/gmy; +const numberRegEx = /[\+\-]?(?:\d+\.\d+|\d+|\.\d+)(?:[eE][\+\-]?\d+)?/gmy; // eslint-disable-next-line no-control-regex -const nameRegEx = /-?(?:(?:[a-zA-Z_]|[^\x00-\x7F]|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))(?:[a-zA-Z_0-9-]*|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))*)/gmy; +const nameRegEx = /-?(?:(?:[a-zA-Z_]|[^\x00-\x7F]|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))(?:[a-zA-Z_0-9\-]*|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))*)/gmy; // const nonQuoteURLRegEx = /(:?[^\)\s\t\n\r\f\'\"\(]|\\(?:\$|\n|[0-9a-fA-F]{1,6}\s?))*/gym; // TODO: non-printable code points omitted type InputToken = '(' | ')' | '{' | '}' | '[' | ']' | ':' | ';' | ',' | ' ' | '^=' | '|=' | '$=' | '*=' | '~=' | '' | undefined | /* */ InputTokenObject | FunctionInputToken | FunctionToken | SimpleBlock | AtKeywordToken; diff --git a/packages/core/profiling/index.ts b/packages/core/profiling/index.ts index 91cb4c04e..8bd3c1def 100644 --- a/packages/core/profiling/index.ts +++ b/packages/core/profiling/index.ts @@ -1,3 +1,4 @@ +/* eslint-disable prefer-rest-params */ declare let __startCPUProfiler: any; declare let __stopCPUProfiler: any; @@ -98,10 +99,10 @@ export function isRunning(name: string): boolean { function countersProfileFunctionFactory(fn: F, name: string, type: MemberType = MemberType.Instance): F { profileNames.push(name); - return function (...args) { + return function () { start(name); try { - return fn(...args); + return fn.apply(this, arguments); } finally { stop(name); } @@ -110,19 +111,19 @@ function countersProfileFunctionFactory(fn: F, name: string, function timelineProfileFunctionFactory(fn: F, name: string, type: MemberType = MemberType.Instance): F { return type === MemberType.Instance - ? function (...args) { + ? function () { const start = time(); try { - return fn(...args); + return fn.apply(this, arguments); } finally { const end = time(); console.log(`Timeline: Modules: ${name} ${this} (${start}ms. - ${end}ms.)`); } } - : function (...args) { + : function () { const start = time(); try { - return fn(...args); + return fn.apply(this, arguments); } finally { const end = time(); console.log(`Timeline: Modules: ${name} (${start}ms. - ${end}ms.)`); diff --git a/packages/core/ui/animation/animation-common.ts b/packages/core/ui/animation/animation-common.ts index ae8b08e27..0771f3654 100644 --- a/packages/core/ui/animation/animation-common.ts +++ b/packages/core/ui/animation/animation-common.ts @@ -100,15 +100,17 @@ export abstract class AnimationBase implements AnimationBaseDefinition { _this.cancel(); }; const _then = promise.then; - promise.then = function (...args) { - const r = _then(...args); + promise.then = function () { + // eslint-disable-next-line prefer-rest-params + const r = _then.apply(promise, arguments); _this.fixupAnimationPromise(r); return r; }; const _catch = promise.catch; - promise.catch = function (...args) { - const r = _catch(...args); + promise.catch = function () { + // eslint-disable-next-line prefer-rest-params + const r = _catch.apply(promise, arguments); _this.fixupAnimationPromise(r); return r; diff --git a/packages/core/ui/builder/binding-builder.ts b/packages/core/ui/builder/binding-builder.ts index 404df5682..b07613510 100644 --- a/packages/core/ui/builder/binding-builder.ts +++ b/packages/core/ui/builder/binding-builder.ts @@ -1,5 +1,5 @@ // regex that contains all symbols applicable for expression used to AI detect an expression. -const expressionSymbolsRegex = /[+-*/%?:<>=!|&()^~]/; +const expressionSymbolsRegex = /[\+\-\*\/%\?:<>=!\|&\(\)^~]/; export namespace bindingConstants { export const sourceProperty = 'sourceProperty'; diff --git a/packages/core/utils/utils-common.ts b/packages/core/utils/utils-common.ts index b453d19c9..991ae0dbb 100644 --- a/packages/core/utils/utils-common.ts +++ b/packages/core/utils/utils-common.ts @@ -11,7 +11,7 @@ export const RESOURCE_PREFIX = 'res://'; export const FILE_PREFIX = 'file:///'; export function escapeRegexSymbols(source: string): string { - const escapeRegex = /[-[]\/{}()*+?.\\^$|]/g; + const escapeRegex = /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g; return source.replace(escapeRegex, '\\$&'); } From cb61c2aa7efa3531ed6f03f7cbf750d6223f23b5 Mon Sep 17 00:00:00 2001 From: Nathanael Anderson Date: Thu, 12 Nov 2020 21:42:23 -0600 Subject: [PATCH 3/8] chore: parser issues from PR#9001, PR#9017, PR#9028 (#9030) --- packages/core/css/parser.ts | 53 +++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/packages/core/css/parser.ts b/packages/core/css/parser.ts index 1de8de2f2..98a46a633 100644 --- a/packages/core/css/parser.ts +++ b/packages/core/css/parser.ts @@ -1,4 +1,4 @@ -import { getKnownColor } from "../color/known-colors"; +import { getKnownColor } from '../color/known-colors'; export type Parsed = { start: number; end: number; value: V }; @@ -54,7 +54,7 @@ export interface BackgroundPosition { text?: string; } -const urlRegEx = /\s*url\((?:('|")([^\1]*)\1|([^)]*))\)\s*/gy; +const urlRegEx = /\s*url\((?:(['"])([^\1]*)\1|([^)]*))\)\s*/gy; export function parseURL(text: string, start = 0): Parsed { urlRegEx.lastIndex = start; const result = urlRegEx.exec(text); @@ -130,7 +130,7 @@ export function convertHSLToRGBColor(hue: number, saturation: number, lightness: const chroma = ((1 - Math.abs(2 * lightness - 1)) * saturation) / 100, X = chroma * (1 - Math.abs((hue % 2) - 1)); - // Add lightness match to all RGB components beforehand + // Add lightness match to all RGB components beforehand let { m: r, m: g, m: b } = { m: lightness - chroma / 2 }; if (0 <= hue && hue < 1) { @@ -162,12 +162,7 @@ export function convertHSLToRGBColor(hue: number, saturation: number, lightness: function hslaToArgbNumber(h: number, s: number, l: number, a = 1): number | undefined { const { r, g, b } = convertHSLToRGBColor(h, s, l); - - if (r >= 0 && r <= 255 && g >= 0 && g <= 255 && b >= 0 && b <= 255 && a >= 0 && a <= 1) { - return Math.round(a * 0xff) * 0x01000000 + r * 0x010000 + g * 0x000100 + b; - } else { - return null; - } + return rgbaToArgbNumber(r, g, b, a); } const hslColorRegEx = /\s*(hsl\(\s*([\d.]*)\s*,\s*([\d.]*)%\s*,\s*([\d.]*)%\s*\))/gy; @@ -196,15 +191,13 @@ export function parseHSLAColor(text: string, start = 0): Parsed { return { start, end, value }; } - export function parseColorKeyword(value, start: number, keyword = parseKeyword(value, start)): Parsed { const parseColor = keyword && getKnownColor(keyword.value); - if (parseColor !== undefined) { + if (parseColor != null) { const end = keyword.end; const value = parseColor; return { start, end, value }; } - return null; } @@ -212,7 +205,7 @@ export function parseColor(value: string, start = 0, keyword = parseKeyword(valu return parseHexColor(value, start) || parseColorKeyword(value, start, keyword) || parseRGBColor(value, start) || parseRGBAColor(value, start) || parseHSLColor(value, start) || parseHSLAColor(value, start); } -const keywordRegEx = /\s*([a-z][\w-]*)\s*/giy; +const keywordRegEx = /\s*([a-z][\w\-]*)\s*/giy; function parseKeyword(text: string, start = 0): Parsed { keywordRegEx.lastIndex = start; const result = keywordRegEx.exec(text); @@ -237,7 +230,7 @@ export function parseRepeat(value: string, start = 0, keyword = parseKeyword(val return null; } -const unitRegEx = /\s*([\+\-]?(?:\d+\.\d+|\d+|\.\d+)(?:[eE][\+\-]?\d+)?)([a-zA-Z]+|%)?\s*/gy; +const unitRegEx = /\s*([+\-]?(?:\d+\.\d+|\d+|\.\d+)(?:[eE][+\-]?\d+)?)([a-zA-Z]+|%)?\s*/gy; export function parseUnit(text: string, start = 0): Parsed> { unitRegEx.lastIndex = start; const result = unitRegEx.exec(text); @@ -512,7 +505,7 @@ function parseDirection(text: string, start = 0): Parsed { const openingBracketRegEx = /\s*\(\s*/gy; const closingBracketRegEx = /\s*\)\s*/gy; -const closingBracketOrCommaRegEx = /\s*(\)|,)\s*/gy; +const closingBracketOrCommaRegEx = /\s*([),])\s*/gy; function parseArgumentsList(text: string, start: number, argument: (value: string, lastIndex: number, index: number) => Parsed): Parsed[]> { openingBracketRegEx.lastIndex = start; const openingBracket = openingBracketRegEx.exec(text); @@ -541,6 +534,7 @@ function parseArgumentsList(text: string, start: number, argument: (value: st if (closingBracketOrComma) { end = closingBracketOrCommaRegEx.lastIndex; if (closingBracketOrComma[1] === ',') { + // noinspection UnnecessaryContinueJS continue; } else if (closingBracketOrComma[1] === ')') { return { start, end, value }; @@ -702,7 +696,7 @@ export interface PseudoClassSelector { type: ':'; identifier: string; } -export type AttributeSelectorTest = '=' | '^=' | '$=' | '*=' | '=' | '~=' | '|='; +export type AttributeSelectorTest = '=' | '^=' | '$=' | '*=' | '~=' | '|='; export interface AttributeSelector { type: '[]'; property: string; @@ -743,7 +737,7 @@ export function parseSimpleIdentifierSelector(text: string, start = 0): Parsed { attributeSelectorRegEx.lastIndex = start; const result = attributeSelectorRegEx.exec(text); @@ -782,7 +776,7 @@ export function parseSimpleSelectorSequence(text: string, start: number): Parsed return { start, end, value }; } -const combinatorRegEx = /\s*(\+|~|>)?\s*/gy; +const combinatorRegEx = /\s*([+~>])?\s*/gy; export function parseCombinator(text: string, start = 0): Parsed { combinatorRegEx.lastIndex = start; const result = combinatorRegEx.exec(text); @@ -818,6 +812,10 @@ export function parseSelector(text: string, start = 0): Parsed { } end = simpleSelectorSequence.end; if (combinator) { + // This logic looks weird; this `if` statement would occur on the next LOOP, so it effects the prior `pair` + // variable which is already pushed into the `value` array is going to have its `undefined` set to this + // value before the following statement creates a new `pair` memory variable. + // noinspection JSUnusedAssignment pair[1] = combinator.value; } pair = [simpleSelectorSequence.value, undefined]; @@ -944,7 +942,7 @@ interface SimpleBlock extends InputTokenObject { values: InputToken[]; } -type AtKeywordToken = InputTokenObject +type AtKeywordToken = InputTokenObject; /** * CSS parser following relatively close: @@ -1316,11 +1314,9 @@ export class CSS3Parser { */ public parseAStylesheet(): Stylesheet { this.topLevelFlag = true; - const stylesheet: Stylesheet = { + return { rules: this.consumeAListOfRules(), }; - - return stylesheet; } /** @@ -1335,7 +1331,7 @@ export class CSS3Parser { case ' ': continue; case '':{ + case '-->': { if (this.topLevelFlag) { continue; } @@ -1345,7 +1341,7 @@ export class CSS3Parser { rules.push(atRule); } continue; - } + } } if ((inputToken).type === TokenObjectType.atKeyword) { this.reconsumeTheCurrentInputToken(inputToken); @@ -1412,8 +1408,7 @@ export class CSS3Parser { let inputToken: InputToken; while ((inputToken = this.consumeAToken())) { if (inputToken === '{') { - const block = this.consumeASimpleBlock(inputToken); - qualifiedRule.block = block; + qualifiedRule.block = this.consumeASimpleBlock(inputToken); return qualifiedRule; } else if ((inputToken).type === TokenObjectType.simpleBlock) { @@ -1513,14 +1508,14 @@ export class CSS3Parser { } const nextInputToken = this.text[this.nextInputCodePointIndex]; switch (nextInputToken) { - case ')':{ + case ')': { this.nextInputCodePointIndex++; const end = this.nextInputCodePointIndex; funcToken.text = name + '(' + this.text.substring(start, end); return funcToken; } - default:{ + default: { const component = this.consumeAComponentValue(); if (component) { funcToken.components.push(component); @@ -1560,7 +1555,7 @@ export class CSSNativeScript { private parseAtRule(rule: AtRule): any { if (rule.name === 'import') { - // TODO: We have used an "@improt { url('path somewhere'); }" at few places. + // TODO: We have used an "@import { url('path somewhere'); }" at few places. return { import: rule.prelude .map((m) => (typeof m === 'string' ? m : m.text)) From cf96e7252cdf66230cc03ddec907168e47d1f250 Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Fri, 13 Nov 2020 05:51:03 +0100 Subject: [PATCH 4/8] feat(frame): add navigatingTo and navigatedTo events (#9025) --- packages/core/ui/frame/frame-common.ts | 13 +++++++++++++ packages/core/ui/frame/index.d.ts | 18 +++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/packages/core/ui/frame/frame-common.ts b/packages/core/ui/frame/frame-common.ts index af20f2b90..709b5c211 100644 --- a/packages/core/ui/frame/frame-common.ts +++ b/packages/core/ui/frame/frame-common.ts @@ -249,6 +249,12 @@ export class FrameBase extends CustomLayoutView { } newPage.onNavigatedTo(isBack); + this.notify({ + eventName: Page.navigatedToEvent, + object: this, + isBack, + entry, + }); // Reset executing context after NavigatedTo is raised; // we do not want to execute two navigations in parallel in case @@ -417,6 +423,13 @@ export class FrameBase extends CustomLayoutView { } backstackEntry.resolvedPage.onNavigatingTo(backstackEntry.entry.context, isBack, backstackEntry.entry.bindingContext); + this.notify({ + eventName: Page.navigatingToEvent, + object: this, + isBack, + entry: backstackEntry.entry, + fromEntry:this.currentEntry + }); } public get animated(): boolean { diff --git a/packages/core/ui/frame/index.d.ts b/packages/core/ui/frame/index.d.ts index 55ebe53eb..dabdcda93 100644 --- a/packages/core/ui/frame/index.d.ts +++ b/packages/core/ui/frame/index.d.ts @@ -1,11 +1,17 @@ import { NavigationType, FrameBase } from './frame-common'; -import { Page } from '../page'; +import { NavigatedData, Page } from '../page'; import { Observable, EventData } from '../../data/observable'; import { View } from '../core/view'; import { Transition } from '../transition'; export * from './frame-interfaces'; +export interface NavigationData extends EventData { + entry?: NavigationEntry; + fromEntry?: NavigationEntry; + isBack?: boolean; +} + /** * Represents the logical View unit that is responsible for navigation within an application. * Nested frames are supported, enabling hierarchical navigation scenarios. @@ -210,6 +216,16 @@ export class Frame extends FrameBase { * @param thisArg - An optional parameter which will be used as `this` context for callback execution. */ on(eventNames: string, callback: (args: EventData) => void, thisArg?: any); + + /** + * Raised when navigation to the page has started. + */ + public on(event: 'navigatingTo', callback: (args: NavigationData) => void, thisArg?: any); + + /** + * Raised when navigation to the page has finished. + */ + public on(event: 'navigatedTo', callback: (args: NavigationData) => void, thisArg?: any); } /** From 3cb35a5080e33cc030fc352c7bb73d60e69dde94 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Fri, 13 Nov 2020 10:35:03 +0100 Subject: [PATCH 5/8] ci: enable on master (still in --dry-run for testing) --- .github/workflows/npm_release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/npm_release.yml b/.github/workflows/npm_release.yml index e21f08f52..cd1baa1d8 100644 --- a/.github/workflows/npm_release.yml +++ b/.github/workflows/npm_release.yml @@ -2,7 +2,7 @@ name: Release @nativescript/core to NPM on: push: - branches: [ 'feat/monorepo' ] + branches: [ 'master' ] jobs: release: @@ -32,4 +32,4 @@ jobs: run: | echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc echo "Publishing @nativescript/core@$NPM_VERSION to NPM..." - npm publish nativescript-core-$NPM_VERSION.tgz --tag ci --dry-run + npm publish nativescript-core-$NPM_VERSION.tgz --tag next --dry-run From 548d0f78ad916ca7e5608eda27bfce8cd73fec55 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Fri, 13 Nov 2020 11:22:30 +0100 Subject: [PATCH 6/8] ci: tweak version number --- .github/workflows/npm_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/npm_release.yml b/.github/workflows/npm_release.yml index cd1baa1d8..ddc199d45 100644 --- a/.github/workflows/npm_release.yml +++ b/.github/workflows/npm_release.yml @@ -16,7 +16,7 @@ jobs: - name: Generate Version working-directory: packages/core - run: echo ::set-env name=NPM_VERSION::$(node -e "console.log(require('./package.json').version);")--$(date +"%m-%d-%Y-%s")-$GITHUB_RUN_NUMBER + run: echo ::set-env name=NPM_VERSION::$(node -e "console.log(require('./package.json').version);")-$(date +"%m-%d-%Y")-$GITHUB_RUN_ID - name: Bump Version working-directory: packages/core From a32c99b1249b2496669f47938d605c76e362c933 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Fri, 13 Nov 2020 11:55:18 +0100 Subject: [PATCH 7/8] ci: use new env syntax see https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files --- .github/workflows/npm_release.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/npm_release.yml b/.github/workflows/npm_release.yml index ddc199d45..9560bf957 100644 --- a/.github/workflows/npm_release.yml +++ b/.github/workflows/npm_release.yml @@ -16,7 +16,9 @@ jobs: - name: Generate Version working-directory: packages/core - run: echo ::set-env name=NPM_VERSION::$(node -e "console.log(require('./package.json').version);")-$(date +"%m-%d-%Y")-$GITHUB_RUN_ID + run: | + echo NPM_TAG=next >> $GITHUB_ENV + echo NPM_VERSION=$(node -e "console.log(require('./package.json').version);")-$NPM_TAG-$(date +"%m-%d-%Y")-$GITHUB_RUN_ID >> $GITHUB_ENV - name: Bump Version working-directory: packages/core @@ -31,5 +33,5 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} run: | echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc - echo "Publishing @nativescript/core@$NPM_VERSION to NPM..." - npm publish nativescript-core-$NPM_VERSION.tgz --tag next --dry-run + echo "Publishing @nativescript/core@$NPM_VERSION to NPM with tag $NPM_TAG..." + npm publish nativescript-core-$NPM_VERSION.tgz --tag $NPM_TAG --dry-run From 023be8cbf1fce409e5ab484c03b6cb38cf10a29f Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Fri, 13 Nov 2020 12:03:03 +0100 Subject: [PATCH 8/8] ci: rename workflow --- .github/workflows/npm_release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/npm_release.yml b/.github/workflows/npm_release.yml index 9560bf957..4264b4363 100644 --- a/.github/workflows/npm_release.yml +++ b/.github/workflows/npm_release.yml @@ -1,9 +1,12 @@ -name: Release @nativescript/core to NPM +name: '@nativescript/core -> npm' on: push: branches: [ 'master' ] +env: + NPM_TAG: 'next' + jobs: release: runs-on: ubuntu-latest @@ -17,7 +20,6 @@ jobs: - name: Generate Version working-directory: packages/core run: | - echo NPM_TAG=next >> $GITHUB_ENV echo NPM_VERSION=$(node -e "console.log(require('./package.json').version);")-$NPM_TAG-$(date +"%m-%d-%Y")-$GITHUB_RUN_ID >> $GITHUB_ENV - name: Bump Version