Skip to content

Commit

Permalink
Merge pull request #4 from Patternslib/depend-dev
Browse files Browse the repository at this point in the history
Depend dev
  • Loading branch information
thet authored Jun 15, 2022
2 parents 6053047 + 86ce0f3 commit a51da95
Show file tree
Hide file tree
Showing 17 changed files with 10,003 additions and 168 deletions.
11 changes: 0 additions & 11 deletions .commitlintrc.json

This file was deleted.

25 changes: 1 addition & 24 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,24 +1 @@
module.exports = {
extends: ["eslint:recommended", "prettier"],
root: true,
env: {
es6: "true",
browser: true,
node: true,
jest: true,
},
parser: "@babel/eslint-parser",
ignorePatterns: [],
rules: {
"no-debugger": 1,
"no-duplicate-imports": 1,
// Do keep due avoid unintendet consequences.
"no-alert": 0,
"no-control-regex": 0,
"no-self-assign": 0,
"no-useless-escape": 0,
},
globals: {
spyOn: true, // eventually replace with jest.spyOn and then fix a ton of test failures.
},
};
module.exports = require("@patternslib/dev/.eslintrc.js");
12 changes: 7 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ jobs:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14'
- run: npm install yarn
- run: make check
node-version: '16'
cache: 'yarn'
- run: |
make install
make check
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ node_modules/
stamp-yarn
stats.json
yarn-error.log
yarn.lock
5 changes: 0 additions & 5 deletions .prettierrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .release-it.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require("@patternslib/patternslib/.release-it.js");
module.exports = require("@patternslib/dev/.release-it.js");
78 changes: 20 additions & 58 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,68 +1,30 @@
-include .env
export

ESLINT ?= npx eslint
YARN ?= npx yarn


stamp-yarn:
$(YARN) install
# Install pre commit hook
$(YARN) husky install
touch stamp-yarn


clean-dist:
rm -Rf dist/


.PHONY: clean
clean: clean-dist
rm -f stamp-yarn
rm -Rf node_modules/
##############
## Please note
##############

# First, run ``make install``.
# After that you have through Makefile extension all the other base targets available.

eslint: stamp-yarn
$(ESLINT) ./src
# If you want to release on GitHub, make sure to have a .env file with a GITHUB_TOKEN.
# Also see:
# https://github.com/settings/tokens
# and https://github.com/release-it/release-it/blob/master/docs/github-releases.md#automated


.PHONY: check
check:: stamp-yarn eslint
$(YARN) run test
# Include base Makefile
-include node_modules/@patternslib/dev/Makefile


.PHONY: bundle
bundle: stamp-yarn
$(YARN) run build


.PHONY: release-major
release-major: check
npx release-it major --dry-run --ci && \
npx release-it major --ci && \
npx release-it --github.release --github.update --no-github.draft --no-increment --no-git --no-npm --ci && \
git checkout CHANGES.md


.PHONY: release-minor
release-minor: check
npx release-it minor --dry-run --ci && \
npx release-it minor --ci && \
npx release-it --github.release --github.update --no-github.draft --no-increment --no-git --no-npm --ci && \
git checkout CHANGES.md


.PHONY: release-patch
release-patch: check
npx release-it patch --dry-run --ci && \
npx release-it patch --ci && \
npx release-it --github.release --github.update --no-github.draft --no-increment --no-git --no-npm --ci && \
git checkout CHANGES.md
# Define the GITHUB_TOKEN in the .env file for usage with release-it.
-include .env
export


.PHONY: serve
serve:: stamp-yarn
$(YARN) run start
.PHONY: install
stamp-yarn install:
npx yarn install
# Install pre commit hook
npx yarn husky install
touch stamp-yarn


