Skip to content

Commit

Permalink
Merge pull request #27 from dutiyesh/chore/format-files
Browse files Browse the repository at this point in the history
Format files
  • Loading branch information
dutiyesh committed Jun 13, 2022
2 parents ed32b22 + e87c2fb commit de7ca7e
Show file tree
Hide file tree
Showing 20 changed files with 120 additions and 106 deletions.
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# https://prettier.io/docs/en/ignore.html

# Dependencies:
node_modules
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "always",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"semi": true
}
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const program = new commander.Command(packageFile.name)
.version(packageFile.version)
.arguments('<project-directory>')
.usage(`${chalk.green('<project-directory>')} [options]`)
.action(name => {
.action((name) => {
projectName = name;
})
.option(
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"chrome-extension-cli": "index.js"
},
"scripts": {
"format": "prettier --single-quote --trailing-comma es5 --write 'index.js' '{config,scripts,utils,templates}/**/*.{js,ts,css}'"
"format": "prettier --write --ignore-unknown 'index.js' '{config,scripts,utils,templates}/**/*.{js,ts,css,html,json}'"
},
"keywords": [
"chrome",
Expand Down Expand Up @@ -43,6 +43,6 @@
"validate-npm-package-name": "^3.0.0"
},
"devDependencies": {
"prettier": "^1.18.2"
"prettier": "^2.6.2"
}
}
2 changes: 1 addition & 1 deletion templates/javascript/devtools/src/devtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
// See https://developer.chrome.com/extensions/devtools

// Create a panel named `My Panel`
chrome.devtools.panels.create('My Panel', '', 'panel.html', panel => {
chrome.devtools.panels.create('My Panel', '', 'panel.html', (panel) => {
console.log('Panel was successfully created!');
});
2 changes: 1 addition & 1 deletion templates/javascript/devtools/src/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ chrome.runtime.sendMessage(
message: 'Hello, my name is Pan. I am from Panel.',
},
},
response => {
(response) => {
console.log(response.message);
}
);
4 changes: 2 additions & 2 deletions templates/javascript/override-page/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import getCurrentTime from './clock';
import getDay from './day';
import './app.css';

(function() {
(function () {
function setTime() {
const time = getCurrentTime();

Expand Down Expand Up @@ -33,7 +33,7 @@ import './app.css';
message: 'Hello, my name is Ove. I am from Override app.',
},
},
response => {
(response) => {
console.log(response.message);
}
);
Expand Down
2 changes: 1 addition & 1 deletion templates/javascript/popup/src/contentScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ chrome.runtime.sendMessage(
message: 'Hello, my name is Con. I am from ContentScript.',
},
},
response => {
(response) => {
console.log(response.message);
}
);
Expand Down
16 changes: 8 additions & 8 deletions templates/javascript/popup/src/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import './popup.css';

(function() {
(function () {
// We will make use of Storage API to get and store `count` value
// More information on Storage API can we found at
// https://developer.chrome.com/extensions/storage
Expand All @@ -11,8 +11,8 @@ import './popup.css';
// More information on Permissions can we found at
// https://developer.chrome.com/extensions/declare_permissions
const counterStorage = {
get: cb => {
chrome.storage.sync.get(['count'], result => {
get: (cb) => {
chrome.storage.sync.get(['count'], (result) => {
cb(result.count);
});
},
Expand Down Expand Up @@ -45,7 +45,7 @@ import './popup.css';
}

function updateCounter({ type }) {
counterStorage.get(count => {
counterStorage.get((count) => {
let newCount;

if (type === 'INCREMENT') {
Expand All @@ -61,7 +61,7 @@ import './popup.css';

// Communicate with content script of
// active tab by sending a message
chrome.tabs.query({ active: true, currentWindow: true }, tabs => {
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
const tab = tabs[0];

chrome.tabs.sendMessage(
Expand All @@ -72,7 +72,7 @@ import './popup.css';
count: newCount,
},
},
response => {
(response) => {
console.log('Current count value passed to contentScript file');
}
);
Expand All @@ -83,7 +83,7 @@ import './popup.css';

function restoreCounter() {
// Restore count value
counterStorage.get(count => {
counterStorage.get((count) => {
if (typeof count === 'undefined') {
// Set counter value as 0
counterStorage.set(0, () => {
Expand All @@ -105,7 +105,7 @@ import './popup.css';
message: 'Hello, my name is Pop. I am from Popup.',
},
},
response => {
(response) => {
console.log(response.message);
}
);
Expand Down
20 changes: 10 additions & 10 deletions templates/shared/devtools/public/devtools.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Chrome DevTools</title>
</head>
<body>
<script src="devtools.js"></script>
<head>
<meta charset="UTF-8" />
<title>Chrome DevTools</title>
</head>
<body>
<script src="devtools.js"></script>

<!--
This HTML page is used to create a DevTools page.
-->
</body>
<!--
This HTML page is used to create a DevTools page.
-->
</body>
</html>
42 changes: 21 additions & 21 deletions templates/shared/devtools/public/panel.html
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My Panel</title>
<link rel="stylesheet" href="panel.css" />
</head>
<body>
<div class="app">
<main class="main">
<p id="message" class="message"></p>
<head>
<meta charset="UTF-8" />
<title>My Panel</title>
<link rel="stylesheet" href="panel.css" />
</head>
<body>
<div class="app">
<main class="main">
<p id="message" class="message"></p>

<hr class="divider" />
<hr class="divider" />

<p class="title">Chrome Extension is Ready!</p>
<p class="subtitle">Start by updating <code>panel.html</code></p>
</main>
</div>
<p class="title">Chrome Extension is Ready!</p>
<p class="subtitle">Start by updating <code>panel.html</code></p>
</main>
</div>

<script src="panel.js"></script>
<script src="panel.js"></script>

<!--
This HTML page is used to create a Panel inside DevTools page.
<!--
This HTML page is used to create a Panel inside DevTools page.
To begin the development, run `npm run watch`.
To create a production bundle, use `npm run build`.
-->
</body>
To begin the development, run `npm run watch`.
To create a production bundle, use `npm run build`.
-->
</body>
</html>
40 changes: 20 additions & 20 deletions templates/shared/override-page/public/index.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>New Tab</title>
<link rel="stylesheet" href="app.css" />
</head>
<body>
<div class="container">
<p id="day" class="day"></p>
<div id="clock" class="clock"></div>
<head>
<meta charset="UTF-8" />
<title>New Tab</title>
<link rel="stylesheet" href="app.css" />
</head>
<body>
<div class="container">
<p id="day" class="day"></p>
<div id="clock" class="clock"></div>

<hr class="divider" />
<hr class="divider" />

<p class="title">Chrome Extension is Ready!</p>
<p class="subtitle">Start by updating <code>index.html</code></p>
</div>
<script src="app.js"></script>
<p class="title">Chrome Extension is Ready!</p>
<p class="subtitle">Start by updating <code>index.html</code></p>
</div>
<script src="app.js"></script>

<!--
This HTML file is a template for overriding pages like New Tab, Bookmarks, or History page.
<!--
This HTML file is a template for overriding pages like New Tab, Bookmarks, or History page.
To begin the development, run `npm run watch`.
To create a production bundle, use `npm run build`.
-->
</body>
To begin the development, run `npm run watch`.
To create a production bundle, use `npm run build`.
-->
</body>
</html>
44 changes: 22 additions & 22 deletions templates/shared/popup/public/popup.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<head>
<meta charset="UTF-8" />
<title>My Chrome Extension</title>
<link rel="stylesheet" href="popup.css" />
</head>
<body>
<div class="app">
<p class="counter-label">Counter</p>
<div id="counter" class="counter"></div>
<div class="button-container">
<button id="decrementBtn" class="button">-</button>
<button id="incrementBtn" class="button">+</button>
</div>
</head>
<body>
<div class="app">
<p class="counter-label">Counter</p>
<div id="counter" class="counter"></div>
<div class="button-container">
<button id="decrementBtn" class="button">-</button>
<button id="incrementBtn" class="button">+</button>
</div>

<hr class="divider" />
<hr class="divider" />

<p class="title">Chrome Extension is Ready!</p>
<p class="subtitle">Start by updating <code>popup.html</code></p>
</div>
<p class="title">Chrome Extension is Ready!</p>
<p class="subtitle">Start by updating <code>popup.html</code></p>
</div>

<script src="popup.js"></script>
<script src="popup.js"></script>

<!--
This HTML file opens when you click on icon from the toolbar.
<!--
This HTML file opens when you click on icon from the toolbar.
To begin the development, run `npm run watch`.
To create a production bundle, use `npm run build`.
-->
</body>
To begin the development, run `npm run watch`.
To create a production bundle, use `npm run build`.
-->
</body>
</html>
2 changes: 1 addition & 1 deletion templates/typescript/devtools/src/devtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
// See https://developer.chrome.com/extensions/devtools

// Create a panel named `My Panel`
chrome.devtools.panels.create('My Panel', '', 'panel.html', panel => {
chrome.devtools.panels.create('My Panel', '', 'panel.html', (panel) => {
console.log('Panel was successfully created!');
});
2 changes: 1 addition & 1 deletion templates/typescript/devtools/src/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ chrome.runtime.sendMessage(
message: 'Hello, my name is Pan. I am from Panel.',
},
},
response => {
(response) => {
console.log(response.message);
}
);
4 changes: 2 additions & 2 deletions templates/typescript/override-page/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import getCurrentTime from './clock';
import getDay from './day';
import './app.css';

(function() {
(function () {
function setTime(): void {
const time: string = getCurrentTime();

Expand Down Expand Up @@ -33,7 +33,7 @@ import './app.css';
message: 'Hello, my name is Ove. I am from Override app.',
},
},
response => {
(response) => {
console.log(response.message);
}
);
Expand Down
6 changes: 3 additions & 3 deletions templates/typescript/popup/src/contentScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See https://developer.chrome.com/extensions/content_scripts

// Log `title` of current active web page
const pageTitle: string = document.head.getElementsByTagName('title')[0]
.innerHTML;
const pageTitle: string =
document.head.getElementsByTagName('title')[0].innerHTML;
console.log(
`Page title is: '${pageTitle}' - evaluated by Chrome extension's 'contentScript.js' file`
);
Expand All @@ -26,7 +26,7 @@ chrome.runtime.sendMessage(
message: 'Hello, my name is Con. I am from ContentScript.',
},
},
response => {
(response) => {
console.log(response.message);
}
);
Expand Down
Loading

0 comments on commit de7ca7e

Please sign in to comment.