Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit 2bdceb6

Browse files
committed
Initial commit from Chrome Extension CLI
0 parents  commit 2bdceb6

20 files changed

+2029
-0
lines changed

.editorconfig

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# See https://editorconfig.org for more about editor config.
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Match all files
7+
[*]
8+
charset = utf-8
9+
end_of_line = lf
10+
indent_size = 2
11+
indent_style = space
12+
insert_final_newline = true
13+
max_line_length = 80
14+
trim_trailing_whitespace = true
15+
16+
# Markdown files
17+
[*.md]
18+
max_line_length = 0
19+
trim_trailing_whitespace = false

.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
6+
# production
7+
/build
8+
9+
# misc
10+
.DS_Store
11+
12+
npm-debug.log*

.prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# See https://prettier.io/docs/en/ignore.html for more about ignoring files from Prettier.
2+
3+
# Ignore artifacts:
4+
build

.prettierrc

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "es5",
4+
"bracketSpacing": true,
5+
"bracketSameLine": false,
6+
"arrowParens": "always",
7+
"htmlWhitespaceSensitivity": "css",
8+
"insertPragma": false,
9+
"semi": true
10+
}

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# <img src="public/icons/icon_48.png" width="45" align="left"> Hektcaptcha Extension
2+
3+
My Chrome Extension
4+
5+
## Features
6+
7+
- Feature 1
8+
- Feature 2
9+
10+
## Install
11+
12+
[**Chrome** extension]() <!-- TODO: Add chrome extension link inside parenthesis -->
13+
14+
## Contribution
15+
16+
Suggestions and pull requests are welcomed!.
17+
18+
---
19+
20+
This project was bootstrapped with [Chrome Extension CLI](https://github.com/dutiyesh/chrome-extension-cli)
21+

config/paths.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict';
2+
3+
const path = require('path');
4+
5+
const PATHS = {
6+
src: path.resolve(__dirname, '../src'),
7+
build: path.resolve(__dirname, '../build'),
8+
};
9+
10+
module.exports = PATHS;

config/webpack.common.js

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
'use strict';
2+
3+
const CopyWebpackPlugin = require('copy-webpack-plugin');
4+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
5+
6+
const PATHS = require('./paths');
7+
8+
// used in the module rules and in the stats exlude list
9+
const IMAGE_TYPES = /\.(png|jpe?g|gif|svg)$/i;
10+
11+
// To re-use webpack configuration across templates,
12+
// CLI maintains a common webpack configuration file - `webpack.common.js`.
13+
// Whenever user creates an extension, CLI adds `webpack.common.js` file
14+
// in template's `config` folder
15+
const common = {
16+
output: {
17+
// the build folder to output bundles and assets in.
18+
path: PATHS.build,
19+
// the filename template for entry chunks
20+
filename: '[name].js',
21+
},
22+
stats: {
23+
all: false,
24+
errors: true,
25+
builtAt: true,
26+
assets: true,
27+
excludeAssets: [IMAGE_TYPES],
28+
},
29+
module: {
30+
rules: [
31+
// Help webpack in understanding CSS files imported in .js files
32+
{
33+
test: /\.css$/,
34+
use: [MiniCssExtractPlugin.loader, 'css-loader'],
35+
},
36+
// Check for images imported in .js files and
37+
{
38+
test: IMAGE_TYPES,
39+
use: [
40+
{
41+
loader: 'file-loader',
42+
options: {
43+
outputPath: 'images',
44+
name: '[name].[ext]',
45+
},
46+
},
47+
],
48+
},
49+
],
50+
},
51+
plugins: [
52+
// Copy static assets from `public` folder to `build` folder
53+
new CopyWebpackPlugin({
54+
patterns: [
55+
{
56+
from: '**/*',
57+
context: 'public',
58+
},
59+
],
60+
}),
61+
// Extract CSS into separate files
62+
new MiniCssExtractPlugin({
63+
filename: '[name].css',
64+
}),
65+
],
66+
};
67+
68+
module.exports = common;

config/webpack.config.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'use strict';
2+
3+
const { merge } = require('webpack-merge');
4+
5+
const common = require('./webpack.common.js');
6+
const PATHS = require('./paths');
7+
8+
// Merge webpack configuration files
9+
const config = (env, argv) =>
10+
merge(common, {
11+
entry: {
12+
popup: PATHS.src + '/popup.js',
13+
contentScript: PATHS.src + '/contentScript.js',
14+
background: PATHS.src + '/background.js',
15+
},
16+
devtool: argv.mode === 'production' ? false : 'source-map',
17+
});
18+
19+
module.exports = config;

0 commit comments

Comments
 (0)