-
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.
Add packaging of CLI as npm packages
- Loading branch information
1 parent
12d1753
commit 2063c0e
Showing
29 changed files
with
2,448 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 |
---|---|---|
|
@@ -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,29 @@ | ||
#!/bin/bash | ||
set -ex | ||
|
||
node bundle.cjs | ||
pnpm generate-types | ||
|
||
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 pkg = require('./packages/cli/package.json') | ||
|
||
const DEPOT_CLI_VERSION = pkg.version.split('-cli.')[1] | ||
|
||
// 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,37 @@ | ||
{ | ||
"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" | ||
}, | ||
"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.2.36.1", | ||
"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.2.36.1", | ||
"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.2.36.1", | ||
"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.2.36.1", | ||
"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.2.36.1", | ||
"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.2.36.1", | ||
"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 | ||
} |
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-win32-arm", | ||
"version": "0.0.1-cli.2.36.1", | ||
"description": "The Windows ARM 32-bit binary for @depot/cli.", | ||
"repository": "https://github.com/depot/cli", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"cpu": [ | ||
"arm" | ||
], | ||
"os": [ | ||
"win32" | ||
], | ||
"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-win32-arm64", | ||
"version": "0.0.1-cli.2.36.1", | ||
"description": "The Windows ARM 64-bit binary for @depot/cli.", | ||
"repository": "https://github.com/depot/cli", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"cpu": [ | ||
"arm64" | ||
], | ||
"os": [ | ||
"win32" | ||
], | ||
"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-win32-ia32", | ||
"version": "0.0.1-cli.2.36.1", | ||
"description": "The Windows Intel 32-bit binary for @depot/cli.", | ||
"repository": "https://github.com/depot/cli", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"cpu": [ | ||
"ia32" | ||
], | ||
"os": [ | ||
"win32" | ||
], | ||
"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-win32-x64", | ||
"version": "0.0.1-cli.2.36.1", | ||
"description": "The Windows Intel 64-bit binary for @depot/cli.", | ||
"repository": "https://github.com/depot/cli", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"cpu": [ | ||
"x64" | ||
], | ||
"os": [ | ||
"win32" | ||
], | ||
"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,22 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Depot Technologies Inc <[email protected]> | ||
Copyright (c) 2020 Evan Wallace | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Oops, something went wrong.