Skip to content

Commit a4fa573

Browse files
authored
Merge pull request #11 from Patternslib/depend-dev
Depend dev
2 parents b23cc23 + 0bf2b95 commit a4fa573

18 files changed

+10160
-177
lines changed

.commitlintrc.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

.eslintrc.js

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1 @@
1-
module.exports = {
2-
extends: ["eslint:recommended", "prettier"],
3-
root: true,
4-
env: {
5-
es6: "true",
6-
browser: true,
7-
node: true,
8-
jest: true,
9-
},
10-
parser: "@babel/eslint-parser",
11-
ignorePatterns: [],
12-
rules: {
13-
"no-debugger": 1,
14-
"no-duplicate-imports": 1,
15-
// Do keep due avoid unintendet consequences.
16-
"no-alert": 0,
17-
"no-control-regex": 0,
18-
"no-self-assign": 0,
19-
"no-useless-escape": 0,
20-
},
21-
globals: {
22-
spyOn: true, // eventually replace with jest.spyOn and then fix a ton of test failures.
23-
},
24-
};
1+
module.exports = require("@patternslib/dev/.eslintrc.js");

.github/workflows/test.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ jobs:
1111
name: test
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
15-
- uses: actions/setup-node@v1
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-node@v3
1616
with:
17-
node-version: '14'
18-
- run: npm install yarn
19-
- run: make check
17+
node-version: '16'
18+
cache: 'yarn'
19+
- run: |
20+
make install
21+
make check

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ node_modules/
55
stamp-yarn
66
stats.json
77
yarn-error.log
8-
yarn.lock

.prettierrc.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

.release-it.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = require("@patternslib/patternslib/.release-it.js");
1+
module.exports = require("@patternslib/dev/.release-it.js");

Makefile

Lines changed: 20 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,30 @@
1-
-include .env
2-
export
3-
4-
ESLINT ?= npx eslint
5-
YARN ?= npx yarn
6-
7-
8-
stamp-yarn:
9-
$(YARN) install
10-
# Install pre commit hook
11-
$(YARN) husky install
12-
touch stamp-yarn
13-
14-
15-
clean-dist:
16-
rm -Rf dist/
17-
18-
19-
.PHONY: clean
20-
clean: clean-dist
21-
rm -f stamp-yarn
22-
rm -Rf node_modules/
1+
##############
2+
## Please note
3+
##############
234

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

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

2813

29-
.PHONY: check
30-
check:: stamp-yarn eslint
31-
$(YARN) run test
14+
# Include base Makefile
15+
-include node_modules/@patternslib/dev/Makefile
3216

33-
34-
.PHONY: bundle
35-
bundle: stamp-yarn
36-
$(YARN) run build
37-
38-
39-
.PHONY: release-major
40-
release-major: check
41-
npx release-it major --dry-run --ci && \
42-
npx release-it major --ci && \
43-
npx release-it --github.release --github.update --no-github.draft --no-increment --no-git --no-npm --ci && \
44-
git checkout CHANGES.md
45-
46-
47-
.PHONY: release-minor
48-
release-minor: check
49-
npx release-it minor --dry-run --ci && \
50-
npx release-it minor --ci && \
51-
npx release-it --github.release --github.update --no-github.draft --no-increment --no-git --no-npm --ci && \
52-
git checkout CHANGES.md
53-
54-
55-
.PHONY: release-patch
56-
release-patch: check
57-
npx release-it patch --dry-run --ci && \
58-
npx release-it patch --ci && \
59-
npx release-it --github.release --github.update --no-github.draft --no-increment --no-git --no-npm --ci && \
60-
git checkout CHANGES.md
17+
# Define the GITHUB_TOKEN in the .env file for usage with release-it.
18+
-include .env
19+
export
6120

6221

63-
.PHONY: serve
64-
serve:: stamp-yarn
65-
$(YARN) run start
22+
.PHONY: install
23+
stamp-yarn install:
24+
npx yarn install
25+
# Install pre commit hook
26+
npx yarn husky install
27+
touch stamp-yarn
6628

6729

6830
#

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = require("@patternslib/patternslib/babel.config.js");
1+
module.exports = require("@patternslib/dev/babel.config.js");

commitlint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("@patternslib/dev/commitlint.config.js");

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Webpack entry point for module federation.
2+
import "@patternslib/patternslib/webpack/module_federation";
3+
// The next import needs to be kept with brackets, otherwise we get this error:
4+
// "Shared module is not available for eager consumption."
5+
import("./bundle-config");

jest.config.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1 @@
1-
module.exports = {
2-
rootDir: "./src",
3-
setupFilesAfterEnv: ["<rootDir>/setupTests.js"],
4-
watchPlugins: ["jest-watch-typeahead/filename", "jest-watch-typeahead/testname"],
5-
transform: {
6-
"^.+\\.[t|j]sx?$": "babel-jest",
7-
},
8-
moduleNameMapper: {
9-
"\\.(css|less|sass|scss)$": "identity-obj-proxy",
10-
},
11-
testEnvironment: "jsdom",
12-
transformIgnorePatterns: ["/node_modules/(?!.*patternslib/*).+\\.[t|j]sx?$"],
13-
};
1+
module.exports = require("@patternslib/dev/jest.config.js");

