Skip to content

Commit

Permalink
Node module only (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbeseda authored Apr 17, 2024
1 parent 29f1bd7 commit 90d9b05
Show file tree
Hide file tree
Showing 107 changed files with 340 additions and 1,258 deletions.
54 changes: 0 additions & 54 deletions .github/workflows/binary-build.yml

This file was deleted.

92 changes: 1 addition & 91 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
node-version: [ 16.x, 18.x, 20.x ]
os: [ windows-latest, ubuntu-latest, macOS-latest, self-hosted ]
os: [ windows-latest, ubuntu-latest, macOS-latest ]

# Go
steps:
Expand Down Expand Up @@ -75,93 +75,3 @@ jobs:
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

# Publish the build to S3
publish:
# Setup
# needs: test
if: startsWith(github.ref, 'refs/tags/v') ||
github.ref == 'refs/heads/main'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, self-hosted ]

# Go
steps:
- name: Check out repo
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install aws-sdk
run: npm i aws-sdk

- name: Install
run: npm i

- name: Publish 'latest' (aka production) build
if: startsWith(github.ref, 'refs/tags/v')
run: npm run publish-binary
env:
DEPLOY: prod
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
BEGIN_CLI_CLIENT_ID_STAGING: ${{ secrets.BEGIN_CLI_CLIENT_ID_STAGING }}
BEGIN_CLI_CLIENT_ID_PRODUCTION: ${{ secrets.BEGIN_CLI_CLIENT_ID_PRODUCTION }}
S3_BUCKET: ${{ secrets.S3_BUCKET }}

- name: Publish 'main' (aka canary) build
if: github.ref == 'refs/heads/main'
run: npm run publish-binary
env:
DEPLOY: main
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
BEGIN_CLI_CLIENT_ID_STAGING: ${{ secrets.BEGIN_CLI_CLIENT_ID_STAGING }}
BEGIN_CLI_CLIENT_ID_PRODUCTION: ${{ secrets.BEGIN_CLI_CLIENT_ID_PRODUCTION }}
S3_BUCKET: ${{ secrets.S3_BUCKET }}

# Deploy to the API + CDN
deploy:
# Setup
needs: publish
if: startsWith(github.ref, 'refs/tags/v') ||
github.ref == 'refs/heads/main'
runs-on: ubuntu-latest

# Go
steps:
- name: Check out repo
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install
run: npm i aws-sdk

- name: Deploy 'latest' (aka production) build
if: startsWith(github.ref, 'refs/tags/v')
run: npm run deploy
env:
DEPLOY: prod
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CF_DISTRO: ${{ secrets.CF_DISTRO }}
LATEST_API: ${{ secrets.LATEST_API }}

- name: Deploy 'main' (aka canary) build
if: github.ref == 'refs/heads/main'
run: npm run deploy
env:
DEPLOY: main
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CF_DISTRO: ${{ secrets.CF_DISTRO }}
LATEST_API: ${{ secrets.LATEST_API }}
8 changes: 2 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
node_modules/
.nyc_output/
build
commit
client-ids.json
config.json
coverage/
node_modules/

scratch/
scripts/package.json
test/tmp/
13 changes: 4 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@begin/deploy",
"license": "Apache-2.0",
"version": "0.21.6",
"bin": {
"begin": "src/index.js"
Expand All @@ -13,14 +14,9 @@
"test:unit": "cross-env tape 'test/unit/**/*-test.js' | tap-arc -v",
"test:integration": "cross-env NODE_ENV=testing tape 'test/integration/**/*-test.js' | tap-arc -v",
"test:integration:slow": "cross-env NODE_ENV=testing tape 'test/integration/**/*-test-slow.js' | tap-arc -v",
"test:module": "cross-env MODULE_ONLY=true npm run test",
"coverage": "nyc --reporter=lcov --reporter=text npm run test:unit",
"lint": "eslint . --fix",
"build": "node vendor/vendor.js && cross-env scripts/binary-config && npx pkg scripts --compress GZip && rm -f commit",
"publish-binary": "BUILD_ALL=true npm run build && scripts/publish",
"deploy": "scripts/deploy"
"lint": "eslint . --fix"
},
"license": "Apache-2.0",
"dependencies": {
"@architect/inventory": "4.0.4",
"@architect/parser": "6.0.3",
Expand All @@ -29,24 +25,23 @@
"@colors/colors": "1.6.0",
"@enhance/cli": "1.2.0",
"@enhance/starter-project": "7.0.2",
"adm-zip": "0.5.10",
"enquirer": "2.4.1",
"minimist": "1.2.8",
"node-machine-id": "1.1.12",
"restore-cursor": "3.1.0",
"strip-ansi": "6.0.1",
"tiny-json-http": "7.5.1",
"tmp": "0.2.3",
"update-notifier-cjs": "5.1.6",
"ws": "8.16.0"
},
"devDependencies": {
"@architect/eslint-config": "~2.1.2",
"@architect/eslint-config": "3.0.0-RC.0",
"@architect/plugin-node-prune": "2.1.0-RC.0",
"cross-env": "~7.0.3",
"eslint": "~8.57.0",
"fs-extra": "~11.2.0",
"nyc": "~15.1.0",
"pkg": "5.8.1",
"proxyquire": "~2.1.3",
"string-argv": "~0.3.2",
"tap-arc": "~1.2.2",
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Alternatively, you can install Begin with npm: `npm i -g @begin/cli`.

## Running locally

Before running `npm run build` to create a local binary be sure to set the following environment variables:
Be sure to set the following environment variables:

```
export DEPLOY=main
Expand Down Expand Up @@ -83,6 +83,6 @@ Similarly, to switch back to `latest` from `main`, run: `begin update --use late

Wherever possible, the Begin CLI adheres to the [Command Line Interface Guidelines](https://clig.dev/).

Begin is `async/await` / `Promises`-based, and uses `pkg` for binary compilation. It is currently CommonJS, with plans to [eventually refactor to ESM](https://github.com/vercel/pkg/issues/1291).
Begin is `async/await` / `Promises`-based. It is currently CommonJS, with plans to eventually refactor to ESM.

Begin is written in idiomatic JavaScript with a key exception: each command's specific `require()` statements are in local scope, not global. This is specifically and deliberately done to [reduce the coldstart time and ensure every execution runs as fast as possible](https://github.com/beginner-corp/cli/discussions/4).
113 changes: 0 additions & 113 deletions scripts/binary-config

This file was deleted.

Loading

0 comments on commit 90d9b05

Please sign in to comment.