Skip to content

Commit

Permalink
Add version 0.9.1, add better build scripts, add zip command to `roll…
Browse files Browse the repository at this point in the history
…up.config.js`
  • Loading branch information
hkamran80 committed Oct 3, 2021
1 parent 0828969 commit 6a2fc32
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 23 deletions.
Binary file removed .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node_modules
build
dist
.DS_Store
**/.DS_Store
.dccache
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@

![Nebula screenshot](screenshots/nebula-new-tab-screenshot.png)

## Building
1. Clone this repository
2. Run `npm install`
3. Run `npm run build:extension`
4. Install the extension with the generated ZIP file

## Installation
TBA
Binary file removed assets/.DS_Store
Binary file not shown.
Binary file removed assets/icons/.DS_Store
Binary file not shown.
5 changes: 3 additions & 2 deletions package-lock.json

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

8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@
"scripts": {
"dev:firefox": "web-ext run --source-dir dist",
"dev:chromium": "web-ext run --source-dir dist --target chromium",
"build": "rimraf dist && tsc && rollup -c rollup.config.js",
"build:watch": "onchange 'template.html' 'index.ts' 'manifest.json' -- npm run build",
"build": "rimraf dist build && mkdir build && tsc && rollup -c rollup.config.js",
"build:watch": "onchange 'src/*' -- npm run build",
"build:extension": "npm run build; web-ext build --source-dir dist",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"new tab"
],
"author": "H. Kamran",
"license": "GPLV3",
"devDependencies": {
Expand All @@ -33,6 +30,7 @@
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-execute": "^1.1.1",
"rollup-plugin-postcss": "^4.0.1",
"rollup-plugin-terser": "^7.0.2",
"tailwindcss": "^2.2.16",
"typescript": "^4.4.3",
"web-ext": "^6.4.0",
Expand Down
13 changes: 9 additions & 4 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import html from "rollup-plugin-bundle-html-thomzz";
import copy from "rollup-plugin-copy";
import postcss from "rollup-plugin-postcss";
import execute from "rollup-plugin-execute";
import { terser } from "rollup-plugin-terser";

const baseConfig = createBasicConfig();

export default merge(baseConfig, {
input: "./build/index.js",
input: "./build/src/index.js",
output: {
dir: "dist",
format: "cjs",
Expand All @@ -20,7 +21,7 @@ export default merge(baseConfig, {
}),
copy({
targets: [
{ src: "manifest.json", dest: "dist" },
{ src: "src/manifest.json", dest: "dist" },
{
src: "./node_modules/webextension-polyfill/dist/browser-polyfill.min.js",
dest: "dist",
Expand All @@ -33,14 +34,18 @@ export default merge(baseConfig, {
],
}),
html({
template: "template.html",
template: "src/template.html",
dest: "dist",
filename: "index.html",
externals: [
{ type: "js", file: "browser-polyfill.min.js", pos: "before" },
],
absolute: true,
}),
execute(["npx tailwindcss -i ./newtab.css -o ./dist/newtab.css"]),
terser(),
execute([
"npx tailwindcss -i ./src/newtab.css -o ./dist/newtab.css",
"zip -r build/nebula-new-tab.zip dist",
]),
],
});
4 changes: 3 additions & 1 deletion index.ts → src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ browser.runtime.onInstalled.addListener(async () => {
hourStatus: "12",
});

await browser.tabs.create({ url: browser.runtime.getURL("index.html") });
console.debug(browser.runtime.getURL("/index.html"));

await browser.tabs.create({ url: browser.runtime.getURL("/index.html") });
});

// Background Image Initialization
Expand Down
4 changes: 0 additions & 4 deletions manifest.json → src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,5 @@
"chrome_url_overrides": {
"newtab": "index.html"
},
"chrome_settings_overrides": {
"homepage": "index.html",
"startup_pages": ["index.html"]
},
"permissions": ["storage"]
}
File renamed without changes.
6 changes: 3 additions & 3 deletions template.html → src/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
name="description"
content="Welcome to Nebula, your new tab page!"
/>
<link rel="stylesheet" href="newtab.css" />
<link rel="stylesheet" href="/newtab.css" />
</head>

<body class="bg-white dark:bg-black">
Expand All @@ -33,7 +33,7 @@
text-8xl text-white
"
>
16:30
00:00
</h1>
<h2
id="date"
Expand All @@ -46,7 +46,7 @@
text-3xl text-white
"
>
Friday, October 1, 2021
Sunday, October 3, 2021
</h2>
</div>

Expand Down
2 changes: 1 addition & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const defaultTheme = require("tailwindcss/defaultTheme");

module.exports = {
mode: "jit",
purge: ["./template.html", "./index.ts", "./newtab.css"],
purge: ["./src/*.{html,css,ts}"],
darkMode: "media",
theme: {
fontFamily: {
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"outDir": "build",
"outDir": "./build",
"rootDir": "./"
},
"include": ["./*.ts"]
"include": ["./src/*.ts"]
}

0 comments on commit 6a2fc32

Please sign in to comment.