package.json

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,50 +5,18 @@
55
"license": "MIT",
66
"main": "./src/pat-content-mirror.js",
77
"dependencies": {
8-
"@patternslib/patternslib": "^6.0.1",
9-
"underscore": "^1.13.2"
8+
"jquery": "^3.6.0"
9+
},
10+
"peerDependencies": {
11+
"@patternslib/patternslib": "*"
1012
},
1113
"devDependencies": {
12-
"@babel/core": "^7.16.0",
13-
"@babel/eslint-parser": "^7.16.3",
14-
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
15-
"@babel/preset-env": "^7.16.0",
16-
"@commitlint/cli": "^15.0.0",
17-
"@commitlint/config-conventional": "^15.0.0",
18-
"@release-it/conventional-changelog": "^3.3.0",
19-
"@testing-library/jest-dom": "^5.15.0",
20-
"babel-loader": "^8.2.3",
21-
"copy-webpack-plugin": "^10.0.0",
22-
"core-js": "3.19.1",
23-
"css-loader": "^6.5.0",
24-
"eslint": "^8.2.0",
25-
"eslint-config-prettier": "^8.3.0",
26-
"expose-loader": "^3.0.0",
27-
"husky": "^7.0.4",
28-
"identity-obj-proxy": "^3.0.0",
29-
"imports-loader": "^3.1.0",
30-
"inspectpack": "^4.7.1",
31-
"jest": "^27.3.1",
32-
"jest-watch-typeahead": "^1.0.0",
33-
"prettier": "^2.4.1",
34-
"regenerator-runtime": "^0.13.9",
35-
"release-it": "^14.11.7",
36-
"sass": "^1.43.4",
37-
"sass-loader": "^12.3.0",
38-
"style-loader": "^3.3.0",
39-
"terser-webpack-plugin": "^5.2.5",
40-
"timezone-mock": "^1.2.2",
41-
"webpack": "^5.64.1",
42-
"webpack-bundle-analyzer": "^4.4.2",
43-
"webpack-cli": "^4.9.1",
44-
"webpack-dev-server": "^4.5.0",
45-
"webpack-modernizr-loader": "^5.0.0",
46-
"whybundled": "^2.0.0",
47-
"yarn": "^1.22.17"
14+
"@patternslib/dev": "^2.0.0"
4815
},
4916
"scripts": {
5017
"start": "NODE_ENV=development webpack serve --config webpack.config.js",
5118
"build": "NODE_ENV=production webpack --config webpack.config.js",
19+
"build:dev": "NODE_ENV=development webpack --config webpack.config.js",
5220
"build:stats": "NODE_ENV=production webpack --config webpack.config.js --json > stats.json",
5321
"test": "jest"
5422
},
@@ -59,6 +27,9 @@
5927
"not op_mini all"
6028
]
6129
},
30+
"keywords": [
31+
"patternslib"
32+
],
6233
"publishConfig": {
6334
"access": "public"
6435
},

prettier.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("@patternslib/dev/prettier.config.js");

src/pat-content-mirror.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
import $ from "jquery";
2-
import _ from "underscore";
32
import Base from "@patternslib/patternslib/src/core/base";
43
import Parser from "@patternslib/patternslib/src/core/parser";
54

65
const parser = new Parser("content-mirror");
7-
parser.add_argument("target");
6+
parser.addArgument("target", "p.content-mirror .text");
87

98
export default Base.extend({
109
name: "content-mirror",
1110
trigger: ".pat-content-mirror",
12-
defaults: {
13-
target: "p.content-mirror .text",
14-
},
1511

16-
init: function content_mirror_init($el, opts) {
17-
const options = parser.parse($el, opts, true)[0];
18-
this.options = _.extend(_.clone(this.defaults), options);
12+
init: function content_mirror_init($el) {
13+
this.options = parser.parse(this.el, this.options);
1914
const $mirror = $(this.options.target).parents("p.content-mirror").first();
2015
$el.on(
2116
"input propertychange",

src/pat-content-mirror.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import "regenerator-runtime/runtime"; // needed for ``await`` support
21
import pattern from "./pat-content-mirror";
32
import utils from "@patternslib/patternslib/src/core/utils";
43

src/setupTests.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

webpack.config.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
process.traceDeprecation = true;
2+
const mf_config = require("@patternslib/dev/webpack/webpack.mf");
3+
const package_json = require("./package.json");
24
const path = require("path");
3-
const patternslib_config = require("@patternslib/patternslib/webpack/webpack.config.js");
5+
const patternslib_config = require("@patternslib/dev/webpack/webpack.config.js");
46

57
module.exports = async (env, argv) => {
68
let config = {
79
entry: {
8-
bundle: path.resolve(__dirname, "bundle-config.js"),
10+
"bundle.min": path.resolve(__dirname, "index.js"),
911
},
1012
};
1113

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

17+
config.plugins.push(
18+
mf_config({
19+
package_json: package_json,
20+
remote_entry: config.entry["bundle.min"],
21+
})
22+
);
23+
1524
if (process.env.NODE_ENV === "development") {
1625
config.devServer.static.directory = __dirname;
1726
}

0 commit comments

Comments
 (0)