diff --git a/.github/workflows/automation.yml b/.github/workflows/automation.yml index 96b7261..26e631b 100644 --- a/.github/workflows/automation.yml +++ b/.github/workflows/automation.yml @@ -3,28 +3,28 @@ name: CI on: push: branches: - - master + - master pull_request: branches: - - master + - master create: branches: - - master + - master jobs: - updateKeyword: + about: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - + - name: Jaid/action-sync-node-meta uses: jaid/action-sync-node-meta@v1.4.0 with: direction: overwrite-github # default is overwrite-file githubToken: ${{ secrets.GITHUB }} - - ci: + + release: runs-on: ubuntu-latest steps: - name: Checkout @@ -41,27 +41,26 @@ jobs: @semantic-release/github env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # Auto Changog generator - + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # Auto Changog generator + docs: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - + - name: update documentation uses: CoCreate-app/CoCreate-docs@master - - + cdn: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - + - name: upload cdn uses: CoCreate-app/CoCreate-s3@master with: aws-key-id: ${{ secrets.AWSACCESSKEYID }} aws-access-key: ${{ secrets.AWSSECERTACCESSKEY }} - source: './dist/CoCreate-google-maps.min.js' \ No newline at end of file + source: "./dist/CoCreate-google-maps.min.js" diff --git a/demo/autocomplete.html b/demo/autocomplete.html index 25fb452..5e62257 100644 --- a/demo/autocomplete.html +++ b/demo/autocomplete.html @@ -177,7 +177,7 @@ organization_Id: '5de0387b12e200ea63204d6c' } - + \ No newline at end of file diff --git a/demo/current-location.html b/demo/current-location.html index 9a9a5b5..571ac48 100644 --- a/demo/current-location.html +++ b/demo/current-location.html @@ -101,7 +101,7 @@ //5ee2eae63e956152355a3446 - + diff --git a/demo/direction.html b/demo/direction.html index 2ad3598..3f745af 100644 --- a/demo/direction.html +++ b/demo/direction.html @@ -177,7 +177,7 @@ organization_Id: '5de0387b12e200ea63204d6c' } - + diff --git a/demo/fleet-tracking.html b/demo/fleet-tracking.html index 643e9ae..1a2c246 100644 --- a/demo/fleet-tracking.html +++ b/demo/fleet-tracking.html @@ -101,7 +101,7 @@ //5ee2eae63e956152355a3446 - + diff --git a/demo/search.html b/demo/search.html index 9375ad9..1c49c1c 100644 --- a/demo/search.html +++ b/demo/search.html @@ -55,7 +55,7 @@ organization_Id: '5de0387b12e200ea63204d6c' } - + diff --git a/package.json b/package.json index 8df773e..672b55d 100644 --- a/package.json +++ b/package.json @@ -2,13 +2,29 @@ "name": "@cocreate/google-maps", "version": "1.0.0", "description": "A simple google-maps component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.", - "keywords": ["google-maps","cocreate","low-code-framework","no-code-framework","cocreatejs","cocreatejs-component","cocreate-framework","no-code","low-code","collaborative-framework","realtime","realtime-framework","collaboration","shared-editing","html5-framework","javascript-framework"], - "publishConfig": { - "access": "public" - }, + "keywords": [ + "google-maps", + "cocreate", + "low-code-framework", + "no-code-framework", + "cocreatejs", + "cocreatejs-component", + "cocreate-framework", + "no-code", + "low-code", + "collaborative-framework", + "realtime", + "realtime-framework", + "collaboration", + "shared-editing", + "html5-framework", + "javascript-framework" + ], + "publishConfig": { "access": "public" }, "scripts": { - "start": "npx webpack --config webpack.config.js --watch", + "start": "npx webpack --config webpack.config.js", "build": "NODE_ENV=production npx webpack --config webpack.config.js", + "dev": "npx webpack --config webpack.config.js --watch", "docs": "node ./node_modules/@cocreate/docs/src/index.js" }, "repository": { @@ -21,19 +37,24 @@ "url": "https://github.com/CoCreate-app/CoCreate-google-maps/issues" }, "homepage": "https://cocreate.app/docs/google-maps", + "funding": { + "type": "GitHub Sponsors ❤", + "url": "https://github.com/sponsors/CoCreate-app" + }, + "main": "./src/index.js", "devDependencies": { - "@babel/core": "^7.12.10", - "@babel/preset-env": "^7.12.11", - "babel-loader": "^8.2.2", + "@babel/core": "^7.9.6", + "@babel/preset-env": "^7.9.6", + "babel-loader": "^8.1.0", "clean-webpack-plugin": "^3.0.0", "html-webpack-plugin": "^4.5.0", "uglifyjs-webpack-plugin": "^2.2.0", - "webpack": "^5.14.0", - "webpack-cli": "^4.3.1", - "webpack-log": "^3.0.1" + "webpack": "^5.24.4", + "webpack-cli": "^4.5.0", + "webpack-log": "^3.0.1", + "file-loader": "^6.2.0", + "style-loader": "^2.0.0", + "terser-webpack-plugin": "^5.1.1" }, - - "dependencies": { - "@cocreate/docs": "^1.0.3" - } + "dependencies": { "@cocreate/docs": "^1.0.3" } } diff --git a/webpack.config.js b/webpack.config.js index e93aa42..354ea1d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,61 +1,85 @@ -// Webpack uses this to work with directories -const path = require('path'); -const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); -// const HtmlWebpackPlugin = require('html-webpack-plugin'); -// const { CleanWebpackPlugin } = require('clean-webpack-plugin'); +const path = require("path") +const TerserPlugin = require("terser-webpack-plugin") +const MiniCssExtractPlugin = require("mini-css-extract-plugin") +let isProduction = process.env.NODE_ENV === "production" +const { CleanWebpackPlugin } = require("clean-webpack-plugin") -let isProduction = process.env.NODE_ENV === 'production'; - -// This is main configuration object. -// Here you write different options and tell Webpack what to do module.exports = { - - // Path to your entry point. From this file Webpack will begin his work entry: { - 'CoCreate-google-maps': './src/CoCreate-google-maps.js', + "CoCreate-google-maps": "./src/index.js", }, - - // Path and filename of your result bundle. - // Webpack will bundle all JavaScript into this file output: { - path: path.resolve(__dirname, 'dist'), - filename: isProduction ? '[name].min.js' : '[name].js', - libraryTarget: 'umd', - libraryExport: 'default', - library: ['CoCreate', 'google-maps'], + path: path.resolve(__dirname, "dist"), + filename: isProduction ? "[name].min.js" : "[name].js", + libraryTarget: "umd", + libraryExport: "default", + library: ["CoCreate", "googleMaps"], globalObject: "this", + // publicPath: 'https://server.cocreate.app/CoCreateJS/dist/' }, + plugins: [ + new CleanWebpackPlugin(), + new MiniCssExtractPlugin({ + filename: "[name].css", + }), + ], // Default mode for Webpack is production. // Depending on mode Webpack will apply different things // on final bundle. For now we don't need production's JavaScript // minifying and other thing so let's set mode to development - mode: isProduction ? 'production' : 'development', + mode: isProduction ? "production" : "development", module: { - rules: [{ - test: /\.js$/, + rules: [ + { + test: /.js$/, exclude: /(node_modules)/, use: { - loader: 'babel-loader', + loader: "babel-loader", options: { - presets: ['@babel/preset-env'] - } - } + plugins: ["@babel/plugin-transform-modules-commonjs"], + }, + }, }, - ] + { + test: /.css$/i, + use: [ + { loader: "style-loader", options: { injectType: "linkTag" } }, + "file-loader", + ], + }, + ], }, // add source map - ...(isProduction ? {} : { devtool: 'eval-source-map' }), + ...(isProduction ? {} : { devtool: "eval-source-map" }), - // add uglifyJs optimization: { - minimizer: [new UglifyJsPlugin({ - uglifyOptions: { - // get options: https://github.com/mishoo/UglifyJS - drop_console: isProduction + minimize: true, + minimizer: [ + new TerserPlugin({ + extractComments: true, + // cache: true, + parallel: true, + // sourceMap: true, // Must be set to true if using source-maps in production + terserOptions: { + // https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions + // extractComments: 'all', + compress: { + drop_console: true, + }, + }, + }), + ], + splitChunks: { + chunks: "all", + minSize: 200, + // maxSize: 99999, + //minChunks: 1, + + cacheGroups: { + defaultVendors: false, }, - })], + }, }, - -}; +}