Skip to content

Commit

Permalink
fix npm publish
Browse files Browse the repository at this point in the history
  • Loading branch information
teintinu committed Aug 13, 2022
1 parent 12f7ee1 commit a60d521
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ node_modules
__debug_bin

npm/
tmp/

snapshot/**/*.js
snapshot/**/*.map
Expand Down
7 changes: 6 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ builds:
- CGO_ENABLED=0
goos:
- linux
- windows
# - windows TODO: fix
- darwin
ignore:
- goos: windows
goarch: arm
- goos: windows
goarch: arm64
checksum:
name_template: 'checksums.txt'
snapshot:
Expand Down
2 changes: 1 addition & 1 deletion examples/clean-architecture/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ package-lock.json
yarn-error.log
yarn.lock
tsconfig.**
jest.config.js
tmp
out
.eslintrc.json
coverage
.vscode
.jest
jest.config.js
2 changes: 1 addition & 1 deletion internal/compat.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !darwin
// TODO: + build !darwin

package internal

Expand Down
37 changes: 19 additions & 18 deletions scripts/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@ const packageJsonFile = process.argv[2]

const matchesTag = /^refs\/tags\/v(.*)$/.exec(github_ref)

if (matchesTag && matchesTag[ 1 ]) {
const version = matchesTag[ 1 ]
const packageJson = {
const version = matchesTag && matchesTag[ 1 ] || '0.0.1'

const packageJson = {
"name": "khayyam",
"version": version,
"description": "A clean mono workspace automation",
"main": "index.js",
"scripts": {
"postinstall": "go-npm install",
"preuninstall": "go-npm uninstall"
},
"goBinary": {
"name": "khayyam",
"version": version,
"description": "A clean mono workspace automation",
"main": "index.js",
"scripts": {
"postinstall": "go-npm install",
"preuninstall": "go-npm uninstall"
},
"goBinary": {
"name": "khayyam",
"path": "./bin",
"url": "https://github.com/teintinu/khayyam/releases/download/v{{version}}/khayyam_{{version}}_{{platform}}_{{arch}}.tar.gz"
}
}
fs.writeFileSync(packageJsonFile, JSON.stringify(packageJson, null, 2), 'utf8')
}
"path": "./bin",
"url": "https://github.com/teintinu/khayyam/releases/download/v{{version}}/khayyam_{{version}}_{{platform}}_{{arch}}.tar.gz"
}
}
fs.writeFileSync(packageJsonFile.replace('/package.json','/version.txt'), version, 'utf8')
fs.writeFileSync(packageJsonFile, JSON.stringify(packageJson, null, 2), 'utf8')
console.log(packageJsonFile+' created')
8 changes: 8 additions & 0 deletions scripts/prepare.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
#!/usr/bin/env bash

set -e

export

ROOT=`realpath $(dirname $0)/..`
rm -Rf $ROOT/npm
mkdir -p $ROOT/npm
cd $ROOT

cd $ROOT/npm

node ../scripts/prepare.js $ROOT/npm/package.json
cp $ROOT/README.md $ROOT/npm/

npm install go-npm --save
rm -Rf node_modules
1 change: 1 addition & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ for snapshot in $snapshots; do
)
done

git reset --hard
echo "done"

0 comments on commit a60d521

Please sign in to comment.