Skip to content

Commit

Permalink
feat: complete rewrite and restructure
Browse files Browse the repository at this point in the history
  • Loading branch information
davgothic committed Dec 26, 2023
1 parent e95e1f8 commit 0060d2f
Show file tree
Hide file tree
Showing 28 changed files with 5,292 additions and 366 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
17 changes: 17 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"env": {
"browser": true,
"es2021": true,
"webextensions": true
},
"extends": "airbnb-base",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"ignorePatterns": ["dist/**/*.js"],
"rules": {
"no-console": "off",
"import/no-extraneous-dependencies": ["error", {"devDependencies": true}]
}
}
12 changes: 12 additions & 0 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
on:
pull_request:
types:
- opened
- reopened
- synchronize
- assigned

jobs:
lint:
name: Lint
uses: ./.github/workflows/run-lint.yml
10 changes: 10 additions & 0 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
on:
push:
branches:
- master

jobs:
chrome-extension-upload:
name: Chrome Extension Upload
uses: ./.github/workflows/run-chrome-extension-upload.yml
secrets: inherit
46 changes: 46 additions & 0 deletions .github/workflows/run-chrome-extension-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Chrome Extension Upload

on:
workflow_call:
secrets:
EXTENSION_ID:
required: true
CLIENT_ID:
required: true
CLIENT_SECRET:
required: true
REFRESH_TOKEN:
required: true

jobs:
deploy:
if: ${{ github.repository_owner == 'davgothic' }}
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: '20'

- name: Install dependencies
run: npm ci

- name: Build extension
run: npm run build

- name: Compress dist directory
run: zip -r extension.zip dist

- name: Upload Extension
uses: mnao305/[email protected]
with:
file-path: extension.zip
extension-id: ${{ secrets.EXTENSION_ID }}
client-id: ${{ secrets.CLIENT_ID }}
client-secret: ${{ secrets.CLIENT_SECRET }}
refresh-token: ${{ secrets.REFRESH_TOKEN }}
publish: false
23 changes: 23 additions & 0 deletions .github/workflows/run-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint

on:
workflow_call:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'

- name: NPM install
run: npm ci

- name: Run Linter
run: npm run lint
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
68 changes: 68 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]


## [2.0.0] - 2023-12-23
### Added

- An auto-copy option with a configurable delay
- Support for matching browser colour scheme
- A theme selector with light and dark options
- An options page for configuring settings

### Changed

- Update to Chrome manifest v3
- Rewrote using plain JavaScript
- Split word list into a separate file with the intention to support more in future

## [1.5.0] - 2012-08-04

### Added

- Added README file

## [1.4.0] - 2012-07-07

### Changed

- Set `offline_enabled` setting to true in the manifest file to specify that this extension can run offline.

## [1.3.0] - 2011-11-12

### Changed

- Updated the paragraph checkbox style to look more like Chrome's UI.

## [1.2.0] - 2011-08-11

### Added

- Added a few additional icons.

## [1.1.0] - 2011-08-06

### Changed

- Updated the UI to make it look a little more at home in Chrome.

## [1.0.0] - 2011-08-06

### Added

- Initial release

[unreleased]: https://github.com/davgothic/DummyText/compare/v2.0.0...HEAD
[2.0.0]: https://github.com/davgothic/DummyText/compare/v1.5.0...v2.0.0
[1.5.0]: https://github.com/davgothic/DummyText/compare/v1.4.0...v1.5.0
[1.4.0]: https://github.com/davgothic/DummyText/compare/v1.3.0...v1.4.0
[1.3.0]: https://github.com/davgothic/DummyText/compare/v1.2.0...v1.3.0
[1.2.0]: https://github.com/davgothic/DummyText/compare/v1.1.0...v1.2.0
[1.1.0]: https://github.com/davgothic/DummyText/compare/v1.0.0...v1.1.0
[1.0.0]: https://github.com/davgothic/DummyText/releases/tag/v1.0.0
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2011 David Hancock

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16 changes: 1 addition & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
# DummyText (Chrome Extension)

Simple, quick and unobtrusive dummy text generator for web designers and developers. This extension installs a small icon in your browser allowing you quick access to paragraphs of dummy text (Lorem ipsum style) at the click of a button.
Simple, quick and unobtrusive dummy text generator for web designers and developers. This extension installs a small icon in your browser allowing you quick access to paragraphs of dummy text (lorem ipsum style) at the click of a button.

The number of paragraphs, words per paragraph and whether or not to wrap paragraphs in paragraph tags can be changed easily. Once happy with your selection, simply click the Copy button and the text is sent straight to your clipboard ready for pasting!

## Installation

Install via the [Chrome Web Store listing](https://chrome.google.com/webstore/detail/dummytext/ahnionhaccolmddlboaklelpadaeafbj).

## Changelog

* 1.5
* Set offline_enabled setting to true in the manifest file to specify that this extension can run offline.

* 1.4
* Updated the paragraph checkbox style to look more like Chrome's UI.

* 1.3
* Added a few additional icons.

* 1.2
* Updated the UI to make it look a little more at home in Chrome.
38 changes: 38 additions & 0 deletions manifest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { defineManifest } from '@crxjs/vite-plugin';
import packageJson from './package.json';

const { version } = packageJson;

// Convert from Semver (example: 0.1.0-beta6)
const [major, minor, patch, label = '0'] = version
// can only contain digits, dots, or dash
.replace(/[^\d.-]+/g, '')
// split into version parts
.split(/[.-]/);

export default defineManifest(async (env) => ({
manifest_version: 3,
name:
env.mode === 'staging'
? '[INTERNAL] DummyText'
: 'DummyText',
// up to four numbers separated by dots
version: `${major}.${minor}.${patch}.${label}`,
// semver is OK in 'version_name'
version_name: version,
description: 'Generates random dummy text (Lorem Ipsum).',
icons: {
16: 'media/icon19.png',
48: 'media/icon48.png',
128: 'media/icon128.png',
},
action: {
default_icon: 'media/icon19.png',
default_popup: 'popup.html',
},
offline_enabled: true,
options_page: 'options.html',
permissions: [
'storage',
],
}));
16 changes: 0 additions & 16 deletions manifest.json

This file was deleted.

File renamed without changes
File renamed without changes
File renamed without changes
95 changes: 0 additions & 95 deletions media/scripts/lipsum.coffee

This file was deleted.

Loading

0 comments on commit 0060d2f

Please sign in to comment.