Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
OR13 committed Aug 10, 2024
1 parent 10b57f8 commit 0bb8f0a
Show file tree
Hide file tree
Showing 17 changed files with 45 additions and 10,096 deletions.
452 changes: 0 additions & 452 deletions dist/37.index.js

This file was deleted.

581 changes: 0 additions & 581 deletions dist/502.index.js

This file was deleted.

8,694 changes: 0 additions & 8,694 deletions dist/925.index.js

This file was deleted.

14 changes: 0 additions & 14 deletions dist/956.index.js

This file was deleted.

228 changes: 3 additions & 225 deletions dist/index.js

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@
},
"homepage": "https://github.com/transmute-industries/transmute#readme",
"dependencies": {
"@actions/core": "^1.10.1",
"dotenv": "^16.4.5",
"yargs": "^17.7.2"
"@actions/core": "^1.10.1"
},
"devDependencies": {
"@types/jest": "^29.2.6",
Expand All @@ -64,4 +62,4 @@
"ts-jest": "^29.0.3",
"typescript": "^4.9.4"
}
}
}
24 changes: 0 additions & 24 deletions scripts/bundle-contexts.js

This file was deleted.

1 change: 1 addition & 0 deletions scripts/local-sanity.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm run transmute -- jose key generate --alg ES256
30 changes: 30 additions & 0 deletions src/action/facade.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import * as core from '@actions/core'

import { parseArgs } from "node:util";

// https://stackoverflow.com/questions/29655760/convert-a-string-into-shell-arguments
const re = /"[^"]+"|'[^']+'|\S+/g

// prefer to parse options deeper
const options = {
foo: {
type: 'boolean' as "string" | "boolean",
short: 'f',
},
alg: {
type: 'string' as "string" | "boolean",
},
};

export async function facade(prompt: string = process.argv.slice(2).join(' ')) {
try {
if (process.env.GITHUB_ACTION) {
prompt = core.getInput("transmute")
}
const promptArgs = prompt.match(re) || []
const parsed = parseArgs({ args: promptArgs, options, allowPositionals: true });
console.log(parsed)
} catch (error) {
core.setFailed('💀 Internal Error.')
}
}
18 changes: 2 additions & 16 deletions src/action/run.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
#!/usr/bin/env node

import * as core from '@actions/core'
import { facade } from "./facade"

import cli from '../cli'

async function run() {
if (process.env.GITHUB_ACTION) {
try {
console.warn('todo github action')
} catch (error) {
core.setFailed((error as Error).message)
}
} else {
await cli.init()
}
}

run()
facade()
15 changes: 0 additions & 15 deletions src/cli/index.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/cli/jose/index.ts

This file was deleted.

27 changes: 0 additions & 27 deletions src/cli/jose/key/generate.ts

This file was deleted.

6 changes: 0 additions & 6 deletions src/cli/jose/key/index.ts

This file was deleted.

33 changes: 0 additions & 33 deletions src/cli/jose/module.ts

This file was deleted.

4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const cli = {}
import { facade } from './action/facade'

const cli = { facade }

export default cli
6 changes: 4 additions & 2 deletions tests/cli.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import cli from '../src'

it('src exports cli', () => {
expect(cli).toBeDefined()
it('cli exports facade', async () => {
await cli.facade(`
jose key generate --alg ES256
`)
})

0 comments on commit 0bb8f0a

Please sign in to comment.