Skip to content

Commit

Permalink
feat: initialize project
Browse files Browse the repository at this point in the history
  • Loading branch information
rottenronin committed Dec 15, 2023
0 parents commit 996f7f6
Show file tree
Hide file tree
Showing 329 changed files with 37,436 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# EditorConfig is awesome: http://EditorConfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 79

[Makefile]
indent_style = tab

[*.md]
trim_trailing_whitespace = false
3 changes: 3 additions & 0 deletions .env.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VITE_I18N_LOCALE=fr
VITE_I18N_FALLBACK_LOCALE=fr
VITE_PORT=8085
8 changes: 8 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
doc
mock-shop/**
public
nginx
node_modules
tests/mock-server/public
tests/e2e/dist
tests/e2e
120 changes: 120 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/* eslint-disable */
module.exports = {
root: true,
parser: 'vue-eslint-parser',
parserOptions: {
ecmaVersion: 2022, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
parser: '@typescript-eslint/parser',
ecmaFeatures: {
jsx: true // Allows for the parsing of JSX
},
},
extends: [
'materya',
'materya/typescript',
"plugin:vue/vue3-recommended",
"eslint:recommended",
"@vue/typescript/recommended"
],
env: {
node: true,
},
settings: {
'import/resolver': {
node: {
extensions: [".js", ".jsx", ".ts", ".tsx", '.vue'],
paths: ['@types'],
},
},
},
rules: {
'@typescript-eslint/naming-convention': 'off',
'max-len': ['error', {
code: 79,
ignoreComments: true,
ignoreTemplateLiterals: true,
ignoreStrings: true,
ignoreUrls: true,
}],
semi: ['error', 'never'],
'import/extensions': 'off',
'import/no-cycle': 'off',
'import/named': 'off', // Does not work well with TS
camelcase: ['off', { ignoreDestructuring: true }],
'no-unused-expressions': ['off', { allowShortCircuit: true }],
'arrow-parens': ['error', 'as-needed', { requireForBlockBody: false }],
'space-before-function-paren': ['off'],
'@typescript-eslint/no-unused-vars': ['error', {
varsIgnorePattern: '^\\\$',
}],
'object-curly-newline': ['error', {
ObjectExpression: { consistent: true },
}],
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'template-tag-spacing': ['error', 'always'],
'no-console': process.env.NODE_ENV === 'dev' ? 'off' : 'error',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'comma-dangle': [2, 'always-multiline'],
'import/no-unresolved': ['error', {
ignore: ['^@/@types/cresh-ui$', '^@', 'config'],
}],
'lines-between-class-members': ['warn', 'always', { exceptAfterSingleLine: true }],
'@typescript-eslint/member-delimiter-style': ['error', {
"multiline": {
'delimiter': 'none',
'requireLast': false
},
'singleline': {
'delimiter': 'semi',
'requireLast': false
}
}],
'vue/component-name-in-template-casing': ['error', 'PascalCase', {
'registeredComponentsOnly': true,
'ignores': [],
}],
'vue/html-indent': 'off',
'vue/attributes-order': 'off',
'vue/no-boolean-default': ['error', 'default-false'],
'vue/no-reserved-component-names': ['error'],
'vue/padding-line-between-blocks': ['error', 'always'],
'vue/require-name-property': ['error'],
'vue/one-component-per-file': ['error'],
'vue/custom-event-name-casing': ['error'],
'vue/no-arrow-functions-in-watch': ['error'],
'vue/no-custom-modifiers-on-v-model': ['error'],
'vue/no-dupe-v-else-if': ['error'],
'vue/no-multiple-template-root': ['off'],
'no-undef': 'off', // @typescript-eslint/no-undef
'no-param-reassign': ['error', { "props": false }],
'no-shadow': 'off', // @typescript-eslint/no-shadow
'vue/custom-event-name-casing': 'off',
'no-nested-ternary': ['warn'],
'vue/max-len': ['off'], // max-len exists
'import/no-extraneous-dependencies':[
'error',
{
'devDependencies':[
'**/*.test.ts',
]
}
]
},
overrides: [
{
files: [
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)',
'**/tests/unit/**/*.test.{j,t}s?(x)'
],
env: {
mocha: true
}
}
],
ignorePatterns: [
'src/pages/*', // pages for examples purposes only
'cypress.config.ts',
]
}
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!--- Provide a general summary of the issue in the Title above -->

## Expected Behavior
<!--- Tell us what should happen -->

## Current Behavior
<!--- Tell us what happens instead of the expected behavior -->

## Possible Solution
<!--- (optional) Suggest a fix/reason for the bug, -->

## Steps to Reproduce
<!--
Provide a link to a live example, or an unambiguous set of steps to
reproduce this bug. Include code to reproduce, if relevant
-->

1.
2.
3.
4.

## Logs

<!-- When relevant, capture and include logs -->

## Are you willing to make a pull request to fix it ?

