diff --git a/.eslintrc.json b/.eslintrc.json index 2aa5c41..4faf1c6 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -28,7 +28,7 @@ ["^\\u0000"], ["^node:"], ["^@?\\w"], - ["@seamapi/makenew-tsmodule"], + ["seam"], ["^lib/"], ["^"], ["^\\."] diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 738e5dc..a42a661 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @seambot +* @razor-x diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b4ce4c9..072e2d1 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -100,7 +100,7 @@ jobs: write-mode: overwrite path: index.js contents: | - import '@seamapi/makenew-tsmodule' + import 'seam' - name: Install run: npm install --save ${{ steps.packages.outputs.paths }} - name: Run diff --git a/.github/workflows/makenew.yml b/.github/workflows/makenew.yml deleted file mode 100644 index 4623663..0000000 --- a/.github/workflows/makenew.yml +++ /dev/null @@ -1,95 +0,0 @@ ---- -name: Make New - -on: - workflow_dispatch: - inputs: - package: - description: Package name (@seamapi/new-package) - required: true - repo: - description: GitHub repository name (new-repo) - required: true - title: - description: Package title (New Package) - required: true - description: - description: Short package description (Foos and bars.) - required: true - -jobs: - repository: - name: Create new repository - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - name: Create repository - run: | - gh extension install mislav/gh-repo-collab - gh repo create --internal --disable-wiki --description "$DESCRIPTION" $REPO - gh repo edit $REPO --delete-branch-on-merge - gh repo edit $REPO --enable-projects=false - gh repo-collab add $REPO $CODEOWNER --permission admin - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - CODEOWNER: ${{ github.actor }} - REPO: seamapi/${{ github.event.inputs.repo }} - DESCRIPTION: ${{ github.event.inputs.description }} - bootstrap: - name: Bootstrap repository - runs-on: ubuntu-latest - timeout-minutes: 30 - needs: repository - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.GH_TOKEN }} - - name: Import GPG key - uses: crazy-max/ghaction-import-gpg@v6 - with: - git_user_signingkey: true - git_commit_gpgsign: true - git_committer_name: ${{ secrets.GIT_USER_NAME }} - git_committer_email: ${{ secrets.GIT_USER_EMAIL }} - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.GPG_PASSPHRASE }} - - name: Replace makenew boilerplate - run: ./makenew.sh - env: - CI: 'true' - mk_codeowner: ${{ github.actor }} - mk_repo: ${{ github.event.inputs.repo }} - mk_slug: ${{ github.event.inputs.package }} - mk_title: ${{ github.event.inputs.title }} - mk_description: ${{ github.event.inputs.description }} - - name: Set origin - run: | - git remote add origin $ORIGIN - git config --add --bool push.autoSetupRemote true - env: - ORIGIN: https://github.com/seamapi/${{ github.event.inputs.repo }}.git - - name: Commit - uses: stefanzweifel/git-auto-commit-action@v5 - with: - branch: main - skip_fetch: true - skip_checkout: true - commit_message: Replace makenew boilerplate - commit_user_name: ${{ secrets.GIT_USER_NAME }} - commit_user_email: ${{ secrets.GIT_USER_EMAIL }} - commit_author: ${{ secrets.GIT_USER_NAME }} <${{ secrets.GIT_USER_EMAIL }}> - version: - name: Cut initial version - runs-on: ubuntu-latest - timeout-minutes: 30 - needs: bootstrap - steps: - - name: Wait for repo to exist - run: sleep 10 - - name: Cut version - run: gh workflow run version.yml --repo $REPO --raw-field version=patch - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - REPO: seamapi/${{ github.event.inputs.repo }} diff --git a/README.md b/README.md index ec28642..8328168 100644 --- a/README.md +++ b/README.md @@ -1,90 +1,20 @@ -# TypeScript Module Package Skeleton +# Seam JavaScript SDK -[![npm](https://img.shields.io/npm/v/@seamapi/makenew-tsmodule.svg)](https://www.npmjs.com/package/@seamapi/makenew-tsmodule) -[![GitHub Actions](https://github.com/seamapi/makenew-tsmodule/actions/workflows/check.yml/badge.svg)](https://github.com/seamapi/makenew-tsmodule/actions/workflows/check.yml) +[![npm](https://img.shields.io/npm/v/seam.svg)](https://www.npmjs.com/package/seam) +[![GitHub Actions](https://github.com/seamapi/javascript-next/actions/workflows/check.yml/badge.svg)](https://github.com/seamapi/javascript-next/actions/workflows/check.yml) -Package skeleton for a TypeScript module. +JavaScript SDK for the Seam API written in TypeScript. ## Description -Bootstrap a new TypeScript module in five minutes or less. - -### Features - -- Strongly typed JavaScript with [TypeScript]. -- Native [ECMAScript module] compatible with [Node.js]. -- Package management with [npm]. -- Publish as a package to [GitHub Packages] and [npm]. -- Examples with configurable options and arguments powered by [yargs] with [landlubber]. -- Linting with the [JavaScript Standard Style] using [ESLint]. -- [Prettier] code. -- Futuristic debuggable unit testing with [AVA]. -- Code coverage reporting with [Istanbul] and [c8]. -- Robust static dependency analysis with [DPDM]. -- Fully automated version management and package publishing with [semantic-release]. -- Continuous testing and package publishing with [GitHub Actions]. -- Consistent coding with [EditorConfig]. -- Start coding instantly with [GitHub Codespaces]. -- Get PR reviews directly from [code owners]. -- Automatically close [stale] Issues and Pull Requests. -- Badges from [Shields.io]. - -[AVA]: https://github.com/avajs/ava -[code owners]: https://github.blog/2017-07-06-introducing-code-owners/ -[DPDM]: https://github.com/acrazing/dpdm -[ECMAScript module]: https://nodejs.org/api/esm.html -[ESLint]: https://eslint.org/ -[EditorConfig]: https://editorconfig.org/ -[GitHub Actions]: https://github.com/features/actions -[GitHub Codespaces]: https://github.com/features/packages -[GitHub Packages]: https://github.com/features/packages -[Istanbul]: https://istanbul.js.org/ -[JavaScript Standard Style]: https://standardjs.com/ -[Node.js]: https://nodejs.org/ -[Prettier]: https://prettier.io/ -[semantic-release]: https://semantic-release.gitbook.io/ -[Shields.io]: https://shields.io/ -[stale]: https://github.com/marketplace/stale -[TypeScript]: https://www.typescriptlang.org/ -[c8]: https://github.com/bcoe/c8 -[landlubber]: https://github.com/razor-x/landlubber -[npm]: https://www.npmjs.com/ -[yargs]: https://yargs.js.org/ - -### Bootstrapping a new project - -1. [Trigger a makenew workflow from this repository][makenew workflow]. 🚀 - - Provide a value for each required input. - - There are no defaults. - - Example values are shown in parentheses. -2. When the workflow completes, clone your new repo and start coding! - -[makenew workflow]: https://github.com/seamapi/makenew-tsmodule/actions/workflows/makenew.yml - -### Updating from this skeleton - -If you want to pull in future updates from this skeleton, -you can fetch and merge in changes from this repository. - -Add this as a new remote with - -``` -$ git remote add makenew git@github.com:seamapi/makenew-tsmodule.git -``` - -You can then fetch and merge changes with - -``` -$ git fetch --no-tags makenew -$ git merge makenew/main -``` +TODO ## Installation Add this as a dependency to your project using [npm] with ``` -$ npm install @seamapi/makenew-tsmodule +$ npm install seam ``` [npm]: https://www.npmjs.com/ @@ -94,8 +24,8 @@ $ npm install @seamapi/makenew-tsmodule ### Quickstart ``` -$ git clone https://github.com/seamapi/makenew-tsmodule.git -$ cd makenew-tsmodule +$ git clone https://github.com/seamapi/javascript-next.git +$ cd javascript-next $ nvm install $ npm install $ npm run test:watch @@ -115,10 +45,10 @@ The [source code] is hosted on GitHub. Clone the project with ``` -$ git clone git@github.com:seamapi/makenew-tsmodule.git +$ git clone git@github.com:seamapi/javascript-next.git ``` -[source code]: https://github.com/seamapi/makenew-tsmodule +[source code]: https://github.com/seamapi/javascript-next ### Requirements @@ -171,7 +101,7 @@ $ gh workflow run version.yml --raw-field version= [GitHub CLI]: https://cli.github.com/ [npm-version]: https://docs.npmjs.com/cli/version -[version workflow_dispatch on GitHub Actions]: https://github.com/seamapi/makenew-tsmodule/actions?query=workflow%3Aversion +[version workflow_dispatch on GitHub Actions]: https://github.com/seamapi/javascript-next/actions?query=workflow%3Aversion ## GitHub Actions diff --git a/examples/todo.ts b/examples/todo.ts index a335851..23a513e 100644 --- a/examples/todo.ts +++ b/examples/todo.ts @@ -1,6 +1,6 @@ import type { Builder, Command, Describe, Handler } from 'landlubber' -import { todo } from '@seamapi/makenew-tsmodule' +import { todo } from 'seam' interface Options { x: string diff --git a/makenew.sh b/makenew.sh deleted file mode 100755 index 38526bb..0000000 --- a/makenew.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -u - -find_replace () { - git grep --cached -Il '' | xargs sed -i.sedbak -e "$1" - find . -name "*.sedbak" -exec rm {} \; -} - -sed_insert () { - sed -i.sedbak -e "$2\\""$3" $1 - rm $1.sedbak -} - -sed_delete () { - sed -i.sedbak -e "$2" $1 - rm $1.sedbak -} - -check_env () { - test -d .git || (echo 'This is not a Git repository. Exiting.' && exit 1) - for cmd in ${1}; do - command -v ${cmd} >/dev/null 2>&1 || \ - (echo "Could not find '$cmd' which is required to continue." && exit 2) - done - echo - echo 'Ready to bootstrap your new project!' - echo -} - -stage_env () { - echo - echo 'Removing origin and tags.' - git tag | xargs git tag -d - git branch --unset-upstream - git remote rm origin - echo - git rm -f makenew.sh - git rm -f .github/workflows/makenew.yml - echo - echo 'Staging changes.' - git add --all - echo - echo 'Done!' - echo -} - -makenew () { - if [[ -z "${CI:-}" ]]; then - echo 'Answer all prompts.' - echo 'There are no defaults.' - echo 'Example values are shown in parentheses.' - read -p '> Your GitHub username (my-user): ' mk_codeowner - read -p '> GitHub repository name (new-repo): ' mk_repo - read -p '> Package name (@seamapi/new-package): ' mk_slug - read -p '> Package title (New Package): ' mk_title - read -p '> Short package description (Foos and bars.): ' mk_description - fi - - sed_delete README.md '10,80d' - sed_insert README.md '10i' 'TODO' - - find_replace "s/^ \"version\": \".*\"/ \"version\": \"0.0.0\"/g" - find_replace "s/TypeScript Module Package Skeleton/${mk_title}/g" - find_replace "s/Package skeleton for a TypeScript module\./${mk_description}/g" - find_replace "s/@seambot/@${mk_codeowner}/g" - find_replace "s|@seamapi/makenew-tsmodule|${mk_slug}|g" - find_replace "s|makenew-tsmodule|${mk_repo}|g" - - echo - echo 'Replacing boilerplate.' -} - -check_env 'git read sed xargs' -makenew -stage_env -exit diff --git a/package-lock.json b/package-lock.json index 4d0d124..a783549 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "@seamapi/makenew-tsmodule", - "version": "1.3.0", + "name": "seam", + "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@seamapi/makenew-tsmodule", + "name": "seam", "version": "1.3.0", "license": "MIT", "devDependencies": { diff --git a/package.json b/package.json index 144c6f3..5900054 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "@seamapi/makenew-tsmodule", - "version": "1.3.0", - "description": "Package skeleton for a TypeScript module.", + "name": "seam", + "version": "0.0.0", + "description": "JavaScript SDK for the Seam API written in TypeScript.", "type": "module", "main": "index.js", "types": "index.d.ts", @@ -16,9 +16,9 @@ "keywords": [ "node" ], - "homepage": "https://github.com/seamapi/makenew-tsmodule", - "bugs": "https://github.com/seamapi/makenew-tsmodule/issues", - "repository": "seamapi/makenew-tsmodule", + "homepage": "https://github.com/seamapi/javascript-next", + "bugs": "https://github.com/seamapi/javascript-next/issues", + "repository": "seamapi/javascript-next", "license": "MIT", "author": { "name": "Seam Labs, Inc.", diff --git a/test/todo.test.ts b/test/todo.test.ts index a65739e..2dd7281 100644 --- a/test/todo.test.ts +++ b/test/todo.test.ts @@ -1,6 +1,6 @@ import test from 'ava' -import { todo } from '@seamapi/makenew-tsmodule' +import { todo } from 'seam' test('todo: returns argument', (t) => { t.is(todo('todo'), 'todo', 'returns input') diff --git a/tsconfig.json b/tsconfig.json index 4d42186..c2b6c4a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,7 +24,7 @@ "forceConsistentCasingInFileNames": true, "baseUrl": "./", "paths": { - "@seamapi/makenew-tsmodule": ["./src/index.ts"], + "seam": ["./src/index.ts"], "lib/*": ["./src/lib/*"] } },