Skip to content

Commit c05f871

Browse files
authored
Merge pull request #1021 from Patternslib/depend-dev
Depend dev
2 parents 5710f1b + 6296f8d commit c05f871

22 files changed

Lines changed: 231 additions & 824 deletions

.commitlintrc.json

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

.eslintrc.js

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +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-
"cache/",
13-
"coverage/",
14-
"dist/",
15-
"node_modules/",
16-
"src/lib/depends_parse.js",
17-
"stats.json",
18-
"style/",
19-
],
20-
rules: {
21-
"no-debugger": 1,
22-
"no-duplicate-imports": 1,
23-
// Do keep due avoid unintendet consequences.
24-
"no-alert": 0,
25-
"no-control-regex": 0,
26-
"no-self-assign": 0,
27-
"no-useless-escape": 0,
28-
},
29-
};
1+
module.exports = require("@patternslib/dev/.eslintrc.js");

.github/workflows/test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ jobs:
1616
with:
1717
node-version: '16'
1818
cache: 'yarn'
19-
- run: make check
19+
- run: |
20+
make install
21+
make check

.prettierrc.json

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

.release-it.js

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,6 @@
1-
const fs = require("fs");
2-
const path = require("path");
1+
const config = require("@patternslib/dev/.release-it.js");
32

4-
const commits_template = fs
5-
.readFileSync(
6-
path.resolve(__dirname, ".release-it", "conventional-changelog-commit.hbs")
7-
)
8-
.toString();
3+
config.plugins["@release-it/conventional-changelog"].header =
4+
"# Changelog\n\nSee the [history](./docs/history/index.md) for older changelog entries.\n\n";
95

10-
module.exports = {
11-
npm: {
12-
publish: true,
13-
},
14-
git: {
15-
requireBranch: "master",
16-
commitMessage: "Release new version.",
17-
commitArgs: ["-n"],
18-
},
19-
plugins: {
20-
"@release-it/conventional-changelog": {
21-
infile: "CHANGES.md",
22-
header: "# Changelog\n\nSee the [history](./docs/history/index.md) for older changelog entries.\n\n",
23-
ignoreRecommendedBump: true,
24-
preset: {
25-
name: "conventionalcommits",
26-
types: [
27-
{
28-
type: "breaking",
29-
section: "Breaking Changes",
30-
},
31-
{
32-
type: "feat",
33-
section: "Features",
34-
},
35-
{
36-
type: "fix",
37-
section: "Bug Fixes",
38-
},
39-
{
40-
type: "maint",
41-
section: "Maintenance",
42-
},
43-
],
44-
},
45-
writerOpts: {
46-
commitPartial: commits_template,
47-
},
48-
},
49-
},
50-
};
6+
module.exports = config;

.release-it/conventional-changelog-commit.hbs

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

Makefile

Lines changed: 18 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
1+
##############
2+
## Please note
3+
##############
4+
5+
# First, run ``make install``.
6+
# After that you have through Makefile extension all the other base targets available.
7+
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
12+
13+
14+
# Include base Makefile
15+
-include node_modules/@patternslib/dev/Makefile
16+
117
# Define the GITHUB_TOKEN in the .env file for usage with release-it.
218
-include .env
319
export
420

5-
ESLINT ?= npx eslint
621
PEGJS ?= npx pegjs
722
SASS ?= npx sass
823
YARN ?= npx yarn
924

