Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
atas committed Oct 10, 2024
1 parent ba67bce commit b10458b
Show file tree
Hide file tree
Showing 81 changed files with 19,691 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public/ui.bundle.js
public/ui.bundle.map
public/vendor.bundle.js
public/vendor.bundle.map
node_modules
dist
srcArchive
webpack.config.js
webpack.prod.config.js
.eslintrc.js
gulpfile.ts
88 changes: 88 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
module.exports = {
root: true,
settings: {
react: {
createClass: 'createReactClass', // Regex for Component Factory to use,
// default to "createReactClass"
pragma: 'React', // Pragma to use, default to "React"
fragment: 'Fragment', // Fragment to use (maybe a property of <pragma>), default to "Fragment"
version: 'detect', // React version. "detect" automatically picks the version you have installed.
},
propWrapperFunctions: [
// The names of any function used to wrap propTypes, e.g. `forbidExtraProps`. If this isn't set, any propTypes wrapped in a function will be skipped.
'forbidExtraProps',
{ property: 'freeze', object: 'Object' },
{ property: 'myFavoriteWrapper' },
],
linkComponents: [
// Components used as alternatives to <a> for linking, eg. <Link to={ url } />
'Hyperlink',
{ name: 'Link', linkAttribute: 'to' },
],
},
env: {
browser: true,
es6: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:prettier/recommended',
'plugin:promise/recommended',
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
tsconfigRootDir: __dirname,
project: './tsconfig.eslint.json',
},
plugins: ['react', '@typescript-eslint', 'promise'],
rules: {
indent: ['error', 'tab'],
'no-tabs': 0,
semi: 'off',
'require-await': 'off', // disabled in favour of @typescript-eslint/require-await
'react/no-unescaped-entities': 'off',
'no-duplicate-imports': ['error', { includeExports: true }],
'react/prop-types': 'off',
'prettier/prettier': 'off',
'no-return-await': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/semi': ['error'],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/no-floating-promises': 'off', // Because in UI floating promises are common
'@typescript-eslint/require-await': 'warn',
'@typescript-eslint/promise-function-async': [
'error',
{
allowedPromiseNames: ['Thenable'],
checkArrowFunctions: true,
checkFunctionDeclarations: true,
checkFunctionExpressions: true,
checkMethodDeclarations: true,
},
],
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-this-alias': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-empty-interface': 'off',
},
};
64 changes: 64 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build and Publish to GitHub Packages

on:
push:

jobs:
build_and_publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'

- name: Cache npm dependencies
uses: actions/cache@v2
with:
path: ~/.npm # This caches the npm cache, not node_modules directly
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install dependencies
run: npm ci

- name: Run Jest tests
run: npm test

- name: Just build don't ship
if: github.ref != 'refs/heads/master'
run: |
npm run build
- name: Set next version
run: |
next_version=$(git for-each-ref --sort=-creatordate --format '%(refname:short)' refs/tags/v* | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1 | awk -F '.' '{print $1 "." $2 "." $3+1}')
next_version=${next_version#v}
echo "next_version=$next_version"
echo "next_version=$next_version" >> $GITHUB_ENV
- name: Bump version and create new tag
if: github.ref == 'refs/heads/master'
run: |
echo '//npm.pkg.github.com/:_authToken=${NPM_TOKEN}' >> .npmrc
git config user.name "GitHub Actions"
git config user.email "<[email protected]>"
# Update package.json with the new version
jq ".version = \"${{ env.next_version }}\"" package.json > tmp.json && mv tmp.json package.json
git tag -a v${{ env.next_version }} -m "Release v${{ env.next_version }}"
npm run ship
git push origin v${{ env.next_version }}
env:
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65 changes: 65 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
.DS_Store
tsconfig.tsbuildinfo

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

.idea/
dist/
esm/
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@atas:registry=https://npm.pkg.github.com
always-auth=true
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"trailingComma": "all",
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"printWidth": 100,
"useTabs": true,
"bracketSpacing": true,
"arrowParens": "avoid",
"bracketSameLine": true
}
8 changes: 8 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript',
'@babel/preset-react',
],
plugins: ['@babel/plugin-transform-regenerator'],
};
13 changes: 13 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
transform: {
'^.+\\.[t|j]sx?$': 'babel-jest', // Use babel-jest to transform JS/TS files
},
transformIgnorePatterns: [
'/node_modules/(?!query-string|decode-uri-component|split-on-first|filter-obj)', // Include query-string and decode-uri-component in transformation
],
moduleNameMapper: {
'\\.(css|less|scss|sass)$': 'identity-obj-proxy', // For mocking style imports if necessary
},
};
Loading

0 comments on commit b10458b

Please sign in to comment.