Refactor to typescript (config part)
parent
0934b3f408
commit
6d3fde10d7
|
|
@ -2,4 +2,4 @@
|
|||
*
|
||||
|
||||
# Files required for the action
|
||||
!action/
|
||||
!dist/
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ end_of_line = lf
|
|||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
max_line_length = 100
|
||||
max_line_length = 120
|
||||
tab_width = 2
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
**/node_modules/**
|
||||
**/action/**
|
||||
dist/
|
||||
lib/
|
||||
node_modules/
|
||||
jest.config.js
|
||||
|
|
|
|||
|
|
@ -1,21 +1,20 @@
|
|||
{
|
||||
"parser": "babel-eslint",
|
||||
"plugins": ["jest", "@typescript-eslint", "prettier", "unicorn"],
|
||||
"extends": ["plugin:unicorn/recommended", "plugin:github/recommended", "prettier"],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 9,
|
||||
"sourceType": "module",
|
||||
"project": "./tsconfig.json"
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true,
|
||||
"jest": true
|
||||
"jest/globals": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2020,
|
||||
"ecmaFeatures": {
|
||||
"impliedStrict": true
|
||||
}
|
||||
},
|
||||
"extends": ["airbnb", "plugin:unicorn/recommended", "prettier"],
|
||||
"plugins": ["react", "jsx-a11y", "import", "prettier", "flowtype", "unicorn"],
|
||||
"settings": { "react": { "version": "latest" } },
|
||||
"rules": {
|
||||
"prettier/prettier": "error",
|
||||
"import/no-extraneous-dependencies": 0
|
||||
"import/no-extraneous-dependencies": 0,
|
||||
"import/no-namespace": "off"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
dist/index* -diff linguist-generated=true
|
||||
dist/licenses* -diff linguist-generated=true
|
||||
dist/sourcemap* -diff linguist-generated=true
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
.idea
|
||||
node_modules
|
||||
coverage/
|
||||
lib/
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
**/node_modules/**
|
||||
**/action/**
|
||||
**/dist/**
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@
|
|||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"printWidth": 100
|
||||
"printWidth": 120
|
||||
}
|
||||
|
|
|
|||
2
.yarnrc
2
.yarnrc
|
|
@ -1,3 +1,3 @@
|
|||
save-prefix ""
|
||||
save-prefix "^"
|
||||
--install.audit true
|
||||
--add.audit true
|
||||
|
|
|
|||
|
|
@ -117,4 +117,4 @@ branding:
|
|||
color: 'gray-dark'
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'action/index.js'
|
||||
main: 'dist/index.js'
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
const esModules = ['lodash-es'].join('|');
|
||||
|
||||
module.exports = {
|
||||
ignore: [`/node_modules/(?!${esModules})`],
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
targets: {
|
||||
node: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
|
|
@ -1,9 +1,12 @@
|
|||
const esModules = ['lodash-es'].join('|');
|
||||
|
||||
module.exports = {
|
||||
clearMocks: true,
|
||||
moduleFileExtensions: ['js', 'ts'],
|
||||
testEnvironment: 'node',
|
||||
moduleFileExtensions: ['js', 'jsx', 'json', 'vue'],
|
||||
transform: { '^.+\\.(js|jsx)?$': 'babel-jest' },
|
||||
transformIgnorePatterns: [`/node_modules/(?!${esModules})`],
|
||||
setupFilesAfterEnv: ['./src/jest.setup.js'],
|
||||
};
|
||||
testMatch: ['**/*.test.ts'],
|
||||
testRunner: 'jest-circus/runner',
|
||||
transform: {
|
||||
'^.+\\.ts$': 'ts-jest'
|
||||
},
|
||||
setupFilesAfterEnv: ['./src/jest.setup.ts'],
|
||||
verbose: true
|
||||
}
|
||||
|
|
|
|||
57
package.json
57
package.json
|
|
@ -1,54 +1,55 @@
|
|||
{
|
||||
"name": "unity-builder",
|
||||
"version": "0.5.0",
|
||||
"version": "2.0.0",
|
||||
"description": "Build Unity projects for different platforms.",
|
||||
"main": "action/index.js",
|
||||
"main": "dist/index.js",
|
||||
"repository": "git@github.com:webbertakken/unity-builder.git",
|
||||
"author": "Webber <webber@takken.io>",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"prebuild": "yarn",
|
||||
"build": "ncc build src --out action --minify",
|
||||
"lint": "prettier --check \"src/**/*.js\" && eslint src",
|
||||
"format": "prettier --write \"src/**/*.js\"",
|
||||
"build": "tsc && ncc build --source-map --license licenses.txt",
|
||||
"lint": "prettier --check \"src/**/*.{js,ts}\" && eslint src/**/*.ts",
|
||||
"format": "prettier --write \"src/**/*.{js,ts}\"",
|
||||
"test": "jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/exec": "1.0.4",
|
||||
"@actions/github": "^2.1.1",
|
||||
"base-64": "^0.1.0",
|
||||
"@actions/exec": "^1.0.4",
|
||||
"@actions/github": "^2.2.0",
|
||||
"base-64": "^1.0.0",
|
||||
"kubernetes-client": "^9.0.0",
|
||||
"semver": "^7.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "7.8.4",
|
||||
"@babel/core": "7.9.6",
|
||||
"@babel/preset-env": "7.9.6",
|
||||
"@zeit/ncc": "0.22.1",
|
||||
"babel-eslint": "10.1.0",
|
||||
"eslint": "6.8.0",
|
||||
"eslint-config-airbnb": "18.1.0",
|
||||
"eslint-config-prettier": "6.11.0",
|
||||
"eslint-plugin-flowtype": "4.7.0",
|
||||
"eslint-plugin-import": "2.20.2",
|
||||
"eslint-plugin-jsx-a11y": "6.2.3",
|
||||
"eslint-plugin-prettier": "3.1.3",
|
||||
"eslint-plugin-react": "7.19.0",
|
||||
"eslint-plugin-unicorn": "19.0.1",
|
||||
"@types/jest": "^26.0.15",
|
||||
"@types/node": "^14.14.9",
|
||||
"@types/semver": "^7.3.4",
|
||||
"@typescript-eslint/parser": "^4.8.1",
|
||||
"@vercel/ncc": "^0.25.1",
|
||||
"eslint": "^7.17.0",
|
||||
"eslint-config-prettier": "^8.1.0",
|
||||
"eslint-plugin-github": "^4.1.1",
|
||||
"eslint-plugin-jest": "^24.1.3",
|
||||
"eslint-plugin-prettier": "^3.3.1",
|
||||
"eslint-plugin-unicorn": "^28.0.2",
|
||||
"husky": "4.2.5",
|
||||
"jest": "25.5.3",
|
||||
"lint-staged": "10.2.2",
|
||||
"lodash-es": "4.17.15",
|
||||
"prettier": "2.0.5"
|
||||
"jest": "^26.6.3",
|
||||
"jest-circus": "^26.6.3",
|
||||
"js-yaml": "^3.14.0",
|
||||
"lint-staged": "^10.5.4",
|
||||
"lodash-es": "^4.17.21",
|
||||
"prettier": "^2.2.1",
|
||||
"ts-jest": "^26.4.4",
|
||||
"typescript": "^4.1.3"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged && yarn build && git add action/index.js"
|
||||
"pre-commit": "lint-staged && yarn build && git add dist/index.*"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,jsx}": [
|
||||
"*.{js,jsx,ts,tsx}": [
|
||||
"prettier --write",
|
||||
"eslint",
|
||||
"git add",
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
import * as core from '@actions/core';
|
||||
|
||||
// @ts-ignore
|
||||
import { Action, BuildParameters, Cache, Docker, ImageTag, Kubernetes, Output } from './model';
|
||||
|
||||
const core = require('@actions/core');
|
||||
|
||||
async function action() {
|
||||
async function run() {
|
||||
Action.checkCompatibility();
|
||||
Cache.verify();
|
||||
|
||||
|
|
@ -24,6 +25,6 @@ async function action() {
|
|||
await Output.setBuildVersion(buildParameters.buildVersion);
|
||||
}
|
||||
|
||||
action().catch((error) => {
|
||||
run().catch((error) => {
|
||||
core.setFailed(error.message);
|
||||
});
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||
"outDir": "./lib", /* Redirect output structure to the directory. */
|
||||
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
"noImplicitAny": false, /* Re-enable after fixing compatibility */ /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||
},
|
||||
"exclude": ["node_modules", "**/*.test.ts"]
|
||||
}
|
||||
Loading…
Reference in New Issue