-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #186 from depot/packaging
- Loading branch information
Showing
32 changed files
with
2,554 additions
and
2 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 |
---|---|---|
|
@@ -14,6 +14,23 @@ jobs: | |
go-version: "1.20.5" | ||
check-latest: true | ||
cache: true | ||
|
||
- name: Install pnpm | ||
uses: pnpm/[email protected] | ||
with: | ||
version: 8.x.x | ||
|
||
- name: Install Node 18 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18" | ||
cache: pnpm | ||
cache-dependency-path: npm/pnpm-lock.yaml | ||
|
||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile --ignore-scripts | ||
working-directory: npm | ||
|
||
- name: Verify dependencies | ||
run: | | ||
go mod verify | ||
|
@@ -44,6 +61,12 @@ jobs: | |
args: --timeout 5m | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- run: pnpm fmt:check | ||
working-directory: npm | ||
|
||
- run: pnpm type-check | ||
working-directory: npm | ||
|
||
build: | ||
runs-on: ubuntu-latest-16-cores | ||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | ||
|
@@ -54,11 +77,32 @@ jobs: | |
go-version: "1.20.5" | ||
check-latest: true | ||
cache: true | ||
|
||
- name: Install pnpm | ||
uses: pnpm/[email protected] | ||
with: | ||
version: 8.x.x | ||
|
||
- name: Install Node 18 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18" | ||
cache: pnpm | ||
cache-dependency-path: npm/pnpm-lock.yaml | ||
|
||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile --ignore-scripts | ||
working-directory: npm | ||
|
||
- uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
version: 1.19.0 | ||
args: build --clean --snapshot | ||
|
||
- run: make npm | ||
env: | ||
DEPOT_CLI_VERSION: v0.0.0-dev | ||
|
||
package: | ||
runs-on: ubuntu-latest | ||
if: github.event_name != 'pull_request' | ||
|
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 |
---|---|---|
|
@@ -10,18 +10,49 @@ jobs: | |
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'dev-') | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.20.5" | ||
check-latest: true | ||
cache: true | ||
|
||
- name: Install pnpm | ||
uses: pnpm/[email protected] | ||
with: | ||
version: 8.x.x | ||
|
||
- name: Install Node 18 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18" | ||
registry-url: https://registry.npmjs.org | ||
cache: pnpm | ||
cache-dependency-path: npm/pnpm-lock.yaml | ||
|
||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile --ignore-scripts | ||
working-directory: npm | ||
|
||
- name: Compute tag name | ||
id: tag-name | ||
run: echo "::set-output name=tag-name::${GITHUB_REF#refs/tags/}" | ||
|
||
- uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
version: 1.19.0 | ||
args: release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.BOT_PUBLIC_GITHUB_TOKEN }} | ||
GORELEASER_CURRENT_TAG: ${{ steps.tag-name.outputs.tag-name }} | ||
|
||
- name: Build pnpm packages | ||
run: make npm | ||
env: | ||
DEPOT_VERSION: ${{ steps.tag-name.outputs.tag-name }} | ||
|
||
- name: Release npm packages | ||
run: pnpm publish -r --access public --no-git-checks | ||
working-directory: npm | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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 |
---|---|---|
|
@@ -4,7 +4,8 @@ dist/ | |
/bin | ||
/depot | ||
|
||
node_modules | ||
|
||
/CHANGELOG.md | ||
.vscode | ||
go.work | ||
go.work.sum |
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 @@ | ||
{ | ||
"prettier.prettierPath": "npm/node_modules/prettier/index.cjs", | ||
"typescript.tsdk": "npm/node_modules/typescript/lib", | ||
"typescript.enablePromptUseWorkspaceTsdk": true | ||
} |
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,6 +1,6 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Depot Ventures LLC <[email protected]> | ||
Copyright (c) 2022 Depot Technologies Inc <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
|
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
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,3 @@ | ||
packages/cli/install.js | ||
packages/*/bin | ||
packages/*/lib |
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 @@ | ||
bin/ | ||
dist/ | ||
lib/ | ||
pnpm-lock.yaml | ||
packages/**/*.js |
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,30 @@ | ||
#!/bin/bash | ||
set -ex | ||
|
||
node bundle.cjs | ||
pnpm generate-types | ||
pnpm update-versions | ||
|
||
chmod +x packages/cli/bin/depot | ||
|
||
mkdir -p packages/cli-linux-ia32/bin/ | ||
mkdir -p packages/cli-linux-x64/bin/ | ||
mkdir -p packages/cli-linux-arm/bin/ | ||
mkdir -p packages/cli-linux-arm64/bin/ | ||
mkdir -p packages/cli-darwin-x64/bin/ | ||
mkdir -p packages/cli-darwin-arm64/bin/ | ||
mkdir -p packages/cli-win32-ia32/bin/ | ||
mkdir -p packages/cli-win32-x64/bin/ | ||
mkdir -p packages/cli-win32-arm/bin/ | ||
mkdir -p packages/cli-win32-arm64/bin/ | ||
|
||
cp ../dist/linux_linux_386/bin/depot packages/cli-linux-ia32/bin/ | ||
cp ../dist/linux_linux_amd64_v1/bin/depot packages/cli-linux-x64/bin/ | ||
cp ../dist/linux_linux_arm_6/bin/depot packages/cli-linux-arm/bin/ | ||
cp ../dist/linux_linux_arm64/bin/depot packages/cli-linux-arm64/bin/ | ||
cp ../dist/macos_darwin_amd64_v1/bin/depot packages/cli-darwin-x64/bin/ | ||
cp ../dist/macos_darwin_arm64/bin/depot packages/cli-darwin-arm64/bin/ | ||
cp ../dist/windows_windows_386/bin/depot.exe packages/cli-win32-ia32/bin/ | ||
cp ../dist/windows_windows_amd64_v1/bin/depot.exe packages/cli-win32-x64/bin/ | ||
cp ../dist/windows_windows_arm_6/bin/depot.exe packages/cli-win32-arm/bin/ | ||
cp ../dist/windows_windows_arm64/bin/depot.exe packages/cli-win32-arm64/bin/ |
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,36 @@ | ||
const esbuild = require('esbuild') | ||
|
||
const DEPOT_CLI_VERSION = process.env.DEPOT_CLI_VERSION?.replace('v', '') | ||
if (!DEPOT_CLI_VERSION) throw new Error('Missing DEPOT_CLI_VERSION') | ||
|
||
// packages/cli/install.js | ||
esbuild.build({ | ||
entryPoints: ['src/install.ts'], | ||
bundle: true, | ||
platform: 'node', | ||
target: 'node14', | ||
outfile: 'packages/cli/install.js', | ||
external: ['@depot/cli'], | ||
}) | ||
|
||
// packages/cli/lib/main.js | ||
esbuild.build({ | ||
entryPoints: ['src/main.ts'], | ||
bundle: true, | ||
platform: 'node', | ||
target: 'node14', | ||
outfile: 'packages/cli/lib/main.js', | ||
external: ['@depot/cli'], | ||
define: {DEPOT_CLI_VERSION: JSON.stringify(DEPOT_CLI_VERSION)}, | ||
}) | ||
|
||
// packages/cli/bin/depot | ||
esbuild.build({ | ||
entryPoints: ['src/shim.ts'], | ||
bundle: true, | ||
platform: 'node', | ||
target: 'node14', | ||
outfile: 'packages/cli/bin/depot', | ||
external: ['@depot/cli'], | ||
define: {DEPOT_CLI_VERSION: JSON.stringify(DEPOT_CLI_VERSION)}, | ||
}) |
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,38 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"build": "./build.sh", | ||
"clean": "rm -rf packages/*/bin packages/*/lib packages/cli/install.js", | ||
"fmt": "prettier --write .", | ||
"fmt:check": "prettier --check .", | ||
"generate-types": "dts-bundle-generator src/main.ts -o packages/cli/lib/main.d.ts --external-inlines execa", | ||
"type-check": "tsc --noEmit", | ||
"update-versions": "node ./update-versions.cjs" | ||
}, | ||
"dependencies": { | ||
"execa": "^8.0.1" | ||
}, | ||
"devDependencies": { | ||
"@tsconfig/node18": "^18.2.1", | ||
"@types/node": "^20.5.3", | ||
"dts-bundle-generator": "^8.0.1", | ||
"esbuild": "^0.19.2", | ||
"esbuild-register": "^3.4.2", | ||
"prettier": "^3.0.2", | ||
"prettier-plugin-organize-imports": "^3.2.3", | ||
"prettier-plugin-pkg": "^0.18.0", | ||
"tsup": "^7.2.0", | ||
"typescript": "^5.1.6" | ||
}, | ||
"prettier": { | ||
"printWidth": 120, | ||
"semi": false, | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"bracketSpacing": false, | ||
"plugins": [ | ||
"prettier-plugin-organize-imports", | ||
"prettier-plugin-pkg" | ||
] | ||
} | ||
} |
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,20 @@ | ||
{ | ||
"name": "@depot/cli-darwin-arm64", | ||
"version": "0.0.1-cli.0.0.0-dev", | ||
"description": "The macOS ARM 64-bit binary for @depot/cli.", | ||
"repository": "https://github.com/depot/cli", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"cpu": [ | ||
"arm64" | ||
], | ||
"os": [ | ||
"darwin" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"preferUnplugged": true | ||
} |
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,20 @@ | ||
{ | ||
"name": "@depot/cli-darwin-x64", | ||
"version": "0.0.1-cli.0.0.0-dev", | ||
"description": "The macOS Intel 64-bit binary for @depot/cli.", | ||
"repository": "https://github.com/depot/cli", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"cpu": [ | ||
"x64" | ||
], | ||
"os": [ | ||
"darwin" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"preferUnplugged": true | ||
} |
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,20 @@ | ||
{ | ||
"name": "@depot/cli-linux-arm", | ||
"version": "0.0.1-cli.0.0.0-dev", | ||
"description": "The Linux ARM binary for @depot/cli.", | ||
"repository": "https://github.com/depot/cli", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"cpu": [ | ||
"arm" | ||
], | ||
"os": [ | ||
"linux" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"preferUnplugged": true | ||
} |
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,20 @@ | ||
{ | ||
"name": "@depot/cli-linux-arm64", | ||
"version": "0.0.1-cli.0.0.0-dev", | ||
"description": "The Linux ARM 64-bit binary for @depot/cli.", | ||
"repository": "https://github.com/depot/cli", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"cpu": [ | ||
"arm64" | ||
], | ||
"os": [ | ||
"linux" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"preferUnplugged": true | ||
} |
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,20 @@ | ||
{ | ||
"name": "@depot/cli-linux-ia32", | ||
"version": "0.0.1-cli.0.0.0-dev", | ||
"description": "The Linux Intel 32-bit binary for @depot/cli.", | ||
"repository": "https://github.com/depot/cli", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"cpu": [ | ||
"ia32" | ||
], | ||
"os": [ | ||
"linux" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"preferUnplugged": true | ||
} |
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,20 @@ | ||
{ | ||
"name": "@depot/cli-linux-x64", | ||
"version": "0.0.1-cli.0.0.0-dev", | ||
"description": "The Linux Intel 64-bit binary for @depot/cli.", | ||
"repository": "https://github.com/depot/cli", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"cpu": [ | ||
"x64" | ||
], | ||
"os": [ | ||
"linux" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"preferUnplugged": true | ||
} |
Oops, something went wrong.