Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .commitlintrc.json

This file was deleted.

30 changes: 1 addition & 29 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,29 +1 @@
module.exports = {
extends: ["eslint:recommended", "prettier"],
root: true,
env: {
es6: "true",
browser: true,
node: true,
jest: true,
},
parser: "@babel/eslint-parser",
ignorePatterns: [
"cache/",
"coverage/",
"dist/",
"node_modules/",
"src/lib/depends_parse.js",
"stats.json",
"style/",
],
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,
},
};
module.exports = require("@patternslib/dev/.eslintrc.js");
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ jobs:
with:
node-version: '16'
cache: 'yarn'
- run: make check
- run: |
make install
make check
5 changes: 0 additions & 5 deletions .prettierrc.json

This file was deleted.

52 changes: 4 additions & 48 deletions .release-it.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,6 @@
const fs = require("fs");
const path = require("path");
const config = require("@patternslib/dev/.release-it.js");

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

module.exports = {
npm: {
publish: true,
},
git: {
requireBranch: "master",
commitMessage: "Release new version.",
commitArgs: ["-n"],
},
plugins: {
"@release-it/conventional-changelog": {
infile: "CHANGES.md",
header: "# Changelog\n\nSee the [history](./docs/history/index.md) for older changelog entries.\n\n",
ignoreRecommendedBump: true,
preset: {
name: "conventionalcommits",
types: [
{
type: "breaking",
section: "Breaking Changes",
},
{
type: "feat",
section: "Features",
},
{
type: "fix",
section: "Bug Fixes",
},
{
type: "maint",
section: "Maintenance",
},
],
},
writerOpts: {
commitPartial: commits_template,
},
},
},
};
module.exports = config;
70 changes: 0 additions & 70 deletions .release-it/conventional-changelog-commit.hbs

This file was deleted.

140 changes: 18 additions & 122 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
##############
## Please note
##############

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

# 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


# Include base Makefile
-include node_modules/@patternslib/dev/Makefile

# Define the GITHUB_TOKEN in the .env file for usage with release-it.
-include .env
export

ESLINT ?= npx eslint
PEGJS ?= npx pegjs
SASS ?= npx sass
YARN ?= npx yarn

