From 2df765116c51774abbb7039e7bd52ad93af9416f Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 5 Apr 2020 15:36:36 +0000 Subject: [PATCH 01/65] Update dependency jasmine-node to v3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 99db5a8c..ace8a291 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "@types/jasmine": "3.5.10", "@types/node": "11.15.9", "jasmine": "3.5.0", - "jasmine-node": "1.16.2", + "jasmine-node": "3.0.0", "ts-node": "8.8.2", "typescript": "3.8.3" }, From aff7ebf9f1f2789e8e008b6d0ccaa3d70d95ba78 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 8 Apr 2020 19:21:58 +0000 Subject: [PATCH 02/65] Update dependency @types/node to v11.15.10 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 388d0c8e..979798fe 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "license": "MIT", "devDependencies": { "@types/jasmine": "3.5.10", - "@types/node": "11.15.9", + "@types/node": "11.15.10", "jasmine": "3.5.0", "jasmine-node": "1.16.2", "ts-node": "8.8.2", From 5f12c5d9171f4584dc80b719941556a4e9ff0490 Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Thu, 16 Apr 2020 13:48:10 +0530 Subject: [PATCH 03/65] add githun workflow --- .github/workflows/nodejs.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/nodejs.yml diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml new file mode 100644 index 00000000..9b8ed442 --- /dev/null +++ b/.github/workflows/nodejs.yml @@ -0,0 +1,30 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Node.js CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + - run: npm run build + env: + CI: true From ce3623835290503535ee774536ec1b5dccb4d7f9 Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Thu, 16 Apr 2020 13:51:25 +0530 Subject: [PATCH 04/65] create workflow file --- .github/workflows/nodejs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 9b8ed442..61c790fc 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -24,7 +24,7 @@ jobs: uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - - run: npm ci + - run: npm install - run: npm run build env: CI: true From 4cb09491ed2ede0c65f3f4bbdb091cc53cd8991d Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Thu, 16 Apr 2020 14:17:55 +0530 Subject: [PATCH 05/65] add npm version badge --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ebb3f609..0093ba28 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![npm version](https://badge.fury.io/js/%40ngx-builders%2Fanalyze.svg)](https://badge.fury.io/js/%40ngx-builders%2Fanalyze) + # Builder To Run Source Map Explorer [![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-) @@ -60,4 +62,4 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d -This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! \ No newline at end of file +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! From 172ad3b028d940660ba07d4ac9866667be5ecb30 Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Thu, 16 Apr 2020 14:24:31 +0530 Subject: [PATCH 06/65] add build status badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0093ba28..56db107f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![npm version](https://badge.fury.io/js/%40ngx-builders%2Fanalyze.svg)](https://badge.fury.io/js/%40ngx-builders%2Fanalyze) - +![Node.js CI](https://github.com/ngx-builders/source-map-analyzer/workflows/Node.js%20CI/badge.svg?branch=master) # Builder To Run Source Map Explorer [![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-) From ecb653de3080ff92dc90b4dc42180978d44f3256 Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Thu, 16 Apr 2020 14:28:00 +0530 Subject: [PATCH 07/65] add npm download badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 56db107f..95a7933e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ [![npm version](https://badge.fury.io/js/%40ngx-builders%2Fanalyze.svg)](https://badge.fury.io/js/%40ngx-builders%2Fanalyze) ![Node.js CI](https://github.com/ngx-builders/source-map-analyzer/workflows/Node.js%20CI/badge.svg?branch=master) +![npm downloads](https://img.shields.io/npm/dt/@ngx-builders/analyze?label=npm%20downloads)](https://www.npmjs.com/package/@ngx-builders/analyze) + # Builder To Run Source Map Explorer [![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-) From 3cd7c5bef543394395899ac10255067120d7fded Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Thu, 16 Apr 2020 14:29:27 +0530 Subject: [PATCH 08/65] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 95a7933e..ac1072db 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![npm version](https://badge.fury.io/js/%40ngx-builders%2Fanalyze.svg)](https://badge.fury.io/js/%40ngx-builders%2Fanalyze) ![Node.js CI](https://github.com/ngx-builders/source-map-analyzer/workflows/Node.js%20CI/badge.svg?branch=master) -![npm downloads](https://img.shields.io/npm/dt/@ngx-builders/analyze?label=npm%20downloads)](https://www.npmjs.com/package/@ngx-builders/analyze) +[![npm downloads](https://img.shields.io/npm/dt/@ngx-builders/analyze?label=npm%20downloads)](https://www.npmjs.com/package/@ngx-builders/analyze) # Builder To Run Source Map Explorer From 2dc9c29b04b899be105e291382bd7a0d74c3c55e Mon Sep 17 00:00:00 2001 From: Tobias Wittwer Date: Fri, 17 Apr 2020 10:35:56 +0200 Subject: [PATCH 09/65] Fix typo in source-map-explorer package --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ac1072db..761f2452 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,10 @@ This builder does it for you with zero configuration. ng add @ngx-builders/analyze ``` -NOTE: For this version you need to install source-map-explore globally using +NOTE: For this version you need to install source-map-explorer globally using ``` -npm i source-map-explore -g +npm i source-map-explorer -g ``` We will remove this dependecny in future updates. From 822d8b5c7efc7c0e5bc8e819c26e582c4e5914a2 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 17 Apr 2020 09:07:03 +0000 Subject: [PATCH 10/65] docs: update README.md [skip ci] --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 761f2452..585986e5 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ # Builder To Run Source Map Explorer -[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-) Want to run the source-map-explorer with Angular? @@ -57,6 +57,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d +

Ankit

📖

Tobias Wittwer

📖
From 3d56228f561f3a4b5b0b52a0498318fdb46e8f05 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 17 Apr 2020 09:07:04 +0000 Subject: [PATCH 11/65] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 9bb87baf..b7153d80 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -13,6 +13,15 @@ "contributions": [ "doc" ] + }, + { + "login": "twittwer", + "name": "Tobias Wittwer", + "avatar_url": "https://avatars1.githubusercontent.com/u/8677948?v=4", + "profile": "https://github.com/twittwer", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, From 2bf2592133b7ab024701807066712cc516b06e10 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 17 Apr 2020 21:23:57 +0000 Subject: [PATCH 12/65] chore(deps): update dependency @types/node to v11.15.11 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 461fff2d..f667adef 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "license": "MIT", "devDependencies": { "@types/jasmine": "3.5.10", - "@types/node": "11.15.10", + "@types/node": "11.15.11", "jasmine": "3.5.0", "jasmine-node": "3.0.0", "ts-node": "8.8.2", From dcb409166bb8df11c71ac2b95d004dc57ad623f5 Mon Sep 17 00:00:00 2001 From: AnkitSharma-007 Date: Sun, 19 Apr 2020 23:15:39 +0530 Subject: [PATCH 13/65] Added the option to select the bundle to analyze --- analyze/index.ts | 31 +++++++++++++++++++++++++------ package.json | 1 + 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/analyze/index.ts b/analyze/index.ts index 57acb5e2..b5123e4e 100644 --- a/analyze/index.ts +++ b/analyze/index.ts @@ -4,6 +4,7 @@ import { Schema } from './schema'; import util from 'util'; import { exec } from 'child_process'; import fs from 'fs'; +import inquirer from 'inquirer'; export const execAsync = util.promisify(exec); @@ -17,10 +18,9 @@ export default createBuilder( const overrides = { // this is an example how to override the workspace set of options - ...({ sourceMap: true }) + ...({ sourceMap: true }) }; - const build = await context.scheduleTarget({ target: 'build', project: context?.target?.project || '', @@ -30,12 +30,31 @@ export default createBuilder( const result = await build.result; if (result.success) { - const file = fs.readdirSync(builderConfig.outputPath).filter(f => f.includes('main-es2015')); - const mainFile = file.find(f => f.endsWith('.js')); - console.log(mainFile); + const file = fs.readdirSync(builderConfig.outputPath).filter(f => f.includes('es2015')); + const filesToRemove = file.filter(f => f.includes('polyfills') || f.includes('runtime')); + let filesToShow = file.filter(f => !filesToRemove.includes(f) && f.endsWith('.js')); - const explorerCommand = `source-map-explorer ${builderConfig.outputPath}/${mainFile}`; + let mainFile = filesToShow[0]; + let promptAvailableBundles; + + if (filesToShow.length > 1) { + promptAvailableBundles = await inquirer + .prompt([ + { + type: 'list', + name: 'bundleName', + message: 'Select the bundle to run the analyzer?', + choices: filesToShow, + }, + ]) + .catch(error => { + context.logger.info(error); + }); + mainFile = promptAvailableBundles.bundleName; + } + + const explorerCommand = `source-map-explorer ${builderConfig.outputPath}/${mainFile}`; const { stdout, stderr } = await execAsync(explorerCommand); context.logger.info(stdout); context.logger.info(stderr); diff --git a/package.json b/package.json index 461fff2d..39220c9b 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "dependencies": { "@angular-devkit/architect": "^0.901.0", "@angular-devkit/core": "^9.1.0", + "inquirer": "^7.1.0", "schematics-utilities": "^2.0.1" } } From f2de52b4c1f50e9f7ac92fc4cdc76d0a6bd47b6d Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 20 Apr 2020 20:35:39 +0000 Subject: [PATCH 14/65] chore(deps): update dependency ts-node to v8.9.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f667adef..8242727e 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "@types/node": "11.15.11", "jasmine": "3.5.0", "jasmine-node": "3.0.0", - "ts-node": "8.8.2", + "ts-node": "8.9.0", "typescript": "3.8.3" }, "dependencies": { From 415b620fae6abb4485b6a4d2de0905dfa543bf3f Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Tue, 21 Apr 2020 23:58:59 +0530 Subject: [PATCH 15/65] fix: changes to ng add --- ng-add/index.ts | 33 +-------------------------------- package.json | 3 +++ 2 files changed, 4 insertions(+), 32 deletions(-) diff --git a/ng-add/index.ts b/ng-add/index.ts index 089f2377..20d7fa50 100644 --- a/ng-add/index.ts +++ b/ng-add/index.ts @@ -1,25 +1,7 @@ import { Rule, SchematicContext, SchematicsException, Tree, chain } from '@angular-devkit/schematics'; import { experimental, JsonParseMode, parseJson } from '@angular-devkit/core'; -import { addPackageJsonDependency, NodeDependency, NodeDependencyType } from 'schematics-utilities'; import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks'; -function addPackageJsonDependencies(): Rule { - return (host: Tree, context: SchematicContext) => { - - // always add the package under dev dependencies - const dependencies: NodeDependency[] = [ - { type: NodeDependencyType.Dev, version: '~0.0.0', name: '@ngx-builders/analyze' } - ]; - - dependencies.forEach(dependency => { - addPackageJsonDependency(host, dependency); - context.logger.log('info', `✅️ Added "${dependency.name}" into ${dependency.type}`); - }); - - return host; - }; -} - function getWorkspace(host: Tree): { path: string; workspace: experimental.workspace.WorkspaceSchema } { const possibleFiles = ['/angular.json', './angular.json']; const path = possibleFiles.find(path => host.exists(path)); @@ -107,19 +89,6 @@ export function sourceMapBuilder(options: NgAddOptions): Rule { }; } -export function installPackageJsonDependencies(): Rule { - return (host: Tree, context: SchematicContext) => { - context.addTask(new NodePackageInstallTask()); - context.logger.log('info', `🔍 Installing packages...`); - - return host; - }; - } - export default function (options: NgAddOptions): Rule { - return chain([ - sourceMapBuilder(options), - addPackageJsonDependencies(), - installPackageJsonDependencies() - ]); + return sourceMapBuilder(options) } diff --git a/package.json b/package.json index 461fff2d..dfa5992e 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,9 @@ "main": "index.js", "builders": "./builders.json", "schematics": "./collection.json", + "ng-add": { + "save": "devDependencies" + }, "scripts": { "build": "tsc", "test": "ts-node node_modules/jasmine/bin/jasmine command/index_spec.ts" From 3fdeda2e1c712d4a398ed845f677d37e440c5ead Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Wed, 22 Apr 2020 00:06:32 +0530 Subject: [PATCH 16/65] update version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dfa5992e..95637575 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ngx-builders/analyze", - "version": "0.0.6", + "version": "0.0.8", "description": "", "main": "index.js", "builders": "./builders.json", From 3d43d49cf82ee05318bfc5c8b8e479bc431f9c13 Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Wed, 22 Apr 2020 00:10:14 +0530 Subject: [PATCH 17/65] fix: code smells --- ng-add/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ng-add/index.ts b/ng-add/index.ts index 20d7fa50..0db8b805 100644 --- a/ng-add/index.ts +++ b/ng-add/index.ts @@ -1,6 +1,5 @@ -import { Rule, SchematicContext, SchematicsException, Tree, chain } from '@angular-devkit/schematics'; +import { Rule, SchematicContext, SchematicsException, Tree } from '@angular-devkit/schematics'; import { experimental, JsonParseMode, parseJson } from '@angular-devkit/core'; -import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks'; function getWorkspace(host: Tree): { path: string; workspace: experimental.workspace.WorkspaceSchema } { const possibleFiles = ['/angular.json', './angular.json']; From 5a60e40afaa608b58f9f0d555affe039c6cc648f Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 22 Apr 2020 02:31:55 +0000 Subject: [PATCH 18/65] chore(deps): update dependency @types/node to v11.15.12 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 13a781ba..0d110142 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "license": "MIT", "devDependencies": { "@types/jasmine": "3.5.10", - "@types/node": "11.15.11", + "@types/node": "11.15.12", "jasmine": "3.5.0", "jasmine-node": "3.0.0", "ts-node": "8.9.0", From 7310268b8c4816869fc57d583c8ab167d1793f9e Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 26 Apr 2020 05:54:19 +0000 Subject: [PATCH 19/65] chore(deps): update dependency ts-node to v8.9.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0d110142..7df33c82 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@types/node": "11.15.12", "jasmine": "3.5.0", "jasmine-node": "3.0.0", - "ts-node": "8.9.0", + "ts-node": "8.9.1", "typescript": "3.8.3" }, "dependencies": { From 5505cce9fc2df69139094af2190e1231fbdfa9d4 Mon Sep 17 00:00:00 2001 From: Bhavik Date: Sat, 2 May 2020 14:39:11 -0400 Subject: [PATCH 20/65] feat:use npx to run source-map-explorer --- README.md | 5 +---- analyze/index.ts | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 585986e5..f2034c2a 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,8 @@ This builder does it for you with zero configuration. ng add @ngx-builders/analyze ``` -NOTE: For this version you need to install source-map-explorer globally using +NOTE: This version uses npx to install source-map-explorer temporarily if it isn't installed already. If you don't have npx installed, please install it. -``` -npm i source-map-explorer -g -``` We will remove this dependecny in future updates. diff --git a/analyze/index.ts b/analyze/index.ts index b5123e4e..4593a07f 100644 --- a/analyze/index.ts +++ b/analyze/index.ts @@ -54,7 +54,7 @@ export default createBuilder( mainFile = promptAvailableBundles.bundleName; } - const explorerCommand = `source-map-explorer ${builderConfig.outputPath}/${mainFile}`; + const explorerCommand = `npx source-map-explorer ${builderConfig.outputPath}/${mainFile}`; const { stdout, stderr } = await execAsync(explorerCommand); context.logger.info(stdout); context.logger.info(stderr); From 6f5ca1f8ab081087006806d1701aee734b7007f0 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 12 May 2020 22:25:15 +0000 Subject: [PATCH 21/65] chore(deps): update dependency typescript to v3.9.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7df33c82..7f251d5f 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "jasmine": "3.5.0", "jasmine-node": "3.0.0", "ts-node": "8.9.1", - "typescript": "3.8.3" + "typescript": "3.9.2" }, "dependencies": { "@angular-devkit/architect": "^0.901.0", From 576447d233fe80094e3ef0f4f645e552a3d43470 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 15 May 2020 22:40:01 +0000 Subject: [PATCH 22/65] Update dependency ts-node to v8.10.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7f251d5f..ea85f223 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@types/node": "11.15.12", "jasmine": "3.5.0", "jasmine-node": "3.0.0", - "ts-node": "8.9.1", + "ts-node": "8.10.1", "typescript": "3.9.2" }, "dependencies": { From 51d9b1fd7c689858eecd186aa6bbf0b641f8b559 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 15 May 2020 22:43:28 +0000 Subject: [PATCH 23/65] docs: update README.md [skip ci] --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f2034c2a..55bc0183 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ # Builder To Run Source Map Explorer -[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-) Want to run the source-map-explorer with Angular? @@ -55,6 +55,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Ankit

📖
Tobias Wittwer

📖 +
Bhavik

💻 From dec5e5d64454735af6bdf1b5a03e73fbe1004a0a Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 15 May 2020 22:43:30 +0000 Subject: [PATCH 24/65] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index b7153d80..73b9319e 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -22,6 +22,15 @@ "contributions": [ "doc" ] + }, + { + "login": "BhavikCpatel", + "name": "Bhavik", + "avatar_url": "https://avatars3.githubusercontent.com/u/8742935?v=4", + "profile": "https://github.com/BhavikCpatel", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, From abb9e2d2a40437cd74194e8a61fbf285f93098bd Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Sat, 16 May 2020 04:30:47 +0530 Subject: [PATCH 25/65] updated and release 1.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ea85f223..f5007e59 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ngx-builders/analyze", - "version": "0.0.8", + "version": "1.0.0", "description": "", "main": "index.js", "builders": "./builders.json", From c6a7d15908c88cb6bcb004e14dc353f3f61bd8be Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 28 May 2020 17:15:58 +0000 Subject: [PATCH 26/65] Update dependency ts-node to v8.10.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f5007e59..d854fc81 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@types/node": "11.15.12", "jasmine": "3.5.0", "jasmine-node": "3.0.0", - "ts-node": "8.10.1", + "ts-node": "8.10.2", "typescript": "3.9.2" }, "dependencies": { From 6b27d0d75621b1734d12a36a836425dc679019b8 Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Fri, 3 Jul 2020 21:52:41 +0530 Subject: [PATCH 27/65] feat: analyse all bundles fixes #41 --- analyze/index.ts | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/analyze/index.ts b/analyze/index.ts index 4593a07f..8eac9913 100644 --- a/analyze/index.ts +++ b/analyze/index.ts @@ -30,30 +30,7 @@ export default createBuilder( const result = await build.result; if (result.success) { - const file = fs.readdirSync(builderConfig.outputPath).filter(f => f.includes('es2015')); - const filesToRemove = file.filter(f => f.includes('polyfills') || f.includes('runtime')); - let filesToShow = file.filter(f => !filesToRemove.includes(f) && f.endsWith('.js')); - - let mainFile = filesToShow[0]; - let promptAvailableBundles; - - if (filesToShow.length > 1) { - promptAvailableBundles = await inquirer - .prompt([ - { - type: 'list', - name: 'bundleName', - message: 'Select the bundle to run the analyzer?', - choices: filesToShow, - }, - ]) - .catch(error => { - context.logger.info(error); - }); - - mainFile = promptAvailableBundles.bundleName; - } - + const mainFile = '*es2015.*.js'; const explorerCommand = `npx source-map-explorer ${builderConfig.outputPath}/${mainFile}`; const { stdout, stderr } = await execAsync(explorerCommand); context.logger.info(stdout); From 7a8b626ac8298afa1b345f6e107c340088e400fc Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Fri, 3 Jul 2020 23:20:38 +0530 Subject: [PATCH 28/65] feat: support gzip option --- README.md | 10 +++------- analyze/index.ts | 11 ++++++----- analyze/schema.d.ts | 2 +- analyze/schema.json | 2 +- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 55bc0183..01dfc928 100644 --- a/README.md +++ b/README.md @@ -29,16 +29,12 @@ Now whenever you want to analyze your angular project just run a command `ng run ## 📦 Options -#### --configuration -#### --no-build +#### --gzip - **optional** -- Default: `false` (string) +- Default: `false` (boolean) - Example: - - `ng run [YOUR_PROJECT_NAME]:analyze --no-build` – Angular project is NOT built - -Skip build process during analysis. -This can be used when you are sure that you haven't changed anything and want to analyze the bundle + - `ng run [YOUR_PROJECT_NAME]:analyze --gzip` – Give the stats of gzip bundle. # License [MIT](https://github.com/ngx-builders/source-map-analyzer/blob/master/LICENSE) diff --git a/analyze/index.ts b/analyze/index.ts index 8eac9913..27a2f6b2 100644 --- a/analyze/index.ts +++ b/analyze/index.ts @@ -3,22 +3,20 @@ import { json } from '@angular-devkit/core'; import { Schema } from './schema'; import util from 'util'; import { exec } from 'child_process'; -import fs from 'fs'; -import inquirer from 'inquirer'; export const execAsync = util.promisify(exec); export default createBuilder( async (builderConfig: Schema, context: BuilderContext): Promise => { try { - context.reportStatus(`Executing "${builderConfig.noBuild}"...`); + context.reportStatus(`Starting Build`); // const child = childProcess.spawn(options.command, options.args, { stdio: 'pipe' }); const configuration = 'production'; const overrides = { // this is an example how to override the workspace set of options - ...({ sourceMap: true }) + ...({ sourceMap: true, budgets: [] }) }; const build = await context.scheduleTarget({ @@ -31,7 +29,10 @@ export default createBuilder( if (result.success) { const mainFile = '*es2015.*.js'; - const explorerCommand = `npx source-map-explorer ${builderConfig.outputPath}/${mainFile}`; + let explorerCommand = `npx source-map-explorer ${builderConfig.outputPath}/${mainFile}`; + if (builderConfig.gzip) { + explorerCommand = `${explorerCommand} --gzip`; + } const { stdout, stderr } = await execAsync(explorerCommand); context.logger.info(stdout); context.logger.info(stderr); diff --git a/analyze/schema.d.ts b/analyze/schema.d.ts index 569367f5..038b01c8 100644 --- a/analyze/schema.d.ts +++ b/analyze/schema.d.ts @@ -1,4 +1,4 @@ export interface Schema { - noBuild?: boolean; outputPath: string; + gzip?: boolean; } \ No newline at end of file diff --git a/analyze/schema.json b/analyze/schema.json index 8709c383..50e98933 100644 --- a/analyze/schema.json +++ b/analyze/schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/schema", "type": "object", "properties": { - "noBuild": { + "gzip": { "type": "boolean" }, "outputPath": { From 59aef1ca8732748545177b8381f3f20fcf581d9a Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Fri, 3 Jul 2020 23:30:00 +0530 Subject: [PATCH 29/65] release 1.1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f5007e59..9429e3f2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ngx-builders/analyze", - "version": "1.0.0", + "version": "1.1.0", "description": "", "main": "index.js", "builders": "./builders.json", From 7b398fb0073908d811a8af760d65c210994f2bb6 Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Sat, 4 Jul 2020 00:08:09 +0530 Subject: [PATCH 30/65] feat: support angular 10 --- analyze/index.ts | 2 +- analyze/schema.d.ts | 1 + analyze/schema.json | 4 ++++ package.json | 5 ++--- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/analyze/index.ts b/analyze/index.ts index 27a2f6b2..283ab84b 100644 --- a/analyze/index.ts +++ b/analyze/index.ts @@ -28,7 +28,7 @@ export default createBuilder( const result = await build.result; if (result.success) { - const mainFile = '*es2015.*.js'; + const mainFile = builderConfig.diffLoading ? '*es2015.*.js' : '*.js'; let explorerCommand = `npx source-map-explorer ${builderConfig.outputPath}/${mainFile}`; if (builderConfig.gzip) { explorerCommand = `${explorerCommand} --gzip`; diff --git a/analyze/schema.d.ts b/analyze/schema.d.ts index 038b01c8..2951c6fe 100644 --- a/analyze/schema.d.ts +++ b/analyze/schema.d.ts @@ -1,4 +1,5 @@ export interface Schema { outputPath: string; gzip?: boolean; + diffLoading?:boolean; } \ No newline at end of file diff --git a/analyze/schema.json b/analyze/schema.json index 50e98933..bb696252 100644 --- a/analyze/schema.json +++ b/analyze/schema.json @@ -7,6 +7,10 @@ }, "outputPath": { "type": "string" + }, + "diffLoading": { + "type":"boolean", + "default": true } } } diff --git a/package.json b/package.json index 9429e3f2..f12656ae 100644 --- a/package.json +++ b/package.json @@ -38,9 +38,8 @@ "typescript": "3.9.2" }, "dependencies": { - "@angular-devkit/architect": "^0.901.0", - "@angular-devkit/core": "^9.1.0", - "inquirer": "^7.1.0", + "@angular-devkit/architect": "0.1000.1", + "@angular-devkit/core": "10.0.1", "schematics-utilities": "^2.0.1" } } From 78fd844c30402cec4d8df5433574fbb549f228c7 Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Sat, 4 Jul 2020 00:11:47 +0530 Subject: [PATCH 31/65] update docs --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 01dfc928..b2352660 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,13 @@ Now whenever you want to analyze your angular project just run a command `ng run - Example: - `ng run [YOUR_PROJECT_NAME]:analyze --gzip` – Give the stats of gzip bundle. + +#### --diffLoading +- **optional** +- Default: `true` (boolean) +- Example: + - `ng run [YOUR_PROJECT_NAME]:analyze --diffLoading=false` – A new Angular 10 project will have differential loading set to false, but if you upgrade from previous version and have differential loading enabled it will remain the same. This flag is for backward compatibilily. You can skip this option is differential loading is enabled. + # License [MIT](https://github.com/ngx-builders/source-map-analyzer/blob/master/LICENSE) From 30319c4a1cc8e6955df6594498c547d567e8e6c0 Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Sat, 4 Jul 2020 00:15:25 +0530 Subject: [PATCH 32/65] release 2.0.0 --- README.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b2352660..3262df90 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Now whenever you want to analyze your angular project just run a command `ng run - **optional** - Default: `true` (boolean) - Example: - - `ng run [YOUR_PROJECT_NAME]:analyze --diffLoading=false` – A new Angular 10 project will have differential loading set to false, but if you upgrade from previous version and have differential loading enabled it will remain the same. This flag is for backward compatibilily. You can skip this option is differential loading is enabled. + - `ng run [YOUR_PROJECT_NAME]:analyze --diffLoading=false` – A new Angular 10 project will have differential loading set to false, but if you upgrade from previous version and have differential loading enabled it will remain the same. This flag is for backward compatibilily. You can skip this option if differential loading is enabled. # License [MIT](https://github.com/ngx-builders/source-map-analyzer/blob/master/LICENSE) diff --git a/package.json b/package.json index f12656ae..ae4da7b6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ngx-builders/analyze", - "version": "1.1.0", + "version": "2.0.0", "description": "", "main": "index.js", "builders": "./builders.json", From 13402f66f56d3cba31015cccc4c0c695124bdbfa Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 24 Jul 2020 23:41:35 +0000 Subject: [PATCH 33/65] Update dependency jasmine to v3.6.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ae4da7b6..b84144f6 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "devDependencies": { "@types/jasmine": "3.5.10", "@types/node": "11.15.12", - "jasmine": "3.5.0", + "jasmine": "3.6.1", "jasmine-node": "3.0.0", "ts-node": "8.10.1", "typescript": "3.9.2" From 79b60fa33577d2c5b0494917d22c23f16343851e Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 31 Jul 2020 20:32:08 +0000 Subject: [PATCH 34/65] Update angularcli monorepo --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ae4da7b6..c6879d46 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,8 @@ "typescript": "3.9.2" }, "dependencies": { - "@angular-devkit/architect": "0.1000.1", - "@angular-devkit/core": "10.0.1", + "@angular-devkit/architect": "0.1000.5", + "@angular-devkit/core": "10.0.5", "schematics-utilities": "^2.0.1" } } From ed48868b0f1b69344fd7e642299c45b04b9ad147 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 13 Aug 2020 07:17:15 +0000 Subject: [PATCH 35/65] Update dependency @types/node to v11.15.20 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 29c613e3..791e4990 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "license": "MIT", "devDependencies": { "@types/jasmine": "3.5.10", - "@types/node": "11.15.12", + "@types/node": "11.15.20", "jasmine": "3.6.1", "jasmine-node": "3.0.0", "ts-node": "8.10.1", From 41366451ef08c89360088c000775a63414e27e09 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 13 Aug 2020 08:07:24 +0000 Subject: [PATCH 36/65] Update dependency typescript to v3.9.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fb50b4f8..1446d198 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "jasmine": "3.6.1", "jasmine-node": "3.0.0", "ts-node": "8.10.2", - "typescript": "3.9.2" + "typescript": "3.9.7" }, "dependencies": { "@angular-devkit/architect": "0.1000.5", From 1e4366df071d1f740390160f7a0e57071f7cea31 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 13 Aug 2020 08:48:47 +0000 Subject: [PATCH 37/65] Update dependency @types/jasmine to v3.5.12 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f1800690..fba0a627 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "author": "Santosh Yadav ", "license": "MIT", "devDependencies": { - "@types/jasmine": "3.5.10", + "@types/jasmine": "3.5.12", "@types/node": "11.15.20", "jasmine": "3.6.1", "jasmine-node": "3.0.0", From ef5750f00074a17d68f24c02b4fd652aa5071f16 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 29 Oct 2020 04:57:02 +0000 Subject: [PATCH 38/65] Update angularcli monorepo --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index fba0a627..80e2a40b 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,8 @@ "typescript": "3.9.7" }, "dependencies": { - "@angular-devkit/architect": "0.1000.5", - "@angular-devkit/core": "10.0.5", + "@angular-devkit/architect": "0.1002.0", + "@angular-devkit/core": "10.2.0", "schematics-utilities": "^2.0.1" } } From 10de92c037c6e1848b576448347746c300943797 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 29 Oct 2020 04:57:28 +0000 Subject: [PATCH 39/65] Update dependency typescript to v4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fba0a627..9d5343ea 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "jasmine": "3.6.1", "jasmine-node": "3.0.0", "ts-node": "8.10.2", - "typescript": "3.9.7" + "typescript": "4.0.5" }, "dependencies": { "@angular-devkit/architect": "0.1000.5", From da35dcd6946282a2ebdccdd01d9351a44114f73b Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Sat, 7 Nov 2020 17:02:57 +0530 Subject: [PATCH 40/65] feat-provided project option for build --- README.md | 2 ++ ng-add/schema.json | 22 +++++++++++++++------- tsconfig.json | 4 ++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3262df90..9938fc0e 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ This builder does it for you with zero configuration. ``` ng add @ngx-builders/analyze +OR +ng add @ngx-builders/analyze --project={projectName} ``` NOTE: This version uses npx to install source-map-explorer temporarily if it isn't installed already. If you don't have npx installed, please install it. diff --git a/ng-add/schema.json b/ng-add/schema.json index f5483723..7cea44a6 100644 --- a/ng-add/schema.json +++ b/ng-add/schema.json @@ -1,8 +1,16 @@ { - "$schema": "http://json-schema.org/schema", - "id": "source-map-explore", - "title": "Builder to analyze using source-map-explorer", - "type": "object", - "properties": {}, - "required": [] -} \ No newline at end of file + "$schema": "http://json-schema.org/schema", + "id": "source-map-explore", + "title": "Builder to analyze using source-map-explorer", + "type": "object", + "properties": { + "project": { + "type": "string", + "description": "The name of the project.", + "$default": { + "$source": "projectName" + } + } + }, + "required": [] +} diff --git a/tsconfig.json b/tsconfig.json index dfd20e9e..5ad4561f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,9 +16,9 @@ "forceConsistentCasingInFileNames": true, "strictPropertyInitialization": false, "strictNullChecks": true, - "sourceMap": true, + "sourceMap": false, "declaration": false, - "inlineSources": true, + "inlineSources": false, "stripInternal": true, "skipLibCheck": true, "noImplicitAny": false, From c99d3fd274109ff2bda762e92dd014d48891f168 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 7 Nov 2020 11:38:52 +0000 Subject: [PATCH 41/65] Update dependency @types/jasmine to v3.6.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9d5343ea..7b4a2d7e 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "author": "Santosh Yadav ", "license": "MIT", "devDependencies": { - "@types/jasmine": "3.5.12", + "@types/jasmine": "3.6.1", "@types/node": "11.15.20", "jasmine": "3.6.1", "jasmine-node": "3.0.0", From 7e473b7c6543187c248fdabc8f8e522ff518ac1f Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 7 Nov 2020 11:38:59 +0000 Subject: [PATCH 42/65] Update dependency jasmine to v3.6.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9d5343ea..5d9904c6 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "devDependencies": { "@types/jasmine": "3.5.12", "@types/node": "11.15.20", - "jasmine": "3.6.1", + "jasmine": "3.6.3", "jasmine-node": "3.0.0", "ts-node": "8.10.2", "typescript": "4.0.5" From 53b5fb27cdb2e9f938db8051798ff1296012b6c3 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 7 Nov 2020 11:39:18 +0000 Subject: [PATCH 43/65] Update dependency ts-node to v9 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e23efc61..67a471ba 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@types/node": "11.15.20", "jasmine": "3.6.1", "jasmine-node": "3.0.0", - "ts-node": "8.10.2", + "ts-node": "9.0.0", "typescript": "4.0.5" }, "dependencies": { From cf2f854c89c1dcebd45f914befb324354f618872 Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Sat, 7 Nov 2020 17:16:23 +0530 Subject: [PATCH 44/65] release 2.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 91b2817a..5479f82c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ngx-builders/analyze", - "version": "2.0.0", + "version": "2.1.0", "description": "", "main": "index.js", "builders": "./builders.json", From 643f21c3dd6c8473c3e95a351bed0958c8388901 Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Thu, 12 Nov 2020 22:50:42 +0530 Subject: [PATCH 45/65] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9938fc0e..79364502 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +![source-map-analyzer](https://socialify.git.ci/ngx-builders/source-map-analyzer/image?font=Raleway&forks=1&issues=1&language=1&owner=1&pattern=Charlie%20Brown&pulls=1&stargazers=1&theme=Dark) + [![npm version](https://badge.fury.io/js/%40ngx-builders%2Fanalyze.svg)](https://badge.fury.io/js/%40ngx-builders%2Fanalyze) ![Node.js CI](https://github.com/ngx-builders/source-map-analyzer/workflows/Node.js%20CI/badge.svg?branch=master) [![npm downloads](https://img.shields.io/npm/dt/@ngx-builders/analyze?label=npm%20downloads)](https://www.npmjs.com/package/@ngx-builders/analyze) From bc8b2e07eb60b8505e70db2696fdaa712dc14359 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 26 Apr 2021 17:07:39 +0000 Subject: [PATCH 46/65] Update dependency typescript to v4.2.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5479f82c..72aa206f 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "jasmine": "3.6.3", "jasmine-node": "3.0.0", "ts-node": "9.0.0", - "typescript": "4.0.5" + "typescript": "4.2.4" }, "dependencies": { "@angular-devkit/architect": "0.1002.0", From 07cacd70498bf979dcfbcea87722dfd630875453 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 15 May 2021 21:14:06 +0000 Subject: [PATCH 47/65] Update dependency @types/jasmine to v3.7.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5479f82c..e982f882 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "author": "Santosh Yadav ", "license": "MIT", "devDependencies": { - "@types/jasmine": "3.6.1", + "@types/jasmine": "3.7.4", "@types/node": "11.15.20", "jasmine": "3.6.3", "jasmine-node": "3.0.0", From b65c477e5d93ecc4034151390b99773671b71f79 Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Sun, 23 May 2021 21:32:38 +0530 Subject: [PATCH 48/65] use node 14 --- .github/workflows/nodejs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 61c790fc..7665c68e 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: - node-version: [12.x] + node-version: [14.x] steps: - uses: actions/checkout@v2 From 40e7ecfd953051f2300e1881268d5bf63bb08e79 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 23 May 2021 16:04:18 +0000 Subject: [PATCH 49/65] Update dependency ts-node to v9.1.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e81edf3d..531901fe 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@types/node": "11.15.20", "jasmine": "3.6.3", "jasmine-node": "3.0.0", - "ts-node": "9.0.0", + "ts-node": "9.1.1", "typescript": "4.2.4" }, "dependencies": { From 30b336929df081c7b3550e63c84ba43ad9d0ad84 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 23 May 2021 16:04:25 +0000 Subject: [PATCH 50/65] Update dependency @types/node to v14 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e81edf3d..4f877108 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "license": "MIT", "devDependencies": { "@types/jasmine": "3.7.4", - "@types/node": "11.15.20", + "@types/node": "14.17.0", "jasmine": "3.6.3", "jasmine-node": "3.0.0", "ts-node": "9.0.0", From aa5d1c019e46a3997e13b3aff0d6ba96b298522c Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 23 May 2021 16:09:52 +0000 Subject: [PATCH 51/65] Update dependency jasmine to v3.7.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c439654e..f86defd9 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "devDependencies": { "@types/jasmine": "3.7.4", "@types/node": "14.17.0", - "jasmine": "3.6.3", + "jasmine": "3.7.0", "jasmine-node": "3.0.0", "ts-node": "9.1.1", "typescript": "4.2.4" From d1ec1cea3efdbb38b519855d5e9ab8e09df95336 Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Sun, 23 May 2021 21:46:33 +0530 Subject: [PATCH 52/65] update package --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f86defd9..d2893ee1 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,6 @@ "dependencies": { "@angular-devkit/architect": "0.1002.0", "@angular-devkit/core": "10.2.0", - "schematics-utilities": "^2.0.1" + "schematics-utilities": "2.0.3" } } From 97580c7a3e828028460cc7c23190af9ef8c90a9b Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Sun, 23 May 2021 21:48:16 +0530 Subject: [PATCH 53/65] release 2.2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f86defd9..fa897d18 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ngx-builders/analyze", - "version": "2.1.0", + "version": "2.2.0", "description": "", "main": "index.js", "builders": "./builders.json", From b28ed3a939810fa7bf2ffdfc12608b9f2c23a68d Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Sun, 23 May 2021 21:49:59 +0530 Subject: [PATCH 54/65] release 2.3.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b5427984..6634634a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ngx-builders/analyze", - "version": "2.2.0", + "version": "2.3.0", "description": "", "main": "index.js", "builders": "./builders.json", From 0bf242ec357b1cb1cec81be769c21cd645ba0369 Mon Sep 17 00:00:00 2001 From: vimal patel Date: Mon, 18 Oct 2021 22:00:22 +0530 Subject: [PATCH 55/65] added github action to publish package to npm (#74) * added github action to publish package to npm --- .github/workflows/npm-publish.yml | 53 +++++++++++++++++++++++++++++++ package.json | 5 ++- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/npm-publish.yml diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 00000000..afae8464 --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,53 @@ +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages + +name: Node.js Package + +on: + push: + branches: + - 'releases/**' + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 12 + - run: npm ci + + publish-npm: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 12 + registry-url: https://registry.npmjs.org/ + scope: '@ngx-builders' + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} + + publish-gpr: + needs: build + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 12 + registry-url: https://npm.pkg.github.com/ + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.GIT_PKG_TOKEN}} diff --git a/package.json b/package.json index 6634634a..cc708618 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ngx-builders/analyze", - "version": "2.3.0", + "version": "2.3.1", "description": "", "main": "index.js", "builders": "./builders.json", @@ -16,6 +16,9 @@ "type": "git", "url": "git+https://github.com/ngx-builders/source-map-analyzer.git" }, + "publishConfig": { + "access": "public" + }, "keywords": [ "angular", "schematics", From 4a8570ededfda8128f89ece4c9435605991b4552 Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Mon, 18 Oct 2021 22:05:45 +0530 Subject: [PATCH 56/65] Update npm-publish.yml (#78) --- .github/workflows/npm-publish.yml | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index afae8464..78082d62 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/setup-node@v2 with: node-version: 12 - - run: npm ci + - run: npm i publish-npm: needs: build @@ -30,24 +30,7 @@ jobs: node-version: 12 registry-url: https://registry.npmjs.org/ scope: '@ngx-builders' - - run: npm ci + - run: npm i - run: npm publish env: NODE_AUTH_TOKEN: ${{secrets.npm_token}} - - publish-gpr: - needs: build - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: 12 - registry-url: https://npm.pkg.github.com/ - - run: npm ci - - run: npm publish - env: - NODE_AUTH_TOKEN: ${{secrets.GIT_PKG_TOKEN}} From b78cc5a1607eb16c9e0a180191453d5289b9adab Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Thu, 4 Nov 2021 12:59:41 +0530 Subject: [PATCH 57/65] update packag.json (#81) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cc708618..25a7958d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ngx-builders/analyze", - "version": "2.3.1", + "version": "2.3.2", "description": "", "main": "index.js", "builders": "./builders.json", From f8f14133783fde813c00675711e885c52d3440f1 Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Thu, 4 Nov 2021 13:41:45 +0530 Subject: [PATCH 58/65] build before publish (#82) * fix build and publish * change diffloading flag --- .github/workflows/npm-publish.yml | 1 + README.md | 4 ++-- analyze/schema.json | 2 +- package.json | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 78082d62..2e59ca22 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -31,6 +31,7 @@ jobs: registry-url: https://registry.npmjs.org/ scope: '@ngx-builders' - run: npm i + - run: npm run build - run: npm publish env: NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/README.md b/README.md index 79364502..60399cdb 100644 --- a/README.md +++ b/README.md @@ -43,9 +43,9 @@ Now whenever you want to analyze your angular project just run a command `ng run #### --diffLoading - **optional** -- Default: `true` (boolean) +- Default: `false` (boolean) - Example: - - `ng run [YOUR_PROJECT_NAME]:analyze --diffLoading=false` – A new Angular 10 project will have differential loading set to false, but if you upgrade from previous version and have differential loading enabled it will remain the same. This flag is for backward compatibilily. You can skip this option if differential loading is enabled. + - `ng run [YOUR_PROJECT_NAME]:analyze --diffLoading=true` – You can change to true if differential loading is enabled. # License [MIT](https://github.com/ngx-builders/source-map-analyzer/blob/master/LICENSE) diff --git a/analyze/schema.json b/analyze/schema.json index bb696252..341496e3 100644 --- a/analyze/schema.json +++ b/analyze/schema.json @@ -10,7 +10,7 @@ }, "diffLoading": { "type":"boolean", - "default": true + "default": false } } } diff --git a/package.json b/package.json index 25a7958d..083e21a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ngx-builders/analyze", - "version": "2.3.2", + "version": "2.3.3", "description": "", "main": "index.js", "builders": "./builders.json", From 7765a9ecbbd52c7e2a5f7cfc21198cab4a18e543 Mon Sep 17 00:00:00 2001 From: vimal patel Date: Sun, 5 Dec 2021 22:13:03 +0530 Subject: [PATCH 59/65] feat: angular 13 migration #83 (#84) Updated to Angular 13 --- .github/workflows/npm-publish.yml | 2 +- .npmignore | 0 analyze/index.ts | 2 +- analyze/schema.json | 1 + ng-add/index.ts | 46 ++++++------------------------- ng-add/schema.json | 2 +- ng-add/schema.ts | 5 ++++ package.json | 18 ++++++------ 8 files changed, 27 insertions(+), 49 deletions(-) create mode 100644 .npmignore create mode 100644 ng-add/schema.ts diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 2e59ca22..316b59a3 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -6,7 +6,7 @@ name: Node.js Package on: push: branches: - - 'releases/**' + - 'release/**' release: types: [created] diff --git a/.npmignore b/.npmignore new file mode 100644 index 00000000..e69de29b diff --git a/analyze/index.ts b/analyze/index.ts index 283ab84b..3d651ca9 100644 --- a/analyze/index.ts +++ b/analyze/index.ts @@ -43,7 +43,7 @@ export default createBuilder( success: true }; } - catch (e) { + catch (e:any) { return { error: e.message, success: true diff --git a/analyze/schema.json b/analyze/schema.json index 341496e3..f7c4f77e 100644 --- a/analyze/schema.json +++ b/analyze/schema.json @@ -1,5 +1,6 @@ { "$schema": "http://json-schema.org/schema", + "$id": "source-map-analyze", "type": "object", "properties": { "gzip": { diff --git a/ng-add/index.ts b/ng-add/index.ts index 0db8b805..1a1cc03c 100644 --- a/ng-add/index.ts +++ b/ng-add/index.ts @@ -1,46 +1,18 @@ import { Rule, SchematicContext, SchematicsException, Tree } from '@angular-devkit/schematics'; -import { experimental, JsonParseMode, parseJson } from '@angular-devkit/core'; +import { getWorkspace, getWorkspacePath, ProjectType, WorkspaceProject } from 'schematics-utilities'; +import { NgAddOptions } from './schema'; -function getWorkspace(host: Tree): { path: string; workspace: experimental.workspace.WorkspaceSchema } { - const possibleFiles = ['/angular.json', './angular.json']; - const path = possibleFiles.find(path => host.exists(path)); - - if (!path) { - throw new SchematicsException(`Could not find angular.json`); - } - - const configBuffer = host.read(path); - if (!configBuffer) { - throw new SchematicsException(`Could not find angular.json`); - } - - const content = configBuffer.toString(); - let workspace: experimental.workspace.WorkspaceSchema; - - try { - workspace = parseJson(content, JsonParseMode.Loose) as experimental.workspace.WorkspaceSchema; - } catch (e) { - throw new SchematicsException(`Could not parse angular.json: ${e.message}`); - } - - return { path, workspace }; -} - -interface NgAddOptions { - project?: string; - siteID: string; - netlifyToken: string; -} export function sourceMapBuilder(options: NgAddOptions): Rule { return (tree: Tree, _context: SchematicContext) => { // get the workspace details - const { path: workspacePath, workspace } = getWorkspace(tree); + const workspaceSchema = getWorkspace(tree); + const workspacePath: string = getWorkspacePath(tree); // getting project name if (!options.project) { - if (workspace.defaultProject) { - options.project = workspace.defaultProject; + if (workspaceSchema && workspaceSchema.defaultProject) { + options.project = workspaceSchema.defaultProject; } else { throw new SchematicsException( 'No Angular project selected and no default project in the workspace' @@ -49,7 +21,7 @@ export function sourceMapBuilder(options: NgAddOptions): Rule { } // Validating project name - const project = workspace.projects[options.project]; + const project: WorkspaceProject = workspaceSchema.projects[options.project]; if (!project) { throw new SchematicsException( 'The specified Angular project is not defined in this workspace' @@ -59,7 +31,7 @@ export function sourceMapBuilder(options: NgAddOptions): Rule { // Checking if it is application if (project.projectType !== 'application') { throw new SchematicsException( - `Deploy requires an Angular project type of "application" in angular.json` + `source-map-analyzer requires an Angular project type of "application" in angular.json` ); } @@ -83,7 +55,7 @@ export function sourceMapBuilder(options: NgAddOptions): Rule { } } - tree.overwrite(workspacePath, JSON.stringify(workspace, null, 2)); + tree.overwrite(workspacePath, JSON.stringify(workspaceSchema, null, 2)); return tree; }; } diff --git a/ng-add/schema.json b/ng-add/schema.json index 7cea44a6..c6f421f0 100644 --- a/ng-add/schema.json +++ b/ng-add/schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/schema", - "id": "source-map-explore", + "$id": "source-map-explore", "title": "Builder to analyze using source-map-explorer", "type": "object", "properties": { diff --git a/ng-add/schema.ts b/ng-add/schema.ts new file mode 100644 index 00000000..5f9af5a8 --- /dev/null +++ b/ng-add/schema.ts @@ -0,0 +1,5 @@ +export interface NgAddOptions { + project: string | undefined; + siteID: string; + netlifyToken: string; +} diff --git a/package.json b/package.json index 083e21a3..5dbd743c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ngx-builders/analyze", - "version": "2.3.3", + "version": "3.0.0", "description": "", "main": "index.js", "builders": "./builders.json", @@ -10,7 +10,7 @@ }, "scripts": { "build": "tsc", - "test": "ts-node node_modules/jasmine/bin/jasmine command/index_spec.ts" + "test": "ts-node node_modules/jasmine/bin/jasmine analyze/index_spec.ts" }, "repository": { "type": "git", @@ -33,16 +33,16 @@ "author": "Santosh Yadav ", "license": "MIT", "devDependencies": { - "@types/jasmine": "3.7.4", - "@types/node": "14.17.0", - "jasmine": "3.7.0", + "@types/jasmine": "3.10.2", + "@types/node": "16.11.11", + "jasmine": "3.10.0", "jasmine-node": "3.0.0", - "ts-node": "9.1.1", - "typescript": "4.2.4" + "ts-node": "10.4.0", + "typescript": "~4.5.2" }, "dependencies": { - "@angular-devkit/architect": "0.1002.0", - "@angular-devkit/core": "10.2.0", + "@angular-devkit/architect": "0.1300.0", + "@angular-devkit/core": "13.0.0", "schematics-utilities": "2.0.3" } } From 5b42fae56e31b8dbb070657bc31eab3fd50df32e Mon Sep 17 00:00:00 2001 From: vimal patel Date: Fri, 10 Dec 2021 20:27:07 +0530 Subject: [PATCH 60/65] chore: update github action to publish package (#86) updated github action so that whenever we create a new release then only it will be triggered and publish the package to npm --- .github/workflows/npm-publish.yml | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 316b59a3..a4dee5c4 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -1,27 +1,14 @@ # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages -name: Node.js Package +name: Publish Package on: - push: - branches: - - 'release/**' release: - types: [created] + types: [published] jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: 12 - - run: npm i - publish-npm: - needs: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From 4dff6e6da71c6d43004f1bb92b0f054a366e57d7 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 5 Jan 2022 22:28:12 +0530 Subject: [PATCH 61/65] docs: add patelvimal as a contributor for code (#90) Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 12 +++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 73b9319e..54dd9cd9 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -31,6 +31,15 @@ "contributions": [ "code" ] + }, + { + "login": "patelvimal", + "name": "vimal patel", + "avatar_url": "https://avatars.githubusercontent.com/u/6451223?v=4", + "profile": "http://patelvimal.github.io/", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 60399cdb..9a9f842d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ # Builder To Run Source Map Explorer -[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-) Want to run the source-map-explorer with Angular? @@ -60,14 +60,16 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d - - - + + + +

Ankit

📖

Tobias Wittwer

📖

Bhavik

💻

Ankit

📖

Tobias Wittwer

📖

Bhavik

💻

vimal patel

💻
- + + This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! From b4459810892cd7da286ceacc286800225527db50 Mon Sep 17 00:00:00 2001 From: vimal patel Date: Thu, 6 Jan 2022 11:51:48 +0530 Subject: [PATCH 62/65] feat: removed "schematics-utilities" package and dependent code (#91) * chore: update github action to publish package updated github action so that whenever we create a new release then only it will be triggered and publish the package to npm * feat: removed "schematics-utilities" package and dependent code and replaced it with native workspace methods --- collection.json | 2 +- ng-add/index.ts | 64 ++++++++++++++++++--------------------------- ng-add/schema.ts | 2 -- ng-add/workspace.ts | 64 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 6 ++--- 5 files changed, 93 insertions(+), 45 deletions(-) create mode 100644 ng-add/workspace.ts diff --git a/collection.json b/collection.json index 6e413a26..399f2435 100644 --- a/collection.json +++ b/collection.json @@ -3,7 +3,7 @@ "schematics": { "ng-add": { "description": "Builder to analyze package using source-map-explorer", - "factory": "./ng-add/index", + "factory": "./ng-add/index#ngAdd", "schema": "./ng-add/schema.json", "aliases": [ "install" diff --git a/ng-add/index.ts b/ng-add/index.ts index 1a1cc03c..d0f0f0a5 100644 --- a/ng-add/index.ts +++ b/ng-add/index.ts @@ -1,18 +1,17 @@ -import { Rule, SchematicContext, SchematicsException, Tree } from '@angular-devkit/schematics'; -import { getWorkspace, getWorkspacePath, ProjectType, WorkspaceProject } from 'schematics-utilities'; +import { TargetDefinition } from '@angular-devkit/core/src/workspace'; +import { chain, Rule, SchematicsException, Tree } from '@angular-devkit/schematics'; import { NgAddOptions } from './schema'; +import { getWorkspace, updateWorkspace } from './workspace'; -export function sourceMapBuilder(options: NgAddOptions): Rule { - return (tree: Tree, _context: SchematicContext) => { - // get the workspace details - const workspaceSchema = getWorkspace(tree); - const workspacePath: string = getWorkspacePath(tree); +export function ngAdd(options: NgAddOptions): Rule { + return async (host: Tree) => { + const workspace = await getWorkspace(host); - // getting project name + // Get project name if (!options.project) { - if (workspaceSchema && workspaceSchema.defaultProject) { - options.project = workspaceSchema.defaultProject; + if (workspace.extensions.defaultProject) { + options.project = workspace.extensions.defaultProject as string; } else { throw new SchematicsException( 'No Angular project selected and no default project in the workspace' @@ -21,45 +20,32 @@ export function sourceMapBuilder(options: NgAddOptions): Rule { } // Validating project name - const project: WorkspaceProject = workspaceSchema.projects[options.project]; + const project = workspace.projects.get(options.project); if (!project) { - throw new SchematicsException( - 'The specified Angular project is not defined in this workspace' - ); + throw new SchematicsException(`The specified Angular project is not defined in this workspace`); } // Checking if it is application - if (project.projectType !== 'application') { - throw new SchematicsException( - `source-map-analyzer requires an Angular project type of "application" in angular.json` - ); + if (project.extensions['projectType'] !== 'application') { + throw new SchematicsException(`source-map-analyzer requires an Angular project type of "application" in angular.json`); } + + const outputPath: string | undefined = project.targets.get('build')?.options?.outputPath as string; - // Getting output path from Angular.json - if ( - !project.architect || - !project.architect.build || - !project.architect.build.options || - !project.architect.build.options.outputPath - ) { - throw new SchematicsException( - `Cannot read the output path(architect.build.options.outputPath) of the Angular project "${options.project}" in angular.json` - ); + if (!outputPath) { + const message: string = `Cannot read the output path(architect.build.options.outputPath) of the Angular project "${options.project}" in angular.json`; + throw new SchematicsException(message); } - // adding deploy statement for builder - project.architect['analyze'] = { - "builder": "@ngx-builders/analyze:analyze", - "options": { - "outputPath": project.architect.build.options.outputPath + var targetDefinition: TargetDefinition = { + builder: "@ngx-builders/analyze:analyze", + options: { + outputPath: outputPath } } - tree.overwrite(workspacePath, JSON.stringify(workspaceSchema, null, 2)); - return tree; - }; -} + project.targets.add({ name: 'analyze', ...targetDefinition }); -export default function (options: NgAddOptions): Rule { - return sourceMapBuilder(options) + return chain([updateWorkspace(workspace)]); + }; } diff --git a/ng-add/schema.ts b/ng-add/schema.ts index 5f9af5a8..b597c694 100644 --- a/ng-add/schema.ts +++ b/ng-add/schema.ts @@ -1,5 +1,3 @@ export interface NgAddOptions { project: string | undefined; - siteID: string; - netlifyToken: string; } diff --git a/ng-add/workspace.ts b/ng-add/workspace.ts new file mode 100644 index 00000000..4c972690 --- /dev/null +++ b/ng-add/workspace.ts @@ -0,0 +1,64 @@ +import { virtualFs, workspaces } from '@angular-devkit/core'; +import { noop, Rule, SchematicsException, Tree } from '@angular-devkit/schematics'; + +/* Below code reference is taken from Angular CLI project. + https://github.com/angular/angular-cli/blob/master/packages/schematics/angular/utility/workspace.ts + + These methods are not part of public APIs so we should not be referencing those methods. + that's why added below method here. +*/ + +function createHost(tree: Tree): workspaces.WorkspaceHost { + return { + async readFile(path: string): Promise { + const data = tree.read(path); + if (!data) { + throw new SchematicsException('File not found.'); + } + return virtualFs.fileBufferToString(data); + }, + async writeFile(path: string, data: string): Promise { + return tree.overwrite(path, data); + }, + async isDirectory(path: string): Promise { + return !tree.exists(path) && tree.getDir(path).subfiles.length > 0; + }, + async isFile(path: string): Promise { + return tree.exists(path); + }, + }; +} + +export async function getWorkspace(tree: Tree, path = '/') : Promise { + const host = createHost(tree); + const { workspace } = await workspaces.readWorkspace(path, host); + return workspace; +} + +export function updateWorkspace( + updater: (workspace: workspaces.WorkspaceDefinition) => void | Rule | PromiseLike, + ): Rule; + export function updateWorkspace(workspace: workspaces.WorkspaceDefinition): Rule; + export function updateWorkspace( + updaterOrWorkspace: + | workspaces.WorkspaceDefinition + | ((workspace: workspaces.WorkspaceDefinition) => void | Rule | PromiseLike), + ): Rule { + return async (tree: Tree) => { + const host = createHost(tree); + + if (typeof updaterOrWorkspace === 'function') { + const { workspace } = await workspaces.readWorkspace('/', host); + + const result = await updaterOrWorkspace(workspace); + + await workspaces.writeWorkspace(workspace, host); + + return result || noop; + } else { + await workspaces.writeWorkspace(updaterOrWorkspace, host); + + return noop; + } + }; + } \ No newline at end of file diff --git a/package.json b/package.json index 5dbd743c..2773ab83 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@ngx-builders/analyze", - "version": "3.0.0", - "description": "", + "version": "3.0.1", + "description": "Angular Builder To Run Source Map Explorer", "main": "index.js", "builders": "./builders.json", "schematics": "./collection.json", @@ -43,6 +43,6 @@ "dependencies": { "@angular-devkit/architect": "0.1300.0", "@angular-devkit/core": "13.0.0", - "schematics-utilities": "2.0.3" + "@angular-devkit/schematics": "^13.0.0" } } From a18c06a39c4e3539f3fbdb25ce274ae385be3e25 Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Sun, 16 Apr 2023 00:30:46 +0200 Subject: [PATCH 63/65] feat: remove build from analyze --- .gitignore | 3 +- analyze/index.ts | 67 +++++++++++++++++++------------------------ analyze/index_spec.ts | 60 -------------------------------------- analyze/schema.d.ts | 3 +- analyze/schema.json | 9 ++++-- ng-add/index.ts | 2 +- package.json | 20 ++++++------- tsconfig.json | 13 ++------- 8 files changed, 52 insertions(+), 125 deletions(-) delete mode 100644 analyze/index_spec.ts diff --git a/.gitignore b/.gitignore index bab65b8b..3dd6a2b1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.js *.map node_modules -package-lock.json \ No newline at end of file +package-lock.json +dist \ No newline at end of file diff --git a/analyze/index.ts b/analyze/index.ts index 3d651ca9..1b887443 100644 --- a/analyze/index.ts +++ b/analyze/index.ts @@ -1,53 +1,44 @@ -import { BuilderOutput, createBuilder, BuilderContext } from '@angular-devkit/architect'; -import { json } from '@angular-devkit/core'; -import { Schema } from './schema'; -import util from 'util'; -import { exec } from 'child_process'; +import { + BuilderOutput, + createBuilder, + BuilderContext, +} from "@angular-devkit/architect"; +import { Schema } from "./schema"; +import util from "util"; +import { exec } from "child_process"; export const execAsync = util.promisify(exec); export default createBuilder( - async (builderConfig: Schema, context: BuilderContext): Promise => { + async ( + builderConfig: Schema, + context: BuilderContext + ): Promise => { try { - context.reportStatus(`Starting Build`); - // const child = childProcess.spawn(options.command, options.args, { stdio: 'pipe' }); + context.reportStatus(`Starting Report generation...🚀`); - const configuration = 'production'; - - const overrides = { - // this is an example how to override the workspace set of options - ...({ sourceMap: true, budgets: [] }) - }; - - const build = await context.scheduleTarget({ - target: 'build', - project: context?.target?.project || '', - configuration - }, overrides as json.JsonObject); - - const result = await build.result; - - if (result.success) { - const mainFile = builderConfig.diffLoading ? '*es2015.*.js' : '*.js'; - let explorerCommand = `npx source-map-explorer ${builderConfig.outputPath}/${mainFile}`; - if (builderConfig.gzip) { - explorerCommand = `${explorerCommand} --gzip`; - } - const { stdout, stderr } = await execAsync(explorerCommand); - context.logger.info(stdout); - context.logger.info(stderr); + const mainFile = "*.js"; + let explorerCommand = `npx source-map-explorer ${builderConfig.outputPath}/${mainFile}`; + if (builderConfig.gzip) { + explorerCommand = `${explorerCommand} --gzip`; + } + if(builderConfig.reportPath) { + const reportFormat = builderConfig.reportFormat || 'html'; + explorerCommand = `${explorerCommand} --${reportFormat} ${builderConfig.reportPath}/${context?.target?.project}.html`; } + const { stdout, stderr } = await execAsync(explorerCommand); + context.logger.info(stdout); + context.logger.info(stderr); context.reportStatus(`Done.`); return { - success: true + success: true, }; - } - catch (e:any) { + } catch (e: any) { return { error: e.message, - success: true + success: true, }; } - }); - + } +); diff --git a/analyze/index_spec.ts b/analyze/index_spec.ts deleted file mode 100644 index 4f7a25b8..00000000 --- a/analyze/index_spec.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { Architect } from '@angular-devkit/architect'; -import { TestingArchitectHost } from '@angular-devkit/architect/testing'; -import { logging, schema } from '@angular-devkit/core'; - -const { join } = require('path'); - -describe('Command Runner Builder', () => { - let architect: Architect; - let architectHost: TestingArchitectHost; - - - beforeEach(async () => { - const registry = new schema.CoreSchemaRegistry(); - registry.addPostTransform(schema.transforms.addUndefinedDefaults); - - - // Arguments to TestingArchitectHost are workspace and current directories. - // Since we don't use those, both are the same in this case. - architectHost = new TestingArchitectHost(__dirname, __dirname); - architect = new Architect(architectHost, registry); - - - // This will either take a Node package name, or a path to the directory - // for the package.json file. - await architectHost.addBuilderFromPackage(join(__dirname, '..')); - console.log('#', Array.from((architectHost as any)._builderMap.keys())) - }); - - - // This might not work in Windows. - it('can run ls', async () => { - // Create a logger that keeps an array of all messages that were logged. - const logger = new logging.Logger(''); - const logs: string[] = []; - logger.subscribe(ev => logs.push(ev.message)); - - // A "run" can contain multiple outputs, and contains progress information. - const run = await architect.scheduleBuilder('@example/command-runner:command', { - command: 'ls', - args: [__dirname], - }, { logger }); // We pass the logger for checking later. - - - // The "result" member is the next output of the runner. - // This is of type BuilderOutput. - const output = await run.result; - - // Stop the builder from running. This really stops Architect from keeping - // the builder associated states in memory, since builders keep waiting - // to be scheduled. - await run.stop(); - - // Expect that it succeeded. - expect(output.success).toBe(true); - - // Expect that this file was listed. It should be since we're running - // `ls $__dirname`. - expect(logs.toString()).toContain('index_spec.ts'); - }); -}); diff --git a/analyze/schema.d.ts b/analyze/schema.d.ts index 2951c6fe..620ab400 100644 --- a/analyze/schema.d.ts +++ b/analyze/schema.d.ts @@ -1,5 +1,6 @@ export interface Schema { outputPath: string; gzip?: boolean; - diffLoading?:boolean; + reportPath?: string; + reportFormat: 'html' | 'json' | 'tsv' ; } \ No newline at end of file diff --git a/analyze/schema.json b/analyze/schema.json index f7c4f77e..8f017712 100644 --- a/analyze/schema.json +++ b/analyze/schema.json @@ -9,9 +9,12 @@ "outputPath": { "type": "string" }, - "diffLoading": { - "type":"boolean", - "default": false + "reportPath": { + "type": "string" + }, + "reportFormat": { + "type": "string", + "default": "html" } } } diff --git a/ng-add/index.ts b/ng-add/index.ts index d0f0f0a5..40a75f93 100644 --- a/ng-add/index.ts +++ b/ng-add/index.ts @@ -14,7 +14,7 @@ export function ngAdd(options: NgAddOptions): Rule { options.project = workspace.extensions.defaultProject as string; } else { throw new SchematicsException( - 'No Angular project selected and no default project in the workspace' + 'No Angular project selected or you are in a Nx workspace' ); } } diff --git a/package.json b/package.json index 2773ab83..1302d791 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ngx-builders/analyze", - "version": "3.0.1", + "version": "4.0.0", "description": "Angular Builder To Run Source Map Explorer", "main": "index.js", "builders": "./builders.json", @@ -9,8 +9,9 @@ "save": "devDependencies" }, "scripts": { - "build": "tsc", - "test": "ts-node node_modules/jasmine/bin/jasmine analyze/index_spec.ts" + "copy:pacakge": "cp package.json dist", + "copy:json": "cp ng-add/schema.json dist/ng-add/schema.json && cp builders.json dist/builders.json && cp collection.json dist/collection.json && cp README.md dist/README.md && cp analyze/schema.json dist/analyze/schema.json", + "build": "tsc && npm run copy:pacakge && npm run copy:json" }, "repository": { "type": "git", @@ -33,16 +34,13 @@ "author": "Santosh Yadav ", "license": "MIT", "devDependencies": { - "@types/jasmine": "3.10.2", "@types/node": "16.11.11", - "jasmine": "3.10.0", - "jasmine-node": "3.0.0", - "ts-node": "10.4.0", - "typescript": "~4.5.2" + "ts-node": "10.9.1", + "typescript": "~5.0.0" }, "dependencies": { - "@angular-devkit/architect": "0.1300.0", - "@angular-devkit/core": "13.0.0", - "@angular-devkit/schematics": "^13.0.0" + "@angular-devkit/architect": "0.1502.6", + "@angular-devkit/core": "15.2.6", + "@angular-devkit/schematics": "15.2.6" } } diff --git a/tsconfig.json b/tsconfig.json index 5ad4561f..c8ae742f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,20 +2,14 @@ "compilerOptions": { "moduleResolution": "node", "module": "commonjs", - "target": "es2015", + "target": "ES2020", + "outDir": "dist", "lib": [ - "es2015", - "dom", - "es2015.promise", - "es2015.collection", - "es2015.iterable" + "es2018" ], "strict": true, "allowSyntheticDefaultImports": true, - "suppressImplicitAnyIndexErrors": true, "forceConsistentCasingInFileNames": true, - "strictPropertyInitialization": false, - "strictNullChecks": true, "sourceMap": false, "declaration": false, "inlineSources": false, @@ -32,6 +26,5 @@ "angularCompilerOptions": { "skipTemplateCodegen": true, "strictMetadataEmit": true, - "enableSummariesForJit": false } } \ No newline at end of file From 68bde9f8dbc7eb5db8e1a1be7e6f15df9d4e1a70 Mon Sep 17 00:00:00 2001 From: Santosh Yadav Date: Sun, 16 Apr 2023 00:33:19 +0200 Subject: [PATCH 64/65] update CI --- .github/workflows/nodejs.yml | 10 +++++----- .github/workflows/npm-publish.yml | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 7665c68e..d7c8fb1f 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -5,9 +5,9 @@ name: Node.js CI on: push: - branches: [ master ] + branches: [ main ] pull_request: - branches: [ master ] + branches: [ main ] jobs: build: @@ -16,12 +16,12 @@ jobs: strategy: matrix: - node-version: [14.x] + node-version: [16.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - run: npm install diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index a4dee5c4..ee580c66 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -11,10 +11,10 @@ jobs: publish-npm: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: - node-version: 12 + node-version: 16 registry-url: https://registry.npmjs.org/ scope: '@ngx-builders' - run: npm i From 751bc6d3c4912c7248173e605cf00cb7ed5d6743 Mon Sep 17 00:00:00 2001 From: Vijayagopan Date: Sat, 24 Jun 2023 22:48:08 +0530 Subject: [PATCH 65/65] ugrading to angular 16 (#110) * ugrading to angular 16 * Upgrade to angular 16 and bumping up the version --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 1302d791..0333a640 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ngx-builders/analyze", - "version": "4.0.0", + "version": "5.0.0", "description": "Angular Builder To Run Source Map Explorer", "main": "index.js", "builders": "./builders.json", @@ -34,13 +34,13 @@ "author": "Santosh Yadav ", "license": "MIT", "devDependencies": { - "@types/node": "16.11.11", + "@types/node": "20.3.1", "ts-node": "10.9.1", - "typescript": "~5.0.0" + "typescript": "~5.1.3" }, "dependencies": { - "@angular-devkit/architect": "0.1502.6", - "@angular-devkit/core": "15.2.6", - "@angular-devkit/schematics": "15.2.6" + "@angular-devkit/architect": "0.1601.0", + "@angular-devkit/core": "16.1.0", + "@angular-devkit/schematics": "16.1.0" } }