Skip to content

Commit

Permalink
chore: format code base
Browse files Browse the repository at this point in the history
  • Loading branch information
saikumarrs committed Dec 10, 2024
1 parent f557d3e commit d409d53
Show file tree
Hide file tree
Showing 142 changed files with 1,877 additions and 1,986 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ permissions:
contents: read # This is required for actions/checkout

env:
NODE_OPTIONS: "--no-warnings"
NODE_OPTIONS: '--no-warnings'

jobs:
get-deploy-inputs:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy-sanity-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ permissions:

env:
NODE_OPTIONS: '--no-warnings'
CACHE_CONTROL: "\"max-age=3600\""
CACHE_CONTROL: '"max-age=3600"'

jobs:
deploy:
Expand All @@ -69,7 +69,7 @@ jobs:
current_version=$(jq -r .version packages/sanity-suite/package.json)
echo "CURRENT_VERSION_VALUE=$current_version" >> $GITHUB_ENV
echo "DATE=$(date)" >> $GITHUB_ENV
if [ "${{ inputs.environment }}" == "staging" ]; then
echo "AWS_ACCOUNT_ID=${{ secrets.AWS_STAGING_ACCOUNT_ID }}" >> $GITHUB_ENV
echo "AWS_S3_SYNC_ROLE=${{ secrets.AWS_STAGING_S3_SYNC_ROLE }}" >> $GITHUB_ENV
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
- name: Install AWS CLI
uses: unfor19/install-aws-cli-action@master

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ permissions:
contents: read # This is required for actions/checkout

env:
NODE_OPTIONS: "--no-warnings"
CACHE_CONTROL: "\"no-store\"" # "\"max-age=3600\""
NODE_OPTIONS: '--no-warnings'
CACHE_CONTROL: '"no-store"' # '"max-age=3600"'

jobs:
deploy:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/draft-new-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ jobs:
pr_title: 'chore(release): pull ${{ steps.create-release.outputs.branch_name }} into main'
pr_body: |
:crown: *An automated PR*
This PR is created automatically by the GitHub Actions workflow to merge the release branch into the main branch.
Linear Ticket:
https://linear.app/rudderstack/issue/${{ github.event.inputs.release_ticket_id }}
Expand All @@ -134,4 +134,3 @@ jobs:
console.error(`Error deleting branch ${branchToDelete}:`, error);
process.exit(1); // Fail the workflow if branch deletion fails
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
types: ['opened', 'reopened', 'synchronize']

env:
NODE_OPTIONS: "--no-warnings"
NODE_OPTIONS: '--no-warnings'
BASE_REF: ${{ github.event.pull_request.base.sha || 'HEAD' }}

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests-and-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
types: ['opened', 'reopened', 'synchronize']

env:
NODE_OPTIONS: "--no-warnings"
NODE_OPTIONS: '--no-warnings'
BASE_REF: ${{ github.event.pull_request.base.sha || 'HEAD' }}

jobs:
Expand Down
12 changes: 6 additions & 6 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ As far as the law allows, the software comes as is, without any warranty or cond

## Definitions

The *licensor* is the entity offering these terms, and the *software* is the software the licensor makes available under these terms, including any portion of it.
The _licensor_ is the entity offering these terms, and the _software_ is the software the licensor makes available under these terms, including any portion of it.

*you* refers to the individual or entity agreeing to these terms.
_you_ refers to the individual or entity agreeing to these terms.

*your company* is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. *control* means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
_your company_ is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. _control_ means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.

*your licenses* are all the licenses granted to you for the software under these terms.
_your licenses_ are all the licenses granted to you for the software under these terms.

*use* means anything you do with the software requiring one of your licenses.
_use_ means anything you do with the software requiring one of your licenses.

*trademark* means trademarks, service marks, and similar rights.
_trademark_ means trademarks, service marks, and similar rights.
32 changes: 18 additions & 14 deletions examples/chrome-extension/background-script-websockets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ It can also give you more insights about how to turn a v2 extension to v3.

In other words, this is a **working, installable v3 extension** example meant for you to **jumpstart** the development of your own extension.


## Installation

