Skip to content

Commit 3c23759

Browse files
LightLight
Light
authored and
Light
committed
feat(all): implement basic functions
1 parent 8d4984d commit 3c23759

23 files changed

+7033
-1138
lines changed

.cz-config.js

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
'use strict';
2+
3+
module.exports = {
4+
types: [
5+
{ value: 'feat', name: 'feat: A new feature' },
6+
{ value: 'fix', name: 'fix: A bug fix' },
7+
{ value: 'docs', name: 'docs: Documentation only changes' },
8+
{
9+
value: 'style',
10+
name: 'style: Changes that do not affect the meaning of the code\n (white-space, formatting, missing semi-colons, etc)',
11+
},
12+
{
13+
value: 'refactor',
14+
name: 'refactor: A code change that neither fixes a bug nor adds a feature',
15+
},
16+
{
17+
value: 'perf',
18+
name: 'perf: A code change that improves performance',
19+
},
20+
{ value: 'test', name: 'test: Adding missing tests' },
21+
{
22+
value: 'chore',
23+
name: 'chore: Changes to the build process or auxiliary tools\n and libraries such as documentation generation',
24+
},
25+
{ value: 'revert', name: 'revert: Revert to a commit' },
26+
{ value: 'build', name: 'build: Change project builds or external dependencies' },
27+
],
28+
// override the messages, defaults are as follows
29+
messages: {
30+
type: "Select the type of change that you're committing:",
31+
scope: '\nDenote the SCOPE of this change (optional):',
32+
// used if allowCustomScopes is true
33+
customScope: 'Denote the SCOPE of this change:',
34+
subject: 'Write a SHORT, IMPERATIVE tense description of the change:\n',
35+
body: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n',
36+
breaking: 'List any BREAKING CHANGES (optional):\n',
37+
footer: 'List any ISSUES CLOSED by this change (optional). E.g.: #31, #34:\n',
38+
confirmCommit: 'Are you sure you want to proceed with the commit above?',
39+
},
40+
41+
allowCustomScopes: true,
42+
allowBreakingChanges: ['feat', 'fix'],
43+
44+
// limit subject length
45+
subjectLimit: 100,
46+
};

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33

44
# production
55
/build
6+
/archive
67

78
# misc
89
.DS_Store
910

1011
npm-debug.log*
12+
jsconfig.json
13+
size-plugin.json

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Light
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

commitlint.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
rules: {
4+
'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'style', 'refactor', 'perf', 'test', 'chore', 'revert', 'build']],
5+
'subject-case': [0],
6+
},
7+
};

config/paths.js

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const path = require('path');
55
const PATHS = {
66
src: path.resolve(__dirname, '../src'),
77
build: path.resolve(__dirname, '../build'),
8+
archive: path.resolve(__dirname, '../archive'),
89
};
910

1011
module.exports = PATHS;

config/webpack.common.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
const SizePlugin = require('size-plugin');
44
const CopyWebpackPlugin = require('copy-webpack-plugin');
5+
const ZipWebpackPlugin = require('zip-webpack-plugin');
56
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
7+
const packageInfo = require('../package.json');
68

79
const PATHS = require('./paths');
10+
const DEV = process.env.NODE_ENV === 'development';
811

912
// To re-use webpack configuration across templates,
1013
// CLI maintains a common webpack configuration file - `webpack.common.js`.
@@ -17,7 +20,7 @@ const common = {
1720
// the filename template for entry chunks
1821
filename: '[name].js',
1922
},
20-
devtool: 'source-map',
23+
devtool: DEV ? 'source-map' : 'none',
2124
stats: {
2225
all: false,
2326
errors: true,
@@ -55,12 +58,18 @@ const common = {
5558
from: '**/*',
5659
context: 'public',
5760
},
58-
]
61+
],
5962
}),
6063
// Extract CSS into separate files
6164
new MiniCssExtractPlugin({
6265
filename: '[name].css',
6366
}),
67+
DEV
68+
? null
69+
: new ZipWebpackPlugin({
70+
path: PATHS.archive,
71+
filename: `${packageInfo.name}_v${packageInfo.version}.zip`,
72+
}),
6473
],
6574
};
6675

config/webpack.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const PATHS = require('./paths');
88
// Merge webpack configuration files
99
const config = merge(common, {
1010
entry: {
11-
popup: PATHS.src + '/popup.js',
12-
contentScript: PATHS.src + '/contentScript.js',
11+
// popup: PATHS.src + '/popup.js',
12+
// contentScript: PATHS.src + '/contentScript.js',
1313
background: PATHS.src + '/background.js',
1414
},
1515
});

0 commit comments

Comments
 (0)