SOURCES = $(wildcard src/*.js) $(wildcard src/pat/*.js) $(wildcard src/lib/*.js)
GENERATED = src/lib/depends_parse.js

PACKAGE_NAME = "patternslib"

all:: bundle css


########################################################################
## Install dependencies

.PHONY: install
stamp-yarn install:
$(YARN) install
Expand All @@ -27,130 +36,17 @@ stamp-yarn install:
# $(YARN) husky add .husky/commit-msg "npx yarn commitlint --edit $1"
touch stamp-yarn

clean-dist:
rm -Rf dist/

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

########################################################################
## Tests

.PHONY: eslint
eslint: stamp-yarn
$(ESLINT) ./src

.PHONY: check
check: stamp-yarn eslint
$(YARN) run testonce


########################################################################
## Builds

.PHONY: build
build: bundle all-css

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

release-zip: clean-dist bundle
$(eval PACKAGE_VERSION := $(shell node -p "require('./package.json').version"))
@echo name is $(PACKAGE_NAME)
@echo version is $(PACKAGE_VERSION)
mkdir -p dist/$(PACKAGE_NAME)-bundle-$(PACKAGE_VERSION)
-mv dist/* dist/$(PACKAGE_NAME)-bundle-$(PACKAGE_VERSION)
cd dist/ && zip -r $(PACKAGE_NAME)-bundle-$(PACKAGE_VERSION).zip $(PACKAGE_NAME)-bundle-$(PACKAGE_VERSION)/

.PHONY: release-major
release-major: check
npx release-it major && \
make release-zip && \
npx release-it --github.release --github.update --github.assets=dist/*.zip --no-github.draft --no-increment --no-git --no-npm && \
git checkout CHANGES.md

.PHONY: release-minor
release-minor: check
npx release-it minor && \
make release-zip && \
npx release-it --github.release --github.update --github.assets=dist/*.zip --no-github.draft --no-increment --no-git --no-npm && \
git checkout CHANGES.md

.PHONY: release-patch
release-patch: check
npx release-it patch && \
make release-zip && \
npx release-it --github.release --github.update --github.assets=dist/*.zip --no-github.draft --no-increment --no-git --no-npm && \
git checkout CHANGES.md

.PHONY: prerelease-alpha
prerelease-alpha: clean install
npx release-it --preRelease=alpha && \
make release-zip && \
npx release-it --github.preRelease --github.update --github.assets=dist/*.zip --no-github.draft --no-increment --no-git --no-npm && \
git checkout CHANGES.md

.PHONY: prerelease-beta
prerelease-beta: clean install
npx release-it --preRelease=beta && \
make release-zip && \
npx release-it --github.preRelease --github.update --github.assets=dist/*.zip --no-github.draft --no-increment --no-git --no-npm && \
git checkout CHANGES.md
build: bundle css


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

.PHONY: all-css
all-css: css
@echo "Hang tight!"
@$(SASS) -I . -I _sass src/pat/auto-scale/_auto-scale.scss src/pat/auto-scale/auto-scale.css
@$(SASS) -I . -I _sass src/pat/auto-suggest/_auto-suggest.scss src/pat/auto-suggest/auto-suggest.css
@$(SASS) -I . -I _sass src/pat/bumper/_bumper.scss src/pat/bumper/bumper.css
@$(SASS) -I . -I _sass src/pat/carousel/_carousel.scss src/pat/carousel/carousel.css
@$(SASS) -I . -I _sass src/pat/checklist/_checklist.scss src/pat/checklist/checklist.css
@$(SASS) -I . -I _sass src/pat/collapsible/_collapsible.scss src/pat/collapsible/collapsible.css
@$(SASS) -I . -I _sass src/pat/colour-picker/_colour-picker.scss src/pat/colour-picker/colour-picker.css
@$(SASS) -I . -I _sass src/pat/date-picker/_date-picker.scss src/pat/date-picker/date-picker.css
@$(SASS) -I . -I _sass src/pat/datetime-picker/_datetime-picker.scss src/pat/datetime-picker/datetime-picker.css
@$(SASS) -I . -I _sass src/pat/equaliser/_equaliser.scss src/pat/equaliser/equaliser.css
@$(SASS) -I . -I _sass src/pat/expandable-tree/_expandable-tree.scss src/pat/expandable-tree/expandable-tree.css
@$(SASS) -I . -I _sass src/pat/focus/_focus.scss src/pat/focus/focus.css
@$(SASS) -I . -I _sass src/pat/gallery/_gallery.scss src/pat/gallery/gallery.css
@echo "Almost there, don't give up!"
@$(SASS) -I . -I _sass src/pat/grid/_grid.scss src/pat/grid/grid.css
@$(SASS) -I . -I _sass src/pat/image-crop/_image-crop.scss src/pat/image-crop/image-crop.css
@$(SASS) -I . -I _sass src/pat/inject/_inject.scss src/pat/inject/inject.css
@$(SASS) -I . -I _sass src/pat/masonry/_masonry.scss src/pat/masonry/masonry.css
@$(SASS) -I . -I _sass src/pat/menu/_menu.scss src/pat/menu/menu.css
@$(SASS) -I . -I _sass src/pat/modal/_modal.scss src/pat/modal/modal.css
@$(SASS) -I . -I _sass src/pat/notification/_notification.scss src/pat/notification/notification.css
@$(SASS) -I . -I _sass src/pat/sortable/_sortable.scss src/pat/sortable/sortable.css
@$(SASS) -I . -I _sass src/pat/stacks/_stacks.scss src/pat/stacks/stacks.css
@$(SASS) -I . -I _sass src/pat/switch/_switch.scss src/pat/switch/switch.css
@$(SASS) -I . -I _sass src/pat/syntax-highlight/_syntax-highlight.scss src/pat/syntax-highlight/syntax-highlight.css
@$(SASS) -I . -I _sass src/pat/toggle/_toggle.scss src/pat/toggle/toggle.css
@$(SASS) -I . -I _sass src/pat/tooltip/_tooltip.scss src/pat/tooltip/tooltip.css
@echo "Done. Each pattern now has a CSS file."

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

.PHONY: watch
watch:
$(SASS) --watch -I style -I . -I _sass _sass/_patterns.scss:style/patterns.css

########################################################################

.PHONY: serve
serve: bundle css
$(YARN) run start
@printf "\nBundle built\n\n"

.PHONY: designerhappy
designerhappy: serve

35 changes: 1 addition & 34 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,34 +1 @@
module.exports = (env) => {
let config = {
presets: [
[
"@babel/preset-env",
{
useBuiltIns: "entry",
corejs: 3,
},
],
],
};

// passed via NODE_ENV=development environment variable.
if (env.env() === "development") {
// For development, do less transformations for better readability.
config = {
presets: [
[
"@babel/preset-env",
{
modules: false,
debug: true,
useBuiltIns: false,
targets: "last 1 Chrome version, last 1 Firefox version",
},
],
],
plugins: ["@babel/plugin-proposal-optional-chaining"],
};
}

return config;
};
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");
Loading