diff --git a/.gitignore b/.gitignore index 01a2cd1ad..06b16a74f 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ apps/**/*/*.map apps/**/*/platforms apps/**/*/webpack.*.js *.tgz +!tools/plugins/nps-i-1.0.3.tgz # System Files .DS_Store diff --git a/.npsrc b/.npsrc index b656150bd..12f87dc2d 100644 --- a/.npsrc +++ b/.npsrc @@ -1,4 +1,3 @@ { - "require": "ts-node/register/transpile-only", - "config": "./tools/workspace-scripts.ts" + "config": "./tools/workspace-scripts.js" } \ No newline at end of file diff --git a/README.md b/README.md index c52656619..a0b4d1726 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,14 @@ npm i npm start setup ``` +Need help? + +``` +npm run help +``` + +Browse commands with descriptions of all available workspace scripts. + # Packages * [@nativescript/angular]() diff --git a/package.json b/package.json index d0e8f6a30..2861880dd 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "version": "7.0.0-rc.29", "license": "MIT", "scripts": { - "start": "nps" + "start": "nps", + "help": "nps-i" }, "private": true, "dependencies": { @@ -40,6 +41,7 @@ "nativescript": "rc", "node-sass": "~4.14.1", "nps": "^5.10.0", + "nps-i": "file:tools/plugins/nps-i-1.0.3.tgz", "nps-utils": "^1.7.0", "parse-css": "git+https://github.com/tabatkins/parse-css.git", "parserlib": "^1.1.1", diff --git a/packages/core/css/css-tree-parser.ts b/packages/core/css/css-tree-parser.ts index e3c63bbf1..25b5661c1 100644 --- a/packages/core/css/css-tree-parser.ts +++ b/packages/core/css/css-tree-parser.ts @@ -1,5 +1,4 @@ -import { parse as parseType } from 'css-tree'; -const parse: typeof parseType = require('css-tree'); +import { parse } from 'css-tree'; function mapSelectors(selector: string): string[] { if (!selector) { diff --git a/packages/core/xml/index.js b/packages/core/xml/index.js index acf9f8162..d8fdb947f 100644 --- a/packages/core/xml/index.js +++ b/packages/core/xml/index.js @@ -1,6 +1,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.XmlParser = exports.ParserEvent = exports.ParserEventType = void 0; -var easysax = require("../js-libs/easysax"); +var easysax = require('../js-libs/easysax'); +var easysax_1 = require("../js-libs/easysax"); var ParserEventType = (function () { function ParserEventType() { } @@ -413,7 +414,7 @@ function _HandleAmpEntities(found, decimalValue, hexValue, wordValue) { var XmlParser = (function () { function XmlParser(onEvent, onError, processNamespaces) { this._processNamespaces = processNamespaces; - this._parser = new easysax.EasySAXParser(); + this._parser = new easysax_1.EasySAXParser(); var that = this; this._parser.on('startNode', function (elem, attr, uq, tagend, str, pos) { var attributes = attr(); diff --git a/tools/plugins/nps-i-1.0.3.tgz b/tools/plugins/nps-i-1.0.3.tgz new file mode 100644 index 000000000..ee3838e14 Binary files /dev/null and b/tools/plugins/nps-i-1.0.3.tgz differ diff --git a/tools/workspace-scripts.js b/tools/workspace-scripts.js new file mode 100644 index 000000000..d97078d65 --- /dev/null +++ b/tools/workspace-scripts.js @@ -0,0 +1,111 @@ +const npsUtils = require('nps-utils'); + +module.exports = { + scripts: { + default: 'nps', + nx: { + script: 'nx', + description: 'Execute any command with the @nrwl/cli' + }, + format: { + script: 'nx format:write', + description: 'Format the source code of the entire workspace (auto-run on precommit hook)' + }, + setup: { + script: 'npx rimraf -- hooks node_modules package-lock.json && npm i && ts-patch install && nx run core:setup', + description: 'Setup the workspace for development' + }, + // app testing targets + apps: { + // Automated test runner which executes unit tests on the target platform + automated: { + clean: { + script: 'nx run apps-automated:clean', + description: 'Clean apps/automated' + }, + ios: { + script: 'nx run apps-automated:ios', + description: 'Run apps/automated on iOS' + }, + android: { + script: 'nx run apps-automated:android', + description: 'Run apps/automated on Android' + }, + }, + // Playground useful for livesyncing changes and experimenting + playground: { + clean: { + script: 'nx run apps-playground:clean', + description: 'Clean apps/playground' + }, + ios: { + script: 'nx run apps-playground:ios', + description: 'Run apps/playground on iOS' + }, + android: { + script: 'nx run apps-playground:android', + description: 'Run apps/playground on Android' + }, + }, + // Various UI level setups for @nativescript/core testing + ui: { + clean: { + script: 'nx run apps-ui:clean', + description: 'Clean apps/ui' + }, + ios: { + script: 'nx run apps-ui:ios', + description: 'Run apps/ui on iOS' + }, + android: { + script: 'nx run apps-ui:android', + description: 'Run apps/ui on Android' + }, + }, + }, + // packages + // build output is always in dist/packages + packages: { + // @nativescript/core + core: { + build: { + script: 'nx run core:build.npm', + description: '@nativescript/core: Build for npm' + }, + test: { + script: 'nx run core:unit', + description: '@nativescript/core: Unit tests', + watch: { + script: 'nx run core:unit.watch', + description: '@nativescript/core: Unit tests with watcher' + }, + }, + }, + // tns-core-modules (old historic compatibility) + 'core-compat': { + build: { + script: 'nx run core-compat:build', + description: 'tns-core-modules: (Compatibility package) Build for npm' + }, + }, + // @nativescript/ui-mobile-base + 'ui-mobile-base': { + build: { + script: 'nx run ui-mobile-base:build', + description: '@nativescript/ui-mobile-base: Build for npm' + }, + }, + // @nativescript/webpack + webpack: { + build: { + script: 'nx run webpack:build', + description: '@nativescript/webpack: Build for npm' + }, + test: { + script: 'nx run webpack:test', + description: '@nativescript/webpack: Unit tests' + }, + }, + }, + }, +}; diff --git a/tools/workspace-scripts.ts b/tools/workspace-scripts.ts deleted file mode 100644 index 2314e7ff6..000000000 --- a/tools/workspace-scripts.ts +++ /dev/null @@ -1,66 +0,0 @@ -const npsUtils = require('nps-utils'); - -module.exports = { - scripts: { - default: 'nps', - // execute any command with the @nrwl/cli - nx: 'nx', - // format the entire workspace - format: 'nx format:write', - // setup the workspace for development - setup: 'npx rimraf -- hooks node_modules package-lock.json && npm i && ts-patch install && nx run core:setup', - // app testing targets - apps: { - // Automated test runner which executes unit tests on the target platform - automated: { - clean: 'nx run apps-automated:clean', - ios: 'nx run apps-automated:ios', - android: 'nx run apps-automated:android', - }, - // Playground useful for livesyncing changes and experimenting - playground: { - clean: 'nx run apps-playground:clean', - ios: 'nx run apps-playground:ios', - android: 'nx run apps-playground:android', - }, - // Various UI level setups for @nativescript/core testing - ui: { - clean: 'nx run apps-ui:clean', - ios: 'nx run apps-ui:ios', - android: 'nx run apps-ui:android', - }, - }, - // packages - // build output is always in dist/packages - packages: { - // @nativescript/core - core: { - // build for npm - build: 'nx run core:build.npm', - test: { - // unit tests - script: 'nx run core:unit', - watch: { - // unit tests with watcher - script: 'nx run core:unit.watch', - }, - }, - }, - // tns-core-modules (old historic compatibility) - 'core-compat': { - // build for npm - build: 'nx run core-compat:build', - }, - // @nativescript/ui-mobile-base - 'ui-mobile-base': { - // build for npm - build: 'nx run ui-mobile-base:build', - }, - // @nativescript/webpack - webpack: { - build: 'nx run webpack:build', - test: 'nx run webpack:test', - }, - }, - }, -};