typescript-github-action-template 0.2.2-0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ export class TypedDocumentString extends String {
2
+ constructor(value, __meta__) {
3
+ super(value);
4
+ this.value = value;
5
+ this.__meta__ = __meta__;
6
+ }
7
+ toString() {
8
+ return this.value;
9
+ }
10
+ }
11
+ export const ViewerLoginDocument = new TypedDocumentString(`
12
+ query ViewerLogin {
13
+ viewer {
14
+ login
15
+ }
16
+ }
17
+ `);
@@ -0,0 +1,2 @@
1
+ export * from './fragment-masking.js';
2
+ export * from './gql.js';
@@ -0,0 +1,2 @@
1
+ export * from './fragment-masking.js';
2
+ export * from './gql.js';
package/dist/index.js CHANGED
@@ -8,17 +8,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { error, getInput, getState, notice, saveState, setFailed, } from '@actions/core';
11
+ import { graphql } from './__graphql__/gql.js';
11
12
  import { getOctokit } from './getOctokit.js';
13
+ const queryViewerLogin = graphql(`
14
+ query ViewerLogin {
15
+ viewer {
16
+ login
17
+ }
18
+ }
19
+ `).toString();
12
20
  export function getLogin(githubToken) {
13
21
  return __awaiter(this, void 0, void 0, function* () {
14
22
  const octokit = getOctokit(githubToken);
15
- const { viewer: { login }, } = yield octokit.graphql(`
16
- query {
17
- viewer {
18
- login
19
- }
20
- }
21
- `, {});
23
+ const { viewer: { login }, } = (yield octokit.graphql(queryViewerLogin, {}));
22
24
  return login;
23
25
  });
24
26
  }
@@ -34,7 +36,7 @@ function run() {
34
36
  function cleanup() {
35
37
  const login = getState('login');
36
38
  notice(`Goodbye, ${login}!`);
37
- error('Please implemented or removed Action cleanup.');
39
+ error('Please implement or remove Action cleanup.');
38
40
  }
39
41
  if (!getState('isPost')) {
40
42
  saveState('isPost', 'true');
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "typescript-github-action-template",
3
- "version": "0.2.2-0",
3
+ "version": "0.2.2",
4
4
  "description": "A template to create custom GitHub Action with TypeScript/JavaScript.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.js",
7
7
  "type": "module",
8
8
  "scripts": {
9
+ "codegen": "rm -rf src/__graphql__ && graphql-codegen-esm --config codegen.ts",
9
10
  "build": "rm -rf dist && yarn tsc",
10
11
  "bundle": "rm -rf bundle && yarn ncc build src/index.ts --external eslint --source-map --license licenses.txt --out bundle",
11
12
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -26,8 +27,13 @@
26
27
  "homepage": "https://github.com/CatChen/typescript-github-action-template#readme",
27
28
  "funding": "https://github.com/CatChen/typescript-github-action-template?sponsor=1",
28
29
  "devDependencies": {
30
+ "@0no-co/graphqlsp": "^1.12.12",
29
31
  "@eslint/eslintrc": "^3.0.2",
30
32
  "@eslint/js": "^9.2.0",
33
+ "@graphql-codegen/cli": "5.0.2",
34
+ "@graphql-codegen/near-operation-file-preset": "^3.0.0",
35
+ "@graphql-codegen/typescript": "4.0.9",
36
+ "@graphql-codegen/typescript-document-nodes": "4.0.9",
31
37
  "@serverless-guru/prettier-plugin-import-order": "^0.4.2",
32
38
  "@types/node": "^22.0.0",
33
39
  "@typescript-eslint/eslint-plugin": "^8.0.0",
@@ -36,6 +42,7 @@
36
42
  "eslint": "^9.0.0",
37
43
  "eslint-config-prettier": "^9.0.0",
38
44
  "eslint-plugin-prettier": "^5.0.0",
45
+ "graphql": "^16.9.0",
39
46
  "husky": "^9.0.5",
40
47
  "is-ci": "^3.0.1",
41
48
  "lint-staged": "^15.0.2",