Skip to content
This repository was archived by the owner on Jan 27, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
adding firefox support for devtools
  • Loading branch information
sumitarora committed Jan 12, 2022
commit 35e98da519163d05629457c5de79486eb906f536
28 changes: 26 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"architect": {
"build": {
"builder": "ngx-build-plus:browser",
"defaultConfiguration": "production",
"options": {
"outputPath": "dist/shell-dev",
"index": "src/index.html",
Expand All @@ -32,6 +33,14 @@
"scripts": []
},
"configurations": {
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
},
"production": {
"fileReplacements": [
{
Expand Down Expand Up @@ -84,7 +93,11 @@
"extraWebpackConfig": "shell-dev-webpack.config.js",
"browserTarget": "shell-dev:build"
},
"defaultConfiguration": "development",
"configurations": {
"development": {
"browserTarget": "shell-dev:build:development"
},
"production": {
"browserTarget": "shell-dev:build:production"
},
Expand Down Expand Up @@ -148,6 +161,7 @@
"architect": {
"build": {
"builder": "ngx-build-plus:browser",
"defaultConfiguration": "production",
"options": {
"outputPath": "dist/shell-chrome",
"extraWebpackConfig": "projects/shell-chrome/shell-chrome-webpack.config.js",
Expand All @@ -159,7 +173,6 @@
"aot": true,
"assets": [
"projects/shell-chrome/src/assets",
"projects/shell-chrome/src/manifest.json",
"projects/shell-chrome/src/devtools.html",
"projects/shell-chrome/src/popups"
],
Expand All @@ -170,6 +183,14 @@
"scripts": []
},
"configurations": {
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
},
"production": {
"fileReplacements": [
{
Expand All @@ -189,7 +210,6 @@
},
"outputHashing": "none",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"buildOptimizer": true,
Expand All @@ -205,10 +225,14 @@
},
"serve": {
"builder": "ngx-build-plus:dev-server",
"defaultConfiguration": "development",
"options": {
"browserTarget": "shell-chrome:build"
},
"configurations": {
"development": {
"browserTarget": "shell-chrome:build:development"
},
"production": {
"browserTarget": "shell-chrome:build:production"
}
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"start": "cross-env LATEST_SHA=`git rev-parse --short HEAD` ng serve",
"start-no-animations": "yarn start --configuration=e2e",
"build": "ng build",
"build:chrome": "cross-env LATEST_SHA=`git rev-parse --short HEAD` ng build shell-chrome",
"build:chrome": "cross-env LATEST_SHA=`git rev-parse --short HEAD` ng build shell-chrome && cross-env BUILD=chrome node projects/shell-chrome/copy-manifest.js",
"build:firefox": "cross-env LATEST_SHA=`git rev-parse --short HEAD` ng build shell-chrome && cross-env BUILD=firefox node projects/shell-chrome/copy-manifest.js",
"release": "node projects/shell-chrome/set-version.js && cross-env LATEST_SHA=`git rev-parse --short HEAD` ng build shell-chrome --configuration production",
"test": "ng test",
"lint": "tslint -p tsconfig.json -c tslint.json",
Expand Down Expand Up @@ -84,7 +85,7 @@
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.4.2",
"ng-packagr": "^12.0.0",
"ngx-build-plus": "^11.0.0",
"ngx-build-plus": "^13.0.1",
"prettier": "^2.0.0",
"pretty-quick": "^3.0.0",
"protractor": "~7.0.0",
Expand Down
15 changes: 15 additions & 0 deletions projects/shell-chrome/copy-manifest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const chalk = require('chalk');
const { writeFileSync, readFileSync } = require('fs');
const { join } = require('path');

console.log('creating build for:', chalk.yellow(process.env.BUILD));

const MANIFEST_INPUT_PATH = join(__dirname, `src/manifest/manifest.${process.env.BUILD}.json`);
const MANIFEST_OUTPUT_PATH = join(process.cwd(), `dist/shell-chrome/manifest.json`);

const rawData = readFileSync(MANIFEST_INPUT_PATH);
const manifest = JSON.parse(rawData.toString());
console.log('writing manifest file for:', chalk.yellow(process.env.BUILD));

writeFileSync(MANIFEST_OUTPUT_PATH, JSON.stringify(manifest, null, 2), { flag: 'a+' });
console.log('manifest copied: ', chalk.green('done'));
2 changes: 1 addition & 1 deletion projects/shell-chrome/set-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const semver = require('semver');
const { writeFileSync, readFileSync } = require('fs');
const { join } = require('path');

const MANIFEST_PATH = join(__dirname, 'src/manifest.json');
const MANIFEST_PATH = join(__dirname, 'src/manifest/manifest.chrome.json');

const manifest = JSON.parse(readFileSync(MANIFEST_PATH).toString());

Expand Down
40 changes: 40 additions & 0 deletions projects/shell-chrome/src/manifest/manifest.firefox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"manifest_version": 2,
"short_name": "Angular DevTools",
"name": "Angular DevTools",
"description": "Angular DevTools extends Chrome DevTools adding Angular specific debugging and profiling capabilities.",
"version": "1.0.4",
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
"icons": {
"16": "assets/icon16.png",
"48": "assets/icon48.png",
"128": "assets/icon128.png"
},
"browser_action": {
"default_icon": {
"16": "assets/icon16.png",
"48": "assets/icon48.png",
"128": "assets/icon128.png"
},
"default_popup": "popups/not-angular.html",
"browser_style": true
},
"devtools_page": "devtools.html",
"web_accessible_resources": ["backend.js", "runtime.js", "devtools.html"],
"background": {
"scripts": ["background.js", "runtime.js"]
},
"permissions": ["activeTab", "http://*/*", "https://*/*", "file:///*"],
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["runtime.js"],
"run_at": "document_start"
},
{
"matches": ["<all_urls>"],
"js": ["ng-validate.js"],
"run_at": "document_idle"
}
]
}
Loading