-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add npm project push and testing (#3)
* add npm tests * add github action for publishing * add eslint + ci testing * 1.1.0 * add release scripts * updating dependencies * test push event * add test training data * update tests from ESLINT errors * fix ESLint... :eye-rolling-eyes: * update tests and bot * update Wrangler + deps + tests * update test cases * fix workflow tests * update deps * update lint rules * no need to test node 18.x * allow test tweets.txt
- Loading branch information
Showing
19 changed files
with
7,196 additions
and
889 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
env: | ||
node: true | ||
es2021: true | ||
extends: 'eslint:recommended' | ||
parserOptions: | ||
ecmaVersion: 'latest' | ||
sourceType: 'module' | ||
rules: | ||
indent: | ||
- error | ||
- 4 | ||
- SwitchCase: 1 | ||
linebreak-style: | ||
- error | ||
- unix | ||
quotes: | ||
- error | ||
- single | ||
- avoidEscape: true | ||
semi: | ||
- error | ||
- always | ||
no-unused-vars: | ||
- error | ||
- argsIgnorePattern: '^_' | ||
varsIgnorePattern: '^_' | ||
no-console: off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Run linter | ||
run: npm run lint --if-present | ||
|
||
- name: Run tests | ||
run: npm test | ||
|
||
- name: Build | ||
run: npm run build --if-present |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Publish Package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Run tests | ||
run: npm test | ||
|
||
- name: Build | ||
run: npm run build --if-present | ||
|
||
publish: | ||
needs: test | ||
if: github.event.release.target_commitish == 'main' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build | ||
run: npm run build --if-present | ||
|
||
- name: Publish to NPM | ||
run: npm publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Deploy to Cloudflare Workers | ||
run: npm run deploy | ||
env: | ||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"push": { | ||
"ref": "refs/heads/main" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,122 @@ | ||
# Dependencies | ||
node_modules/ | ||
jspm_packages/ | ||
.pnp | ||
.pnp.js | ||
.npm | ||
package-lock.json | ||
yarn.lock | ||
.yarn/ | ||
.yarnrc.yml | ||
|
||
# Testing | ||
coverage/ | ||
.nyc_output/ | ||
*.lcov | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
.pnpm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Dependency directories | ||
node_modules/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# dotenv environment variable files | ||
# Environment variables | ||
.env | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.env.* | ||
.env.local | ||
.env.*.local | ||
.dev.vars | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
.vscode | ||
# IDE - VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
*.code-workspace | ||
.history/ | ||
|
||
# Cloudflare Workers | ||
.wrangler/ | ||
.dev.vars | ||
# IDE - JetBrains | ||
.idea/ | ||
*.iml | ||
*.ipr | ||
*.iws | ||
|
||
# IDE - Sublime Text | ||
*.sublime-workspace | ||
*.sublime-project | ||
|
||
# macOS | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
Icon | ||
._* | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Windows | ||
Thumbs.db | ||
Thumbs.db:encryptable | ||
ehthumbs.db | ||
ehthumbs_vista.db | ||
[Dd]esktop.ini | ||
$RECYCLE.BIN/ | ||
*.cab | ||
*.msi | ||
*.msix | ||
*.msm | ||
*.msp | ||
*.lnk | ||
|
||
# Build output | ||
dist/ | ||
build/ | ||
.wrangler/ | ||
.cloudflare/ | ||
worker/ | ||
*.tsbuildinfo | ||
|
||
# Ignore the following files in the root of this repository: | ||
.DS_Store | ||
tweets.txt | ||
# Local dev | ||
.local/ | ||
.cache/ | ||
*.swp | ||
*.swo | ||
*~ | ||
|
||
# Project specific | ||
#tweets.txt | ||
.secrets | ||
.github/workflows/release.event.json | ||
|
||
# Test files | ||
__tests__/*.js.snap | ||
__snapshots__/ | ||
*.snap | ||
|
||
# Cloudflare specific | ||
.dev.vars | ||
wrangler.toml | ||
.wrangler/ | ||
.cloudflare/ | ||
.requirements.txt | ||
|
||
# Misc | ||
*.bak | ||
*.tmp | ||
.temp/ | ||
.cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Development files | ||
.github/ | ||
tests/ | ||
babel.config.json | ||
jest.config.js | ||
.env | ||
.env.* | ||
|
||
# Editor files | ||
.vscode/ | ||
.idea/ | ||
*.swp | ||
*.swo | ||
|
||
# Logs | ||
logs/ | ||
*.log | ||
npm-debug.log* | ||
|
||
# Dependencies | ||
node_modules/ | ||
|
||
# Build artifacts | ||
dist/ | ||
build/ | ||
coverage/ | ||
|
||
# Git files | ||
.git/ | ||
.gitignore | ||
|
||
# Misc | ||
.DS_Store | ||
Thumbs.db |
Oops, something went wrong.