diff --git a/.eslintrc.json b/.eslintrc.json index 96a4e7b3..e7753a92 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -7,14 +7,18 @@ }, "extends": [ "@nuxtjs", - "plugin:nuxt/recommended" + "plugin:nuxt/recommended", + "prettier" + ], + "plugins": [ + "prettier" ], - "plugins": [], "rules": { + "prettier/prettier": "error", "semi": [ 2, "always" ], "vue/multi-word-component-names": "off" } -} +} \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 99fbebdd..e9d154f2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,14 +6,14 @@ on: jobs: install: - if: "!contains(github.event.head_commit.message, 'skip ci')" + if: contains(github.event.head_commit.message, 'skip ci') == false name: Install runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest] - node: [16] + node: [19] steps: - uses: actions/setup-node@v3 @@ -27,14 +27,12 @@ jobs: with: path: | node_modules - ~/.cache/ms-playwright/ - ~\AppData\Local\ms-playwright\ key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }} - name: Install Dependencies if: steps.cache.outputs.cache-hit != 'true' run: npm ci - name: Test - run: npm run test + run: npm run test --workspaces semantic-version: name: Semantic Release @@ -44,7 +42,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node: [16] + node: [19] steps: - uses: actions/setup-node@v3 @@ -68,7 +66,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node: [16] + node: [19] steps: - uses: actions/setup-node@v3 @@ -82,70 +80,38 @@ jobs: with: path: | node_modules - ~/.cache/ms-playwright/ - ~\AppData\Local\ms-playwright\ key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }} - - name: Build + + - name: BuildDefault run: | - npm run generate -- examples/default - touch dist/.nojekyll + npm run generate --workspace=@nuxt-custom-elements-example/default env: BASE_URL: /nuxt-custom-elements-example/ DIST_PATH: ../../dist # tailwind-css - - name: BuildTailwindCss + - name: BuildTailwindCSS run: | - npm run generate -- examples/tailwind-css - unlink dist/tailwind-css/.nojekyll + npm run generate --workspace=@nuxt-custom-elements-example/tailwindcss env: - BASE_URL: /nuxt-custom-elements-example/tailwind-css/ - DIST_PATH: ../../dist/tailwind-css + BASE_URL: /nuxt-custom-elements-example/tailwindcss/ + DIST_PATH: ../../dist/tailwindcss # vuetify - name: BuildVuetify run: | - npm run generate -- examples/vuetify - unlink dist/vuetify/.nojekyll + npm run generate --workspace=@nuxt-custom-elements-example/vuetify env: BASE_URL: /nuxt-custom-elements-example/vuetify/ DIST_PATH: ../../dist/vuetify - # vue-i18n - - name: BuildVueI18n - run: | - npm run generate -- examples/vue-i18n - unlink dist/vue-i18n/.nojekyll - env: - BASE_URL: /nuxt-custom-elements-example/vue-i18n/ - DIST_PATH: ../../dist/vue-i18n - - # vue-router - - name: BuildVueRouter - run: | - npm run generate -- examples/vue-router - unlink dist/vue-router/.nojekyll - env: - BASE_URL: /nuxt-custom-elements-example/vue-router/ - DIST_PATH: ../../dist/vue-router - - # vuex - - name: BuildVuex + # pinia + - name: BuildPinia run: | - npm run generate -- examples/vuex - unlink dist/vuex/.nojekyll + npm run generate --workspace=@nuxt-custom-elements-example/pinia env: BASE_URL: /nuxt-custom-elements-example/vuex/ - DIST_PATH: ../../dist/vuex - - # external - - name: BuildExternal - run: | - npm run generate -- examples/external - unlink dist/external/.nojekyll - env: - BASE_URL: /nuxt-custom-elements-example/external/ - DIST_PATH: ../../dist/external + DIST_PATH: ../../dist/pinia - name: Archive Production Artifact uses: actions/upload-artifact@master @@ -160,7 +126,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node: [16] + node: [19] steps: - name: Download Artifact uses: actions/download-artifact@master diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 40eef3a2..5d9a8a6e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node: [14, 16] + node: [19] steps: - uses: actions/setup-node@v3 @@ -27,8 +27,6 @@ jobs: with: path: | node_modules - ~/.cache/ms-playwright/ - ~\AppData\Local\ms-playwright\ key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }} - name: Install Dependencies @@ -36,4 +34,4 @@ jobs: run: npm ci - name: Test - run: npm run test + run: npm run test --workspaces diff --git a/.gitignore b/.gitignore index 1ceaa9a9..593f507c 100644 --- a/.gitignore +++ b/.gitignore @@ -90,3 +90,4 @@ sw.* *.swp .history +.output diff --git a/.lintstagedrc b/.lintstagedrc index b4bc5c68..8728345f 100644 --- a/.lintstagedrc +++ b/.lintstagedrc @@ -1,5 +1,5 @@ { "*.(js|vue)": [ - "npm run lint:es" + "npm run test --workspaces" ] } \ No newline at end of file diff --git a/.nvmrc b/.nvmrc index 431076a9..d9875d47 100755 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16.16.0 +19.9.0 diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 00000000..904210f0 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,8 @@ +{ + "arrowParens": "avoid", + "bracketSameLine": true, + "trailingComma": "none", + "singleQuote": true, + "semi": true, + "printWidth": 80 +} diff --git a/.stylelintignore b/.stylelintignore new file mode 100644 index 00000000..a7a11f4d --- /dev/null +++ b/.stylelintignore @@ -0,0 +1,9 @@ +# Common +node_modules +dist +.nuxt +coverage +.reports + +# Files +**/*.js diff --git a/.stylelintrc.json b/.stylelintrc similarity index 58% rename from .stylelintrc.json rename to .stylelintrc index 8e16e4e1..2f7cd94a 100644 --- a/.stylelintrc.json +++ b/.stylelintrc @@ -4,25 +4,27 @@ "stylelint-config-recess-order" ], "customSyntax": "postcss-html", + "ignoreFiles": [ + "./**/*.js" + ], + "plugins": [ + "stylelint-prettier" + ], "rules": { - "max-line-length": null, + "prettier/prettier": true, "value-keyword-case": [ "lower", { "camelCaseSvgKeywords": true } ], - "at-rule-no-unknown": [ + "selector-pseudo-class-no-unknown": [ true, { - "ignoreAtRules": [ - "tailwind", - "apply", - "variants", - "responsive", - "screen" + "ignorePseudoClasses": [ + "deep" ] } ] } -} +} \ No newline at end of file diff --git a/README.md b/README.md index 5dcf5e4b..0e24be59 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,9 @@ # Nuxt Custom-Elements Example -This is an example project for using [Nuxt Custom-Elements](https://github.com/GrabarzUndPartner/nuxt-custom-elements) with [Nuxt.js](https://nuxtjs.org) and plugins ([VueI18n](https://kazupon.github.io/vue-i18n/), [Vuetify](https://vuetifyjs.com/), ...). +This is an example project for using [Nuxt Custom-Elements](https://github.com/GrabarzUndPartner/nuxt-custom-elements) with [Nuxt.js](https://nuxtjs.org) and plugins ([VueI18n](https://kazupon.github.io/vue-i18n/), [Vuetify](https://vuetifyjs.com/), ...). For more information, see the [Usage section](https://nuxt-custom-elements.grabarzundpartner.dev/usage/) in the documentation. - - [👁   **Preview**](https://grabarzundpartner.github.io/nuxt-custom-elements-example/) - [📖   **Documentation**](http://nuxt-custom-elements.grabarzundpartner.dev/) @@ -13,38 +12,38 @@ For more information, see the [Usage section](https://nuxt-custom-elements.graba First of all, the repository must be cloned and install dependencies with ```bash -$ npm install +npm install ``` Each example can be started in `dev`, `server` and `ssr`. -For this the path to the example must be given as argument (e.g. `npm run dev -- examples/default`). +For this the path to the example must be given as workspace (e.g. `npm run dev --workspace=@nuxt-custom-elements-example/default`). The path specification must be specified in `dev`, `build`, `generate` and `start`. **Available examples:** -| Path | | -| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| `examples/tailwind-css` | [Preview](https://grabarzundpartner.github.io/nuxt-custom-elements-example/tailwind-css/) - [Source](https://github.com/GrabarzUndPartner/nuxt-custom-elements-example/tree/main/examples/tailwind-css) | -| `examples/vue-i18n` | [Preview](https://grabarzundpartner.github.io/nuxt-custom-elements-example/vue-i18n/) - [Source](https://github.com/GrabarzUndPartner/nuxt-custom-elements-example/tree/main/examples/vue-i18n) | -| `examples/vue-router` | [Preview](https://grabarzundpartner.github.io/nuxt-custom-elements-example/vue-router/) - [Source](https://github.com/GrabarzUndPartner/nuxt-custom-elements-example/tree/main/examples/vue-router) | -| `examples/vuetify` | [Preview](https://grabarzundpartner.github.io/nuxt-custom-elements-example/vuetify/) - [Source](https://github.com/GrabarzUndPartner/nuxt-custom-elements-example/tree/main/examples#:~:text=last%20month-,vuetify,-fix(update)%3A%20update) | -| `examples/vuex` | [Preview](https://grabarzundpartner.github.io/nuxt-custom-elements-example/vuex/) - [Source](https://github.com/GrabarzUndPartner/nuxt-custom-elements-example/tree/main/examples/vuex) | -| `examples/external` | [Preview](https://grabarzundpartner.github.io/nuxt-custom-elements-example/external/) - [Source](https://github.com/GrabarzUndPartner/nuxt-custom-elements-example/tree/main/examples/external) | +| Path | | +| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `pinia` | [Preview](https://grabarzundpartner.github.io/nuxt-custom-elements-example/pinia/) - [Source](https://github.com/GrabarzUndPartner/nuxt-custom-elements-example/tree/main/packages/pinia) | +| `tailwindcss` | [Preview](https://grabarzundpartner.github.io/nuxt-custom-elements-example/tailwindcss/) - [Source](https://github.com/GrabarzUndPartner/nuxt-custom-elements-example/tree/main/packages/tailwindcss) | +| `vuetify` | [Preview](https://grabarzundpartner.github.io/nuxt-custom-elements-example/vuetify/) - [Source](https://github.com/GrabarzUndPartner/nuxt-custom-elements-example/tree/main/packages/vuetify) | ### Development ``` -$ npm run dev -- examples/default +npm run dev --workspace=@nuxt-custom-elements-example/default ``` ### Server + ``` -$ npm run build -- examples/default && npm run start -- examples/default +npm run build --workspace=@nuxt-custom-elements-example/default && npm run start --workspace=@nuxt-custom-elements-example/default ``` + ### Static + ``` -$ npm run generate -- examples/default --target static && npm run start -- examples/default --target static +npm run generate --workspace=@nuxt-custom-elements-example/default --target static && npm run start --workspace=@nuxt-custom-elements-example/default --target static ``` Finally, the example can be opened in the browser via [http://localhost:3000/]( http://localhost:3000/). diff --git a/commitlint.config.js b/commitlint.config.js index dc0adae1..c34aa79d 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,5 +1,3 @@ module.exports = { - extends: [ - '@commitlint/config-conventional' - ] + extends: ['@commitlint/config-conventional'] }; diff --git a/examples/default/assets/icons/i18n.png b/examples/default/assets/icons/i18n.png deleted file mode 100644 index 296c5839..00000000 Binary files a/examples/default/assets/icons/i18n.png and /dev/null differ diff --git a/examples/default/assets/icons/vue.png b/examples/default/assets/icons/vue.png deleted file mode 100644 index 80fca152..00000000 Binary files a/examples/default/assets/icons/vue.png and /dev/null differ diff --git a/examples/default/nuxt.config.js b/examples/default/nuxt.config.js deleted file mode 100644 index 469ff400..00000000 --- a/examples/default/nuxt.config.js +++ /dev/null @@ -1,60 +0,0 @@ -import pkg from '../../package.json'; - -export default { - srcDir: __dirname, - - generate: { - dir: process.env.DIST_PATH || '../../dist', - crawler: false - }, - - router: { - base: process.env.BASE_URL - }, - - head: { - title: 'Examples - Nuxt Custom-Elements', - htmlAttrs: { - lang: 'en' - }, - meta: [ - { charset: 'utf-8' }, - { name: 'viewport', content: 'width=device-width, initial-scale=1' }, - { hid: 'description', name: 'description', content: pkg.description } - ], - link: [ - { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' } - ] - }, - - customElements: { - entries: [ - { - name: 'Example', - tags: [ - { - name: 'CustomElementExample', - path: '@/components/Example', - options: { - props: { - title: 'Customizable title' - } - }, - slotContent: 'Customizable slot content' - } - ] - } - ] - }, - - buildModules: [ - '@nuxt/postcss8', - '@nuxtjs/eslint-module', - '@nuxtjs/stylelint-module' - ], - - modules: [ - 'nuxt-custom-elements' - ] - -}; diff --git a/examples/default/pages/index.vue b/examples/default/pages/index.vue deleted file mode 100644 index ab2ec4aa..00000000 --- a/examples/default/pages/index.vue +++ /dev/null @@ -1,129 +0,0 @@ - - - - - diff --git a/examples/external/layouts/default.vue b/examples/external/layouts/default.vue deleted file mode 100644 index 609ad17e..00000000 --- a/examples/external/layouts/default.vue +++ /dev/null @@ -1,10 +0,0 @@ - - - - diff --git a/examples/external/nuxt.config.js b/examples/external/nuxt.config.js deleted file mode 100644 index 8c750e76..00000000 --- a/examples/external/nuxt.config.js +++ /dev/null @@ -1,37 +0,0 @@ -import pkg from '../../package.json'; - -export default { - target: 'static', - srcDir: __dirname, - - generate: { - dir: process.env.DIST_PATH || '../../dist', - crawler: false - }, - - router: { - base: process.env.BASE_URL - }, - - head: { - title: 'External Example - Nuxt Custom-Elements', - htmlAttrs: { - lang: 'en' - }, - meta: [ - { charset: 'utf-8' }, - { name: 'viewport', content: 'width=device-width, initial-scale=1' }, - { hid: 'description', name: 'description', content: pkg.description } - ], - link: [ - { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' } - ] - }, - - buildModules: [ - '@nuxt/postcss8', - '@nuxtjs/eslint-module', - '@nuxtjs/stylelint-module' - ] - -}; diff --git a/examples/external/pages/index.vue b/examples/external/pages/index.vue deleted file mode 100644 index 297752c7..00000000 --- a/examples/external/pages/index.vue +++ /dev/null @@ -1,52 +0,0 @@ - - diff --git a/examples/tailwind-css/entries/TailwindCss.vue b/examples/tailwind-css/entries/TailwindCss.vue deleted file mode 100644 index 08bcfc7c..00000000 --- a/examples/tailwind-css/entries/TailwindCss.vue +++ /dev/null @@ -1,14 +0,0 @@ - - - diff --git a/examples/tailwind-css/entries/TailwindCssShadow.vue b/examples/tailwind-css/entries/TailwindCssShadow.vue deleted file mode 100644 index 25031804..00000000 --- a/examples/tailwind-css/entries/TailwindCssShadow.vue +++ /dev/null @@ -1,20 +0,0 @@ - - - - - diff --git a/examples/tailwind-css/layouts/default.vue b/examples/tailwind-css/layouts/default.vue deleted file mode 100644 index c1a8f2ab..00000000 --- a/examples/tailwind-css/layouts/default.vue +++ /dev/null @@ -1,10 +0,0 @@ - - - - diff --git a/examples/tailwind-css/nuxt.config.js b/examples/tailwind-css/nuxt.config.js deleted file mode 100644 index 868bb586..00000000 --- a/examples/tailwind-css/nuxt.config.js +++ /dev/null @@ -1,85 +0,0 @@ -import pkg from '../../package.json'; - -export default { - target: 'static', - srcDir: __dirname, - - generate: { - dir: process.env.DIST_PATH || '../../dist', - crawler: false - }, - - router: { - base: process.env.BASE_URL - }, - - head: { - title: 'TailwindCSS Example - Nuxt Custom-Elements', - htmlAttrs: { - lang: 'en' - }, - meta: [ - { charset: 'utf-8' }, - { name: 'viewport', content: 'width=device-width, initial-scale=1' }, - { hid: 'description', name: 'description', content: pkg.description } - ], - link: [ - { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' } - ] - }, - - build: { - postcss: { - plugins: { - 'postcss-import': true, - 'postcss-nesting': {}, - 'tailwindcss/nesting': {} - }, - order: 'cssnanoLast' - } - }, - - customElements: { - entries: [ - { - name: 'Example', - tags: [ - { - name: 'CustomElementTailwindCss', - path: '@/entries/TailwindCss' - } - ] - }, - { - name: 'ExampleShadow', - shadow: true, - tags: [ - { - name: 'CustomElementTailwindCss', - path: '@/entries/TailwindCssShadow' - } - ] - } - ] - }, - - tailwindcss: { - cssPath: '~/assets/css/tailwind.css', - configPath: 'tailwind.config.js', - jit: false, - exposeConfig: false, - config: {} - }, - - buildModules: [ - '@nuxt/postcss8', - '@nuxtjs/eslint-module', - '@nuxtjs/stylelint-module', - '@nuxtjs/tailwindcss' - ], - - modules: [ - 'nuxt-custom-elements' - ] - -}; diff --git a/examples/tailwind-css/pages/frames/custom-shadow.vue b/examples/tailwind-css/pages/frames/custom-shadow.vue deleted file mode 100644 index 1da6a279..00000000 --- a/examples/tailwind-css/pages/frames/custom-shadow.vue +++ /dev/null @@ -1,56 +0,0 @@ - - - diff --git a/examples/tailwind-css/pages/index.vue b/examples/tailwind-css/pages/index.vue deleted file mode 100644 index d61bb251..00000000 --- a/examples/tailwind-css/pages/index.vue +++ /dev/null @@ -1,24 +0,0 @@ -