#
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require("@patternslib/patternslib/babel.config.js");
module.exports = require("@patternslib/dev/babel.config.js");
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@patternslib/dev/commitlint.config.js");
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Webpack entry point for module federation.
import "@patternslib/patternslib/webpack/module_federation";
// The next import needs to be kept with brackets, otherwise we get this error:
// "Shared module is not available for eager consumption."
import("./bundle-config");
14 changes: 1 addition & 13 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1 @@
module.exports = {
rootDir: "./src",
setupFilesAfterEnv: ["<rootDir>/setupTests.js"],
watchPlugins: ["jest-watch-typeahead/filename", "jest-watch-typeahead/testname"],
transform: {
"^.+\\.[t|j]sx?$": "babel-jest",
},
moduleNameMapper: {
"\\.(css|less|sass|scss)$": "identity-obj-proxy",
},
testEnvironment: "jsdom",
transformIgnorePatterns: ["/node_modules/(?!.*patternslib/*).+\\.[t|j]sx?$"],
};
module.exports = require("@patternslib/dev/jest.config.js");
46 changes: 9 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,18 @@
"license": "MIT",
"main": "./src/pat-resourcepolling.js",
"dependencies": {
"@patternslib/patternslib": "^6.0.1"
"jquery": "^3.6.0"
},
"peerDependencies": {
"@patternslib/patternslib": "*"
},
"devDependencies": {
"@babel/core": "^7.16.0",
"@babel/eslint-parser": "^7.16.3",
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
"@babel/preset-env": "^7.16.0",
"@commitlint/cli": "^15.0.0",
"@commitlint/config-conventional": "^15.0.0",
"@release-it/conventional-changelog": "^3.3.0",
"@testing-library/jest-dom": "^5.15.0",
"babel-loader": "^8.2.3",
"copy-webpack-plugin": "^10.0.0",
"core-js": "3.19.1",
"css-loader": "^6.5.0",
"eslint": "^8.2.0",
"eslint-config-prettier": "^8.3.0",
"expose-loader": "^3.0.0",
"husky": "^7.0.4",
"identity-obj-proxy": "^3.0.0",
"imports-loader": "^3.1.0",
"inspectpack": "^4.7.1",
"jest": "^27.3.1",
"jest-watch-typeahead": "^1.0.0",
"prettier": "^2.4.1",
"regenerator-runtime": "^0.13.9",
"release-it": "^14.11.7",
"sass": "^1.43.4",
"sass-loader": "^12.3.0",
"style-loader": "^3.3.0",
"terser-webpack-plugin": "^5.2.5",
"timezone-mock": "^1.2.2",
"webpack": "^5.64.1",
"webpack-bundle-analyzer": "^4.4.2",
"webpack-cli": "^4.9.1",
"webpack-dev-server": "^4.5.0",
"webpack-modernizr-loader": "^5.0.0",
"whybundled": "^2.0.0",
"yarn": "^1.22.17"
"@patternslib/dev": "^2.0.0"
},
"scripts": {
"start": "NODE_ENV=development webpack serve --config webpack.config.js",
"build": "NODE_ENV=production webpack --config webpack.config.js",
"build:dev": "NODE_ENV=development webpack --config webpack.config.js",
"build:stats": "NODE_ENV=production webpack --config webpack.config.js --json > stats.json",
"test": "jest"
},
Expand All @@ -58,6 +27,9 @@
"not op_mini all"
]
},
"keywords": [
"patternslib"
],
"publishConfig": {
"access": "public"
},
Expand Down
1 change: 1 addition & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@patternslib/dev/prettier.config.js");
1 change: 0 additions & 1 deletion src/pat-resourcepolling.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import "regenerator-runtime/runtime"; // needed for ``await`` support
import pattern from "./pat-resourcepolling";

describe("pat-resourcepolling", () => {
Expand Down
9 changes: 0 additions & 9 deletions src/setupTests.js

This file was deleted.

13 changes: 11 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
process.traceDeprecation = true;
const mf_config = require("@patternslib/dev/webpack/webpack.mf");
const package_json = require("./package.json");
const path = require("path");
const patternslib_config = require("@patternslib/patternslib/webpack/webpack.config.js");
const patternslib_config = require("@patternslib/dev/webpack/webpack.config.js");

module.exports = async (env, argv) => {
let config = {
entry: {
bundle: path.resolve(__dirname, "bundle-config.js"),
"bundle.min": path.resolve(__dirname, "index.js"),
},
};

config = patternslib_config(env, argv, config);
config.output.path = path.resolve(__dirname, "dist/");

config.plugins.push(
mf_config({
package_json: package_json,
remote_entry: config.entry["bundle.min"],
})
);

if (process.env.NODE_ENV === "development") {
config.devServer.static.directory = __dirname;
}
Expand Down
Loading

0 comments on commit a51da95

Please sign in to comment.