Skip to content

Commit a8077fa

Browse files
authored
Merge pull request #12 from guocaoyi/feat/v0.8
merge(0.8.1): merge feat/v0.8 to origin main
2 parents 767c21a + 306acb6 commit a8077fa

28 files changed

+358
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pnpm-lock.yaml
1515
build
1616
types
1717
index.js
18+
!**/index.js
1819

1920
# ignore ide settings
2021
.idea

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ Summary
99
5. version timestamp follow the yyyy.MM.dd format
1010
```
1111

12+
## 0.8.1 [2022.09.09]
13+
14+
- docs: add zn_CN readme
15+
1216
## 0.8.0 [2022.09.05]
1317

1418
- remove: qwik framework boilerplate

README_zh.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010

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

19+
[EN](./README.md) · [中文](./README_zh.md)
20+
1921
## 安装
2022

2123
> Node >= 14.18.0

bin.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env node
2+
3+
import './index.js'

index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#!/usr/bin/env node
2-
3-
// @ts-check
41
import * as fs from 'fs'
52
import * as path from 'path'
63
import minimist from 'minimist'

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "create-chrome-ext",
3-
"version": "0.8.0",
3+
"version": "0.8.1",
44
"type": "module",
55
"description": "Scaffolding your chrome extension, multiple boilerplates supported!",
66
"author": "yalda",
77
"license": "MIT",
8-
"main": "index.js",
8+
"main": "bin.js",
99
"bin": {
1010
"create-chrome-ext": "index.js",
1111
"crx": "index.js"

template-stencil-js/package.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "chrome-extension-stencil-js",
3+
"version": "0.0.0",
4+
"author": "",
5+
"description": "",
6+
"type": "module",
7+
"license": "MIT",
8+
"keywords": [
9+
"chrome-extension",
10+
"stencil",
11+
"vite",
12+
"create-chrome-ext"
13+
],
14+
"engines": {
15+
"node": ">=14.18.0"
16+
},
17+
"scripts": {
18+
"s:build": "stencil build",
19+
"s:start": "stencil build --dev --watch --serve",
20+
"s:test": "stencil test --spec --e2e",
21+
"s:test.watch": "stencil test --spec --e2e --watchAll",
22+
"s:generate": "stencil generate",
23+
"dev": "vite",
24+
"build": "vite build",
25+
"build.client": "vite build --outDir server/public",
26+
"preview": "vite preview",
27+
"fmt": "prettier --write '**/*.{jsx,js,json,css,md}'"
28+
},
29+
"devDependencies": {
30+
"@crxjs/vite-plugin": "^1.0.12",
31+
"@stencil/core": "2.13.0",
32+
"express": "4.17.2",
33+
"prettier": "^2.7.1",
34+
"vite": "^2.9.13"
35+
}
36+
}
4.18 KB
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Loading
3.01 KB
Loading
449 Bytes
Loading
827 Bytes
Loading
1.21 KB
Loading
7.73 KB
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
console.info('chrome-ext template-stencil-js background script')
2+
3+
export {}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
main {
2+
text-align: center;
3+
padding: 1em;
4+
margin: 0 auto;
5+
}
6+
7+
h3 {
8+
color: #673ab8;
9+
text-transform: uppercase;
10+
font-size: 1.5rem;
11+
font-weight: 200;
12+
line-height: 1.2rem;
13+
margin: 2rem auto;
14+
}
15+
16+
h6 {
17+
font-size: 0.5rem;
18+
color: #333333;
19+
margin: 0.5rem;
20+
}
21+
22+
a {
23+
font-size: 0.5rem;
24+
margin: 0.5rem;
25+
color: #cccccc;
26+
text-decoration: none;
27+
}
28+
29+
@media (min-width: 480px) {
30+
h3 {
31+
max-width: none;
32+
}
33+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Component, Prop, h } from '@stencil/core'
2+
3+
@Component({
4+
tag: 'app-options',
5+
styleUrl: 'app-options.css',
6+
})
7+
export class AppOptions {
8+
@Prop() crx: string = ''
9+
10+
render() {
11+
return (
12+
<main>
13+
<h3>Options Page!</h3>
14+
15+
<h6>v 0.0.0</h6>
16+
17+
<a href="https://www.npmjs.com/package/create-chrome-ext" target="_blank">
18+
Power by {this.crx}
19+
</a>
20+
</main>
21+
)
22+
}
23+
}
24+
25+
export default AppOptions
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
main {
2+
text-align: center;
3+
padding: 1em;
4+
margin: 0 auto;
5+
}
6+
7+
h3 {
8+
color: #673ab8;
9+
text-transform: uppercase;
10+
font-size: 1.5rem;
11+
font-weight: 200;
12+
line-height: 1.2rem;
13+
margin: 2rem auto;
14+
}
15+
16+
h6 {
17+
font-size: 0.5rem;
18+
color: #333333;
19+
margin: 0.5rem;
20+
}
21+
22+
a {
23+
font-size: 0.5rem;
24+
margin: 0.5rem;
25+
color: #cccccc;
26+
text-decoration: none;
27+
}
28+
29+
@media (min-width: 480px) {
30+
h3 {
31+
max-width: none;
32+
}
33+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Component, Prop, h } from '@stencil/core'
2+
3+
@Component({
4+
tag: 'app-popup',
5+
styleUrl: 'app-popup.css',
6+
})
7+
export class AppPopup {
8+
@Prop() crx: string = ''
9+
10+
render() {
11+
return (
12+
<main>
13+
<h3>Popup Page!</h3>
14+
15+
<h6>v 0.0.0</h6>
16+
17+
<a href="https://www.npmjs.com/package/create-chrome-ext" target="_blank">
18+
Power by {this.crx}
19+
</a>
20+
</main>
21+
)
22+
}
23+
}
24+
25+
export default AppPopup
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
console.info('chrome-ext template-stencil-js content script')
2+
3+
export {}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
Global App CSS
3+
----------------------
4+
Use this file for styles that should be applied to all components.
5+
For example, "font-family" within the "body" selector is a CSS property
6+
most apps will want applied to all components.
7+
8+
Any global CSS variables should also be applied here.
9+
*/
10+
11+
:root {
12+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
13+
'Open Sans', 'Helvetica Neue', sans-serif;
14+
font-size: 16px;
15+
line-height: 24px;
16+
font-weight: 400;
17+
18+
color-scheme: light dark;
19+
color: rgba(255, 255, 255, 0.87);
20+
background-color: #242424;
21+
22+
font-synthesis: none;
23+
text-rendering: optimizeLegibility;
24+
-webkit-font-smoothing: antialiased;
25+
-moz-osx-font-smoothing: grayscale;
26+
-webkit-text-size-adjust: 100%;
27+
}
28+
29+
@media (prefers-color-scheme: light) {
30+
:root {
31+
color: #213547;
32+
background-color: #ffffff;
33+
}
34+
a:hover {
35+
color: #747bff;
36+
}
37+
}
38+
39+
body {
40+
min-width: 20rem;
41+
margin: 0px;
42+
padding: 0px;
43+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif,
44+
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
45+
}

template-stencil-js/src/global/app.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default async () => {
2+
/**
3+
* The code to be executed should be placed within a default function that is
4+
* exported by the global script. Ensure all of the code in the global script
5+
* is wrapped in the function() that is exported.
6+
*/
7+
};

template-stencil-js/src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { Components, JSX } from './components';
2+
import '@stencil-community/router';

template-stencil-js/src/manifest.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { defineManifest } from '@crxjs/vite-plugin'
2+
3+
export default defineManifest({
4+
name: 'create-chrome-ext',
5+
description: '',
6+
version: '0.0.0',
7+
manifest_version: 3,
8+
icons: {
9+
16: 'img/logo-16.png',
10+
32: 'img/logo-34.png',
11+
48: 'img/logo-48.png',
12+
128: 'img/logo-128.png',
13+
},
14+
action: {
15+
default_popup: 'popup.html',
16+
default_icon: 'img/logo-48.png',
17+
},
18+
options_page: 'options.html',
19+
background: {
20+
service_worker: 'src/background/index.js',
21+
type: 'module',
22+
},
23+
content_scripts: [
24+
{
25+
matches: ['http://*/*', 'https://*/*'],
26+
js: ['src/content/index.js'],
27+
},
28+
],
29+
web_accessible_resources: [
30+
{
31+
resources: ['img/logo-16.png', 'img/logo-34.png', 'img/logo-48.png', 'img/logo-128.png'],
32+
matches: [],
33+
},
34+
],
35+
permissions: [],
36+
})

template-stencil-js/src/options.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" href="/icons/logo.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Chrome Extensioin + Stencil + JS + Vite App - Options</title>
8+
9+
<script type="module" src="/build/app.esm.js"></script>
10+
<script nomodule src="/build/app.js"></script>
11+
<link href="/build/app.css" rel="stylesheet" />
12+
13+
<link rel="manifest" href="/manifest.json" />
14+
</head>
15+
<body>
16+
<comp-options crx="create-chrome-ext"></comp-options>
17+
</body>
18+
</html>

template-stencil-js/src/popup.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" href="/icon/logo.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Chrome Extensioin + Popup + JS + Vite App - Popup</title>
8+
9+
<script type="module" src="/build/app.esm.js"></script>
10+
<script nomodule src="/build/app.js"></script>
11+
<link href="/build/app.css" rel="stylesheet" />
12+
13+
<link rel="manifest" href="/manifest.json" />
14+
</head>
15+
<body>
16+
<comp-popup crx="create-chrome-ext"></comp-popup>
17+
<script type="module" src="/src/popup/index.jsx"></script>
18+
</body>
19+
</html>

0 commit comments

Comments
 (0)