From 3d45828112a9e489642a713447fb62b6cf2f2f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Sat, 9 Mar 2019 01:48:41 +0100 Subject: [PATCH 1/2] Remove custom "npm link" behaviour There is already a procedure for both npm and yarn to read an npm module from disk. It's convenient and reliable. E.g. `yarn run dev:styleguide` maybe works for in the browser. But if I import `@humanconnection/styleguide` in the test, I get non-deterministic behaviour. Let's get rid of `yarn run dev:styleguide` --- README.md | 10 +++++++--- nuxt.config.js | 23 +---------------------- package.json | 1 - plugins/styleguide-dev.js | 4 ---- 4 files changed, 8 insertions(+), 30 deletions(-) delete mode 100644 plugins/styleguide-dev.js diff --git a/README.md b/README.md index d395a54e..c14e3e53 100644 --- a/README.md +++ b/README.md @@ -48,9 +48,13 @@ All reusable Components (for example avatar) should be done inside the [Nitro-St More information can be found here: https://github.com/Human-Connection/Nitro-Styleguide - -If you need to change something in the styleguide and want to see the effects on the frontend immediately, then we have you covered. -You need to clone the styleguide to the parent directory `../Nitro-Styleguide` and run `yarn && yarn run dev`. After that you run `yarn run dev:styleguide` instead of `yarn run dev` and you will see your changes reflected inside the fronten! +Use [`yarn link`](https://yarnpkg.com/lang/en/docs/cli/link/) to modify the styleguide repository locally: +```sh +# in Nitro-Styleguide +$ yarn link +$ cd ../Nitro-Web +$ yarn link "@human-connection/styleguide" +``` ## Internationalization (i18n) diff --git a/nuxt.config.js b/nuxt.config.js index dfe6ceef..692a9b7d 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -2,14 +2,6 @@ const pkg = require('./package') const envWhitelist = ['NODE_ENV', 'MAINTENANCE', 'MAPBOX_TOKEN'] const dev = process.env.NODE_ENV !== 'production' -const styleguidePath = '../Nitro-Styleguide' -const styleguideStyles = process.env.STYLEGUIDE_DEV - ? [ - `${styleguidePath}/src/system/styles/main.scss`, - `${styleguidePath}/src/system/styles/shared.scss` - ] - : '@human-connection/styleguide/dist/shared.scss' - module.exports = { mode: 'universal', @@ -78,7 +70,7 @@ module.exports = { ** Global processed styles */ styleResources: { - scss: styleguideStyles + scss: '@human-connection/styleguide/dist/shared.scss' }, /* @@ -194,19 +186,6 @@ module.exports = { exclude: /(node_modules)/ }) } - if (process.env.STYLEGUIDE_DEV) { - const path = require('path') - config.resolve.alias['@@'] = path.resolve( - __dirname, - `${styleguidePath}/src/system` - ) - config.module.rules.push({ - resourceQuery: /blockType=docs/, - loader: require.resolve( - `${styleguidePath}/src/loader/docs-trim-loader.js` - ) - }) - } const svgRule = config.module.rules.find(rule => rule.test.test('.svg')) svgRule.test = /\.(png|jpe?g|gif|webp)$/ diff --git a/package.json b/package.json index 2cae3899..be512095 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,6 @@ "private": true, "scripts": { "dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server", - "dev:styleguide": "cross-env STYLEGUIDE_DEV=true yarn dev", "build": "nuxt build", "start": "cross-env node server/index.js", "generate": "nuxt generate", diff --git a/plugins/styleguide-dev.js b/plugins/styleguide-dev.js deleted file mode 100644 index 4cffe028..00000000 --- a/plugins/styleguide-dev.js +++ /dev/null @@ -1,4 +0,0 @@ -import Vue from 'vue' -import Styleguide from '@@' - -Vue.use(Styleguide) From 2794b82e391ed59202d13892c1545c781b11f3e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Wed, 13 Mar 2019 01:03:32 +0100 Subject: [PATCH 2/2] Fix export 'default' (...) was not found --- nuxt.config.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nuxt.config.js b/nuxt.config.js index 7ab37acf..1f5352de 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -170,6 +170,8 @@ module.exports = { ** You can extend webpack config here */ extend(config, ctx) { + if (ctx.isDev) config.resolve.symlinks = false + // Run ESLint on save if (ctx.isDev && ctx.isClient) { config.module.rules.push({