Skip to content

Commit

Permalink
Merge pull request #12 from guocaoyi/feat/v0.8
Browse files Browse the repository at this point in the history
merge(0.8.1): merge feat/v0.8 to origin main
  • Loading branch information
guocaoyi authored Sep 9, 2022
2 parents 767c21a + 306acb6 commit a8077fa
Show file tree
Hide file tree
Showing 28 changed files with 358 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pnpm-lock.yaml
build
types
index.js
!**/index.js

# ignore ide settings
.idea
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ Summary
5. version timestamp follow the yyyy.MM.dd format
```

## 0.8.1 [2022.09.09]

- docs: add zn_CN readme

## 0.8.0 [2022.09.05]

- remove: qwik framework boilerplate
Expand Down
4 changes: 3 additions & 1 deletion README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@

> Chrome 插件生成器,支持多种框架模板!
- 🚀 迅速的热更能力(采用 [Vite2](https://vitejs.dev))
- 🚀 敏捷的热更能力(采用 [Vite2](https://vitejs.dev))
- 🥡 开箱即用
- 🌈 多种前端框架支撑 (9+)
- 🥢 支撑 TypeScript 以及 JavaScript
- 🌗 明亮以及暗黑模式

[EN](./README.md) · [中文](./README_zh.md)

## 安装

> Node >= 14.18.0
Expand Down
3 changes: 3 additions & 0 deletions bin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node

import './index.js'
3 changes: 0 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env node

// @ts-check
import * as fs from 'fs'
import * as path from 'path'
import minimist from 'minimist'
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "create-chrome-ext",
"version": "0.8.0",
"version": "0.8.1",
"type": "module",
"description": "Scaffolding your chrome extension, multiple boilerplates supported!",
"author": "yalda",
"license": "MIT",
"main": "index.js",
"main": "bin.js",
"bin": {
"create-chrome-ext": "index.js",
"crx": "index.js"
Expand Down
36 changes: 36 additions & 0 deletions template-stencil-js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "chrome-extension-stencil-js",
"version": "0.0.0",
"author": "",
"description": "",
"type": "module",
"license": "MIT",
"keywords": [
"chrome-extension",
"stencil",
"vite",
"create-chrome-ext"
],
"engines": {
"node": ">=14.18.0"
},
"scripts": {
"s:build": "stencil build",
"s:start": "stencil build --dev --watch --serve",
"s:test": "stencil test --spec --e2e",
"s:test.watch": "stencil test --spec --e2e --watchAll",
"s:generate": "stencil generate",
"dev": "vite",
"build": "vite build",
"build.client": "vite build --outDir server/public",
"preview": "vite preview",
"fmt": "prettier --write '**/*.{jsx,js,json,css,md}'"
},
"devDependencies": {
"@crxjs/vite-plugin": "^1.0.12",
"@stencil/core": "2.13.0",
"express": "4.17.2",
"prettier": "^2.7.1",
"vite": "^2.9.13"
}
}
Binary file added template-stencil-js/public/icons/logo.ico
Binary file not shown.
2 changes: 2 additions & 0 deletions template-stencil-js/public/icons/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added template-stencil-js/public/img/logo-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added template-stencil-js/public/img/logo-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added template-stencil-js/public/img/logo-34.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added template-stencil-js/public/img/logo-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added template-stencil-js/src/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions template-stencil-js/src/background/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
console.info('chrome-ext template-stencil-js background script')

export {}
33 changes: 33 additions & 0 deletions template-stencil-js/src/components/app-options/app-options.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
main {
text-align: center;
padding: 1em;
margin: 0 auto;
}

h3 {
color: #673ab8;
text-transform: uppercase;
font-size: 1.5rem;
font-weight: 200;
line-height: 1.2rem;
margin: 2rem auto;
}

h6 {
font-size: 0.5rem;
color: #333333;
margin: 0.5rem;
}

a {
font-size: 0.5rem;
margin: 0.5rem;
color: #cccccc;
text-decoration: none;
}

@media (min-width: 480px) {
h3 {
max-width: none;
}
}
25 changes: 25 additions & 0 deletions template-stencil-js/src/components/app-options/app-options.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Component, Prop, h } from '@stencil/core'

@Component({
tag: 'app-options',
styleUrl: 'app-options.css',
})
export class AppOptions {
@Prop() crx: string = ''

render() {
return (
<main>
<h3>Options Page!</h3>

<h6>v 0.0.0</h6>

<a href="https://www.npmjs.com/package/create-chrome-ext" target="_blank">
Power by {this.crx}
</a>
</main>
)
}
}

export default AppOptions
33 changes: 33 additions & 0 deletions template-stencil-js/src/components/app-popup/app-popup.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
main {
text-align: center;
padding: 1em;
margin: 0 auto;
}

h3 {
color: #673ab8;
text-transform: uppercase;
font-size: 1.5rem;
font-weight: 200;
line-height: 1.2rem;
margin: 2rem auto;
}

h6 {
font-size: 0.5rem;
color: #333333;
margin: 0.5rem;
}

a {
font-size: 0.5rem;
margin: 0.5rem;
color: #cccccc;
text-decoration: none;
}

@media (min-width: 480px) {
h3 {
max-width: none;
}
}
25 changes: 25 additions & 0 deletions template-stencil-js/src/components/app-popup/app-popup.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Component, Prop, h } from '@stencil/core'

@Component({
tag: 'app-popup',
styleUrl: 'app-popup.css',
})
export class AppPopup {
@Prop() crx: string = ''

render() {
return (
<main>
<h3>Popup Page!</h3>

<h6>v 0.0.0</h6>

<a href="https://www.npmjs.com/package/create-chrome-ext" target="_blank">
Power by {this.crx}
</a>
</main>
)
}
}

export default AppPopup
3 changes: 3 additions & 0 deletions template-stencil-js/src/content/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
console.info('chrome-ext template-stencil-js content script')

export {}
45 changes: 45 additions & 0 deletions template-stencil-js/src/global/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
Global App CSS
----------------------
Use this file for styles that should be applied to all components.
For example, "font-family" within the "body" selector is a CSS property
most apps will want applied to all components.
Any global CSS variables should also be applied here.
*/

:root {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
'Open Sans', 'Helvetica Neue', sans-serif;
font-size: 16px;
line-height: 24px;
font-weight: 400;

color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;

font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}

@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
}

body {
min-width: 20rem;
margin: 0px;
padding: 0px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif,
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
}
7 changes: 7 additions & 0 deletions template-stencil-js/src/global/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default async () => {
/**
* The code to be executed should be placed within a default function that is
* exported by the global script. Ensure all of the code in the global script
* is wrapped in the function() that is exported.
*/
};
2 changes: 2 additions & 0 deletions template-stencil-js/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { Components, JSX } from './components';
import '@stencil-community/router';
36 changes: 36 additions & 0 deletions template-stencil-js/src/manifest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { defineManifest } from '@crxjs/vite-plugin'

export default defineManifest({
name: 'create-chrome-ext',
description: '',
version: '0.0.0',
manifest_version: 3,
icons: {
16: 'img/logo-16.png',
32: 'img/logo-34.png',
48: 'img/logo-48.png',
128: 'img/logo-128.png',
},
action: {
default_popup: 'popup.html',
default_icon: 'img/logo-48.png',
},
options_page: 'options.html',
background: {
service_worker: 'src/background/index.js',
type: 'module',
},
content_scripts: [
{
matches: ['http://*/*', 'https://*/*'],
js: ['src/content/index.js'],
},
],
web_accessible_resources: [
{
resources: ['img/logo-16.png', 'img/logo-34.png', 'img/logo-48.png', 'img/logo-128.png'],
matches: [],
},
],
permissions: [],
})
18 changes: 18 additions & 0 deletions template-stencil-js/src/options.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/icons/logo.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Chrome Extensioin + Stencil + JS + Vite App - Options</title>

<script type="module" src="/build/app.esm.js"></script>
<script nomodule src="/build/app.js"></script>
<link href="/build/app.css" rel="stylesheet" />

<link rel="manifest" href="/manifest.json" />
</head>
<body>
<comp-options crx="create-chrome-ext"></comp-options>
</body>
</html>
19 changes: 19 additions & 0 deletions template-stencil-js/src/popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/icon/logo.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Chrome Extensioin + Popup + JS + Vite App - Popup</title>

<script type="module" src="/build/app.esm.js"></script>
<script nomodule src="/build/app.js"></script>
<link href="/build/app.css" rel="stylesheet" />

<link rel="manifest" href="/manifest.json" />
</head>
<body>
<comp-popup crx="create-chrome-ext"></comp-popup>
<script type="module" src="/src/popup/index.jsx"></script>
</body>
</html>
Loading

0 comments on commit a8077fa

Please sign in to comment.