Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
API_KEY=your_api_key_here
SERVER_ROLE_API_KEY=your_server_role_api_key_here
ENDPOINT=https://example.bucketeer.io
52 changes: 52 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: e2e

on:
workflow_dispatch:
workflow_call:
secrets:
E2E_HOST:
required: true
E2E_TOKEN:
required: true
E2E_SERVER_ROLE_TOKEN:
required: true
NPM_TOKEN:
required: true

env:
NODE_VERSION: 20
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

jobs:
e2e:
name: e2e test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: ${{ env.NODE_VERSION }}
- name: Set yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
id: yarn-cache
with:
path: |
**/node_modules
**/.eslintcache
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn
- name: Build
run: yarn build
- name: Create .env file
run: |
echo "API_KEY=${{ secrets.E2E_TOKEN }}" > .env
echo "SERVER_ROLE_API_KEY=${{ secrets.E2E_SERVER_ROLE_TOKEN }}" >> .env
echo "ENDPOINT=${{ secrets.E2E_HOST }}" >> .env
- name: Run e2e tests
run: yarn test:e2e
39 changes: 39 additions & 0 deletions .github/workflows/pr-title-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: pr-title-validation

on:
pull_request_target:
types:
- opened
- reopened
- edited
- synchronize

jobs:
validate_pr_title:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
with:
# Use the following release types to match the same rules in the PR title lint
# https://github.com/googleapis/release-please/blob/main/src/changelog-notes.ts#L42-L55
types: |
feat
fix
perf
deps
revert
docs
style
chore
refactor
test
build
ci
subjectPattern: ^(?![A-Z]).+$
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112 changes: 112 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Pull Request

on:
pull_request:
branches:
- main
paths-ignore:
- "**/**.md"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
NODE_VERSION: 20
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
EXAMPLE_PATH: ./example

jobs:
install-dependencies:
name: Install dependencies
runs-on: ubuntu-latest
outputs:
YARN_CACHE_DIR: ${{ steps.yarn-cache-dir-path.outputs.dir }}
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: ${{ env.NODE_VERSION }}
- name: Set yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
id: yarn-cache
with:
path: |
**/node_modules
**/.eslintcache
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Init
run: yarn

lint:
name: Lint
needs: install-dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
id: yarn-cache
with:
path: |
**/node_modules
**/.eslintcache
${{ needs.install-dependencies.outputs.YARN_CACHE_DIR }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Format
run: yarn prettier
- name: Lint
run: yarn lint

unit-test:
name: Unit test
needs: install-dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
id: yarn-cache
with:
path: |
**/node_modules
**/.eslintcache
${{ needs.install-dependencies.outputs.YARN_CACHE_DIR }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Unit test
run: yarn test

build:
name: Build
needs: install-dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
id: yarn-cache
with:
path: |
**/node_modules
**/.eslintcache
${{ needs.install-dependencies.outputs.YARN_CACHE_DIR }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: SDK Build
run: yarn build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,4 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
/lib
30 changes: 30 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.DS_Store
.vscode
__dist
__lib
__test
__e2e
e2e
example
src
tools
.eslintignore
.eslintrc.js
.gitignore
.nvmrc
.npmignore
.prettierignore
.prettierrc.js
ava-e2e.config.mjs
ava-test.config.mjs
babel-e2e.config.js
babel-test.config.js
babel.config.js
renovate.json
Makefile
tsconfig.json
tsconfig.test.json
tslint.json
yarn-error.log
bootstrap.js
index.ts
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.17.0
11 changes: 11 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
**/*.d.ts
.github/
node_modules/
dist/
build/
coverage/
example/**/node_modules/
example/**/dist/
example/**/build/
example/**/coverage/
lib/
6 changes: 6 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
printWidth: 100,
singleQuote: true,
trailingComma: 'all',
arrowParens: 'always',
};
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.0.1"
}
}
44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
NPM_BIN_DIR := $(CURDIR)/node_modules/.bin
GENFILES_DIR := $(CURDIR)/lib

GIT_REVISION := $(shell git rev-parse --verify HEAD)

export PACKAGE_NAME := $(shell node -p "require('./package.json').name")
export CURRENT_VERSION := $(shell npm view $(PACKAGE_NAME) version 2>/dev/null || echo 0.0.0)
export LOCAL_VERSION := $(shell node -p "require('./package.json').version")

.PHONY: init
init:
yarn

.PHONY: build
build:
yarn build

.PHONY: clean-build
clean-build:
rm -rf $(GENFILES_DIR)

.PHONY: tsc
tsc:
$(NPM_BIN_DIR)/tsc --project tsconfig.json

.PHONY: test
test:
yarn test

.PHONY: lint
lint:
yarn lint

.PHONY: publish-dry
publish-dry:
npm publish --dry-run

.PHONY: publish
publish: copy-genfiles
ifeq ($(shell $(NPM_BIN_DIR)/semver -r ">$(CURRENT_VERSION)" $(LOCAL_VERSION) ),$(LOCAL_VERSION))
npm publish --access public
else
@echo "$(LOCAL_VERSION) exists. skip publish."
endif
Loading