From de4f38f1d7aa3395306b3cb9bb4322fcc64b933c Mon Sep 17 00:00:00 2001 From: Evan Date: Thu, 9 May 2024 02:10:57 +0000 Subject: [PATCH 01/14] Saving progress: making a Makefile to handle building and publishing --- Makefile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..afa967e --- /dev/null +++ b/Makefile @@ -0,0 +1,27 @@ +# Strip debug info (symbol table and DWARF) +# Also add version info to binary +GO_FLAGS += "-ldflags=-s -w -X 'github.com/ev-the-dev/tmplts/cmd.version=$(VERSION)'" + +# Avoid embedding build path in executable +GO_FLAGS += -trimpath + +# CLI Version +VERSION = "9000.0.1" + +build: version + CGO_ENABLED=0 go build $(GO_FLAGS) + +version: npm/package.json + go run scripts/version.go + +.PHONY: publish-all +publish-all: + @npm --version > /dev/null || (echo "The 'npm' command must be in your path to publish" && false) + @echo "Checking for uncommitted & untracked changes..." && test -z "`git status --porcelain | grep 'M'" || \ + (echo "Cannot publish with uncommited/untracked changes:" && \ + git status --porcelain | grep 'M' && false) + @echo "Checking for main branch..." && test main = "`git rev-parse --abbrev-ref HEAD`" || \ + (echo "Cannot publish from non-main branch `git rev-parse --abbrev-ref HEAD`" && false) + @echo "Checking for unpushed commits..." && git fetch + @test "" = "`git cherry`" || (echo "Cannot publish with unpushed commits" && false) + From 9d87ba133c4e1ca10b99567f4cc8f9613aa7e82b Mon Sep 17 00:00:00 2001 From: Evan Date: Thu, 9 May 2024 21:13:55 +0000 Subject: [PATCH 02/14] Adding some platform specific builds and publishing commands to the Makefile; Adding directories for platform binary output --- .github/workflows/deploy.yml | 2 +- Makefile | 44 +++++++++++++++++++++++---- npm/@tmplts/darwin-arm64/package.json | 20 ++++++++++++ npm/@tmplts/darwin-x64/package.json | 20 ++++++++++++ npm/@tmplts/linux-x64/package.json | 20 ++++++++++++ npm/package.json | 7 ++++- 6 files changed, 105 insertions(+), 8 deletions(-) create mode 100644 npm/@tmplts/darwin-arm64/package.json create mode 100644 npm/@tmplts/darwin-x64/package.json create mode 100644 npm/@tmplts/linux-x64/package.json diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 88ce65b..f6c1723 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -63,7 +63,7 @@ jobs: uses: actions/download-artifact@v4 with: name: go_binary - path: npm + path: npm/bin - name: Copy Files run: cp ../README.md ../LICENSE ./ diff --git a/Makefile b/Makefile index afa967e..aa33ba8 100644 --- a/Makefile +++ b/Makefile @@ -8,14 +8,14 @@ GO_FLAGS += -trimpath # CLI Version VERSION = "9000.0.1" -build: version - CGO_ENABLED=0 go build $(GO_FLAGS) - version: npm/package.json - go run scripts/version.go + VERSION=$(go run scripts/version.go) + ############## + # Publishing # +############## .PHONY: publish-all -publish-all: +publish-all: version @npm --version > /dev/null || (echo "The 'npm' command must be in your path to publish" && false) @echo "Checking for uncommitted & untracked changes..." && test -z "`git status --porcelain | grep 'M'" || \ (echo "Cannot publish with uncommited/untracked changes:" && \ @@ -24,4 +24,36 @@ publish-all: (echo "Cannot publish from non-main branch `git rev-parse --abbrev-ref HEAD`" && false) @echo "Checking for unpushed commits..." && git fetch @test "" = "`git cherry`" || (echo "Cannot publish with unpushed commits" && false) - + + @$(MAKE) --no-print-directory -j3 \ + publish-darwin-arm64 \ + publish-darwin-x64 \ + publish-linux-x64 + +publish-darwin-arm64: platform-darwin-arm64 + cd npm/@tmplts/darwin-arm64 && npm publish + +publish-darwin-x64: platform-darwin-x64 + cd npm/@tmplts/darwin-x64 && npm publish + +publish-linux-x64: platform-linux-x64 + cd npm/@tmplts/linux-x64 && npm publish + + + ################## + # Platform Build # +################## +platform-unixlike: + @test -n "$(GOOS)" || (echo "The environment variable GOOS must be provided" && false) + @test -n "$(GOARCH)" || (echo "The environment variable GOARCH must be provided" && false) + @test -n "$(NPMDIR)" || (echo "The environment variable NPMDIR must be provided" && false) + CGO_ENABLED=0 GOOS="$(GOOS)" GOARCH="$(GOARCH)" go build $(GO_FLAGS) -o "$(NPMDIR)/bin/tmplts" + +platform-darwin-arm64: + @$(MAKE) --no-print-directory GOOS=darwin GOARCH=arm64 NPMDIR=npm/@tmplts/darwin-arm64 platform-unixlike + +platform-darwin-x64: + @$(MAKE) --no-print-directory GOOS=darwin GOARCH=amd64 NPMDIR=npm/@tmplts/darwin-x64 platform-unixlike + +platform-linux-x64: + @$(MAKE) --no-print-directory GOOS=linux GOARCH=amd64 NPMDIR=npm/@tmplts/linux-x64 platform-unixlike diff --git a/npm/@tmplts/darwin-arm64/package.json b/npm/@tmplts/darwin-arm64/package.json new file mode 100644 index 0000000..9c47f51 --- /dev/null +++ b/npm/@tmplts/darwin-arm64/package.json @@ -0,0 +1,20 @@ +{ + "name": "@tmplts/darwin-arm64", + "author": "ev-the-dev", + "version": "0.1.0", + "description": "MacOS ARM 64-bit (Mac Silicon) binary for TmplTS", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+https://github.com/ev-the-dev/tmplts.git" + }, + "publishConfig": { + "access": "public" + }, + "os": [ + "darwin" + ], + "cpu": [ + "arm64" + ] +} diff --git a/npm/@tmplts/darwin-x64/package.json b/npm/@tmplts/darwin-x64/package.json new file mode 100644 index 0000000..48c3287 --- /dev/null +++ b/npm/@tmplts/darwin-x64/package.json @@ -0,0 +1,20 @@ +{ + "name": "@tmplts/darwin-x64", + "author": "ev-the-dev", + "version": "0.1.0", + "description": "MacOS AMD 64-bit (Intel) binary for TmplTS", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+https://github.com/ev-the-dev/tmplts.git" + }, + "publishConfig": { + "access": "public" + }, + "os": [ + "darwin" + ], + "cpu": [ + "x64" + ] +} diff --git a/npm/@tmplts/linux-x64/package.json b/npm/@tmplts/linux-x64/package.json new file mode 100644 index 0000000..3389251 --- /dev/null +++ b/npm/@tmplts/linux-x64/package.json @@ -0,0 +1,20 @@ +{ + "name": "@tmplts/linux-x64", + "author": "ev-the-dev", + "version": "0.1.0", + "description": "Linux 64-bit (Intel) binary for TmplTS", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+https://github.com/ev-the-dev/tmplts.git" + }, + "publishConfig": { + "access": "public" + }, + "os": [ + "linux" + ], + "cpu": [ + "x64" + ] +} diff --git a/npm/package.json b/npm/package.json index f9490b6..05308b5 100644 --- a/npm/package.json +++ b/npm/package.json @@ -5,7 +5,7 @@ "description": "TypeScript Project Configuration Bootstrapper", "license": "Apache-2.0", "bin": { - "tmplts": "tmplts" + "tmplts": "bin/tmplts" }, "repository": { "type": "git", @@ -18,6 +18,11 @@ "bugs": { "url": "https://github.com/ev-the-dev/tmplts/issues" }, + "optionalDependencies": { + "@tmplts/darwin-arm64", + "@tmplts/darwin-x64", + "@tmplts/linux-x64" + }, "keywords": [ "typescript", "eslint", From be6e13b0ee676a0a0ef4e11bdfeb0cabb503efc9 Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 10 May 2024 01:42:31 +0000 Subject: [PATCH 03/14] Changing package json bin location and adding a default bin created by makefile --- Makefile | 9 ++++++++- npm/package.json | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index aa33ba8..cd59622 100644 --- a/Makefile +++ b/Makefile @@ -25,11 +25,15 @@ publish-all: version @echo "Checking for unpushed commits..." && git fetch @test "" = "`git cherry`" || (echo "Cannot publish with unpushed commits" && false) - @$(MAKE) --no-print-directory -j3 \ + @$(MAKE) --no-print-directory -j4 \ + publish-default \ publish-darwin-arm64 \ publish-darwin-x64 \ publish-linux-x64 +publish-default: platform-default: + cd npm && npm publish + publish-darwin-arm64: platform-darwin-arm64 cd npm/@tmplts/darwin-arm64 && npm publish @@ -49,6 +53,9 @@ platform-unixlike: @test -n "$(NPMDIR)" || (echo "The environment variable NPMDIR must be provided" && false) CGO_ENABLED=0 GOOS="$(GOOS)" GOARCH="$(GOARCH)" go build $(GO_FLAGS) -o "$(NPMDIR)/bin/tmplts" +platform-default: + @$(MAKE) --no-print-directory GOOS=darwin GOARCH=arm64 NPMDIR=npm platform-unixlike + platform-darwin-arm64: @$(MAKE) --no-print-directory GOOS=darwin GOARCH=arm64 NPMDIR=npm/@tmplts/darwin-arm64 platform-unixlike diff --git a/npm/package.json b/npm/package.json index 05308b5..41cb4f7 100644 --- a/npm/package.json +++ b/npm/package.json @@ -7,6 +7,12 @@ "bin": { "tmplts": "bin/tmplts" }, + "files": [ + "package.json", + "LICENSE", + "README.md", + "bin/tmplts" + ], "repository": { "type": "git", "url": "git+https://github.com/ev-the-dev/tmplts.git" From 7bc9dbb2e484ae1ed2ff183aae7050743df808b3 Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 10 May 2024 01:43:26 +0000 Subject: [PATCH 04/14] Typo in Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cd59622..0e00391 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ publish-all: version publish-darwin-x64 \ publish-linux-x64 -publish-default: platform-default: +publish-default: platform-default cd npm && npm publish publish-darwin-arm64: platform-darwin-arm64 From 33cc039d37442e147a75762c310deaca6459313c Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 10 May 2024 03:04:49 +0000 Subject: [PATCH 05/14] Adding a postinstall script to swap default bin with os viable bin --- npm/install.js | 47 +++++++++++++++++++++++++++++++++++++++++++++++ npm/package.json | 9 ++++++--- 2 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 npm/install.js diff --git a/npm/install.js b/npm/install.js new file mode 100644 index 0000000..288b583 --- /dev/null +++ b/npm/install.js @@ -0,0 +1,47 @@ +const fs = require("fs") +const os = require("os") +const path = require("path") + +const supportedUnixLikePackages = { + "darwin arm64 LE": "@tmplts/darwin-arm64", + "darwin x64 LE": "@tmplts/darwin-x64", + "linux x64 LE": "@tmplts/linux-x64" +} + +function getPkgAndPathForPlatform() { + const platformKey = `${process.platform} ${os.arch()} ${os.endianness()}` + const pkgPath = supportedUnixLikePackages[platformKey] + + if(!pkgPath) { + throw new Error(`Unsupported OS: ${platformKey}`) + } + + return pkgPath +} + +function main() { + const pkgPath = getPkgAndPathForPlatform() + const binSubPath = "bin/esbuild" + + const binFullPath = require.resolve(`${pkgPath}/${binSubPath}`) + const tempPath = path.join(__dirname, "bin-esbuild") + try { + /* + * First: linking binary with temp file. + */ + fs.linkSync(binFullPath, tempPath) + + /* + * Second: rename to atomically replace target file with temp file + */ + fs.renameSync(tempPath, path.join(__dirname, "bin", "tmplts")) + + /* + * Third: Remove temp file + */ + fs.unlinkSync(tempPath) + } catch (e) { + console.error("Failed to swap out default binary with platform compatible one:\nERROR:", e) + } +} + diff --git a/npm/package.json b/npm/package.json index 41cb4f7..d619bd9 100644 --- a/npm/package.json +++ b/npm/package.json @@ -13,6 +13,9 @@ "README.md", "bin/tmplts" ], + "scripts": { + "postinstall": "node install.js" + }, "repository": { "type": "git", "url": "git+https://github.com/ev-the-dev/tmplts.git" @@ -25,9 +28,9 @@ "url": "https://github.com/ev-the-dev/tmplts/issues" }, "optionalDependencies": { - "@tmplts/darwin-arm64", - "@tmplts/darwin-x64", - "@tmplts/linux-x64" + "@tmplts/darwin-arm64": "0.1.0", + "@tmplts/darwin-x64": "0.1.0", + "@tmplts/linux-x64": "0.1.0" }, "keywords": [ "typescript", From a7fc0e68b37f953b53915162e45549f46cdf6895 Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 10 May 2024 03:18:52 +0000 Subject: [PATCH 06/14] Fixing a couple typos --- npm/install.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/npm/install.js b/npm/install.js index 288b583..be57ffd 100644 --- a/npm/install.js +++ b/npm/install.js @@ -21,10 +21,10 @@ function getPkgAndPathForPlatform() { function main() { const pkgPath = getPkgAndPathForPlatform() - const binSubPath = "bin/esbuild" + const binSubPath = "bin/tmplts" const binFullPath = require.resolve(`${pkgPath}/${binSubPath}`) - const tempPath = path.join(__dirname, "bin-esbuild") + const tempPath = path.join(__dirname, "bin-tmplts") try { /* * First: linking binary with temp file. @@ -37,11 +37,14 @@ function main() { fs.renameSync(tempPath, path.join(__dirname, "bin", "tmplts")) /* - * Third: Remove temp file + * Third: Remove temp file if it still exists */ - fs.unlinkSync(tempPath) + if(fs.existsSync(tempPath)){ + fs.unlinkSync(tempPath) + } } catch (e) { console.error("Failed to swap out default binary with platform compatible one:\nERROR:", e) } } +main() From 5898872d8d6d35e296ee73d30f7a5d88c73053a4 Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 10 May 2024 04:00:46 +0000 Subject: [PATCH 07/14] Got Makefile mostly working --- Makefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 0e00391..954afff 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +VERSION := $(shell go run scripts/version.go) # Strip debug info (symbol table and DWARF) # Also add version info to binary GO_FLAGS += "-ldflags=-s -w -X 'github.com/ev-the-dev/tmplts/cmd.version=$(VERSION)'" @@ -5,11 +6,14 @@ GO_FLAGS += "-ldflags=-s -w -X 'github.com/ev-the-dev/tmplts/cmd.version=$(VERSI # Avoid embedding build path in executable GO_FLAGS += -trimpath -# CLI Version -VERSION = "9000.0.1" +.PHONY version: +version: + @echo "Version: $(VERSION)" + +# .PHONY clean: +# clean: +# rm -r npm/@tmplts/darwin-arm64/bin -version: npm/package.json - VERSION=$(go run scripts/version.go) ############## # Publishing # @@ -62,5 +66,5 @@ platform-darwin-arm64: platform-darwin-x64: @$(MAKE) --no-print-directory GOOS=darwin GOARCH=amd64 NPMDIR=npm/@tmplts/darwin-x64 platform-unixlike -platform-linux-x64: +platform-linux-x64: version @$(MAKE) --no-print-directory GOOS=linux GOARCH=amd64 NPMDIR=npm/@tmplts/linux-x64 platform-unixlike From 2c789ad16389fc71e8ef346b0115003fd7777372 Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 10 May 2024 04:05:54 +0000 Subject: [PATCH 08/14] Finished with Makefile --- Makefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 954afff..c8006b9 100644 --- a/Makefile +++ b/Makefile @@ -10,16 +10,20 @@ GO_FLAGS += -trimpath version: @echo "Version: $(VERSION)" -# .PHONY clean: -# clean: -# rm -r npm/@tmplts/darwin-arm64/bin +.PHONY clean: +clean: + cd npm/@tmplts && \ + rm -r \ + darwin-arm64/bin \ + darwin-x64/bin \ + linux-x64/bin ############## # Publishing # ############## .PHONY: publish-all -publish-all: version +publish-all: @npm --version > /dev/null || (echo "The 'npm' command must be in your path to publish" && false) @echo "Checking for uncommitted & untracked changes..." && test -z "`git status --porcelain | grep 'M'" || \ (echo "Cannot publish with uncommited/untracked changes:" && \ @@ -66,5 +70,5 @@ platform-darwin-arm64: platform-darwin-x64: @$(MAKE) --no-print-directory GOOS=darwin GOARCH=amd64 NPMDIR=npm/@tmplts/darwin-x64 platform-unixlike -platform-linux-x64: version +platform-linux-x64: @$(MAKE) --no-print-directory GOOS=linux GOARCH=amd64 NPMDIR=npm/@tmplts/linux-x64 platform-unixlike From cddcc47c5889f3c4d1fa60a3484186fd48b07738 Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 10 May 2024 04:22:07 +0000 Subject: [PATCH 09/14] Adding a clean action to Makefile --- Makefile | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c8006b9..93ffff1 100644 --- a/Makefile +++ b/Makefile @@ -12,18 +12,33 @@ version: .PHONY clean: clean: + rm -f npm/README.md npm/LICENSE &&\ + rm -rf npm/bin + cd npm/@tmplts && \ - rm -r \ + rm -rf \ darwin-arm64/bin \ darwin-x64/bin \ linux-x64/bin + cd npm/@tmplts && \ + rm -f\ + darwin-arm64/README.md darwin-arm64/LICENSE \ + darwin-x64/README.md darwin-x64/LICENSE \ + linux-x64/README.md linux-x64/LICENSE + +.PHONY copy-files: +copy-files: + cp README.md LICENSE npm/ + cp README.md LICENSE npm/@tmplts/darwin-arm64/ + cp README.md LICENSE npm/@tmplts/darwin-x64/ + cp README.md LICENSE npm/@tmplts/linux-x64/ ############## # Publishing # ############## .PHONY: publish-all -publish-all: +publish-all: copy-files @npm --version > /dev/null || (echo "The 'npm' command must be in your path to publish" && false) @echo "Checking for uncommitted & untracked changes..." && test -z "`git status --porcelain | grep 'M'" || \ (echo "Cannot publish with uncommited/untracked changes:" && \ From 8bf443aed4f53c84748cc74cacf33205f6b29241 Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 10 May 2024 04:48:18 +0000 Subject: [PATCH 10/14] Tweaking publish checks in Makefile --- Makefile | 5 +++-- npm/@tmplts/darwin-arm64/package.json | 2 +- npm/@tmplts/darwin-x64/package.json | 2 +- npm/@tmplts/linux-x64/package.json | 2 +- npm/package.json | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 93ffff1..7058e06 100644 --- a/Makefile +++ b/Makefile @@ -39,10 +39,11 @@ copy-files: ############## .PHONY: publish-all publish-all: copy-files + @echo "Attempting to publish all supported binaries..." @npm --version > /dev/null || (echo "The 'npm' command must be in your path to publish" && false) - @echo "Checking for uncommitted & untracked changes..." && test -z "`git status --porcelain | grep 'M'" || \ + @echo "Checking for uncommitted & untracked changes..." && test -z "`git status --porcelain | grep -vE '(README\.md|LICENSE)'`" || \ (echo "Cannot publish with uncommited/untracked changes:" && \ - git status --porcelain | grep 'M' && false) + git status --porcelain | grep -vE '(README\.md|LICENSE)' && false) @echo "Checking for main branch..." && test main = "`git rev-parse --abbrev-ref HEAD`" || \ (echo "Cannot publish from non-main branch `git rev-parse --abbrev-ref HEAD`" && false) @echo "Checking for unpushed commits..." && git fetch diff --git a/npm/@tmplts/darwin-arm64/package.json b/npm/@tmplts/darwin-arm64/package.json index 9c47f51..1e9812b 100644 --- a/npm/@tmplts/darwin-arm64/package.json +++ b/npm/@tmplts/darwin-arm64/package.json @@ -1,7 +1,7 @@ { "name": "@tmplts/darwin-arm64", "author": "ev-the-dev", - "version": "0.1.0", + "version": "0.1.1", "description": "MacOS ARM 64-bit (Mac Silicon) binary for TmplTS", "license": "Apache-2.0", "repository": { diff --git a/npm/@tmplts/darwin-x64/package.json b/npm/@tmplts/darwin-x64/package.json index 48c3287..0c1eeb2 100644 --- a/npm/@tmplts/darwin-x64/package.json +++ b/npm/@tmplts/darwin-x64/package.json @@ -1,7 +1,7 @@ { "name": "@tmplts/darwin-x64", "author": "ev-the-dev", - "version": "0.1.0", + "version": "0.1.1", "description": "MacOS AMD 64-bit (Intel) binary for TmplTS", "license": "Apache-2.0", "repository": { diff --git a/npm/@tmplts/linux-x64/package.json b/npm/@tmplts/linux-x64/package.json index 3389251..1eadfcb 100644 --- a/npm/@tmplts/linux-x64/package.json +++ b/npm/@tmplts/linux-x64/package.json @@ -1,7 +1,7 @@ { "name": "@tmplts/linux-x64", "author": "ev-the-dev", - "version": "0.1.0", + "version": "0.1.1", "description": "Linux 64-bit (Intel) binary for TmplTS", "license": "Apache-2.0", "repository": { diff --git a/npm/package.json b/npm/package.json index d619bd9..5b2b76e 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,7 +1,7 @@ { "name": "@ev-the-dev/tmplts", "author": "ev-the-dev", - "version": "0.1.0", + "version": "0.1.1", "description": "TypeScript Project Configuration Bootstrapper", "license": "Apache-2.0", "bin": { From d4923961acafb38323c87f9187d64ebc7bf044e4 Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 10 May 2024 04:51:03 +0000 Subject: [PATCH 11/14] Adjusting optionalDeps versions --- npm/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/npm/package.json b/npm/package.json index 5b2b76e..f098592 100644 --- a/npm/package.json +++ b/npm/package.json @@ -28,9 +28,9 @@ "url": "https://github.com/ev-the-dev/tmplts/issues" }, "optionalDependencies": { - "@tmplts/darwin-arm64": "0.1.0", - "@tmplts/darwin-x64": "0.1.0", - "@tmplts/linux-x64": "0.1.0" + "@tmplts/darwin-arm64": "0.1.1", + "@tmplts/darwin-x64": "0.1.1", + "@tmplts/linux-x64": "0.1.1" }, "keywords": [ "typescript", From 0065176e4bb65365ed55dfc6f80353b274877c17 Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 10 May 2024 04:57:30 +0000 Subject: [PATCH 12/14] Forgot to include the postinstall script inthe pacakge json files --- npm/@tmplts/darwin-arm64/package.json | 2 +- npm/@tmplts/darwin-x64/package.json | 2 +- npm/@tmplts/linux-x64/package.json | 2 +- npm/package.json | 11 ++++++----- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/npm/@tmplts/darwin-arm64/package.json b/npm/@tmplts/darwin-arm64/package.json index 1e9812b..97b2fdb 100644 --- a/npm/@tmplts/darwin-arm64/package.json +++ b/npm/@tmplts/darwin-arm64/package.json @@ -1,7 +1,7 @@ { "name": "@tmplts/darwin-arm64", "author": "ev-the-dev", - "version": "0.1.1", + "version": "0.1.2", "description": "MacOS ARM 64-bit (Mac Silicon) binary for TmplTS", "license": "Apache-2.0", "repository": { diff --git a/npm/@tmplts/darwin-x64/package.json b/npm/@tmplts/darwin-x64/package.json index 0c1eeb2..5a8a365 100644 --- a/npm/@tmplts/darwin-x64/package.json +++ b/npm/@tmplts/darwin-x64/package.json @@ -1,7 +1,7 @@ { "name": "@tmplts/darwin-x64", "author": "ev-the-dev", - "version": "0.1.1", + "version": "0.1.2", "description": "MacOS AMD 64-bit (Intel) binary for TmplTS", "license": "Apache-2.0", "repository": { diff --git a/npm/@tmplts/linux-x64/package.json b/npm/@tmplts/linux-x64/package.json index 1eadfcb..b0b67ad 100644 --- a/npm/@tmplts/linux-x64/package.json +++ b/npm/@tmplts/linux-x64/package.json @@ -1,7 +1,7 @@ { "name": "@tmplts/linux-x64", "author": "ev-the-dev", - "version": "0.1.1", + "version": "0.1.2", "description": "Linux 64-bit (Intel) binary for TmplTS", "license": "Apache-2.0", "repository": { diff --git a/npm/package.json b/npm/package.json index f098592..a5b5fd6 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,7 +1,7 @@ { "name": "@ev-the-dev/tmplts", "author": "ev-the-dev", - "version": "0.1.1", + "version": "0.1.2", "description": "TypeScript Project Configuration Bootstrapper", "license": "Apache-2.0", "bin": { @@ -11,7 +11,8 @@ "package.json", "LICENSE", "README.md", - "bin/tmplts" + "bin/tmplts", + "install.js" ], "scripts": { "postinstall": "node install.js" @@ -28,9 +29,9 @@ "url": "https://github.com/ev-the-dev/tmplts/issues" }, "optionalDependencies": { - "@tmplts/darwin-arm64": "0.1.1", - "@tmplts/darwin-x64": "0.1.1", - "@tmplts/linux-x64": "0.1.1" + "@tmplts/darwin-arm64": "0.1.2", + "@tmplts/darwin-x64": "0.1.2", + "@tmplts/linux-x64": "0.1.2" }, "keywords": [ "typescript", From ffbea50ba64aa9715b657b6335e8ed32a88dce4b Mon Sep 17 00:00:00 2001 From: Evan Date: Sun, 12 May 2024 03:00:21 +0000 Subject: [PATCH 13/14] Adding windows support --- Makefile | 51 +++++++++++++++++++++----- npm/@tmplts/darwin-arm64/package.json | 2 +- npm/@tmplts/darwin-x64/package.json | 2 +- npm/@tmplts/linux-x64/package.json | 2 +- npm/@tmplts/windows-arm64/package.json | 20 ++++++++++ npm/@tmplts/windows-ia32/package.json | 20 ++++++++++ npm/@tmplts/windows-x64/package.json | 20 ++++++++++ npm/package.json | 11 ++++-- 8 files changed, 111 insertions(+), 17 deletions(-) create mode 100644 npm/@tmplts/windows-arm64/package.json create mode 100644 npm/@tmplts/windows-ia32/package.json create mode 100644 npm/@tmplts/windows-x64/package.json diff --git a/Makefile b/Makefile index 7058e06..3d8d491 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,7 @@ +# TODO: Look into way for `sub-makes` to maintain +# variable references to the root make. For now I've +# used `TGOOS`, `TGOARCH`, and `TNPMDIR` in the +# `platform-unixlike` target to solve this issue VERSION := $(shell go run scripts/version.go) # Strip debug info (symbol table and DWARF) # Also add version info to binary @@ -19,13 +23,19 @@ clean: rm -rf \ darwin-arm64/bin \ darwin-x64/bin \ - linux-x64/bin + linux-x64/bin \ + windows-arm64/bin \ + windows-ia32/bin \ + windows-x64/bin cd npm/@tmplts && \ rm -f\ darwin-arm64/README.md darwin-arm64/LICENSE \ darwin-x64/README.md darwin-x64/LICENSE \ - linux-x64/README.md linux-x64/LICENSE + linux-x64/README.md linux-x64/LICENSE \ + windows-arm64/README.md windows-arm64/LICENSE \ + windows-ia32/README.md windows-ia32/LICENSE \ + windows-x64/README.md windows-x64/LICENSE .PHONY copy-files: copy-files: @@ -33,6 +43,9 @@ copy-files: cp README.md LICENSE npm/@tmplts/darwin-arm64/ cp README.md LICENSE npm/@tmplts/darwin-x64/ cp README.md LICENSE npm/@tmplts/linux-x64/ + cp README.md LICENSE npm/@tmplts/windows-arm64/ + cp README.md LICENSE npm/@tmplts/windows-ia32/ + cp README.md LICENSE npm/@tmplts/windows-x64/ ############## # Publishing # @@ -67,24 +80,42 @@ publish-darwin-x64: platform-darwin-x64 publish-linux-x64: platform-linux-x64 cd npm/@tmplts/linux-x64 && npm publish +publish-windows-arm64: platform-windows-arm64 + cd npm/@tmplts/windows-arm64 && npm publish + +publish-windows-ia32: platform-windows-ia32 + cd npm/@tmplts/windows-ia32 && npm publish + +publish-windows-x64: platform-windows-x64 + cd npm/@tmplts/windows-x64 && npm publish + ################## # Platform Build # ################## platform-unixlike: - @test -n "$(GOOS)" || (echo "The environment variable GOOS must be provided" && false) - @test -n "$(GOARCH)" || (echo "The environment variable GOARCH must be provided" && false) - @test -n "$(NPMDIR)" || (echo "The environment variable NPMDIR must be provided" && false) - CGO_ENABLED=0 GOOS="$(GOOS)" GOARCH="$(GOARCH)" go build $(GO_FLAGS) -o "$(NPMDIR)/bin/tmplts" + @test -n "$(TGOOS)" || (echo "The environment variable GOOS must be provided" && false) + @test -n "$(TGOARCH)" || (echo "The environment variable GOARCH must be provided" && false) + @test -n "$(TNPMDIR)" || (echo "The environment variable NPMDIR must be provided" && false) + CGO_ENABLED=0 GOOS="$(TGOOS)" GOARCH="$(TGOARCH)" go build $(GO_FLAGS) -o "$(TNPMDIR)/bin/tmplts" platform-default: - @$(MAKE) --no-print-directory GOOS=darwin GOARCH=arm64 NPMDIR=npm platform-unixlike + @$(MAKE) --no-print-directory TGOOS=darwin TGOARCH=arm64 TNPMDIR=npm platform-unixlike platform-darwin-arm64: - @$(MAKE) --no-print-directory GOOS=darwin GOARCH=arm64 NPMDIR=npm/@tmplts/darwin-arm64 platform-unixlike + @$(MAKE) --no-print-directory TGOOS=darwin TGOARCH=arm64 TNPMDIR=npm/@tmplts/darwin-arm64 platform-unixlike platform-darwin-x64: - @$(MAKE) --no-print-directory GOOS=darwin GOARCH=amd64 NPMDIR=npm/@tmplts/darwin-x64 platform-unixlike + @$(MAKE) --no-print-directory TGOOS=darwin TGOARCH=amd64 TNPMDIR=npm/@tmplts/darwin-x64 platform-unixlike platform-linux-x64: - @$(MAKE) --no-print-directory GOOS=linux GOARCH=amd64 NPMDIR=npm/@tmplts/linux-x64 platform-unixlike + @$(MAKE) --no-print-directory TGOOS=linux TGOARCH=amd64 TNPMDIR=npm/@tmplts/linux-x64 platform-unixlike + +platform-windows-arm64: + CGO_ENABLED=0 GOOS="windows" GOARCH="arm64" go build $(GO_FLAGS) -o "npm/@tmplts/windows-arm64/bin/tmplts.exe" + +platform-windows-ia32: + CGO_ENABLED=0 GOOS="windows" GOARCH="386" go build $(GO_FLAGS) -o "npm/@tmplts/windows-ia32/bin/tmplts.exe" + +platform-windows-x64: + CGO_ENABLED=0 GOOS="windows" GOARCH="amd64" go build $(GO_FLAGS) -o "npm/@tmplts/windows-x64/bin/tmplts.exe" diff --git a/npm/@tmplts/darwin-arm64/package.json b/npm/@tmplts/darwin-arm64/package.json index 97b2fdb..a00f484 100644 --- a/npm/@tmplts/darwin-arm64/package.json +++ b/npm/@tmplts/darwin-arm64/package.json @@ -1,7 +1,7 @@ { "name": "@tmplts/darwin-arm64", "author": "ev-the-dev", - "version": "0.1.2", + "version": "0.1.3", "description": "MacOS ARM 64-bit (Mac Silicon) binary for TmplTS", "license": "Apache-2.0", "repository": { diff --git a/npm/@tmplts/darwin-x64/package.json b/npm/@tmplts/darwin-x64/package.json index 5a8a365..98baf00 100644 --- a/npm/@tmplts/darwin-x64/package.json +++ b/npm/@tmplts/darwin-x64/package.json @@ -1,7 +1,7 @@ { "name": "@tmplts/darwin-x64", "author": "ev-the-dev", - "version": "0.1.2", + "version": "0.1.3", "description": "MacOS AMD 64-bit (Intel) binary for TmplTS", "license": "Apache-2.0", "repository": { diff --git a/npm/@tmplts/linux-x64/package.json b/npm/@tmplts/linux-x64/package.json index b0b67ad..b0050a8 100644 --- a/npm/@tmplts/linux-x64/package.json +++ b/npm/@tmplts/linux-x64/package.json @@ -1,7 +1,7 @@ { "name": "@tmplts/linux-x64", "author": "ev-the-dev", - "version": "0.1.2", + "version": "0.1.3", "description": "Linux 64-bit (Intel) binary for TmplTS", "license": "Apache-2.0", "repository": { diff --git a/npm/@tmplts/windows-arm64/package.json b/npm/@tmplts/windows-arm64/package.json new file mode 100644 index 0000000..fb0adc9 --- /dev/null +++ b/npm/@tmplts/windows-arm64/package.json @@ -0,0 +1,20 @@ +{ + "name": "@tmplts/windows-arm64", + "author": "ev-the-dev", + "version": "0.1.3", + "description": "Windows ARM 64-bit binary for TmplTS", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+https://github.com/ev-the-dev/tmplts.git" + }, + "publishConfig": { + "access": "public" + }, + "os": [ + "win32" + ], + "cpu": [ + "arm64" + ] +} diff --git a/npm/@tmplts/windows-ia32/package.json b/npm/@tmplts/windows-ia32/package.json new file mode 100644 index 0000000..26f5cee --- /dev/null +++ b/npm/@tmplts/windows-ia32/package.json @@ -0,0 +1,20 @@ +{ + "name": "@tmplts/windows-ia32", + "author": "ev-the-dev", + "version": "0.1.3", + "description": "Windows 32-bit binary for TmplTS", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+https://github.com/ev-the-dev/tmplts.git" + }, + "publishConfig": { + "access": "public" + }, + "os": [ + "win32" + ], + "cpu": [ + "ia32" + ] +} diff --git a/npm/@tmplts/windows-x64/package.json b/npm/@tmplts/windows-x64/package.json new file mode 100644 index 0000000..6309726 --- /dev/null +++ b/npm/@tmplts/windows-x64/package.json @@ -0,0 +1,20 @@ +{ + "name": "@tmplts/windows-x64", + "author": "ev-the-dev", + "version": "0.1.3", + "description": "Windows 64-bit binary for TmplTS", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+https://github.com/ev-the-dev/tmplts.git" + }, + "publishConfig": { + "access": "public" + }, + "os": [ + "win32" + ], + "cpu": [ + "x64" + ] +} diff --git a/npm/package.json b/npm/package.json index a5b5fd6..1ae4865 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,7 +1,7 @@ { "name": "@ev-the-dev/tmplts", "author": "ev-the-dev", - "version": "0.1.2", + "version": "0.1.3", "description": "TypeScript Project Configuration Bootstrapper", "license": "Apache-2.0", "bin": { @@ -29,9 +29,12 @@ "url": "https://github.com/ev-the-dev/tmplts/issues" }, "optionalDependencies": { - "@tmplts/darwin-arm64": "0.1.2", - "@tmplts/darwin-x64": "0.1.2", - "@tmplts/linux-x64": "0.1.2" + "@tmplts/darwin-arm64": "0.1.3", + "@tmplts/darwin-x64": "0.1.3", + "@tmplts/linux-x64": "0.1.3", + "@tmplts/win32-arm64": "0.1.3", + "@tmplts/win32-ia32": "0.1.3", + "@tmplts/win32-x64": "0.1.3" }, "keywords": [ "typescript", From 560e389cd375d2082ce9530c266998a614527c15 Mon Sep 17 00:00:00 2001 From: Evan Date: Sun, 12 May 2024 03:02:39 +0000 Subject: [PATCH 14/14] Adding the windows builds to the publish-all make target/action --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3d8d491..b1697fc 100644 --- a/Makefile +++ b/Makefile @@ -66,7 +66,10 @@ publish-all: copy-files publish-default \ publish-darwin-arm64 \ publish-darwin-x64 \ - publish-linux-x64 + publish-linux-x64 \ + publish-windows-arm64 \ + publish-windows-ia32 \ + publish-windows-x64 publish-default: platform-default cd npm && npm publish