Skip to content

Commit 36e6eb3

Browse files
committed
clean tree
1 parent 7207951 commit 36e6eb3

File tree

8 files changed

+109
-71
lines changed

8 files changed

+109
-71
lines changed

.github/workflows/automation.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@ name: CI
33
on:
44
push:
55
branches:
6-
- master
6+
- master
77
pull_request:
88
branches:
9-
- master
9+
- master
1010
create:
1111
branches:
12-
- master
12+
- master
1313

1414
jobs:
15-
updateKeyword:
15+
about:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: Checkout
1919
uses: actions/checkout@v2
20-
20+
2121
- name: Jaid/action-sync-node-meta
2222
uses: jaid/action-sync-node-meta@v1.4.0
2323
with:
2424
direction: overwrite-github # default is overwrite-file
2525
githubToken: ${{ secrets.GITHUB }}
26-
27-
ci:
26+
27+
release:
2828
runs-on: ubuntu-latest
2929
steps:
3030
- name: Checkout
@@ -41,27 +41,26 @@ jobs:
4141
@semantic-release/github
4242
env:
4343
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # Auto Changog generator
45-
44+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # Auto Changog generator
45+
4646
docs:
4747
runs-on: ubuntu-latest
4848
steps:
4949
- name: Checkout
5050
uses: actions/checkout@v2
51-
51+
5252
- name: update documentation
5353
uses: CoCreate-app/CoCreate-docs@master
54-
55-
54+
5655
cdn:
5756
runs-on: ubuntu-latest
5857
steps:
5958
- name: Checkout
6059
uses: actions/checkout@v2
61-
60+
6261
- name: upload cdn
6362
uses: CoCreate-app/CoCreate-s3@master
6463
with:
6564
aws-key-id: ${{ secrets.AWSACCESSKEYID }}
6665
aws-access-key: ${{ secrets.AWSSECERTACCESSKEY }}
67-
source: './dist/CoCreate-clone.min.js'
66+
source: "./dist/CoCreate-clone.min.js"

demo/CoCreate-clone.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
</script>
124124

125125
<!-- CoCreateJS -->
126-
<script src="https://server.cocreate.app/js/CoCreate.min.js"></script>
126+
<script src="https://server.cocreate.app/CoCreateJS/dist/CoCreate.js"></script>
127127

128128
<!-- CoCreateCRDT -->
129129
<!--<script src="https://cdn.cocreate.app/CoCreate-crdt.min.js"></script>-->

demo/test.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ <h1 data-pass_value_id="addname1"></h1>
9797
</script>
9898

9999
<!-- CoCreateJS -->
100-
<script src="https://server.cocreate.app/js/CoCreate.min.js"></script>
100+
<script src="https://server.cocreate.app/CoCreateJS/dist/CoCreate.js"></script>
101101
</body>
102102
</html>
103103

dist/CoCreate-clone.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/CoCreate-clone.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@
2121
"html5-framework",
2222
"javascript-framework"
2323
],
24-
"publishConfig": {
25-
"access": "public"
26-
},
24+
"publishConfig": { "access": "public" },
2725
"scripts": {
28-
"start": "npx webpack --config webpack.config.js --watch",
26+
"start": "npx webpack --config webpack.config.js",
2927
"build": "NODE_ENV=production npx webpack --config webpack.config.js",
28+
"dev": "npx webpack --config webpack.config.js --watch",
3029
"docs": "node ./node_modules/@cocreate/docs/src/index.js"
3130
},
3231
"repository": {
@@ -35,22 +34,26 @@
3534
},
3635
"author": "CoCreate LLC",
3736
"license": "MIT",
38-
"bugs": {
39-
"url": "https://github.com/CoCreate-app/CoCreate-clone/issues"
40-
},
37+
"bugs": { "url": "https://github.com/CoCreate-app/CoCreate-clone/issues" },
4138
"homepage": "https://cocreate.app/docs/clone",
39+
"funding": {
40+
"type": "GitHub Sponsors ❤",
41+
"url": "https://github.com/sponsors/CoCreate-app"
42+
},
43+
"main": "./src/index.js",
4244
"devDependencies": {
43-
"@babel/core": "^7.12.10",
44-
"@babel/preset-env": "^7.12.11",
45-
"babel-loader": "^8.2.2",
45+
"@babel/core": "^7.9.6",
46+
"@babel/preset-env": "^7.9.6",
47+
"babel-loader": "^8.1.0",
4648
"clean-webpack-plugin": "^3.0.0",
4749
"html-webpack-plugin": "^4.5.0",
4850
"uglifyjs-webpack-plugin": "^2.2.0",
49-
"webpack": "^5.14.0",
50-
"webpack-cli": "^4.3.1",
51-
"webpack-log": "^3.0.1"
51+
"webpack": "^5.24.4",
52+
"webpack-cli": "^4.5.0",
53+
"webpack-log": "^3.0.1",
54+
"file-loader": "^6.2.0",
55+
"style-loader": "^2.0.0",
56+
"terser-webpack-plugin": "^5.1.1"
5257
},
53-
"dependencies": {
54-
"@cocreate/docs": "^1.0.3"
55-
}
58+
"dependencies": { "@cocreate/docs": "^1.0.3" }
5659
}
File renamed without changes.

