From 1007cf9d92a9e013cf707dbb52d17e98f3310ebc Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Wed, 19 Aug 2020 21:34:23 -0700 Subject: [PATCH] feat(focus): interactive options for focus handling --- README.md | 66 +------------------ package.json | 3 +- packages/angular/README.md | 1 - packages/core/package.json | 2 +- packages/webpack/package.json | 2 +- .../webpack/plugins/PlatformFSPlugin.d.ts | 52 +++++++-------- .../plugins/WatchStateLoggerPlugin.d.ts | 10 +-- .../transformers/ns-support-hmr-ng.d.ts | 2 +- packages/webpack/utils/ast-utils.d.ts | 7 +- .../webpack/utils/transformers-utils.d.ts | 9 +-- tools/workspace-scripts.js | 28 +++++++- 11 files changed, 71 insertions(+), 111 deletions(-) delete mode 100644 packages/angular/README.md diff --git a/README.md b/README.md index 74d630027..84943aa7a 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,10 @@ $ npm run setup $ npm start ``` -Browse commands with descriptions of all available workspace scripts. - # Packages -* [@nativescript/angular]() - * [How to contribute]() * [@nativescript/core]() + * Core iOS/Android for NativeScript * [How to contribute]() * [@nativescript/types]() * Types for both iOS/Android below wrapped up as a convenience. *Most commonly used.* @@ -28,65 +25,8 @@ Browse commands with descriptions of all available workspace scripts. * [@nativescript/types-android]() * Types for Android * [@nativescript/ui-mobile-base]() - * Base level native ui classes + * UI mobile base native classes used by core * [How to contribute]() * [@nativescript/webpack]() + * Webpack build utilities and configs used by NativeScript apps * [How to contribute]() - -## @nativescript/core - -```bash -# livesync develop changes -$ npm start apps.playground.ios -$ npm start apps.playground.android -# -# unit tests -$ npm start packages.core.test -$ npm start packages.core.test.watch -# -# build for npm (output: 'dist/packages/core') -$ npm start packages.core.build -``` - -There are additional targets you can test changes against: - -```bash -# variety of manual ui testing -$ npm start apps.ui.ios -$ npm start apps.ui.android -$ npm start apps.ui.clean -# -# used in CI automated tests but you can run these manually as well to check if you caused any regressions -$ npm start apps.automated.ios -$ npm start apps.automated.android -$ npm start apps.automated.clean -``` - -#### Compatibility package for old style tns-core-modules - -Old imports from `tns-core-modules/*` - -```bash -$ npm start packages.core-compat.build -``` - -## @nativescript/ui-mobile-base - -Base native classes for ui components. -Included with @nativescript/core right now as direct dependency but also published separately for others to build on top of if desired. - -If you would like to make changes to source just build when ready to test your changes (you can then clean any testing target to try your changes) - -```bash -$ npm start packages.ui-mobile-base.build -``` - -## @nativescript/webpack - -```bash -# To try any webpack changes, just build and then clean targets to try -$ npm start packages.webpack.build -# -# unit tests -$ npm start packages.webpack.test -``` diff --git a/package.json b/package.json index 6f0bc515a..99971ade4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nativescript", - "version": "7.0.0-rc.51", + "version": "7.0.0-rc.52", "license": "MIT", "scripts": { "setup": "npx rimraf -- hooks node_modules package-lock.json && npm i && ts-patch install && nx run core:setup", @@ -17,6 +17,7 @@ "@nrwl/node": "~10.0.7", "@nrwl/nx-cloud": "~10.0.0", "@nrwl/workspace": "~10.0.7", + "@nstudio/focus": "~10.0.0", "@types/chai": "^4.2.11", "@types/jest": "~26.0.4", "@types/mocha": "^7.0.2", diff --git a/packages/angular/README.md b/packages/angular/README.md deleted file mode 100644 index f55adc113..000000000 --- a/packages/angular/README.md +++ /dev/null @@ -1 +0,0 @@ -Angular 11 rewrite in progress here. \ No newline at end of file diff --git a/packages/core/package.json b/packages/core/package.json index 40893a063..f41649ce1 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -3,7 +3,7 @@ "main": "index", "types": "index.d.ts", "description": "NativeScript Core Modules", - "version": "7.0.0-rc.51", + "version": "7.0.0-rc.52", "homepage": "https://nativescript.org", "repository": { "type": "git", diff --git a/packages/webpack/package.json b/packages/webpack/package.json index e6eb3f0a7..7584c179c 100644 --- a/packages/webpack/package.json +++ b/packages/webpack/package.json @@ -29,7 +29,7 @@ "url": "https://github.com/NativeScript/nativescript-dev-webpack.git" }, "scripts": { - "clean": "npx rimraf -- node_modules package-lock.json && npm i", + "clean": "npx rimraf -- node_modules package-lock.json && npm i --ignore-scripts", "tsc": "tsc", "postinstall": "node postinstall.js", "preuninstall": "node preuninstall.js", diff --git a/packages/webpack/plugins/PlatformFSPlugin.d.ts b/packages/webpack/plugins/PlatformFSPlugin.d.ts index e46940dd0..3f20af06b 100644 --- a/packages/webpack/plugins/PlatformFSPlugin.d.ts +++ b/packages/webpack/plugins/PlatformFSPlugin.d.ts @@ -1,33 +1,33 @@ export interface PlatformFSPluginOptions { - /** - * The target platform. - */ - platform?: string; - /** - * A list of all platforms. By default it is `["ios", "android", "desktop"]`. - */ - platforms?: string[]; - /** - * An array of minimatch expressions used to filter nodes from the file system. - */ - ignore?: string[]; + /** + * The target platform. + */ + platform?: string; + /** + * A list of all platforms. By default it is `["ios", "android", "desktop"]`. + */ + platforms?: string[]; + /** + * An array of minimatch expressions used to filter nodes from the file system. + */ + ignore?: string[]; } export declare class PlatformFSPlugin { - protected readonly platform: string; - protected readonly platforms: ReadonlyArray; - protected readonly ignore: ReadonlyArray; - protected context: string; - constructor({ platform, platforms, ignore }: PlatformFSPluginOptions); - apply(compiler: any): void; + protected readonly platform: string; + protected readonly platforms: ReadonlyArray; + protected readonly ignore: ReadonlyArray; + protected context: string; + constructor({ platform, platforms, ignore }: PlatformFSPluginOptions); + apply(compiler: any): void; } export interface MapFileSystemArgs { - /** - * This is the underlying webpack compiler.inputFileSystem, its interface is similar to Node's fs. - */ - readonly context: string; - readonly platform: string; - readonly platforms: ReadonlyArray; - readonly ignore: ReadonlyArray; - readonly compiler: any; + /** + * This is the underlying webpack compiler.inputFileSystem, its interface is similar to Node's fs. + */ + readonly context: string; + readonly platform: string; + readonly platforms: ReadonlyArray; + readonly ignore: ReadonlyArray; + readonly compiler: any; } export declare function mapFileSystem(args: MapFileSystemArgs): any; diff --git a/packages/webpack/plugins/WatchStateLoggerPlugin.d.ts b/packages/webpack/plugins/WatchStateLoggerPlugin.d.ts index 731169c77..23342c148 100644 --- a/packages/webpack/plugins/WatchStateLoggerPlugin.d.ts +++ b/packages/webpack/plugins/WatchStateLoggerPlugin.d.ts @@ -1,13 +1,13 @@ export declare enum messages { - compilationComplete = 'Webpack compilation complete.', - startWatching = 'Webpack compilation complete. Watching for file changes.', - changeDetected = 'File change detected. Starting incremental webpack compilation...', + compilationComplete = "Webpack compilation complete.", + startWatching = "Webpack compilation complete. Watching for file changes.", + changeDetected = "File change detected. Starting incremental webpack compilation..." } /** * This little plugin will report the webpack state through the console. * So the {N} CLI can get some idea when compilation completes. */ export declare class WatchStateLoggerPlugin { - isRunningWatching: boolean; - apply(compiler: any): void; + isRunningWatching: boolean; + apply(compiler: any): void; } diff --git a/packages/webpack/transformers/ns-support-hmr-ng.d.ts b/packages/webpack/transformers/ns-support-hmr-ng.d.ts index cb9256595..9170a93c6 100644 --- a/packages/webpack/transformers/ns-support-hmr-ng.d.ts +++ b/packages/webpack/transformers/ns-support-hmr-ng.d.ts @@ -3,6 +3,6 @@ import { TransformOperation } from '@ngtools/webpack/src/transformers'; import { AngularCompilerPlugin } from '@ngtools/webpack'; export declare function nsSupportHmrNg(getNgCompiler: () => AngularCompilerPlugin, entryPath: string): ts.TransformerFactory; export declare function handleHmrSupport(mainFile: ts.SourceFile): TransformOperation[]; -export declare const GeneratedDynamicAppOptions = 'options_Generated'; +export declare const GeneratedDynamicAppOptions = "options_Generated"; export declare function getHmrOptionsCode(appModuleName: string, appModulePath: string): string; export declare function getAcceptMainModuleCode(mainModulePath: string): string; diff --git a/packages/webpack/utils/ast-utils.d.ts b/packages/webpack/utils/ast-utils.d.ts index 5519c139d..660aa21d5 100644 --- a/packages/webpack/utils/ast-utils.d.ts +++ b/packages/webpack/utils/ast-utils.d.ts @@ -11,10 +11,7 @@ export declare function getAppModulePath(mainPath: string): string; export declare function findIdentifierNode(node: ts.Node, text: string): ts.Node | null; export declare function getObjectPropertyMatches(objectNode: ts.ObjectLiteralExpression, sourceFile: ts.SourceFile, targetPropertyName: string): ts.ObjectLiteralElement[]; export declare function getDecoratorMetadata(source: ts.SourceFile, identifier: string, module: string): ts.Node[]; -export declare function angularImportsFromNode( - node: ts.ImportDeclaration, - _sourceFile: ts.SourceFile -): { - [name: string]: string; +export declare function angularImportsFromNode(node: ts.ImportDeclaration, _sourceFile: ts.SourceFile): { + [name: string]: string; }; export declare function getExpressionName(expression: ts.Expression): string; diff --git a/packages/webpack/utils/transformers-utils.d.ts b/packages/webpack/utils/transformers-utils.d.ts index 4c9349d5b..0383d4d05 100644 --- a/packages/webpack/utils/transformers-utils.d.ts +++ b/packages/webpack/utils/transformers-utils.d.ts @@ -1,8 +1,5 @@ import { AngularCompilerPlugin } from '@ngtools/webpack'; -export declare function getResolvedEntryModule( - ngCompiler: AngularCompilerPlugin, - projectDir: string -): { - path: any; - className: string; +export declare function getResolvedEntryModule(ngCompiler: AngularCompilerPlugin, projectDir: string): { + path: any; + className: string; }; diff --git a/tools/workspace-scripts.js b/tools/workspace-scripts.js index bae73cf3b..66de2b24d 100644 --- a/tools/workspace-scripts.js +++ b/tools/workspace-scripts.js @@ -2,7 +2,7 @@ const npsUtils = require('nps-utils'); module.exports = { message: 'NativeScript ~ made with ❤️ Choose a command to start...', - pageSize: 25, + pageSize: 32, scripts: { default: 'nps-i', nx: { @@ -125,6 +125,32 @@ module.exports = { }, }, }, + "⚡": { + script: `npx cowsay "Focus on segments of monorepo for efficiency ⚡"`, + description: '_____________ Focus on source (VS Code supported) _____________' + }, + 'focus': { + core: { + script: 'nx g @nstudio/focus:mode core', + description: 'Focus on @nativescript/core' + }, + types: { + script: 'nx g @nstudio/focus:mode types-android,types-ios', + description: 'Focus on @nativescript/types' + }, + 'ui-mobile-base': { + script: 'nx g @nstudio/focus:mode ui-mobile-base', + description: 'Focus on @nativescript/ui-mobile-base' + }, + webpack: { + script: 'nx g @nstudio/focus:mode webpack', + description: 'Focus on @nativescript/webpack' + }, + reset: { + script: 'nx g @nstudio/focus:mode', + description: 'Reset Focus' + } + }, ".....................": { script: `npx cowsay "That's all for now folks ~"`, description: '.....................'