This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable no-console */ | |
/* | |
Alias Absolute Resolver | |
This is a utilitly program allowing you to swap relative paths to the shortest tailwind alias. | |
How to run? | |
npx ts-node aliasAbsolver.ts | |
*/ | |
const fs = require('fs'); | |
const { exit } = require('process'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable no-console */ | |
/* | |
Alias Absolute Resolver | |
This is a utilitly program allowing you to swap relative paths to the shortest tailwind alias. | |
How to run? | |
npx ts-node aliasAbsolver.ts | |
*/ | |
const fs = require('fs'); | |
const { exit } = require('process'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
ChromeMessage, | |
ChromeMessageExecute, | |
MessageResponse, | |
MessageTypes, | |
} from "../types"; | |
import { say } from "cowsay"; | |
const messagesFromReactAppListener = ( | |
message: ChromeMessage, | |
sender: chrome.runtime.MessageSender, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
ChromeMessage, | |
ChromeMessageExecute, | |
MessageResponse, | |
MessageTypes, | |
} from "../types"; | |
import { say } from "cowsay"; | |
const messagesFromReactAppListener = ( | |
message: ChromeMessage, | |
sender: chrome.runtime.MessageSender, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from "react"; | |
import { Button, Container, FormControl, Navbar } from "react-bootstrap"; | |
import { sendMessage } from "../messaging"; | |
import { MessageTypes } from "../types"; | |
const Home = () => { | |
//---- new ---- | |
const [text, setText] = useState(""); | |
const handleChange = (e: any) => { | |
setText(e.target.value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { sendMessage } from "../messaging"; | |
import { MessageTypes } from "../types"; | |
try { | |
chrome.commands.onCommand.addListener((command) => { | |
if (command === "execute") { | |
sendMessage(MessageTypes.shortcutExecute); | |
} | |
}); | |
// this is to check if there are any conflicts in your |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"scripts": { | |
"build": "INLINE_RUNTIME_CHUNK=false GENERATE_SOURCEMAP=false react-scripts build && rm -rf dist/* && mv build/* dist && rollup --config rollup.config.js", | |
"dev": "npm-watch build" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { MessageTypes } from "./types"; | |
export const sendMessage = ( | |
messageType: MessageTypes, | |
payload?: object | null, | |
callback?: any | |
) => { | |
if (!payload) payload = {}; | |
chrome.windows.getCurrent((w) => { | |
chrome.tabs && |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"content_scripts": [ | |
{ | |
"matches": ["<all_urls>"], | |
"js": ["./static/js/content.js"], | |
"all_frames": false, | |
"run_at": "document_end" | |
} | |
], | |
"background": { "service_worker": "./static/js/background.js" }, | |
"commands": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export enum MessageTypes { | |
execute, | |
} | |
export interface ChromeMessageDefault { | |
type: MessageTypes; | |
} | |
export interface ChromeMessageExecute { | |
type: MessageTypes.execute; | |
text: string; |
NewerOlder