Skip to content

Commit

Permalink
build: shipjs 導入 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
locona authored Jun 24, 2021
1 parent 8642fee commit 6bae74c
Show file tree
Hide file tree
Showing 10 changed files with 2,457 additions and 96 deletions.
4 changes: 0 additions & 4 deletions .env

This file was deleted.

65 changes: 65 additions & 0 deletions .github/workflows/shipjs-manual-prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Ship js Manual Prepare
on:
issue_comment:
types: [created]
jobs:
manual_prepare:
if: |
github.event_name == 'issue_comment' &&
(github.event.comment.author_association == 'member' || github.event.comment.author_association == 'owner') &&
startsWith(github.event.comment.body, '@shipjs prepare')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: main
- uses: actions/setup-node@v2
with:
always-auth: true
node-version: 12.x
- run: |
if [ -f "yarn.lock" ]; then
yarn install
else
npm install
fi
- run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- run: npm run release -- --yes --no-browse
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_INCOMING_HOOK: ${{ secrets.SLACK_INCOMING_HOOK }}

create_done_comment:
if: success()
needs: manual_prepare
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "@${{github.actor}} `shipjs prepare` done"
})
create_fail_comment:
if: cancelled() || failure()
needs: manual_prepare
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "@${{github.actor}} `shipjs prepare` fail"
})
32 changes: 32 additions & 0 deletions .github/workflows/shipjs-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Ship js trigger
on:
pull_request:
types:
- closed
jobs:
build:
name: Release
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'releases/v')
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: main
- uses: actions/setup-node@v2
with:
always-auth: true
node-version: 14.x
registry-url: 'https://npm.pkg.github.com'
- run: |
if [ -f "yarn.lock" ]; then
yarn install
else
npm install
fi
- run: npx shipjs trigger
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_INCOMING_HOOK: ${{ secrets.SLACK_INCOMING_HOOK }}
60 changes: 60 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,61 @@
lib

# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
.next/
/out/

# storybook
storybook-static

# production
/src/build
/build

# misc
.DS_Store
*.pem

# debug
*.tmp
*.log*
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
*.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel

*-debug.log
*/*-debug.log

package-lock.json

.yalc
.env

## firebase
.firebase/
.runtimeconfig.json
firebase-adminsdk.json

## rollup
.size-snapshot.json

.env
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"trailingComma": "es5",
"singleQuote": true,
"semi": false
}
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "twitter-api",
"author": "",
"author": "locona([email protected])",
"version": "0.0.1",
"description": "",
"main": "./lib/index.js",
Expand All @@ -10,7 +10,8 @@
"build:js": "NODE_ENV=production node ./esbuild/build.js",
"build:js:watch": "NODE_ENV=production node ./esbuild/watch.js",
"build": "yarn build:types && yarn build:js",
"dev": "ts-node ./lib/index.js"
"dev": "ts-node ./lib/index.js",
"release": "shipjs prepare"
},
"license": "ISC",
"files": [
Expand All @@ -22,12 +23,17 @@
"@types/request": "2.48.5",
"dotenv": "8.6.0",
"esbuild": "0.11.20",
"prettier": "2.3.1",
"shipjs": "0.23.3",
"ts-node": "9.1.1",
"typescript": "4.2.4"
},
"dependencies": {
"node-fetch": "^2.6.1",
"oauth-1.0a": "^2.2.6",
"querystring": "^0.2.1"
},
"volta": {
"node": "14.17.1"
}
}
3 changes: 3 additions & 0 deletions ship.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
publishCommand: ({ tag }) => `yarn publish --tag ${tag}`,
};
1 change: 1 addition & 0 deletions src/oauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export class TwitterOAuth {
async authorizeURL(oauthToken: OAuthToken): Promise<string> {
const baseURL = new URL('https://api.twitter.com/oauth/authorize')
baseURL.searchParams.append('oauth_token', oauthToken.oauth_token)
baseURL.searchParams.append('force_login', 'true')
return baseURL.href
}

Expand Down
76 changes: 37 additions & 39 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
{
"compilerOptions": {
"module": "esnext",
"target": "esnext",
"moduleResolution": "node",
"lib": [
"ESNext",
"dom"
],

"rootDir": "src",
"outDir": "lib",

"strict": true,
"alwaysStrict": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,

"forceConsistentCasingInFileNames": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,

"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"downlevelIteration": true,
"declaration": true,
"esModuleInterop": true,

"pretty": true
},
"include": [
"typings/**/*",
"src/**/*"
]
}
"compilerOptions": {
"module": "esnext",
"target": "esnext",
"moduleResolution": "node",
"lib": [
"ESNext",
"dom"
],
"rootDir": "src",
"outDir": "lib",
"strict": true,
"alwaysStrict": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"forceConsistentCasingInFileNames": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"downlevelIteration": true,
"declaration": true,
"esModuleInterop": true,
"pretty": true
},
"include": [
"typings/**/*",
"src/**/*"
],
"exclude": [
"example"
]
}
Loading

0 comments on commit 6bae74c

Please sign in to comment.