10-
SOURCES = $(wildcard src/*.js) $(wildcard src/pat/*.js) $(wildcard src/lib/*.js)
11-
GENERATED = src/lib/depends_parse.js
12-
1325
PACKAGE_NAME = "patternslib"
1426

1527
all:: bundle css
1628

1729

18-
########################################################################
19-
## Install dependencies
20-
2130
.PHONY: install
2231
stamp-yarn install:
2332
$(YARN) install
@@ -27,130 +36,17 @@ stamp-yarn install:
2736
# $(YARN) husky add .husky/commit-msg "npx yarn commitlint --edit $1"
2837
touch stamp-yarn
2938

30-
clean-dist:
31-
rm -Rf dist/
32-
33-
.PHONY: clean
34-
clean: clean-dist
35-
rm -f stamp-yarn
36-
rm -Rf node_modules/
37-
38-
########################################################################
39-
## Tests
40-
41-
.PHONY: eslint
42-
eslint: stamp-yarn
43-
$(ESLINT) ./src
44-
45-
.PHONY: check
46-
check: stamp-yarn eslint
47-
$(YARN) run testonce
48-
49-
50-
########################################################################
51-
## Builds
5239

5340
.PHONY: build
54-
build: bundle all-css
55-
56-
.PHONY: bundle
57-
bundle: stamp-yarn
58-
$(YARN) run build
59-
60-
release-zip: clean-dist bundle
61-
$(eval PACKAGE_VERSION := $(shell node -p "require('./package.json').version"))
62-
@echo name is $(PACKAGE_NAME)
63-
@echo version is $(PACKAGE_VERSION)
64-
mkdir -p dist/$(PACKAGE_NAME)-bundle-$(PACKAGE_VERSION)
65-
-mv dist/* dist/$(PACKAGE_NAME)-bundle-$(PACKAGE_VERSION)
66-
cd dist/ && zip -r $(PACKAGE_NAME)-bundle-$(PACKAGE_VERSION).zip $(PACKAGE_NAME)-bundle-$(PACKAGE_VERSION)/
67-
68-
.PHONY: release-major
69-
release-major: check
70-
npx release-it major && \
71-
make release-zip && \
72-
npx release-it --github.release --github.update --github.assets=dist/*.zip --no-github.draft --no-increment --no-git --no-npm && \
73-
git checkout CHANGES.md
74-
75-
.PHONY: release-minor
76-
release-minor: check
77-
npx release-it minor && \
78-
make release-zip && \
79-
npx release-it --github.release --github.update --github.assets=dist/*.zip --no-github.draft --no-increment --no-git --no-npm && \
80-
git checkout CHANGES.md
81-
82-
.PHONY: release-patch
83-
release-patch: check
84-
npx release-it patch && \
85-
make release-zip && \
86-
npx release-it --github.release --github.update --github.assets=dist/*.zip --no-github.draft --no-increment --no-git --no-npm && \
87-
git checkout CHANGES.md
88-
89-
.PHONY: prerelease-alpha
90-
prerelease-alpha: clean install
91-
npx release-it --preRelease=alpha && \
92-
make release-zip && \
93-
npx release-it --github.preRelease --github.update --github.assets=dist/*.zip --no-github.draft --no-increment --no-git --no-npm && \
94-
git checkout CHANGES.md
95-
96-
.PHONY: prerelease-beta
97-
prerelease-beta: clean install
98-
npx release-it --preRelease=beta && \
99-
make release-zip && \
100-
npx release-it --github.preRelease --github.update --github.assets=dist/*.zip --no-github.draft --no-increment --no-git --no-npm && \
101-
git checkout CHANGES.md
41+
build: bundle css
42+
10243

10344
src/lib/depends_parse.js: src/lib/depends_parse.pegjs stamp-yarn
10445
$(PEGJS) $<
10546
sed -i~ -e '1s/.*/define(function() {/' -e '$$s/()//' $@ || rm -f $@
10647

107-
.PHONY: all-css
108-
all-css: css
109-
@echo "Hang tight!"
110-
@$(SASS) -I . -I _sass src/pat/auto-scale/_auto-scale.scss src/pat/auto-scale/auto-scale.css
111-
@$(SASS) -I . -I _sass src/pat/auto-suggest/_auto-suggest.scss src/pat/auto-suggest/auto-suggest.css
112-
@$(SASS) -I . -I _sass src/pat/bumper/_bumper.scss src/pat/bumper/bumper.css
113-
@$(SASS) -I . -I _sass src/pat/carousel/_carousel.scss src/pat/carousel/carousel.css
114-
@$(SASS) -I . -I _sass src/pat/checklist/_checklist.scss src/pat/checklist/checklist.css
115-
@$(SASS) -I . -I _sass src/pat/collapsible/_collapsible.scss src/pat/collapsible/collapsible.css
116-
@$(SASS) -I . -I _sass src/pat/colour-picker/_colour-picker.scss src/pat/colour-picker/colour-picker.css
117-
@$(SASS) -I . -I _sass src/pat/date-picker/_date-picker.scss src/pat/date-picker/date-picker.css
118-
@$(SASS) -I . -I _sass src/pat/datetime-picker/_datetime-picker.scss src/pat/datetime-picker/datetime-picker.css
119-
@$(SASS) -I . -I _sass src/pat/equaliser/_equaliser.scss src/pat/equaliser/equaliser.css
120-
@$(SASS) -I . -I _sass src/pat/expandable-tree/_expandable-tree.scss src/pat/expandable-tree/expandable-tree.css
121-
@$(SASS) -I . -I _sass src/pat/focus/_focus.scss src/pat/focus/focus.css
122-
@$(SASS) -I . -I _sass src/pat/gallery/_gallery.scss src/pat/gallery/gallery.css
123-
@echo "Almost there, don't give up!"
124-
@$(SASS) -I . -I _sass src/pat/grid/_grid.scss src/pat/grid/grid.css
125-
@$(SASS) -I . -I _sass src/pat/image-crop/_image-crop.scss src/pat/image-crop/image-crop.css
126-
@$(SASS) -I . -I _sass src/pat/inject/_inject.scss src/pat/inject/inject.css
127-
@$(SASS) -I . -I _sass src/pat/masonry/_masonry.scss src/pat/masonry/masonry.css
128-
@$(SASS) -I . -I _sass src/pat/menu/_menu.scss src/pat/menu/menu.css
129-
@$(SASS) -I . -I _sass src/pat/modal/_modal.scss src/pat/modal/modal.css
130-
@$(SASS) -I . -I _sass src/pat/notification/_notification.scss src/pat/notification/notification.css
131-
@$(SASS) -I . -I _sass src/pat/sortable/_sortable.scss src/pat/sortable/sortable.css
132-
@$(SASS) -I . -I _sass src/pat/stacks/_stacks.scss src/pat/stacks/stacks.css
133-
@$(SASS) -I . -I _sass src/pat/switch/_switch.scss src/pat/switch/switch.css
134-
@$(SASS) -I . -I _sass src/pat/syntax-highlight/_syntax-highlight.scss src/pat/syntax-highlight/syntax-highlight.css
135-
@$(SASS) -I . -I _sass src/pat/toggle/_toggle.scss src/pat/toggle/toggle.css
136-
@$(SASS) -I . -I _sass src/pat/tooltip/_tooltip.scss src/pat/tooltip/tooltip.css
137-
@echo "Done. Each pattern now has a CSS file."
13848

13949
.PHONY: css
14050
css:
14151
@$(SASS) -I style -I _sass -I . _sass/_patterns.scss style/patterns.css
14252

143-
.PHONY: watch
144-
watch:
145-
$(SASS) --watch -I style -I . -I _sass _sass/_patterns.scss:style/patterns.css
146-
147-
########################################################################
148-
149-
.PHONY: serve
150-
serve: bundle css
151-
$(YARN) run start
152-
@printf "\nBundle built\n\n"
153-
154-
.PHONY: designerhappy
155-
designerhappy: serve
156-

babel.config.js

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1 @@
1-
module.exports = (env) => {
2-
let config = {
3-
presets: [
4-
[
5-
"@babel/preset-env",
6-
{
7-
useBuiltIns: "entry",
8-
corejs: 3,
9-
},
10-
],
11-
],
12-
};
13-
14-
// passed via NODE_ENV=development environment variable.
15-
if (env.env() === "development") {
16-
// For development, do less transformations for better readability.
17-
config = {
18-
presets: [
19-
[
20-
"@babel/preset-env",
21-
{
22-
modules: false,
23-
debug: true,
24-
useBuiltIns: false,
25-
targets: "last 1 Chrome version, last 1 Firefox version",
26-
},
27-
],
28-
],
29-
plugins: ["@babel/plugin-proposal-optional-chaining"],
30-
};
31-
}
32-
33-
return config;
34-
};
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");

0 commit comments

Comments
 (0)