Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: npm publish issue with glib #633

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,30 +144,35 @@ jobs:
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
libc: glibc
cross: false

- build: linux-x64-musl
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-musl
libc: musl
cross: true

- build: linux-arm64-gnu
os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-gnu
libc: glibc
cross: true

- build: linux-arm64-musl
os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-musl
libc: musl
cross: true

- build: linux-ia32-gnu
os: ubuntu-latest
rust: stable
target: i686-unknown-linux-gnu
libc: glibc
cross: true

- build: darwin-arm64
Expand All @@ -185,25 +190,29 @@ jobs:
os: windows-latest
rust: stable
target: x86_64-pc-windows-msvc
libc: msvc
ext: ".exe"

- build: win32-x64-gnu
os: windows-latest
rust: stable
target: x86_64-pc-windows-gnu
libc: glibc
ext: ".exe"

- build: win32-arm64-msvc
os: windows-latest
rust: stable
target: aarch64-pc-windows-msvc
libc: msvc
ext: ".exe"

- build: win32-ia32-gnu
os: ubuntu-latest
rust: stable
target: i686-pc-windows-gnu
cross: true
libc: glibc
ext: ".exe"
permissions:
contents: write
Expand Down Expand Up @@ -249,7 +258,7 @@ jobs:
if: github.event_name == 'release' && github.event.action == 'published'
run: |
cd npm
npm run gen -- --target ${{matrix.target}} --version ${{ env.APP_VERSION }} --build ${{matrix.build}} --ext ${{ matrix.ext || '' }}
npm run gen -- --target ${{matrix.target}} --version ${{ env.APP_VERSION }} --build ${{matrix.build}} --ext ${{ matrix.ext || '' }} --libc ${{ matrix.libc }}
- name: Setup .npmrc file to publish to npm
run: echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" > ~/.npmrc

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The below file is a standard `.graphQL` file, with a few additions such as `@ser
Now, run the following command to start the server with the full path to the jsonplaceholder.graphql file that you created above.

```bash
tc start ./jsonplaceholder.graphql
tailcall start ./jsonplaceholder.graphql
```

Head out to [docs] to learn about other powerful tailcall features.
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ chmod +x "$INSTALL_DIR/tailcall-${OS}-${ARCH}"

# Create symlinks in ~/.tailcall/bin
mkdir -p "$HOME/.tailcall/bin"
ln -sf "$INSTALL_DIR/tailcall-${OS}-${ARCH}" "$HOME/.tailcall/bin/tc"
ln -sf "$INSTALL_DIR/tailcall-${OS}-${ARCH}" "$HOME/.tailcall/bin/tailcall"

# Determine which shell the user is running and which profile file to update
if [[ "$SHELL" == *"zsh"* ]]; then
Expand Down
10 changes: 7 additions & 3 deletions npm/gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ interface ICLI {
build: string
version: string
ext?: string
libc?: string
}

const options = parse<ICLI>({
target: { type: String },
build: { type: String },
version: { type: String },
ext: { type: String, optional: true},
ext: { type: String, optional: true },
libc: { type: String, optional: true }
})

async function genPlatformPackage() {
const { target, build, version, ext } = options
const { target, build, version, libc, ext } = options
const [os, cpu] = build.split("-")

const packageJson = await fs.readFile(resolve(__dirname, "./package.json"), "utf8")
Expand All @@ -42,11 +44,13 @@ async function genPlatformPackage() {
cpu: [cpu]
}

if (libc) platformPackage.libc = [libc]

const packagePath = `@tailcallhq/core-${build}`
const binPath = `${packagePath}/bin`

const targetPath = ext ? `../target/${target}/release/tailcall${ext}` : `../target/${target}/release/tailcall`
const tcPath = ext ? `${binPath}/tc${ext}` : `${binPath}/tc`
const tcPath = ext ? `${binPath}/tailcall${ext}` : `${binPath}/tailcall`
const packageJsonPath = `${packagePath}/package.json`
const readmePath = "../README.md"

Expand Down
10 changes: 3 additions & 7 deletions npm/post-install.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
// @ts-check
import { family, GLIBC, MUSL } from "detect-libc"
import { familySync, GLIBC, MUSL } from "detect-libc"
import { exec } from 'child_process'
import util from 'util'

const execa = util.promisify(exec)
const platform = process.platform
const arch = process.arch

let libcFamily
family().then((fam) => {
libcFamily = fam
})

const libcFamily = familySync()
let libc
if (platform === "win32") {
libc = "-msvc"
Expand All @@ -27,4 +23,4 @@ try {
stderr ? console.log(stderr) : console.log(`Successfully installed optional dependency: ${pkg}`, stdout)
} catch (error) {
console.error(`Failed to install optional dependency: ${pkg}`, error.stderr)
}
}
2 changes: 1 addition & 1 deletion src/cli/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const ABOUT: &str = r"
\__/\__,_/_/_/\___/\__,_/_/_/";

#[derive(Parser)]
#[command(name ="tc",author, version = VERSION, about, long_about = Some(ABOUT))]
#[command(name ="tailcall",author, version = VERSION, about, long_about = Some(ABOUT))]
pub struct Cli {
#[command(subcommand)]
pub command: Command,
Expand Down
Loading