Skip to content

Commit

Permalink
feat: init
Browse files Browse the repository at this point in the history
  • Loading branch information
privatenumber committed Jan 8, 2022
0 parents commit 219e53c
Show file tree
Hide file tree
Showing 13 changed files with 3,900 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
@@ -0,0 +1,8 @@
root = true

[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
20 changes: 20 additions & 0 deletions .github/workflows/package-size-report.yml
@@ -0,0 +1,20 @@
name: Package Size Report

on:
pull_request:
branches: [ master, develop ]

jobs:
pkg-size-report:
name: Package Size Report
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Package size report
id: pkg-size-report
uses: privatenumber/pkg-size-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,27 @@
name: Release

on:
push:
branches: master

jobs:
release:
name: Release
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js v14
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install dependencies
run: npx ci
- name: Lint
run: npm run lint
- name: Release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
26 changes: 26 additions & 0 deletions .github/workflows/test.yml
@@ -0,0 +1,26 @@
name: Test

on:
push:
branches: [develop]
pull_request:
branches: [master, develop]

jobs:
test:
name: Test
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js 14
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install dependencies
run: npx ci
- name: Build
run: npm run build
- name: Lint
run: npm run lint
26 changes: 26 additions & 0 deletions .gitignore
@@ -0,0 +1,26 @@
# macOS
.DS_Store

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Dependency directories
node_modules/

# Output of 'npm pack'
*.tgz

# dotenv environment variables file
.env
.env.test

# VSCode
.vscode

# Distribution
dist
1 change: 1 addition & 0 deletions .nvmrc
@@ -0,0 +1 @@
v12.19.0
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Hiroki Osame <hiroki.osame@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
37 changes: 37 additions & 0 deletions README.md
@@ -0,0 +1,37 @@
# build-branch

Script to automate creating _built branches_.

<sub>Support this project by ⭐️ starring and sharing it. [Follow me](https://github.com/privatenumber) to see what other cool projects I'm working on! ❤️</sub>

## Usage

Run in your Git repository from the branch you want to build:

```sh
npx build-branch
```

Run with `--dry` to see what commands would run first:
```sh
npx build-branch --dry
```

## What's a built branch?

In projects that build from source files, a _built branch_ is a branch that contains built assets so it can be installed with [npm](https://docs.npmjs.com/cli/v8/commands/npm-install#:~:text=npm%20install%20%3Cgithubname%3E%2F%3Cgithubrepo%3E%5B%23%3Ccommit-ish%3E%5D):

```sh
npm install 'organization/repository#built-branch'
```

Built branches are useful for quickly testing changes and can be preferrable over permanently publishing a prerelease to npm.

To make a _built branch_, this script does the following:
1. Run `npm run build`
2. Create a new branch with the `built/` namespace
2. Detects npm publish files and commits them to the new branch
4. Force pushes to remote
5. Deletes local built branch
6. Gives you the installation command

4 changes: 4 additions & 0 deletions bin/build-branch.js
@@ -0,0 +1,4 @@
#!/usr/bin/env node

// eslint-disable-next-line unicorn/import-index
require('../dist/index.js');
57 changes: 57 additions & 0 deletions package.json
@@ -0,0 +1,57 @@
{
"name": "build-branch",
"version": "0.0.0-semantic-release",
"description": "Script to automate creating built branches",
"keywords": [
"npm",
"git",
"github",
"built",
"build",
"branch",
"branches"
],
"license": "MIT",
"repository": "privatenumber/build-branch",
"funding": "https://github.com/privatenumber/build-branch?sponsor=1",
"author": {
"name": "Hiroki Osame",
"email": "hiroki.osame@gmail.com"
},
"files": [
"bin",
"dist"
],
"bin": "bin/build-branch.js",
"scripts": {
"build": "tsup src --format cjs --minify",
"lint": "eslint .",
"postversion": "npm run build"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,ts}": "eslint"
},
"devDependencies": {
"@pvtnbr/eslint-config": "^0.11.0",
"@types/node": "^17.0.8",
"@types/npm-packlist": "^1.1.2",
"cleye": "^1.0.1",
"eslint": "^8.6.0",
"execa": "^6.0.0",
"husky": "^4.0.0",
"lint-staged": "^12.1.7",
"npm-packlist": "^3.0.0",
"pkg-up": "^4.0.0",
"tasuku": "^1.0.2",
"tsup": "^5.11.11",
"typescript": "^4.5.4"
},
"eslintConfig": {
"extends": "@pvtnbr"
}
}

0 comments on commit 219e53c

Please sign in to comment.