Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Monorepo Architecture #244

Merged
merged 30 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d5715b4
chore: update dependencies when possible
aAmorim27 Oct 31, 2023
77596ab
feat: remove hooks and tokens packages, delete circular deps
aAmorim27 Nov 6, 2023
051d394
feat: bundle components as a standalone package
aAmorim27 Nov 7, 2023
76a17db
feat: use production names for packages, started dropping buildProps
aAmorim27 Nov 10, 2023
39a5bdb
feat: dropped build props for props declaration
aAmorim27 Nov 14, 2023
225e95c
feat: drop withInstall & makeInstall functions
aAmorim27 Nov 15, 2023
ef78f57
feat: added a vite config file for each publishable package
aAmorim27 Nov 15, 2023
7762388
feat: create build utils, build from workspace root & parallelize build
aAmorim27 Nov 15, 2023
5fd5386
fix: improve treeshake for bundlers
aAmorim27 Nov 16, 2023
3dfb805
feat: started removing unused dependencies, removed scripts folder, u…
aAmorim27 Nov 16, 2023
e44d796
fix: unit tests
aAmorim27 Nov 16, 2023
18a8d30
feat: use prestashop eslint config
aAmorim27 Nov 17, 2023
c8143ef
feat: remove prettier, use comma & single quotes
aAmorim27 Nov 17, 2023
c0cfbd4
refactor(tests): import component in tests using the package name, us…
aAmorim27 Nov 20, 2023
e7ded8d
fix: global package usage & resolver imports, playground fixes
aAmorim27 Nov 20, 2023
756eb2d
fix: update hygen templates to fix with new changes
aAmorim27 Nov 23, 2023
e86f5dc
refactor(tests): use exported props instead of extracting them from t…
aAmorim27 Nov 23, 2023
1a04bd4
Merge remote-tracking branch 'origin' into feat/new-monorepo
aAmorim27 Nov 24, 2023
c174c66
docs: updated documentation
aAmorim27 Nov 24, 2023
bfbe7e4
Merge remote-tracking branch 'origin' into feat/new-monorepo
aAmorim27 Nov 24, 2023
e626849
fix: textarea prop name in stories, run tests once in ci
aAmorim27 Nov 27, 2023
371e295
Merge remote-tracking branch 'origin' into feat/new-monorepo
aAmorim27 Dec 1, 2023
da8f909
fix: code review fixes
aAmorim27 Dec 12, 2023
45891cc
fix: puikLink props correct typing for target & size
aAmorim27 Dec 12, 2023
9593734
chore: update dependencies
aAmorim27 Dec 13, 2023
e3d93a2
Merge branch 'main' into feat/new-monorepo
mattgoud Jan 23, 2024
b957f5e
Merge branch 'main' into feat/new-monorepo
mattgoud Jan 23, 2024
74e83cc
fix: update pnpm-lock.yaml
mattgoud Jan 23, 2024
28c975b
test: update vitest config (coverage)
mattgoud Jan 23, 2024
2ccf6d8
docs: update puik-components README.md
mattgoud Jan 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
dist
pnpm-lock.yaml
CHANGELOG.en-US.md
storybook-static
coverage
!.*
30 changes: 30 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const { defineConfig } = require('eslint-define-config');

module.exports = defineConfig({
root: true,
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 'latest',
sourceType: 'module',
extraFileExtensions: ['.vue'],
project: ['./tsconfig.eslint.json']
},
env: {
browser: true,
node: true
},
extends: [
'@prestashopcorp/eslint-config-ts',
'plugin:vue/vue3-recommended'
],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/strict-boolean-expressions': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/consistent-type-assertions': 'off',
'@typescript-eslint/restrict-plus-operands': 'off',
'no-template-curly-in-string': 'off'
}
});
121 changes: 0 additions & 121 deletions .eslintrc.js

This file was deleted.

3 changes: 0 additions & 3 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
},
],
ignoreDeps: [
// Latest breaks build
'ts-morph',
'type-fest',
// MDX style is broken for 0.4.x
'@storybook/builder-vite',
],
Expand Down
43 changes: 29 additions & 14 deletions .github/workflows/cd-publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,38 @@ jobs:
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Get tag
id: get_tag
run: echo ::set-output name=TAG::$(echo $GITHUB_REF | cut -d / -f 3)

- name: Get git head
id: get_head
run: echo ::set-output name=GIT_HEAD::$(echo $GITHUB_SHA)
- name: Checkout repository
uses: actions/checkout@v3

- name: Build and Publish
uses: ./.github/actions/build-and-publish
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
git_author_email: [email protected]
node_version: 18
github_token: ${{ secrets.GITHUB_TOKEN }}
npm_token: ${{ secrets.NPM_TOKEN }}
version: ${{ steps.get_tag.outputs.TAG }}
git_head: ${{ steps.get_head.outputs.GIT_HEAD }}
version: 8.x.x

- name: Setup node env πŸ—
uses: actions/setup-node@v3
with:
node-version: lts/hydrogen
registry-url: https://registry.npmjs.org/
cache: "pnpm"

- name: Install dependencies πŸ‘¨πŸ»β€πŸ’»
run: pnpm i --frozen-lockfile

- name: Build
run: pnpm build

- name: Update npm version
run: pnpm version $VERSION --no-git-tag-version --allow-same-version
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
VERSION: ${{ steps.get_tag.outputs.TAG }}
cnavarro-prestashop marked this conversation as resolved.
Show resolved Hide resolved

- name: Publish
run: pnpm publish --no-git-checks --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,4 @@ jobs:
run: pnpm lint