- **Fork** this repo, then **clone your forked repo locally**. If you don't have a github account, you can simply download a zip of the repo and unzip it on your computer.
- **Open [the extensions page](chrome://extensions)** in your browser: `chrome://extensions`. This link works on any chromium-based browser.
- If you did not do it already, **toggle the "developer mode"**. This is usually a toggle button at the top right of the extensions page.
Expand All @@ -21,18 +21,20 @@ In other words, this is a **working, installable v3 extension** example meant fo
- **Done!** A new extension called _Chrome Addon v3 Starter_ should have appeared in the list.

## Q&A

> Does this work only on Chrome or on **other web browsers** as well?
At the moment, this works on every chromium-based web browser that supports v3 extensions.
Therefore, you should be able to install this extension on any of the following browsers (as long as they are up-to-date):

- _Free and open-source browsers_:
- Chromium
- Brave
- Chromium
- Brave
- _Proprietary browsers_:
- Chrome
- Edge
- Vivaldi
- Opera
- Chrome
- Edge
- Vivaldi
- Opera

> So it doesn't work on **Firefox** or **Safari**?
Expand Down Expand Up @@ -68,6 +70,7 @@ You should read the [official migration page (v2 to v3)](https://developer.chrom
Using the debugger if your service worker is not loaded is not possible.

However, if you want to test some piece of code before putting it in your service worker, you can:

- load your extension with a working version of the service worker.
- click on "service worker" on the page _chrome://extensions_. This will open the console attached to the service worker.
- paste your code in the console and see if any error is logged.
Expand All @@ -86,15 +89,16 @@ Note that in this console, you have access to anything your service worker has a
- If you forked this repo and cloned your own fork locally, git will push to your fork on your account automatically (i.e. use the command `git push` or `git push origin <your-branch>`).

- If you downloaded a zip or simply cloned this repo locally, do the following:
- Create a github account if you don't already have one and install git on your machine.
- Create a new (empty) repo on your github and copy its url.
- Open a terminal in the folder where the extension is cloned.
- Run the command `git init`, then `git commit -am "Initial commit"`
- Run the command `git remote add origin <url-of-your-repo>`
- Run `git push -u origin master`. The extension code is now on your repo, on brnach _master_.
- If you want, you can make the _master_ branch the default one and delete the _main_ branch in the settings of your repo.
- Create a github account if you don't already have one and install git on your machine.
- Create a new (empty) repo on your github and copy its url.
- Open a terminal in the folder where the extension is cloned.
- Run the command `git init`, then `git commit -am "Initial commit"`
- Run the command `git remote add origin <url-of-your-repo>`
- Run `git push -u origin master`. The extension code is now on your repo, on brnach _master_.
- If you want, you can make the _master_ branch the default one and delete the _main_ branch in the settings of your repo.

## External resources

- [Official feature summary for manifest v3](https://developer.chrome.com/docs/extensions/mv3/intro/mv3-overview/)
- [Migrating from v2 to v3](https://developer.chrome.com/docs/extensions/mv3/intro/mv3-migration/) + [very useful checklist once you think you are done](https://developer.chrome.com/docs/extensions/mv3/mv3-migration-checklist/)
- [Excellent write-ups of a migration](https://github.com/kentbrew/learning-manifest-v3)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
body {
background-color: #222;
color: #eee;
background-color: #222;
color: #eee;

width: 16rem;
height: 4rem;
width: 16rem;
height: 4rem;
}

.special-text {
color: red;
color: red;
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="popup.css">
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="popup.css" />
<title>RudderStack SDK: Chrome Extension Background Script Sample</title>
</head>
<body>
</head>
<body>
This is the <span class="special-text">HTML</span> body of the addon.
</body>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,55 @@
// when the extension is installed or refreshed (or when you access its console).
// It would correspond to the background script in chrome extensions v2.

console.log("This prints to the console of the service worker (background script)")
console.log('This prints to the console of the service worker (background script)');

// Importing and using functionality from external files is also possible.
import { Analytics } from "./rudderAnalytics.js";
import { Analytics } from './rudderAnalytics.js';

console.log(Analytics);

let socket = new WebSocket("ws://localhost:8080");
socket.onopen = function(e) {
console.log("[open] Connection established");
console.log("Sending to server");
let socket = new WebSocket('ws://localhost:8080');
socket.onopen = function (e) {
console.log('[open] Connection established');
console.log('Sending to server');
};

socket.onmessage = function(event) {
console.log(`[message] Data received from server: ${event.data}`);
socket.onmessage = function (event) {
console.log(`[message] Data received from server: ${event.data}`);
};

socket.onclose = function(event) {
if (event.wasClean) {
console.log(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
} else {
// e.g. server process killed or network down
// event.code is usually 1006 in this case
console.log('[close] Connection died');
}
socket.onclose = function (event) {
if (event.wasClean) {
console.log(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
} else {
// e.g. server process killed or network down
// event.code is usually 1006 in this case
console.log('[close] Connection died');
}
};

socket.onerror = function(error) {
console.log(`[error]`);
socket.onerror = function (error) {
console.log(`[error]`);
};

const rudderClient = new Analytics(
"<writeKey>",
"<dataPlaneURL>/v1/batch",
{
logLevel: 'silly',
flashAt: 1,
flushOverride: function(message) {
socket.send(JSON.stringify(message))
}
}
);
const rudderClient = new Analytics('<writeKey>', '<dataPlaneURL>/v1/batch', {
logLevel: 'silly',
flashAt: 1,
flushOverride: function (message) {
socket.send(JSON.stringify(message));
},
});

chrome.tabs.onUpdated.addListener((tabId, tab) => {
if (tab.url) {
rudderClient.track({
userId: "123456",
event: "Event Name",
properties: {
data: {
url: tab.url
},
}
});
}
if (tab.url) {
rudderClient.track({
userId: '123456',
event: 'Event Name',
properties: {
data: {
url: tab.url,
},
},
});
}
});
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
body {
background-color: #222;
color: #eee;
background-color: #222;
color: #eee;
}

.special-text {
color: red;
color: red;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="settings.css">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="stylesheet" href="settings.css" />
<title>RudderStack SDK: Chrome Extension Background Script Sample: Settings</title>
</head>
<body>
</head>
<body>
This is the <span class="special-text">settings</span> page for the addon.
</body>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
2 changes: 1 addition & 1 deletion examples/chrome-extension/websocket-server/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ wss.on('connection', function connection(ws) {

ws.on('message', function message(data) {
try {
const event = JSON.parse(data)
const event = JSON.parse(data);
console.log('received: %s', event.data.batch[0]);
event.done();
} catch (e) {
Expand Down
Loading

0 comments on commit d409d53

Please sign in to comment.