Skip to content

Commit

Permalink
Merge pull request #32 from tomhazledine/esbuild
Browse files Browse the repository at this point in the history
Refactor tooling
  • Loading branch information
tomhazledine authored Jan 8, 2024
2 parents 923198b + cd5a2e6 commit d3e2621
Show file tree
Hide file tree
Showing 59 changed files with 7,011 additions and 9,117 deletions.
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: yarn install
- run: yarn build
- run: yarn test
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
assets/*
.sass-cache
node_modules/*
node_modules
.DS_Store
cjs/
build
coverage
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"arrowParens": "avoid",
"tabWidth": 4,
"useTabs": false,
"trailingComma": "none"
}
6 changes: 0 additions & 6 deletions .travis.yml

This file was deleted.

4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<p align="center"><a href="https://audio.tomhazledine.com" target="_blank"><img width="200"src="https://audio.tomhazledine.com/assets/images/heroLogo.png"></a></p>
<p align="center"><a href="https://audio.tomhazledine.com" target="_blank"><img width="200"src="https://github.com/tomhazledine/picobel/blob/main/images/heroLogo.png"></a></p>

<h1 align="center">Picobel.js</h1>

<p align="center" markdown="1"><a href="https://travis-ci.org/tomhazledine/picobel"><img src="https://travis-ci.org/tomhazledine/picobel.svg?branch=master" alt="Build Status"></a></p>

Picobel.js (pronounced _peek-o-bell_, as in _decibel_) is a lightweight dependency-free Javascript tool that converts html audio tags into styleable markup.

* [Overview](#why-would-i-need-this)
Expand Down
12 changes: 12 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
]
}
45 changes: 45 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import * as esbuild from "esbuild";

const parseArgs = rawArgs => {
const [a, b, ...relevant] = rawArgs;
return relevant
.map(arg => {
const [key, value] = arg.split("=");
return { [key.replace(/-/g, "")]: value || true };
})
.reduce((args, arg) => ({ ...args, ...arg }), {});
};

const args = parseArgs(process.argv);

const globalConfig = {
bundle: true,
outdir: `build`,
minify: args.mode !== "development",
treeShaking: args.mode !== "development",
sourcemap: args.mode === "development"
};

const config = {
js: {
...globalConfig,
format: "esm",
entryPoints: ["src/js/Picobel.js"],
entryNames: "picobel"
},
css: {
...globalConfig,
entryPoints: ["src/css/player.default.css", "src/css/all.css"]
}
};

const build = async config => {
try {
await esbuild.build(config.js);
await esbuild.build(config.css);
} catch (e) {
console.warn("esbuild error", e);
}
};

build(config);
Loading

0 comments on commit d3e2621

Please sign in to comment.