- name: Run tests πŸ§ͺ
run: pnpm test

- name: Run coverage πŸ“ˆ
cnavarro-prestashop marked this conversation as resolved.
Show resolved Hide resolved
run: pnpm coverage
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ packages/puik/version.ts
*.local

# playground test file
playground/src/App.vue
playground/src/App.vue
storybook-static
3 changes: 1 addition & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm exec lint-staged
pnpm exec pretty-quick --staged
pnpm exec lint-staged
5 changes: 0 additions & 5 deletions .prettierignore

This file was deleted.

12 changes: 0 additions & 12 deletions .prettierrc

This file was deleted.

3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
"i18n-ally.localesPaths": "packages/locale/lang",
"i18n-ally.enabledParsers": ["ts"],
"i18n-ally.enabledFrameworks": ["vue", "vue-sfc"],
"i18n-ally.keystyle": "nested"
"i18n-ally.keystyle": "nested",
"eslint.format.enable": true
}
75 changes: 49 additions & 26 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,35 @@ If you want to contribute to this project, make your PR from a feature branch to

⚠️ We use `commitlint` for conventional commit format. ([How to use](https://github.com/conventional-changelog/commitlint))

You can also use [commitizen](https://github.com/commitizen/cz-cli) to create your commit with an interactive command line to respect our commit conventions

```sh
$ pnpm cz
```

## Mono repository structure

This mono repository contains multiple packages under the folder `packages`
- `components` contains all the vue components and is released under the name `@prestashopcorp/puik-components`
cnavarro-prestashop marked this conversation as resolved.
Show resolved Hide resolved
- `locale` contains all the translations files for the default wording in the components, this package is bundled with the other packages when it's used and isn't released as a standalone
- `puik` contains all the other packages and is released under the name `@prestashopcorp/puik`
- `resolver` contains the code of the vue component resolver for [unplugin-vue-components](https://github.com/unplugin/unplugin-vue-components) and is released under the name `@prestashopcorp/puik-resolver`
- `tailwind-preset` contains the [Tailwind Css](https://tailwindcss.com/) preset and is released under the name `@prestashopcorp/puik-tailwind-preset`
- `theme` contains all the CSS classes used in our components and is released under the name `@prestashopcorp/puik-theme`
- `utils` contains all the utility functions used across our packages, this package is bundled with the other packages when it's used and isn't released as a standalone

The `playground` folder contains a Vue 3 to help you develop your components

The `docs` folder contains the configuration and the global documentation of the [Storybook](https://storybook.js.org/)

ℹ️ All the packages with the `private: true` property in the `package.json` aren't released but bundled when used

## Development

### Prerequisites

- NodeJS >= 16
- [PNPM 6 or higher](https://pnpm.io/)
- NodeJS >= 18
- [PNPM 8 or higher](https://pnpm.io/)

### Local development

Expand All @@ -35,7 +58,7 @@ $ pnpm dev

```vue
<script setup lang="ts">
import { PuikComponent } from '@puik/components'
import { PuikComponent } from '@prestashopcorp/puik-components'
cnavarro-prestashop marked this conversation as resolved.
Show resolved Hide resolved
</script>

<template>
Expand All @@ -58,29 +81,29 @@ This command generates multiples files and injects code in these files

```
puik/
β”œβ”€β”€ packages/
β”‚ β”œβ”€β”€ components/
β”‚ β”‚ β”œβ”€β”€ my-component/
β”‚ β”‚ β”‚ β”œβ”€β”€ src/
β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ my-component.ts
β”‚ β”‚ β”‚ β”‚ └── my-component.vue
β”‚ β”‚ β”‚ β”œβ”€β”€ stories/
β”‚ β”‚ β”‚ β”‚ └── my-component.stories.ts
β”‚ β”‚ β”‚ β”œβ”€β”€ style/
β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ css.ts
β”‚ β”‚ β”‚ β”‚ └── index.ts
β”‚ β”‚ β”‚ β”œβ”€β”€ test/
β”‚ β”‚ β”‚ β”‚ └── my-component.spec.ts
β”‚ β”‚ β”‚ └── index.ts
β”‚ β”‚ └── index.ts
β”‚ β”œβ”€β”€ puik/
β”‚ β”‚ └── component.ts
β”‚ └── theme/
β”‚ └── src/
β”‚ β”œβ”€β”€ my-component.scss
β”‚ └── index.scss
└── typings/
└── global.d.ts
└── packages/
β”œβ”€β”€ components/
β”‚ β”œβ”€β”€ my-component/
β”‚ β”‚ β”œβ”€β”€ src/
β”‚ β”‚ β”‚ β”œβ”€β”€ my-component.ts
β”‚ β”‚ β”‚ └── my-component.vue
β”‚ β”‚ β”œβ”€β”€ stories/
β”‚ β”‚ β”‚ └── my-component.stories.ts
β”‚ β”‚ β”œβ”€β”€ style/
β”‚ β”‚ β”‚ β”œβ”€β”€ css.ts
β”‚ β”‚ β”‚ └── index.ts
β”‚ β”‚ β”œβ”€β”€ test/
β”‚ β”‚ β”‚ └── my-component.spec.ts
β”‚ β”‚ └── index.ts
β”‚ └── index.ts
β”œβ”€β”€ puik/
β”‚ β”œβ”€β”€ component.ts
β”‚ └── global.d.ts
└── theme/
└── src/
β”œβ”€β”€ my-component.scss
└── index.scss

```

### Style
Expand Down
Loading