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

Plugin "googleAnalytics" of type "undefined" is not found, can not store config #919

Closed
d-koppenhagen opened this issue Sep 13, 2020 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@d-koppenhagen
Copy link
Contributor

🐞 Bug report

When I will try to update some package in my Angular Scully project for my personal website (Repo here), the update is proceeded but there is a side effect that update also some part of the Scully plugin goolge analytics and the package-lock.json file is changed.

Description

When I install all packages exactly as currently defined in the packlage-lock.json file, the scully plugin @scullyio/scully-plugin-google-analytics works (You can reproduce this by running npm ci on the console as it will not update the lock file and it will install the exact locked versions. ✅

But when I install the packages running npm i, there is some update proceeded that causes the following error message on the console when running npm run scully:

Plugin "googleAnalytics" of type "undefined" is not found, can not store config

After the npm i ran, the package-lock.json file contains the following change that causes the update and in fact the error when running Scully:

// somewhere in line 2681
    "@scullyio/scully-plugin-google-analytics": {
      // ...
      "requires": {
        "@scullyio/scully": "1.0.0-beta.0",
        // ...
      },
      "dependencies": {
        "@scullyio/scully": {
          "version": "1.0.0-beta.0",
          "resolved": "https://registry.npmjs.org/@scullyio/scully/-/scully-1.0.0-beta.0.tgz",
          "integrity": "sha512-NH6RVuXLlptNtE9mnEXjA4oVtvWx4hYQpnzOFhyoW/uo2pGVpqHNE4GojeEn4DEJt9KujFageJq+DlwwN8c8qQ==",
          "requires": {
            "asciidoctor.js": "^1.5.9",
            "chalk": "^4.1.0",
            "chokidar": "^3.4.0",
            "compression": "^1.7.4",
            "cors": "^2.8.5",
            "express": "^4.17.1",
            "front-matter": "^4.0.2",
            "fs-extra": "^9.0.1",
            "guess-parser": "^0.4.18",
            "highlight.js": "^10.1.0",
            "http-proxy-middleware": "^1.0.4",
            "jsdom": "^16.2.2",
            "jsonc": "2.0.0",
            "marked": "^1.1.0",
            "open": "^7.0.3",
            "puppeteer": "^3.3.0",
            "rxjs": "^6.5.5",
            "selfsigned": "^1.10.7",
            "tslib": "^1.13.0",
            "typescript": "^3.8.3",
            "ws": "^7.3.0",
            "yamljs": "^0.3.0",
            "yargs": "^15.3.1"
          }
        },
        // ...
        "tslib": {
          "version": "1.13.0",
          "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz",
          "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q=="
        }
      }
    },
// ...

🔬 Minimal Reproduction

  1. Copy / Fork my repo: Repo here
  2. Run npm i
  3. Run npm run scully:all (Or separate: an Angular Build, the Scully build)
  4. The package-lock.json file is adjusted and the Google Analytics plugin doesn't work anymore

💻Your Environment

Angular Version:


Angular CLI: 10.0.8
Node: 14.8.0
OS: darwin x64

Angular: 10.0.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.1000.8
@angular-devkit/build-angular     0.1000.8
@angular-devkit/build-optimizer   0.1000.8
@angular-devkit/build-webpack     0.1000.8
@angular-devkit/core              10.0.8
@angular-devkit/schematics        10.0.8
@angular/cdk                      10.2.0
@angular/cli                      10.0.8
@angular/youtube-player           10.2.0
@ngtools/webpack                  10.0.8
@schematics/angular               10.0.8
@schematics/update                0.1000.8
rxjs                              6.5.5
typescript                        3.9.7
webpack                           4.43.0

Scully Version:

{
  "name": "d-koppenhagen-website",
  "version": "0.0.0",
  "description": "d-koppenhagen.de website",
  "scripts": {
    "dev": "npm-run-all --parallel build:watch scully:watch",
    "release": "standard-version",
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "build:watch": "ng build --watch",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "scully": "scully",
    "scully:watch": "scully --watch",
    "scully:serve": "scully serve",
    "scully:all": "npm run build -- --prod && npm run scully -- --scanRoutes && npm run scully:serve",
    "post": "ng g @scullyio/init:post --metaDataFile='templates/blog-meta.yaml' --target='blog'",
    "project": "ng g @scullyio/init:post --metaDataFile='templates/project-meta.yaml' --target='projects'"
  },
  "private": true,
  "author": "Danny Koppenhagen <mail@d-koppenhagen.de> (https://d-koppenhagen.de)",
  "homepage": "https://github.com/d-koppenhagen/d-koppenhagen-website",
  "bugs": {
    "url": "https://github.com/d-koppenhagen/d-koppenhagen-website/issues",
    "email": "mail@d-koppenhagen.de"
  },
  "license": "SEE LICENSE IN LICENSE",
  "dependencies": {
    "@angular/animations": "~10.0.2",
    "@angular/cdk": "^10.0.1",
    "@angular/common": "~10.0.2",
    "@angular/compiler": "~10.0.2",
    "@angular/core": "~10.0.2",
    "@angular/forms": "~10.0.2",
    "@angular/platform-browser": "~10.0.2",
    "@angular/platform-browser-dynamic": "~10.0.2",
    "@angular/router": "~10.0.2",
    "@angular/service-worker": "~10.0.2",
    "@angular/youtube-player": "^10.0.0",
    "@fortawesome/angular-fontawesome": "^0.7.0",
    "@fortawesome/fontawesome-free": "^5.14.0",
    "@fortawesome/fontawesome-svg-core": "^1.2.30",
    "@fortawesome/free-brands-svg-icons": "^5.14.0",
    "@fortawesome/free-solid-svg-icons": "^5.14.0",
    "@ngneat/transloco": "^2.19.1",
    "@scullyio/ng-lib": "1.0.0-beta.2",
    "@scullyio/scully-plugin-google-analytics": "1.0.0-beta.0",
    "animate.css": "^4.1.0",
    "ng-navigator-share": "^1.0.4",
    "ng2-animate-on-scroll": "^2.0.0",
    "ngx-sharebuttons": "^8.0.1",
    "ngx-twitter-timeline": "^0.1.5",
    "prismjs": "^1.21.0",
    "rxjs": "~6.5.5",
    "tslib": "~2.0.0",
    "zone.js": "~0.10.3"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.1000.1",
    "@angular/cli": "~10.0.1",
    "@angular/compiler-cli": "~10.0.2",
    "@angular/language-service": "~10.0.2",
    "@commitlint/cli": "^9.1.2",
    "@commitlint/config-angular-type-enum": "^9.1.2",
    "@commitlint/config-conventional": "^9.1.2",
    "@gammastream/scully-plugin-sitemap": "1.0.4",
    "@scullyio/init": "1.0.0-beta.3",
    "@scullyio/scully": "1.0.0-beta.5",
    "@types/jasmine": "~3.5.11",
    "@types/jasminewd2": "~2.0.8",
    "@types/node": "^14.0.14",
    "codelyzer": "^5.2.2",
    "commitizen": "^4.2.1",
    "cz-conventional-changelog": "^3.3.0",
    "fast-xml-parser": "^3.17.4",
    "husky": "^4.2.5",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~5.0.0",
    "jsdom": "^16.2.2",
    "karma": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~3.3.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "ngx-semantic-version": "^2.2.0",
    "npm-run-all": "^4.1.5",
    "prettier": "^2.1.1",
    "pretty-quick": "^3.0.0",
    "protractor": "~7.0.0",
    "scully-plugin-mermaid": "0.0.9",
    "scully-plugin-minify-html": "^3.2.0",
    "scully-plugin-toc": "^1.4.1",
    "standard-version": "^9.0.0",
    "ts-node": "~8.10.2",
    "tslint": "~6.1.0",
    "typescript": "~3.9.5"
  },
  "husky": {
    "hooks": {
      "pre-commit": "pretty-quick --staged",
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
    }
  },
  "config": {
    "commitizen": {
      "path": "./node_modules/cz-conventional-changelog"
    }
  }
}

🔥 Exception or Error


npm run scully:watch -- --scanRoutes 

> d-koppenhagen-website@0.0.0 scully:watch /Users/dannykoppenhagen/dev/d-koppenhagen/d-koppenhagen-website
> scully --watch "--scanRoutes"

using plugins from folder "./scully"
Plugin "googleAnalytics" of type "undefined" is not found, can not store config
⠹ npm ERR! code ELIFECYCLE
npm ERR! errno 15
npm ERR! d-koppenhagen-website@0.0.0 scully:watch: `scully --watch "--scanRoutes"`
npm ERR! Exit status 15
npm ERR! 
npm ERR! Failed at the d-koppenhagen-website@0.0.0 scully:watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/dannykoppenhagen/.npm/_logs/2020-09-13T07_43_14_781Z-debug.log
@d-koppenhagen d-koppenhagen added the bug Something isn't working label Sep 13, 2020
@d-koppenhagen
Copy link
Contributor Author

Oh my Scully config file BTW contains the following:

import { getSitemapPlugin } from '@gammastream/scully-plugin-sitemap';
import { ScullyConfig, setPluginConfig } from '@scullyio/scully';
import { GoogleAnalytics } from '@scullyio/scully-plugin-google-analytics';
import { MinifyHtml } from 'scully-plugin-minify-html';
import { getTocPlugin, TocConfig, TocPluginName } from 'scully-plugin-toc';
import MermaidAPI from 'mermaid/mermaidAPI';
import { getMermaidPlugin, MermaidPluginName } from 'scully-plugin-mermaid';

/**
 * configuration for the markdown plugin
 */
setPluginConfig('md', { enableSyntaxHighlighting: true });

/**
 * configuration for the mermaid plugin
 * All params as defined here are valid:
 * https://mermaid-js.github.io/mermaid/getting-started/Setup.html#mermaidapi-configuration-defaults
 */
const mermaidOptions: MermaidAPI.Config = {
  theme: 'dark',
};
const MermaidPlugin = getMermaidPlugin();
setPluginConfig(MermaidPlugin, mermaidOptions);

/**
 * configuration for the sitemap plugin
 */
const SitemapPlugin = getSitemapPlugin();
setPluginConfig(SitemapPlugin, {
  urlPrefix: 'https://d-koppenhagen.de',
  sitemapFilename: 'sitemap.xml',
  changeFreq: 'monthly',
  priority: [
    '1.0',
    '0.9',
    '0.8',
    '0.7',
    '0.6',
    '0.5',
    '0.4',
    '0.3',
    '0.2',
    '0.1',
    '0.0',
  ],
  ignoredRoutes: [
    /*'/404'*/
  ],
  routes: {
    '/': {
      changeFreq: 'weekly',
      priority: '1.0',
      sitemapFilename: 'sitemap.xml',
    },
    '/blog/:slug': {
      changeFreq: 'weekly',
      priority: '0.9',
      sitemapFilename: 'sitemap-blog.xml',
    },
    '/projects/:slug': {
      changeFreq: 'weekly',
      priority: '0.8',
      sitemapFilename: 'sitemap-blog.xml',
    },
  },
});

/**
 * configuration for the TOC plugin
 */
const tocOptions: TocConfig = {
  blogAreaSelector: '.blog-content',
  insertSelector: '#toc',
  level: ['h2', 'h3'],
  trailingSlash: true,
  scrollIntoViewOnClick: true,
};
const TocPlugin = getTocPlugin();
setPluginConfig(TocPlugin, tocOptions);

/**
 * Gtag plugin config
 */
setPluginConfig(GoogleAnalytics, { globalSiteTag: 'UA-XXXXXXXXX-X' });

/**
 * configure defualt postRenderers
 */
const defaultPostRenderers = [GoogleAnalytics, MinifyHtml];

/**
 * configuration for HTML minification plugin
 */

/**
 * the actual scully configuration
 */
export const config: ScullyConfig = {
  projectRoot: './src',
  projectName: 'd-koppenhagen-website',
  outDir: './dist/static',
  defaultPostRenderers,
  routes: {
    '/projects/:slug': {
      type: 'contentFolder',
      slug: {
        folder: './projects',
      },
      postRenderers: [MermaidPluginName, ...defaultPostRenderers],
    },
    '/blog/:slug': {
      type: 'contentFolder',
      postRenderers: [
        TocPluginName,
        MermaidPluginName,
        ...defaultPostRenderers,
      ],
      slug: {
        folder: './blog',
      },
    },
  },
};

@SanderElias
Copy link
Contributor

@d-koppenhagen I did some related changes that are in the latest beta (.6), can you give that a try and see if it persists?

@d-koppenhagen
Copy link
Contributor Author

If I change this in my package.json:

+ "@scullyio/scully": "1.0.0-beta.6",
- "@scullyio/scully": "1.0.0-beta.5",

... and run npm i, there still occurs the weird change in the package-lock.json file in @scullyio/scully-plugin-google-analytics (same as described in the issue) and it leads to the same error.

@SanderElias
Copy link
Contributor

Ok, we will look futher into that, thanks for confirming

@jorgeucano
Copy link
Contributor

@d-koppenhagen Do you continue with the same issue?

@d-koppenhagen
Copy link
Contributor Author

Yep

@d-koppenhagen
Copy link
Contributor Author

Tomorrow I will try to update all scully packages to the latest versions and then I can tell you if it still happens after updating to 1.0.0

@d-koppenhagen
Copy link
Contributor Author

Hey @jorgeucano , I juts update to scully version 1.0.0. Now the issue has gone away. I also notices that I added the GA plugin to the dependencies instead of devDependencies. Maybe that was part of the problem? .. anyway, with 1.0.0 everything work as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants