Skip to content

Commit

Permalink
Merge pull request #137 from cubing/lgarron/ungulp
Browse files Browse the repository at this point in the history
Overhaul our toolchain
  • Loading branch information
lgarron authored Jan 3, 2025
2 parents 09bc1f8 + 3068643 commit fca76be
Show file tree
Hide file tree
Showing 97 changed files with 2,022 additions and 16,638 deletions.
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

File renamed without changes.
37 changes: 0 additions & 37 deletions .github/workflows/deploy.yml

This file was deleted.

16 changes: 7 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/dist
/node_modules
/result
/www

# This really ought to live in `.git/info/exclude`, but `biome` doesn't understand that file:
# https://github.com/biomejs/biome/issues/4822
/.direnv

node_modules/

# Courtesy of https://github.com/shinnn/gulp-gh-pages
.publish
# This is a `bun` project, but we still use `package-lock.json` as the source
# of truth for our dependencies.
# See the `bun.lockb` target in `Makefile` for more details.
/bun.lockb
/bun.lock
6 changes: 0 additions & 6 deletions .npmignore

This file was deleted.

56 changes: 38 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
# This Makefile is a wrapper around the scripts from `package.json`.
# https://github.com/lgarron/Makefile-scripts

# Note: the first command becomes the default `make` target.
NPM_COMMANDS = build watch dev version postversion lint format

.PHONY: $(NPM_COMMANDS)
$(NPM_COMMANDS):
npm run $@

# We write the npm commands to the top of the file above to make shell autocompletion work in more places.
DYNAMIC_NPM_COMMANDS = $(shell node -e 'console.log(Object.keys(require("./package.json").scripts).join(" "))')
UPDATE_MAKEFILE_SED_ARGS = "s/^NPM_COMMANDS = .*$$/NPM_COMMANDS = ${DYNAMIC_NPM_COMMANDS}/" Makefile
.PHONY: update-Makefile
update-Makefile:
@echo "Updating Makefile…"
@if [ "$(shell uname -s)" = "Darwin" ] ; then sed -i "" ${UPDATE_MAKEFILE_SED_ARGS} ; fi
@if [ "$(shell uname -s)" != "Darwin" ] ; then sed -i"" ${UPDATE_MAKEFILE_SED_ARGS} ; fi
# Yes, this is a bit funky. See "Upgrading/changing dependencies" in README.md
# for details.
bun.lockb: package-lock.json
bun pm migrate --force

.PHONY: build
build: build-lib

.PHONY: build-lib
build-lib: setup
bun run script/build-lib.ts

.PHONY: setup
setup: bun.lockb
ifndef NIX_BUILD_TOP
# Makes sure dependencies match the current checkout. Very fast no-op.
bun install --no-save --verbose
endif

.PHONY: lint
lint: setup
npx @biomejs/biome check

.PHONY: format
format: setup
npx @biomejs/biome check --write"

.PHONY: clean
clean:
rm -rf ./dist/

.PHONY: reset
reset: clean
rm -rf ./node_modules

.PHONY: publish
publish:
npm publish
51 changes: 31 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,48 @@
# Cubing Icons and Fonts
# Cubing icons and fonts

[![Deploy to GitHub Pages](https://github.com/cubing/icons/actions/workflows/deploy.yml/badge.svg)](https://github.com/cubing/icons/actions/workflows/deploy.yml)

## Demo
## Documentation and demo

<https://icons.cubing.net>

## Development

Most development is simply adding/changing existing SVG files. If you haven't dealt
with SVG files before, check out [Inkscape](https://inkscape.org/).
Most development is simply adding/changing existing SVG files under the
[`./src/svg` directory](https://github.com/cubing/icons/tree/main/src/svg). If
you haven't dealt with SVG files before, check out
[Inkscape](https://inkscape.org/).

If you want to actually build a font or CSS locally, you'll need some more tooling.
The easiest way to get those tools is with [nix](https://nixos.org/). You'll
need the experimental [Flakes](https://wiki.nixos.org/wiki/Flakes) feature
enabled.

### Some useful `nix` commands
### Build the project

- `nix flake check` - This is what happens in CI: build the website, check formatting, etc.
- `nix build .#www` - Build the website. When this finishes, open `result/index.html` in your web browser.
You'll need [`bun`](https://bun.sh) to install development dependencies and build the project.

### In a dev shell
If you don't have `bun` installed, we provide a [`nix`](https://nixos.org/)
shell you can activate with `nix develop`.

You can enter a dev shell with `nix develop`. This will open a subshell with
all dependencies installed.
```shell
git clone https://github.com/cubing/icons && cd icons
nix develop # Optional. See above.
make
```

- `npm run build` or `npm run watch` - When this finishes, open `www/index.html` in your web browser.
Files are build into the `./dist` dir.

## Releasing
### Upgrading/changing dependencies

### Bump version and deploy to `npmjs.org`
`package-lock.json` is the source of truth. Use `npm` to change dependencies
(if all you're doing is installing dependencies, you don't need `npm`).

```
npm version major|minor|patch -m "Upgrade to %s for reasons"
As soon as `nix` gets [support for `bun`
lockfiles](https://github.com/NixOS/nixpkgs/issues/255890), we can remove this
quirk.

### Releasing

To bump the version and deploy to `npmjs.org`:

```shell
npm version [major|minor|patch] -m "Release description"
git push --follow-tags
make publish
```
7 changes: 3 additions & 4 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"vcs": {
"enabled": true,
"useIgnoreFile": true,
"clientKind": "git"
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"files": {
"ignore": ["./dist"]
},
"formatter": {
"indentStyle": "space",
Expand Down
17 changes: 0 additions & 17 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# PhantomJS is quite dead, but unfortunately we still depend on it.
# It was removed from nixpkgs a while ago: <https://github.com/NixOS/nixpkgs/pull/169872>
nixpkgs-with-phantomjs.url = "github:NixOS/nixpkgs/d1c3fea7ecbed758168787fe4e4a3157e52bc808";
systems.url = "github:nix-systems/default";
treefmt-nix.url = "github:numtide/treefmt-nix";
};
Expand All @@ -17,7 +14,6 @@
systems = import inputs.systems;
imports = [
./nix/formatting.nix
./nix/phantomjs.nix
./nix/dev-shell.nix
./nix/www.nix
];
Expand Down
Binary file removed fonts/cubing-icons.eot
Binary file not shown.
Loading

0 comments on commit fca76be

Please sign in to comment.