typescript-github-action-template 0.1.16 → 0.1.17

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,45 @@
1
+ import js from '@eslint/js';
2
+ import { FlatCompat } from '@eslint/eslintrc';
3
+ import path from 'path';
4
+ import { fileURLToPath } from 'url';
5
+ import ts from 'typescript-eslint';
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+
10
+ const compat = new FlatCompat({
11
+ baseDirectory: __dirname,
12
+ resolvePluginsRelativeTo: __dirname,
13
+ recommendedConfig: js.configs.recommended,
14
+ });
15
+
16
+ export default ts.config(
17
+ ...compat.config({
18
+ env: {
19
+ browser: true,
20
+ es2022: true,
21
+ node: true,
22
+ },
23
+ extends: ['eslint:recommended', 'plugin:prettier/recommended'],
24
+ parser: '@typescript-eslint/parser',
25
+ parserOptions: {
26
+ project: './tsconfig.json',
27
+ ecmaVersion: 'latest',
28
+ sourceType: 'module',
29
+ },
30
+ root: true,
31
+ rules: {},
32
+ ignorePatterns: [
33
+ 'node_modules/**/*',
34
+ 'lib/**/*',
35
+ 'dist/**/*',
36
+ 'eslint.config.js',
37
+ ],
38
+ overrides: [
39
+ {
40
+ files: ['*.ts'],
41
+ },
42
+ ],
43
+ }),
44
+ ...ts.configs.recommendedTypeChecked,
45
+ );
package/lib/index.js CHANGED
@@ -1,31 +1,18 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  const core_1 = require("@actions/core");
13
4
  const github_1 = require("@actions/github");
14
5
  function run() {
15
- return __awaiter(this, void 0, void 0, function* () {
16
- if (!(0, core_1.getState)('isPost')) {
17
- (0, core_1.saveState)('isPost', 'true');
18
- }
19
- (0, core_1.info)(`This is the Action context: ${JSON.stringify(github_1.context)}`);
20
- (0, core_1.error)('Action needs to be implemented.');
21
- });
6
+ if (!(0, core_1.getState)('isPost')) {
7
+ (0, core_1.saveState)('isPost', 'true');
8
+ }
9
+ (0, core_1.info)(`This is the Action context: ${JSON.stringify(github_1.context)}`);
10
+ (0, core_1.error)('Action needs to be implemented.');
22
11
  }
23
12
  function cleanup() {
24
- return __awaiter(this, void 0, void 0, function* () {
25
- (0, core_1.error)('Post action needs to be implemented or removed.');
26
- });
13
+ (0, core_1.error)('Post action needs to be implemented or removed.');
27
14
  }
28
- if (!process.env['STATE_isPost']) {
15
+ if (!(0, core_1.getState)('isPost')) {
29
16
  run();
30
17
  }
31
18
  else {
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "typescript-github-action-template",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "A template to create custom GitHub Action with TypeScript/JavaScript.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.js",
7
7
  "type": "module",
8
8
  "scripts": {
9
- "build": "yarn tsc",
10
- "package": "yarn ncc build src/index.ts --source-map --license licenses.txt",
9
+ "build": "rm -rf lib && yarn tsc",
10
+ "package": "rm -rf dist && yarn ncc build src/index.ts --external eslint --source-map --license licenses.txt",
11
11
  "test": "echo \"Error: no test specified\" && exit 1",
12
- "lint": "eslint -c .eslintrc.json src",
12
+ "lint": "eslint -c eslint.config.js",
13
13
  "postinstall": "is-ci || husky install",
14
14
  "preversion": "rm -rf lib && rm -rf dist && yarn && yarn build && yarn package"
15
15
  },
@@ -25,19 +25,22 @@
25
25
  "homepage": "https://github.com/CatChen/typescript-github-action-template#readme",
26
26
  "funding": "https://github.com/CatChen/typescript-github-action-template?sponsor=1",
27
27
  "devDependencies": {
28
+ "@eslint/eslintrc": "^3.0.2",
29
+ "@eslint/js": "^9.2.0",
28
30
  "@trivago/prettier-plugin-sort-imports": "^4.0.0",
29
31
  "@types/node": "^20.1.0",
30
32
  "@typescript-eslint/eslint-plugin": "^7.0.1",
31
33
  "@typescript-eslint/parser": "^7.0.1",
32
34
  "@vercel/ncc": "^0.38.0",
33
- "eslint": "^8.28.0",
35
+ "eslint": "^9.0.0",
34
36
  "eslint-config-prettier": "^9.0.0",
35
37
  "eslint-plugin-prettier": "^5.0.0",
36
38
  "husky": "^9.0.5",
37
39
  "is-ci": "^3.0.1",
38
40
  "lint-staged": "^15.0.2",
39
41
  "prettier": "^3.0.2",
40
- "typescript": "^5.0.2"
42
+ "typescript": "^5.0.2",
43
+ "typescript-eslint": "^7.8.0"
41
44
  },
42
45
  "dependencies": {
43
46
  "@actions/core": "^1.10.0",