Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nzakas committed Nov 8, 2024
0 parents commit 0173a80
Show file tree
Hide file tree
Showing 23 changed files with 3,811 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
// see https://docs.renovatebot.com/presets-config/
extends: [
'config:base',
// automatically rebase onto main branch
':rebaseStalePrs',
// groups all ESLint-related dependency upgrades into a single PR
'group:linters'
],
packageRules: [
// only send upgrade for deps (from the npm registry) after they've been
// published for 30 days
{
matchDatasources: ['npm'],
minimumReleaseAge: '30 days',
},
],
}
27 changes: 27 additions & 0 deletions .github/workflows/bun-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Bun CI

on: [push, pull_request]

jobs:
build:

runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [windows-latest, macOS-latest, ubuntu-latest]
bun: [latest]

steps:
- uses: actions/checkout@v4
- name: Use Bun ${{ matrix.bun }}
uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ matrix.bun }}
- name: bun install, build, and test
run: |
bun install
bun run build
bun run --bun test:unit
env:
CI: true
46 changes: 46 additions & 0 deletions .github/workflows/nodejs-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Node CI

on: [push, pull_request]

jobs:
test:

runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [windows-latest, macOS-latest, ubuntu-latest]
node: [18.x, 20.x, 22.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: npm install, build, and test
run: |
npm install
npm run build --if-present
npm test
env:
CI: true
- name: JSR Publish Test
run: npm run test:jsr

emfile_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: npm install and build
run: |
npm install
npm run build --if-present
env:
CI: true
- name: Run EMFILE test
run: npm run test:emfile
62 changes: 62 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
on:
push:
branches:
- main
name: release-please

permissions:
contents: write
pull-requests: write
id-token: write

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: GoogleCloudPlatform/release-please-action@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}

# The logic below handles the npm publication:
- uses: actions/checkout@v4
# these if statements ensure that a publication only occurs when
# a new release is created:
if: ${{ steps.release.outputs.release_created }}

- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
if: ${{ steps.release.outputs.release_created }}

- run: npm ci
if: ${{ steps.release.outputs.release_created }}

- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: ${{ steps.release.outputs.release_created }}

- name: Publish to JSR
run: |
npm run build
npx jsr publish
if: ${{ steps.release.outputs.release_created }}

# Tweets out release announcement
- run: 'npx @humanwhocodes/tweet "${{ github.event.repository.full_name }} v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} has been released!\n\n${{ github.event.repository.html_url }}/releases/tag/${{ steps.release.outputs.tag_name }}"'
if: ${{ steps.release.outputs.release_created }}
env:
TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
TWITTER_ACCESS_TOKEN_KEY: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}

# Toots out release announcement
- run: 'npx @humanwhocodes/toot "${{ github.event.repository.full_name }} v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }} has been released!\n\n${{ github.event.repository.html_url }}/releases/tag/${{ steps.release.outputs.tag_name }}"'
if: ${{ steps.release.outputs.release_created }}
env:
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
MASTODON_HOST: ${{ secrets.MASTODON_HOST }}
72 changes: 72 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# distribution files
dist

# test fixtures
tests/fixtures/typescript-project/index.js

# file used to generate env.d.ts
dist/env.js

tmp
Empty file added CHANGELOG.md
Empty file.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Crosspost

by [Nicholas C. Zakas](https://humanwhocodes.com)

If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate) or [nominate me](https://stars.github.com/nominate/) for a GitHub Star.

## Description

A utility for posting across multiple social networks at once.
46 changes: 46 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import js from "@eslint/js";

export default [
{
ignores: ["tests/fixtures"]
},
js.configs.recommended,
{
languageOptions: {
globals: {
process: false,
URL: false,
console: false
},
},
rules: {
indent: [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
quotes: [
"error",
"double"
],
semi: [
"error",
"always"
]
}
},
{
files: ["tests/**/*.js"],
languageOptions: {
globals: {
describe: false,
it: false,
beforeEach: false,
afterEach: false
}
}
}
];
14 changes: 14 additions & 0 deletions jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "@humanwhocodes/crosspost",
"version": "0.0.0",
"exports": "./dist/index.js",
"publish": {
"include": [
"jsr.json",
"LICENSE",
"README.md",
"dist/index.js",
"dist/index.d.ts"
]
}
}
Loading

0 comments on commit 0173a80

Please sign in to comment.