Skip to content

Commit

Permalink
make it work with Node.js and Bun
Browse files Browse the repository at this point in the history
  • Loading branch information
tsirysndr committed Mar 5, 2024
1 parent fdd29c6 commit dcf4596
Show file tree
Hide file tree
Showing 26 changed files with 1,103 additions and 155 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Do not edit this file directly. It is generated by https://deno.land/x/fluent_github_actions

name: Tests
name: ci
on:
push:
branches:
Expand All @@ -20,3 +20,13 @@ jobs:
run: fluentci run codecov_pipeline
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
publish:
needs: tests
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- name: Publish package
run: npx jsr publish --allow-slow-types
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![fluentci pipeline](https://img.shields.io/badge/dynamic/json?label=pkg.fluentci.io&labelColor=%23000&color=%23460cf1&url=https%3A%2F%2Fapi.fluentci.io%2Fv1%2Fpipeline%2Fgithub_pipeline&query=%24.version)](https://pkg.fluentci.io/github_pipeline)
![deno compatibility](https://shield.deno.dev/deno/^1.37)
[![dagger-min-version](https://img.shields.io/badge/dagger-v0.10.0-blue?color=3D66FF&labelColor=000000)](https://dagger.io)
[![](https://jsr.io/badges/@fluentci/github)](https://jsr.io/@fluentci/github)
[![](https://img.shields.io/codecov/c/gh/fluent-ci-templates/github-pipeline)](https://codecov.io/gh/fluent-ci-templates/github-pipeline)


Expand All @@ -16,7 +17,7 @@ Run the following command:
fluentci run github_pipeline
```

## Dagger Module
## 🧩 Dagger Module

Use as a [Dagger](https://dagger.io) Module:

Expand All @@ -33,7 +34,7 @@ dagger call release-upload --src . \
--token GH_TOKEN
```

## Environment Variables
## 🛠️ Environment Variables

| Variable | Description |
|-----------------------|-------------------------------|
Expand All @@ -42,7 +43,7 @@ dagger call release-upload --src . \
| GH_TOKEN | Github Access Token |


## Jobs
## Jobs

| Job | Description |
|----------------|------------------------------------------------------------|
Expand All @@ -57,12 +58,12 @@ releaseUpload(
): Promise<string>
```

## Programmatic usage
## 👨‍💻 Programmatic usage

You can also use this pipeline programmatically:

```typescript
import { releaseUpload } from "https://pkg.fluentci.io/github_pipeline@v0.4.4/mod.ts";
import { releaseUpload } from "jsr:@fluentci/github";

await releaseUpload(
".",
Expand Down
3 changes: 3 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"name": "@fluentci/github",
"version": "0.5.0",
"exports": "./mod.ts",
"importMap": "import_map.json",
"tasks": {
"esm:add": "deno run -A https://esm.sh/v128 add",
Expand Down
201 changes: 201 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 23 additions & 31 deletions deps.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
export { assertEquals } from "https://deno.land/std@0.191.0/testing/asserts.ts";
import { Client } from "./sdk/client.gen.ts";
export default Client;
export { assertEquals } from "jsr:@std/testing@0.218.2/asserts";

export type { DirectoryID, SecretID } from "./sdk/client.gen.ts";
export { Directory, Secret } from "./sdk/client.gen.ts";
export { connect, uploadContext } from "https://sdk.fluentci.io/v0.3.0/mod.ts";
export { brightGreen } from "https://deno.land/std@0.191.0/fmt/colors.ts";
export { withDevbox } from "https://nix.fluentci.io/v0.5.3/src/dagger/steps.ts";
export { stringifyTree } from "https://esm.sh/stringify-tree@1.1.1";
import gql from "https://esm.sh/graphql-tag@2.12.6";
export { File, Directory, Secret, dag } from "./sdk/client.gen.ts";
export { brightGreen } from "jsr:@std/fmt@0.218.2/colors";
export { stringifyTree } from "npm:stringify-tree@1.1.1";
import { gql } from "npm:graphql-request@6.1.0";
export { gql };
export {
dirname,
join,
resolve,
} from "https://deno.land/std@0.203.0/path/mod.ts";
export { parse } from "https://deno.land/std@0.205.0/flags/mod.ts";
export { snakeCase, camelCase } from "https://cdn.skypack.dev/lodash";
export { dirname, join, resolve } from "jsr:@std/path@0.218.2";
export { parse } from "jsr:@std/flags@0.218.2";

export {
ClientError,
GraphQLClient,
} from "https://esm.sh/v128/graphql-request@6.1.0";
import * as _ from "npm:lodash@4.17.21";
const snakeCase = _.default.snakeCase;
const camelCase = _.default.camelCase;
export { snakeCase, camelCase };

import * as env from "jsr:@tsirysndr/env-js@0.1.2";
export { env };
export { exit } from "jsr:@tsirysndr/exit-js@0.1.0";

export { ClientError, GraphQLClient } from "npm:graphql-request@6.1.0";
export {
DaggerSDKError,
UnknownDaggerError,
Expand All @@ -35,15 +32,10 @@ export {
EngineSessionConnectionTimeoutError,
NotAwaitedRequestError,
ERROR_CODES,
} from "https://esm.sh/@dagger.io/dagger@0.9.3";

export type {
CallbackFct,
ConnectOpts,
} from "https://sdk.fluentci.io/v0.3.0/mod.ts";
} from "./sdk/common/errors/index.ts";

export * as FluentGitlabCI from "https://deno.land/x/fluent_gitlab_ci@v0.4.2/mod.ts";
export * as FluentGithubActions from "https://deno.land/x/fluent_github_actions@v0.2.1/mod.ts";
export * as FluentCircleCI from "https://deno.land/x/fluent_circleci@v0.2.5/mod.ts";
export * as FluentAzurePipelines from "https://deno.land/x/fluent_azure_pipelines@v0.2.0/mod.ts";
export * as FluentAWSCodePipeline from "https://deno.land/x/fluent_aws_codepipeline@v0.2.3/mod.ts";
export * as FluentGitlabCI from "jsr:@tsirysndr/fluent-gitlab-ci@0.5";
export * as FluentGithubActions from "jsr:@tsirysndr/fluent-gh-actions@0.3";
export * as FluentCircleCI from "jsr:@tsirysndr/fluent-circleci@0.3";
export * as FluentAzurePipelines from "jsr:@tsirysndr/fluent-az-pipelines@0.3";
export * as FluentAWSCodePipeline from "jsr:@tsirysndr/fluent-codepipeline@0.3";
5 changes: 3 additions & 2 deletions sdk/builder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createGQLClient } from "./client.ts";
import { Context } from "./context.ts";
import { env } from "../deps.ts";

/**
* @hidden
Expand All @@ -10,9 +11,9 @@ export function initDefaultContext(): Context {
let ctx = new Context();

// Prefer DAGGER_SESSION_PORT if set
const daggerSessionPort = Deno.env.get("DAGGER_SESSION_PORT");
const daggerSessionPort = env.get("DAGGER_SESSION_PORT");
if (daggerSessionPort) {
const sessionToken = Deno.env.get("DAGGER_SESSION_TOKEN");
const sessionToken = env.get("DAGGER_SESSION_TOKEN");
if (!sessionToken) {
throw new Error(
"DAGGER_SESSION_TOKEN must be set when using DAGGER_SESSION_PORT"
Expand Down
Loading

0 comments on commit dcf4596

Please sign in to comment.