diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 6bf777e..b35e8a5 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -41,18 +41,12 @@ jobs: - name: Install run: | yarn - # yarn prepare:front - - # - name: Format - # run: yarn format:check - name: Lint run: yarn lint - # - name: Test - # run: yarn test - + - name: Test + run: yarn test --passWithNoTests - # TODO: fix storybook builds - # - name: Build - # run: yarn build + - name: Build + run: yarn build diff --git a/.gitignore b/.gitignore index c7e94b6..ddae66a 100644 --- a/.gitignore +++ b/.gitignore @@ -37,7 +37,7 @@ testem.log # System Files .DS_Store Thumbs.db -/libs/ui-kit/storybook-static/ +/libs/ui-kit-vue/storybook-static/ apps/frontend-vue/.env infrastructure/.env .nx-cache @@ -47,4 +47,4 @@ apps/api/src/generated # Next.js .next -out \ No newline at end of file +out diff --git a/.tailwind/tailwind.theme.js b/.tailwind/tailwind.theme.js index 12f6881..ce53256 100644 --- a/.tailwind/tailwind.theme.js +++ b/.tailwind/tailwind.theme.js @@ -14,5 +14,6 @@ export const tailwindTheme = { 'primary-600': '#1C64F2', 'primary-700': '#1A56DB', 'primary-800': '#1E429F', + secondary: '#FFD04D', }, } diff --git a/README.md b/README.md index 6854ea1..9d77dc6 100644 --- a/README.md +++ b/README.md @@ -21,13 +21,13 @@ apps/ - frontend-vue - vue -- frontend-react - react +- frontend-next - react - api - graphQL, postgress - api-mongo - node, mongoDB libs/ -- ui-kit +- ui-kit-vue infrastructure/ diff --git a/apps/frontend-next/eslint.config.js b/apps/frontend-next/eslint.config.js index 2ba8e07..979f8c2 100644 --- a/apps/frontend-next/eslint.config.js +++ b/apps/frontend-next/eslint.config.js @@ -9,27 +9,21 @@ const compat = new FlatCompat({ module.exports = [ ...compat.extends( - 'plugin:@nx/react-typescript', - 'next', - 'next/core-web-vitals' + 'plugin:@nx/react-typescript' + // 'next', + // 'next/core-web-vitals' ), ...baseConfig, { files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'], rules: { - '@next/next/no-html-link-for-pages': [ - 'error', - 'apps/frontend-next/pages', - ], + '@typescript-eslint/no-require-imports': 'off', + 'import/extensions': 'off', + 'import/no-unresolved': 'off', + }, + languageOptions: { + parserOptions: { project: ['apps/frontend-next/tsconfig.json'] }, }, - }, - { - files: ['**/*.ts', '**/*.tsx'], - rules: {}, - }, - { - files: ['**/*.js', '**/*.jsx'], - rules: {}, }, ...compat.config({ env: { jest: true } }).map((config) => ({ ...config, @@ -38,5 +32,5 @@ module.exports = [ ...config.rules, }, })), - { ignores: ['.next/**/*'] }, + { ignores: ['!**/*', '**/.next/*', '**/jest.config.ts'] }, ] diff --git a/apps/frontend-next/package.json b/apps/frontend-next/package.json new file mode 100644 index 0000000..6c4fb1b --- /dev/null +++ b/apps/frontend-next/package.json @@ -0,0 +1,3 @@ +{ + "name": "@nx-vite-infra/frontend-next" +} diff --git a/apps/frontend-next/pages/index.tsx b/apps/frontend-next/pages/index.tsx index 6ca7247..03a48af 100644 --- a/apps/frontend-next/pages/index.tsx +++ b/apps/frontend-next/pages/index.tsx @@ -10,7 +10,7 @@ export function Index() {

- Hello there, + Hello there, Welcome frontend-next 👋

