Skip to content

Commit 996f7f6

Browse files
committed
feat: initialize project
0 parents  commit 996f7f6

329 files changed

Lines changed: 37436 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
root = true
4+
5+
[*]
6+
end_of_line = lf
7+
charset = utf-8
8+
indent_style = space
9+
indent_size = 2
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
max_line_length = 79
13+
14+
[Makefile]
15+
indent_style = tab
16+
17+
[*.md]
18+
trim_trailing_whitespace = false

.env.default

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
VITE_I18N_LOCALE=fr
2+
VITE_I18N_FALLBACK_LOCALE=fr
3+
VITE_PORT=8085

.eslintignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
doc
2+
mock-shop/**
3+
public
4+
nginx
5+
node_modules
6+
tests/mock-server/public
7+
tests/e2e/dist
8+
tests/e2e

.eslintrc.js

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
/* eslint-disable */
2+
module.exports = {
3+
root: true,
4+
parser: 'vue-eslint-parser',
5+
parserOptions: {
6+
ecmaVersion: 2022, // Allows for the parsing of modern ECMAScript features
7+
sourceType: 'module', // Allows for the use of imports
8+
parser: '@typescript-eslint/parser',
9+
ecmaFeatures: {
10+
jsx: true // Allows for the parsing of JSX
11+
},
12+
},
13+
extends: [
14+
'materya',
15+
'materya/typescript',
16+
"plugin:vue/vue3-recommended",
17+
"eslint:recommended",
18+
"@vue/typescript/recommended"
19+
],
20+
env: {
21+
node: true,
22+
},
23+
settings: {
24+
'import/resolver': {
25+
node: {
26+
extensions: [".js", ".jsx", ".ts", ".tsx", '.vue'],
27+
paths: ['@types'],
28+
},
29+
},
30+
},
31+
rules: {
32+
'@typescript-eslint/naming-convention': 'off',
33+
'max-len': ['error', {
34+
code: 79,
35+
ignoreComments: true,
36+
ignoreTemplateLiterals: true,
37+
ignoreStrings: true,
38+
ignoreUrls: true,
39+
}],
40+
semi: ['error', 'never'],
41+
'import/extensions': 'off',
42+
'import/no-cycle': 'off',
43+
'import/named': 'off', // Does not work well with TS
44+
camelcase: ['off', { ignoreDestructuring: true }],
45+
'no-unused-expressions': ['off', { allowShortCircuit: true }],
46+
'arrow-parens': ['error', 'as-needed', { requireForBlockBody: false }],
47+
'space-before-function-paren': ['off'],
48+
'@typescript-eslint/no-unused-vars': ['error', {
49+
varsIgnorePattern: '^\\\$',
50+
}],
51+
'object-curly-newline': ['error', {
52+
ObjectExpression: { consistent: true },
53+
}],
54+
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
55+
'template-tag-spacing': ['error', 'always'],
56+
'no-console': process.env.NODE_ENV === 'dev' ? 'off' : 'error',
57+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
58+
'comma-dangle': [2, 'always-multiline'],
59+
'import/no-unresolved': ['error', {
60+
ignore: ['^@/@types/cresh-ui$', '^@', 'config'],
61+
}],
62+
'lines-between-class-members': ['warn', 'always', { exceptAfterSingleLine: true }],
63+
'@typescript-eslint/member-delimiter-style': ['error', {
64+
"multiline": {
65+
'delimiter': 'none',
66+
'requireLast': false
67+
},
68+
'singleline': {
69+
'delimiter': 'semi',
70+
'requireLast': false
71+
}
72+
}],
73+
'vue/component-name-in-template-casing': ['error', 'PascalCase', {
74+
'registeredComponentsOnly': true,
75+
'ignores': [],
76+
}],
77+
'vue/html-indent': 'off',
78+
'vue/attributes-order': 'off',
79+
'vue/no-boolean-default': ['error', 'default-false'],
80+
'vue/no-reserved-component-names': ['error'],
81+
'vue/padding-line-between-blocks': ['error', 'always'],
82+
'vue/require-name-property': ['error'],
83+
'vue/one-component-per-file': ['error'],
84+
'vue/custom-event-name-casing': ['error'],
85+
'vue/no-arrow-functions-in-watch': ['error'],
86+
'vue/no-custom-modifiers-on-v-model': ['error'],
87+
'vue/no-dupe-v-else-if': ['error'],
88+
'vue/no-multiple-template-root': ['off'],
89+
'no-undef': 'off', // @typescript-eslint/no-undef
90+
'no-param-reassign': ['error', { "props": false }],
91+
'no-shadow': 'off', // @typescript-eslint/no-shadow
92+
'vue/custom-event-name-casing': 'off',
93+
'no-nested-ternary': ['warn'],
94+
'vue/max-len': ['off'], // max-len exists
95+
'import/no-extraneous-dependencies':[
96+
'error',
97+
{
98+
'devDependencies':[
99+
'**/*.test.ts',
100+
]
101+
}
102+
]
103+
},
104+
overrides: [
105+
{
106+
files: [
107+
'**/__tests__/*.{j,t}s?(x)',
108+
'**/tests/unit/**/*.spec.{j,t}s?(x)',
109+
'**/tests/unit/**/*.test.{j,t}s?(x)'
110+
],
111+
env: {
112+
mocha: true
113+
}
114+
}
115+
],
116+
ignorePatterns: [
117+
'src/pages/*', // pages for examples purposes only
118+
'cypress.config.ts',
119+
]
120+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!--- Provide a general summary of the issue in the Title above -->
2+
3+
## Expected Behavior
4+
<!--- Tell us what should happen -->
5+
6+
## Current Behavior
7+
<!--- Tell us what happens instead of the expected behavior -->
8+
9+
## Possible Solution
10+
<!--- (optional) Suggest a fix/reason for the bug, -->
11+
12+
## Steps to Reproduce
13+
<!--
14+
Provide a link to a live example, or an unambiguous set of steps to
15+
reproduce this bug. Include code to reproduce, if relevant
16+
-->
17+
18+
1.
19+
2.
20+
3.
21+
4.
22+
23+
## Logs
24+
25+
<!-- When relevant, capture and include logs -->
26+
27+
## Are you willing to make a pull request to fix it ?
28+
29+
<!--
30+
This is an open source project, we maintain it on a best effort basis,
31+
so if you want things to get fixed fast, you should probably participate.
32+
-->
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
name: Publish intermediate npm package
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
pr_number:
7+
description: "Issue or PR number"
8+
required: true
9+
10+
pull_request:
11+
types: [opened, reopened, closed, synchronize, ready_for_review]
12+
branches:
13+
- "beta-4"
14+
15+
jobs:
16+
publish-npm-package:
17+
name: Publish NPM Package
18+
runs-on: ubuntu-latest
19+
if: "!contains(fromJson('[\"cresh-ci\", \"dependabot[bot]\", \"dependabot-preview[bot]\"]'), github.actor)"
20+
21+
outputs:
22+
PR_NUMBER: ${{ env.PR_NUMBER }}
23+
24+
steps:
25+
- name: Checkout Repository
26+
if: github.event.action != 'closed'
27+
uses: actions/checkout@v2
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Setup Node
32+
if: github.event.action != 'closed'
33+
uses: actions/setup-node@v2
34+
with:
35+
node-version: '16'
36+
cache: 'npm'
37+
registry-url: https://npm.pkg.github.com/
38+
scope: '@creshpay'
39+
40+
- name: Issue number
41+
if: github.event.action != 'closed'
42+
id: issue-number
43+
run: |
44+
if [ -z $PR_NUMBER ]; then
45+
echo "PR_NUMBER=${{ github.event.inputs.pr_number }}" >> $GITHUB_ENV
46+
else
47+
echo "PR_NUMBER=${PR_NUMBER}" >> $GITHUB_ENV
48+
fi
49+
env:
50+
PR_NUMBER: ${{ github.event.pull_request.number }}
51+
52+
- name: Build dist
53+
if: github.event.action != 'closed'
54+
run: make
55+
56+
- name: NPM Version
57+
if: github.event.action != 'closed'
58+
id: publish-version
59+
run: |
60+
VERSION=$(cat package.json | jq -r '.version')
61+
SHORT_SHA=$(git rev-parse --short HEAD)
62+
FULL_VERSION=$VERSION-pr${{ env.PR_NUMBER }}.${SHORT_SHA}
63+
npm --no-git-tag-version version ${FULL_VERSION}
64+
echo "::set-output name=VERSION::${FULL_VERSION}"
65+
PACKAGE_NAME=$(cat package.json | jq -r '.name')
66+
echo "::set-output name=PACKAGE_NAME::${PACKAGE_NAME}"
67+
68+
- name: Publish
69+
if: github.event.action != 'closed'
70+
env:
71+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
72+
run: make publish
73+
74+
- name: Write comment
75+
uses: actions/github-script@v5
76+
if: github.event.action != 'closed'
77+
env:
78+
VERSION: ${{steps.publish-version.outputs.VERSION}}
79+
PACKAGE_NAME: ${{steps.publish-version.outputs.PACKAGE_NAME}}
80+
with:
81+
script: |
82+
const heading = '🔥🔥🔥 Intermediate npm package 🔥🔥🔥'
83+
const { VERSION, PACKAGE_NAME, PR_NUMBER } = process.env
84+
const comments = (await github.rest.issues.listComments({
85+
repo: context.repo.repo,
86+
owner: context.repo.owner,
87+
issue_number: PR_NUMBER,
88+
})).data
89+
let comment;
90+
for (let i in comments){
91+
if(comments[i] && comments[i].body && comments[i].body.includes(heading)){
92+
comment = comments[i]
93+
break
94+
}
95+
}
96+
97+
const body = `
98+
${heading}
99+
New version: ${VERSION}
100+
To install it: \`npm i ${PACKAGE_NAME}@${VERSION}\`
101+
`
102+
103+
body.replace(/^\s+/gm, '')
104+
105+
if (comment) {
106+
await github.rest.issues.deleteComment({
107+
repo: context.repo.repo,
108+
owner: context.repo.owner,
109+
comment_id: comment.id,
110+
})
111+
}
112+
await github.rest.issues.createComment({
113+
repo: context.repo.repo,
114+
issue_number: PR_NUMBER,
115+
owner: context.repo.owner,
116+
body,
117+
})
118+
119+
clean-npm:
120+
needs:
121+
- publish-npm-package
122+
runs-on: ubuntu-latest
123+
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
124+
125+
steps:
126+
- name: Checkout Repository
127+
uses: actions/checkout@v2
128+
with:
129+
fetch-depth: 0
130+
131+
- name: Get short sha
132+
shell: bash
133+
id: get-short-sha
134+
run: |
135+
SHORT_SHA=$(git rev-parse --short HEAD)
136+
echo "::set-output name=SHORT_SHA::$SHORT_SHA"
137+
138+
- name: Delete previous versions when pushing new one
139+
if: github.event.action == 'synchronize' || github.event_name == 'workflow_dispatch'
140+
uses: creshpay/action-ghcr-batch-delete-versions@v1
141+
with:
142+
github-access-token: ${{ secrets.CI_ADMIN_PKG_TOKEN }}
143+
org: "${{ github.repository_owner }}"
144+
package_name: "ui-elements"
145+
package_type: "npm"
146+
selector: |
147+
type=name;operator=contains;value=-pr${{ needs.publish-npm-package.outputs.PR_NUMBER }}.
148+
excluder: |
149+
type=name;operator=contains;value=-pr${{ needs.publish-npm-package.outputs.PR_NUMBER }}.${{ steps.get-short-sha.outputs.SHORT_SHA }}
150+
dry-run: "0"
151+
152+
- name: Delete images related to the PR when the PR is closed
153+
if: github.event.action == 'closed'
154+
uses: creshpay/action-ghcr-batch-delete-versions@v1
155+
with:
156+
github-access-token: ${{ secrets.CI_ADMIN_PKG_TOKEN }}
157+
org: "${{ github.repository_owner }}"
158+
package_name: "ui-elements"
159+
package_type: "npm"
160+
selector: |
161+
type=name;operator=contains;value=-pr${{ needs.publish-npm-package.outputs.PR_NUMBER }}.
162+
dry-run: "0"

0 commit comments

Comments
 (0)