webpack.config.js

Lines changed: 66 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,85 @@
1-
const path = require('path');
2-
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
3-
let isProduction = process.env.NODE_ENV === 'production';
1+
const path = require("path")
2+
const TerserPlugin = require("terser-webpack-plugin")
3+
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
4+
let isProduction = process.env.NODE_ENV === "production"
5+
const { CleanWebpackPlugin } = require("clean-webpack-plugin")
46

57
module.exports = {
68
entry: {
7-
'CoCreate-clone': './src/CoCreate-clone.js'
9+
"CoCreate-clone": "./src/index.js",
810
},
911
output: {
10-
path: path.resolve(__dirname, 'dist'),
11-
filename: isProduction ? '[name].min.js' : '[name].js',
12-
libraryTarget: 'umd',
13-
libraryExport: 'default',
14-
library: ['CoCreate', 'clone'],
15-
globalObject: "this"
12+
path: path.resolve(__dirname, "dist"),
13+
filename: isProduction ? "[name].min.js" : "[name].js",
14+
libraryTarget: "umd",
15+
libraryExport: "default",
16+
library: ["CoCreate", "clone"],
17+
globalObject: "this",
18+
// publicPath: 'https://server.cocreate.app/CoCreateJS/dist/'
1619
},
20+
21+
plugins: [
22+
new CleanWebpackPlugin(),
23+
new MiniCssExtractPlugin({
24+
filename: "[name].css",
25+
}),
26+
],
1727
// Default mode for Webpack is production.
1828
// Depending on mode Webpack will apply different things
1929
// on final bundle. For now we don't need production's JavaScript
2030
// minifying and other thing so let's set mode to development
21-
mode: isProduction ? 'production' : 'development',
31+
mode: isProduction ? "production" : "development",
2232
module: {
23-
rules: [{
24-
test: /\.js$/,
25-
exclude: /(node_modules)/,
26-
use: {
27-
loader: 'babel-loader',
28-
options: {
29-
presets: ['@babel/preset-env'],
30-
plugins: ["@babel/plugin-transform-runtime", "@babel/plugin-transform-regenerator"]
31-
32-
}
33-
}
34-
}, ]
33+
rules: [
34+
{
35+
test: /.js$/,
36+
exclude: /(node_modules)/,
37+
use: {
38+
loader: "babel-loader",
39+
options: {
40+
plugins: ["@babel/plugin-transform-modules-commonjs"],
41+
},
42+
},
43+
},
44+
{
45+
test: /.css$/i,
46+
use: [
47+
{ loader: "style-loader", options: { injectType: "linkTag" } },
48+
"file-loader",
49+
],
50+
},
51+
],
3552
},
3653

3754
// add source map
38-
...(isProduction ? {} : { devtool: 'eval-source-map' }),
55+
...(isProduction ? {} : { devtool: "eval-source-map" }),
3956

40-
// add uglifyJs
4157
optimization: {
42-
minimizer: [new UglifyJsPlugin({
43-
uglifyOptions: {
44-
// get options: https://github.com/mishoo/UglifyJS
45-
drop_console: isProduction
58+
minimize: true,
59+
minimizer: [
60+
new TerserPlugin({
61+
extractComments: true,
62+
// cache: true,
63+
parallel: true,
64+
// sourceMap: true, // Must be set to true if using source-maps in production
65+
terserOptions: {
66+
// https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
67+
// extractComments: 'all',
68+
compress: {
69+
drop_console: true,
70+
},
71+
},
72+
}),
73+
],
74+
splitChunks: {
75+
chunks: "all",
76+
minSize: 200,
77+
// maxSize: 99999,
78+
//minChunks: 1,
79+
80+
cacheGroups: {
81+
defaultVendors: false,
4682
},
47-
})],
83+
},
4884
},
4985
}

0 commit comments

Comments
 (0)