diff --git a/apps/frontend-next/postcss.config.js b/apps/frontend-next/postcss.config.js index a8f1ac9..f66cc83 100644 --- a/apps/frontend-next/postcss.config.js +++ b/apps/frontend-next/postcss.config.js @@ -1,4 +1,5 @@ const { join } = require('path') +const baseConfig = require('../../.tailwind/postcss.config') // Note: If you use library-specific PostCSS/Tailwind configuration then you should remove the `postcssConfig` build // option from your application's configuration (i.e. project.json). @@ -6,6 +7,7 @@ const { join } = require('path') // See: https://nx.dev/guides/using-tailwind-css-in-react#step-4:-applying-configuration-to-libraries module.exports = { + ...baseConfig, plugins: { tailwindcss: { config: join(__dirname, 'tailwind.config.js'), diff --git a/apps/frontend-next/project.json b/apps/frontend-next/project.json index bbe4165..0f2f5c4 100644 --- a/apps/frontend-next/project.json +++ b/apps/frontend-next/project.json @@ -5,12 +5,27 @@ "projectType": "application", "tags": [], "targets": { + "build": { + "executor": "@nx/next:build", + "outputs": ["{options.outputPath}"], + "defaultConfiguration": "production", + "options": { + "outputPath": "dist/apps/frontend-next" + } + }, "test": { "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { "jestConfig": "apps/frontend-next/jest.config.ts" } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["apps/frontend-next/**/*.{ts,js,tsx,jsx}"] + } } } } diff --git a/apps/frontend-next/tailwind.config.js b/apps/frontend-next/tailwind.config.js index 7f2bd16..5cd6fb3 100644 --- a/apps/frontend-next/tailwind.config.js +++ b/apps/frontend-next/tailwind.config.js @@ -1,15 +1,19 @@ const { createGlobPatternsForDependencies } = require('@nx/react/tailwind') const { join } = require('path') +const baseConfig = require('../../.tailwind/tailwind.config') + /** @type {import('tailwindcss').Config} */ module.exports = { content: [ join( __dirname, '{src,pages,components,app}/**/*!(*.stories|*.spec).{ts,tsx,html}' + // TODO: add ui-kit-react ), ...createGlobPatternsForDependencies(__dirname), ], + presets: [baseConfig], theme: { extend: {}, }, diff --git a/apps/frontend-vue/eslint.config.js b/apps/frontend-vue/eslint.config.js index 77c30c8..cb2707b 100644 --- a/apps/frontend-vue/eslint.config.js +++ b/apps/frontend-vue/eslint.config.js @@ -19,7 +19,9 @@ module.exports = [ vue: eslintPluginVue, }, }, - { ignores: ['!**/*'] }, + { + ignores: ['!**/*', '**/dist/*', '**/node_modules', '**/vite.config.ts'], + }, { languageOptions: { parser: vueEslintParser, diff --git a/apps/frontend-vue/package.json b/apps/frontend-vue/package.json index 5046926..e4e88d1 100644 --- a/apps/frontend-vue/package.json +++ b/apps/frontend-vue/package.json @@ -1,3 +1,3 @@ { - "name": "frontend-vue" + "name": "@nx-vite-infra/frontend-vue" } diff --git a/apps/frontend-vue/project.json b/apps/frontend-vue/project.json index e75f268..db0d5f0 100644 --- a/apps/frontend-vue/project.json +++ b/apps/frontend-vue/project.json @@ -6,44 +6,21 @@ "tags": [], "targets": { "build": { - "executor": "@nxext/vite:build", - "outputs": ["{options.outputPath}"], + "executor": "nx:run-commands", + "outputs": ["{workspaceRoot}/dist/apps/frontend-vue/"], "defaultConfiguration": "production", "options": { - "outputPath": "dist/apps/frontend-vue", - "baseHref": "/", - "configFile": "apps/frontend-vue/vite.config.ts", - "postcssConfig": "apps/frontend-vue/postcss.config.js" + "commands": [ + "mkdir -p dist/apps/frontend-vue", + "cp -r apps/frontend-vue/dist/** dist/apps/frontend-vue/" + ], + "parallel": false }, - "configurations": { - "production": { - "fileReplacements": [ - { - "replace": "apps/frontend-vue/src/environments/environment.ts", - "with": "apps/frontend-vue/src/environments/environment.prod.ts" - } - ] + "dependsOn": [ + { + "target": "vite:build" } - } - }, - "serve": { - "executor": "@nxext/vite:dev", - "options": { - "outputPath": "dist/apps/frontend-vue", - "baseHref": "/", - "configFile": "apps/frontend-vue/vite.config.ts", - "postcssConfig": "apps/frontend-vue/postcss.config.js" - }, - "configurations": { - "production": { - "fileReplacements": [ - { - "replace": "apps/frontend-vue/src/environments/environment.ts", - "with": "apps/frontend-vue/src/environments/environment.prod.ts" - } - ] - } - } + ] }, "lint": { "executor": "@nrwl/linter:eslint", @@ -53,7 +30,7 @@ } }, "test": { - "executor": "@nxext/vitest:vitest", + "executor": "@nx/vite:test", "options": { "vitestConfig": "apps/frontend-vue/vitest.config.ts" } diff --git a/apps/frontend-vue/src/components/Register.vue b/apps/frontend-vue/src/components/Register.vue index 4ed53a1..41322b3 100644 --- a/apps/frontend-vue/src/components/Register.vue +++ b/apps/frontend-vue/src/components/Register.vue @@ -1,6 +1,5 @@