<!--
This is an open source project, we maintain it on a best effort basis,
so if you want things to get fixed fast, you should probably participate.
-->
162 changes: 162 additions & 0 deletions .github/workflows/publish-intermediate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
name: Publish intermediate npm package

on:
workflow_dispatch:
inputs:
pr_number:
description: "Issue or PR number"
required: true

pull_request:
types: [opened, reopened, closed, synchronize, ready_for_review]
branches:
- "beta-4"

jobs:
publish-npm-package:
name: Publish NPM Package
runs-on: ubuntu-latest
if: "!contains(fromJson('[\"cresh-ci\", \"dependabot[bot]\", \"dependabot-preview[bot]\"]'), github.actor)"

outputs:
PR_NUMBER: ${{ env.PR_NUMBER }}

steps:
- name: Checkout Repository
if: github.event.action != 'closed'
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Node
if: github.event.action != 'closed'
uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'npm'
registry-url: https://npm.pkg.github.com/
scope: '@creshpay'

- name: Issue number
if: github.event.action != 'closed'
id: issue-number
run: |
if [ -z $PR_NUMBER ]; then
echo "PR_NUMBER=${{ github.event.inputs.pr_number }}" >> $GITHUB_ENV
else
echo "PR_NUMBER=${PR_NUMBER}" >> $GITHUB_ENV
fi
env:
PR_NUMBER: ${{ github.event.pull_request.number }}

- name: Build dist
if: github.event.action != 'closed'
run: make

- name: NPM Version
if: github.event.action != 'closed'
id: publish-version
run: |
VERSION=$(cat package.json | jq -r '.version')
SHORT_SHA=$(git rev-parse --short HEAD)
FULL_VERSION=$VERSION-pr${{ env.PR_NUMBER }}.${SHORT_SHA}
npm --no-git-tag-version version ${FULL_VERSION}
echo "::set-output name=VERSION::${FULL_VERSION}"
PACKAGE_NAME=$(cat package.json | jq -r '.name')
echo "::set-output name=PACKAGE_NAME::${PACKAGE_NAME}"
- name: Publish
if: github.event.action != 'closed'
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: make publish

- name: Write comment
uses: actions/github-script@v5
if: github.event.action != 'closed'
env:
VERSION: ${{steps.publish-version.outputs.VERSION}}
PACKAGE_NAME: ${{steps.publish-version.outputs.PACKAGE_NAME}}
with:
script: |
const heading = '🔥🔥🔥 Intermediate npm package 🔥🔥🔥'
const { VERSION, PACKAGE_NAME, PR_NUMBER } = process.env
const comments = (await github.rest.issues.listComments({
repo: context.repo.repo,
owner: context.repo.owner,
issue_number: PR_NUMBER,
})).data
let comment;
for (let i in comments){
if(comments[i] && comments[i].body && comments[i].body.includes(heading)){
comment = comments[i]
break
}
}
const body = `
${heading}
New version: ${VERSION}
To install it: \`npm i ${PACKAGE_NAME}@${VERSION}\`
`
body.replace(/^\s+/gm, '')
if (comment) {
await github.rest.issues.deleteComment({
repo: context.repo.repo,
owner: context.repo.owner,
comment_id: comment.id,
})
}
await github.rest.issues.createComment({
repo: context.repo.repo,
issue_number: PR_NUMBER,
owner: context.repo.owner,
body,
})
clean-npm:
needs:
- publish-npm-package
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'

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

- name: Get short sha
shell: bash
id: get-short-sha
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
echo "::set-output name=SHORT_SHA::$SHORT_SHA"
- name: Delete previous versions when pushing new one
if: github.event.action == 'synchronize' || github.event_name == 'workflow_dispatch'
uses: creshpay/action-ghcr-batch-delete-versions@v1
with:
github-access-token: ${{ secrets.CI_ADMIN_PKG_TOKEN }}
org: "${{ github.repository_owner }}"
package_name: "ui-elements"
package_type: "npm"
selector: |
type=name;operator=contains;value=-pr${{ needs.publish-npm-package.outputs.PR_NUMBER }}.
excluder: |
type=name;operator=contains;value=-pr${{ needs.publish-npm-package.outputs.PR_NUMBER }}.${{ steps.get-short-sha.outputs.SHORT_SHA }}
dry-run: "0"

- name: Delete images related to the PR when the PR is closed
if: github.event.action == 'closed'
uses: creshpay/action-ghcr-batch-delete-versions@v1
with:
github-access-token: ${{ secrets.CI_ADMIN_PKG_TOKEN }}
org: "${{ github.repository_owner }}"
package_name: "ui-elements"
package_type: "npm"
selector: |
type=name;operator=contains;value=-pr${{ needs.publish-npm-package.outputs.PR_NUMBER }}.
dry-run: "0"
Loading

0 comments on commit 996f7f6

Please sign in to comment.