diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 274c68047..1920b591c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,7 +17,7 @@ jobs: - run: npm install - run: npm run symlinks - run: npx nx run-many --target=build --all --prod - - run: node ./dist/libs/scully/scully --project scully-docs --RSD --scan --404=baseOnly + - run: node ./dist/libs/scully/scully --project scully-docs --RSD --scan --404=baseOnly --prod - uses: w9jds/firebase-action@master with: args: deploy --project scullyio --only hosting diff --git a/docs/scully_es.md b/docs/scully_es.md index 8381c6b24..13042b397 100644 --- a/docs/scully_es.md +++ b/docs/scully_es.md @@ -2,14 +2,14 @@ title: Introducción order: 110 lang: es -slug: Introducción +slug: introduccion --- # Introducción (Alfa) ## ¿Qué es Scully? -**Scully** el mejor generador de sitios estáticos para proyectos de Angular buscando adoptar JAMStack. +**Scully** el mejor generador de sitios estáticos para proyectos de Angular buscando adoptar JAMStack. ### ¿Cómo funciona? @@ -43,4 +43,4 @@ Scully [Horas de Oficina](https://meet.google.com/vcm-wekz-hsx?authuser=1) todos El equipo aprecia su retroalimentación y nos gustaría conocer cómo está usando Scully en convinación con otras herramientas. -¿Le gustaría compartir su experiencia con la comunidad? Por favor vea nuestra guía de [CONTRIBUCIÓN](../CONTRIBUTING.md). +¿Le gustaría compartir su experiencia con la comunidad? Por favor vea nuestra guía de [CONTRIBUCIÓN](../CONTRIBUTING.md). diff --git a/libs/plugins/logrocket/.eslintrc b/libs/plugins/logrocket/.eslintrc new file mode 100644 index 000000000..1655d7292 --- /dev/null +++ b/libs/plugins/logrocket/.eslintrc @@ -0,0 +1 @@ +{ "extends": "../../../.eslintrc", "rules": {}, "ignorePatterns": ["!**/*"] } diff --git a/libs/plugins/logrocket/README.md b/libs/plugins/logrocket/README.md new file mode 100644 index 000000000..94621f3ec --- /dev/null +++ b/libs/plugins/logrocket/README.md @@ -0,0 +1,7 @@ +# plugins-logrocket + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `ng test plugins-logrocket` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/plugins/logrocket/jest.config.js b/libs/plugins/logrocket/jest.config.js new file mode 100644 index 000000000..ffbbc14c9 --- /dev/null +++ b/libs/plugins/logrocket/jest.config.js @@ -0,0 +1,9 @@ +module.exports = { + name: 'plugins-logrocket', + preset: '../../../jest.config.js', + transform: { + '^.+\\.[tj]sx?$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'], + coverageDirectory: '../../../coverage/libs/plugins/logrocket', +}; diff --git a/libs/plugins/logrocket/package.json b/libs/plugins/logrocket/package.json new file mode 100644 index 000000000..d29295b7c --- /dev/null +++ b/libs/plugins/logrocket/package.json @@ -0,0 +1,13 @@ +{ + "name": "@scullyio/plugins-logrocket", + "version": "0.0.1", + "author": "Israel Guzman", + "repository": { + "type": "GIT", + "url": "https://github.com/scullyio/scully/tree/main/libs/plugins/logrocket" + }, + "license": "MIT", + "dependencies": { + "tslib": "^1.13.0" + } +} diff --git a/libs/plugins/logrocket/src/index.ts b/libs/plugins/logrocket/src/index.ts new file mode 100644 index 000000000..2894f5e79 --- /dev/null +++ b/libs/plugins/logrocket/src/index.ts @@ -0,0 +1 @@ +export * from './lib/plugins-logrocket'; diff --git a/libs/plugins/logrocket/src/lib/plugins-logrocket.ts b/libs/plugins/logrocket/src/lib/plugins-logrocket.ts new file mode 100644 index 000000000..dd78976ff --- /dev/null +++ b/libs/plugins/logrocket/src/lib/plugins-logrocket.ts @@ -0,0 +1,21 @@ +import { registerPlugin, getPluginConfig } from '@scullyio/scully'; + +export const LogRocket = 'logrocket'; + +export const logrocketPlugin = async (html: string): Promise => { + const logrocketConfig = getPluginConfig(LogRocket); + + if (!logrocketConfig) { + throw new Error('logrocket plugin missing configuration'); + } + + const logrocketScript = ` + + `; + + return html.replace(/<\/head/i, `${logrocketScript} []; + +registerPlugin('render', LogRocket, logrocketPlugin, validator); diff --git a/libs/plugins/logrocket/tsconfig.json b/libs/plugins/logrocket/tsconfig.json new file mode 100644 index 000000000..08c7db8c9 --- /dev/null +++ b/libs/plugins/logrocket/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "types": ["node", "jest"] + }, + "include": ["**/*.ts"] +} diff --git a/libs/plugins/logrocket/tsconfig.lib.json b/libs/plugins/logrocket/tsconfig.lib.json new file mode 100644 index 000000000..9c463b51e --- /dev/null +++ b/libs/plugins/logrocket/tsconfig.lib.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "../../../dist/out-tsc", + "declaration": true, + "rootDir": "./src", + "types": ["node"] + }, + "exclude": ["**/*.spec.ts"], + "include": ["**/*.ts"] +} diff --git a/libs/plugins/logrocket/tsconfig.spec.json b/libs/plugins/logrocket/tsconfig.spec.json new file mode 100644 index 000000000..1798b378a --- /dev/null +++ b/libs/plugins/logrocket/tsconfig.spec.json @@ -0,0 +1,15 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "**/*.spec.ts", + "**/*.spec.tsx", + "**/*.spec.js", + "**/*.spec.jsx", + "**/*.d.ts" + ] +} diff --git a/libs/scully/src/index.ts b/libs/scully/src/index.ts index f762e2cbe..b1d421ee7 100644 --- a/libs/scully/src/index.ts +++ b/libs/scully/src/index.ts @@ -28,7 +28,7 @@ import { handleTravesal } from './lib/utils/handlers/handleTravesal'; import { routeDiscovery } from './lib/utils/handlers/routeDiscovery'; import { executePluginsForRoute } from './lib/renderPlugins/executePlugins'; import { WriteToStorage } from './lib/systemPlugins/writeToFs.plugin'; - +import { prod } from './lib/utils/cli-options'; export * from './lib/utils/log'; export { configValidator, @@ -57,4 +57,5 @@ export { /** end WIP */ getConfig as getMyConfig, setConfig as setMyConfig, + prod, }; diff --git a/libs/scully/src/lib/utils/cli-options.ts b/libs/scully/src/lib/utils/cli-options.ts index 3295de532..2476a13eb 100644 --- a/libs/scully/src/lib/utils/cli-options.ts +++ b/libs/scully/src/lib/utils/cli-options.ts @@ -130,7 +130,7 @@ export const { 'provide a wildcard string separated by ,(comma) to filter the handled routes' ).argv; -export const { pjFirst, serverTimeout, pluginsError, handle404 } = yargs +export const { pjFirst, serverTimeout, pluginsError, handle404, prod } = yargs /** server Timout */ .number('st') .default('st', 0) @@ -154,7 +154,12 @@ export const { pjFirst, serverTimeout, pluginsError, handle404 } = yargs .boolean('pe') .alias('pe', 'pluginsError') .default('pe', true) - .describe('pe', "Exit scully's run when exist an error in a plugin").argv; + .describe('pe', "Exit scully's run when exist an error in a plugin") + /** Use Prod Mode */ + .boolean('prod') + .alias('prod', 'Production') + .default('prod', false) + .describe('prod', 'Use prod mode for Scully').argv; yargs.help(); diff --git a/nx.json b/nx.json index 43ff2ae65..18f5a5906 100644 --- a/nx.json +++ b/nx.json @@ -45,6 +45,9 @@ }, "plugins-scully-plugin-flash-prevention": { "tags": [] + }, + "plugins-logrocket": { + "tags": [] } } } diff --git a/package-lock.json b/package-lock.json index b53bc8c10..5afb12c5c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4278,9 +4278,9 @@ } }, "@types/jasmine": { - "version": "3.5.10", - "resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-3.5.10.tgz", - "integrity": "sha512-3F8qpwBAiVc5+HPJeXJpbrl+XjawGmciN5LgiO7Gv1pl1RHtjoMNqZpqEksaPJW05ViKe8snYInRs6xB25Xdew==", + "version": "3.5.11", + "resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-3.5.11.tgz", + "integrity": "sha512-fg1rOd/DehQTIJTifGqGVY6q92lDgnLfs7C6t1ccSwQrMyoTGSoH6wWzhJDZb6ezhsdwAX4EIBLe8w5fXWmEng==", "dev": true }, "@types/jasminewd2": { diff --git a/scully.scully-docs.config.ts b/scully.scully-docs.config.ts index 019f22827..2cbe5ce63 100644 --- a/scully.scully-docs.config.ts +++ b/scully.scully-docs.config.ts @@ -1,11 +1,26 @@ -import { ScullyConfig, setPluginConfig } from '@scullyio/scully'; +import { + ScullyConfig, + setPluginConfig, + prod, + getPluginConfig, +} from '@scullyio/scully'; import { DisableAngular } from 'scully-plugin-disable-angular'; import './demos/plugins/docs-link-update'; +import { LogRocket } from '@scullyio/plugins/logrocket'; setPluginConfig('md', { enableSyntaxHighlighting: true }); const defaultPostRenderers = [DisableAngular]; +if (prod) { + setPluginConfig(LogRocket, { app: 'herodevs', id: 'scully' }); + defaultPostRenderers.push(LogRocket); +} else { + // This is for check the plugin with the test + setPluginConfig(LogRocket, { app: 'test', id: 'test' }); + defaultPostRenderers.push(LogRocket); +} + export const config: ScullyConfig = { projectRoot: './apps/scully-docs/src', projectName: 'scully-docs', diff --git a/tests/jest/src/__tests__/__snapshots__/docsThere.spec.ts.snap b/tests/jest/src/__tests__/__snapshots__/docsThere.spec.ts.snap index 73c6b785c..6e859c0b8 100644 --- a/tests/jest/src/__tests__/__snapshots__/docsThere.spec.ts.snap +++ b/tests/jest/src/__tests__/__snapshots__/docsThere.spec.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`docsSite should have content for all markdown files 1`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/CODE_OF_CONDUCT 1`] = ` " ScullyDocs @@ -26,7 +26,9 @@ exports[`docsSite should have content for all markdown files 1`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

Code of Conduct

As contributors and maintainers of the Scully project, we pledge to respect everyone who contributes by posting issues, updating documentation, submitting pull requests, providing feedback in comments, and any other activities.

@@ -40,7 +42,7 @@ exports[`docsSite should have content for all markdown files 1`] = ` " `; -exports[`docsSite should have content for all markdown files 2`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/CODE_OF_CONDUCT_es 1`] = ` " ScullyDocs @@ -66,7 +68,9 @@ exports[`docsSite should have content for all markdown files 2`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

Código de Conducta

Como contribuyentes y mantenedores del proyecto Scully, nos comprometemos a respetar a todos los que contribuyen mediante la publicación de problemas, la actualización de la documentación, el envío de solicitudes de extracción, la retroalimentación en los comentarios y cualquier otra actividad. @@ -80,7 +84,7 @@ Si está sujeto o es testigo de un comportamiento inaceptable, o tiene alguna ot " `; -exports[`docsSite should have content for all markdown files 3`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/Introduction 1`] = ` " ScullyDocs @@ -106,7 +110,72 @@ exports[`docsSite should have content for all markdown files 3`] = ` scully-content { display: none; } - + + + + + \\"scullyLogo\\"

Introduction (Alpha)

+

What is Scully?

+

Scully is the best static site generator for Angular projects looking to embrace the JAMStack.

+

How does it work?

+

Under the hood, Scully analyzes an Angular application, and it generates a static version of it. In addition, it is EASY TO USE because it provides several Angular schematics.

+

Scully works on Windows, Linux and macOS.

+

Visit one of the following topics:

+ +
+

Join the Scully community on Gitter

+

Scully Office Hours every Tuesday at noon MST

+
+

Do you want to collaborate to scully?

+

The team would love your feedback and how you are using Scully with other tools.

+

Want to share your experience with the community? Please check our CONTRIBUTING guidelines.

+
+ + +" +`; + +exports[`docsSite should have content for all markdown files check html for markdown docs/blog 1`] = ` +" + + ScullyDocs + + + + + + + \\"scullyLogo\\"

Creating a Blog

Scully is the best option for moving a blog to Angular! It provides a schematic that enables Angular applications to use markdown files for blog's content.

@@ -296,7 +365,7 @@ published: true " `; -exports[`docsSite should have content for all markdown files 4`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/blog_es 1`] = ` " ScullyDocs @@ -322,7 +391,9 @@ exports[`docsSite should have content for all markdown files 4`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

Crear un blog

Scully es la mejor opción para mover tu blog a Angular!

@@ -429,7 +500,7 @@ CREATE mdblog/2020-03-24-blog.md (95 bytes) " `; -exports[`docsSite should have content for all markdown files 5`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/features 1`] = ` " ScullyDocs @@ -455,7 +526,9 @@ exports[`docsSite should have content for all markdown files 5`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

Scully's Features

Under the hood, Scully analyzes an Angular application and generates a static @@ -491,7 +564,7 @@ its usage AS EASY AS POSSIBLE!

" `; -exports[`docsSite should have content for all markdown files 6`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/features_es 1`] = ` " ScullyDocs @@ -517,7 +590,9 @@ exports[`docsSite should have content for all markdown files 6`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

Caracteristicas de Scully

Tras bambalinas, Scully analiza la aplicación de Angular y genera una versión estática de esta. Proporciona varios esquemas (schematics) de Angular para @@ -552,7 +627,7 @@ hacer su uso LO MÁS SENCILLO POSIBLE!

" `; -exports[`docsSite should have content for all markdown files 7`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/getting-started 1`] = ` " ScullyDocs @@ -578,7 +653,9 @@ exports[`docsSite should have content for all markdown files 7`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

Getting Started with Scully

Welcome to Scully!

@@ -653,7 +730,7 @@ These index.html files are jamstack-packed with HTML and CS " `; -exports[`docsSite should have content for all markdown files 8`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/getting-started_es 1`] = ` " ScullyDocs @@ -679,7 +756,9 @@ exports[`docsSite should have content for all markdown files 8`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

Iniciando con Scully

¡Bienvenido a Scully!

@@ -780,7 +859,70 @@ y la navegación del sitio aun funciona. Pero sobre todo, la mayor parte del sit " `; -exports[`docsSite should have content for all markdown files 9`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/introduccion 1`] = ` +" + + ScullyDocs + + + + + + + + + \\"scullyLogo\\"

Introducción (Alfa)

+

¿Qué es Scully?

+

Scully el mejor generador de sitios estáticos para proyectos de Angular buscando adoptar JAMStack.

+

¿Cómo funciona?

+

Tras bambalinas, Scully analiza la plicación de Angular y genera una versión estática de esta. Además, es FACIL DE USAR porque proporciona varios esquemas (schematics) de Angular.

+

Scully funciona en Windows, Linux y macOS.

+

Visite uno de los siguientes temas:

+ +
+

Unase a la comunidad de Scully en Gitter

+

Scully Horas de Oficina todos los martes al medio día MST.

+
+

¿Le gustaría colaborar a Scully?

+

El equipo aprecia su retroalimentación y nos gustaría conocer cómo está usando Scully en convinación con otras herramientas.

+

¿Le gustaría compartir su experiencia con la comunidad? Por favor vea nuestra guía de CONTRIBUCIÓN.

+
+ + +" +`; + +exports[`docsSite should have content for all markdown files check html for markdown docs/issues 1`] = ` " ScullyDocs @@ -806,7 +948,9 @@ exports[`docsSite should have content for all markdown files 9`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

Issues

To create a bug report: Go to Scully Bug template.

@@ -818,7 +962,7 @@ exports[`docsSite should have content for all markdown files 9`] = ` " `; -exports[`docsSite should have content for all markdown files 10`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/plugins 1`] = ` " ScullyDocs @@ -844,7 +988,9 @@ exports[`docsSite should have content for all markdown files 10`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

Plugins

Scully uses a plugin system that allows users to define new ways for Scully to pre-render an application. There are five main @@ -1114,7 +1260,7 @@ registerPlugin('fileHandler', " `; -exports[`docsSite should have content for all markdown files 11`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/plugins_es 1`] = ` " ScullyDocs @@ -1140,7 +1286,9 @@ exports[`docsSite should have content for all markdown files 11`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

Plugins

Scully utiliza un sistema de plugins que permite a los usuarios definir nuevas formas en las que Scully haga el pre-render de la aplicación. Hay cinco tipos @@ -1410,7 +1558,7 @@ registerPlugin('fileHandler', " `; -exports[`docsSite should have content for all markdown files 12`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/polyfills 1`] = ` " ScullyDocs @@ -1436,7 +1584,9 @@ exports[`docsSite should have content for all markdown files 12`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

Polyfills

Depending on the browser and environment that the application targets, some polyfills are @@ -1454,7 +1604,7 @@ to be aware of different points in the application's lifecycle.

" `; -exports[`docsSite should have content for all markdown files 13`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/pre-requisites 1`] = ` " ScullyDocs @@ -1480,7 +1630,9 @@ exports[`docsSite should have content for all markdown files 13`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

Prerequisites

You need an existing Angular application, or you can create a new one in order to use Scully.

@@ -1507,7 +1659,7 @@ exports[`docsSite should have content for all markdown files 13`] = ` " `; -exports[`docsSite should have content for all markdown files 14`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/pre-requisites_es 1`] = ` " ScullyDocs @@ -1533,7 +1685,9 @@ exports[`docsSite should have content for all markdown files 14`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

Requisitos Previos

Necesita una aplicación existente de Angular o puede crear una nueva para usar Scully.

@@ -1560,7 +1714,7 @@ exports[`docsSite should have content for all markdown files 14`] = ` " `; -exports[`docsSite should have content for all markdown files 15`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/recommended-plugins 1`] = ` " ScullyDocs @@ -1586,7 +1740,9 @@ exports[`docsSite should have content for all markdown files 15`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

Recommended Plugins

If you would like to add a plugin to this list; edit the docs/recommended-plugins.md file and submit a PR.

@@ -1630,7 +1786,7 @@ exports[`docsSite should have content for all markdown files 15`] = ` " `; -exports[`docsSite should have content for all markdown files 16`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/recommended-plugins_es 1`] = ` " ScullyDocs @@ -1656,7 +1812,9 @@ exports[`docsSite should have content for all markdown files 16`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

Plugins Recomendados

Si gusta agregar un plugin a esta lista; edite el archivo docs/recommended-plugins.md y haga un PR.

@@ -1700,7 +1858,7 @@ exports[`docsSite should have content for all markdown files 16`] = ` " `; -exports[`docsSite should have content for all markdown files 17`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/release-for-v8 1`] = ` " ScullyDocs @@ -1726,7 +1884,9 @@ exports[`docsSite should have content for all markdown files 17`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

Step for Releasing a v8.x.x library

    @@ -1756,7 +1916,7 @@ exports[`docsSite should have content for all markdown files 17`] = ` " `; -exports[`docsSite should have content for all markdown files 18`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/roadmap 1`] = ` " ScullyDocs @@ -1782,7 +1942,9 @@ exports[`docsSite should have content for all markdown files 18`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

    roadmap / wishlist

      @@ -1812,7 +1974,7 @@ exports[`docsSite should have content for all markdown files 18`] = ` " `; -exports[`docsSite should have content for all markdown files 19`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/routeParameters 1`] = ` " ScullyDocs @@ -1838,7 +2000,9 @@ exports[`docsSite should have content for all markdown files 19`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

      Route Parameters & Scully

      If you run Scully and the following warning is displayed, you need to teach Scully how to use the project's route parameters.

      @@ -1857,7 +2021,7 @@ exports[`docsSite should have content for all markdown files 19`] = ` " `; -exports[`docsSite should have content for all markdown files 20`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/scully-cmd-line 1`] = ` " ScullyDocs @@ -1883,7 +2047,9 @@ exports[`docsSite should have content for all markdown files 20`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

      Scully Command Line Options

      The Scully CLI has the following available options:

      @@ -1992,7 +2158,7 @@ If the Scully server gets a request for a route(file) that does not exists on th " `; -exports[`docsSite should have content for all markdown files 21`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/scully-configuration 1`] = ` " ScullyDocs @@ -2018,7 +2184,9 @@ exports[`docsSite should have content for all markdown files 21`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

      Scully Configuration

      The central part of a Scully project is the scully.<projectname>.config.ts file. This file exports the Scully build configuration for an application.

      @@ -2193,7 +2361,7 @@ For example if you add image and font " `; -exports[`docsSite should have content for all markdown files 22`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/scully-lib-core 1`] = ` " ScullyDocs @@ -2219,7 +2387,9 @@ exports[`docsSite should have content for all markdown files 22`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

      Scully Core

      This section covers Scully's core features, and they are listed below:

      @@ -2331,7 +2501,7 @@ More over, it allows you to load the state on subsequent route changes after the " `; -exports[`docsSite should have content for all markdown files 23`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/scully-provided-plugins 1`] = ` " ScullyDocs @@ -2357,7 +2527,9 @@ exports[`docsSite should have content for all markdown files 23`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

      This document describes Scully's builtin plugins.

      json (router)

      @@ -2375,129 +2547,7 @@ exports[`docsSite should have content for all markdown files 23`] = ` " `; -exports[`docsSite should have content for all markdown files 24`] = ` -" - - ScullyDocs - - - - - - - \\"scullyLogo\\"

      Introduction (Alpha)

      -

      What is Scully?

      -

      Scully is the best static site generator for Angular projects looking to embrace the JAMStack.

      -

      How does it work?

      -

      Under the hood, Scully analyzes an Angular application, and it generates a static version of it. In addition, it is EASY TO USE because it provides several Angular schematics.

      -

      Scully works on Windows, Linux and macOS.

      -

      Visit one of the following topics:

      - -
      -

      Join the Scully community on Gitter

      -

      Scully Office Hours every Tuesday at noon MST

      -
      -

      Do you want to collaborate to scully?

      -

      The team would love your feedback and how you are using Scully with other tools.

      -

      Want to share your experience with the community? Please check our CONTRIBUTING guidelines.

      -
      - - -" -`; - -exports[`docsSite should have content for all markdown files 25`] = ` -" - - ScullyDocs - - - - - - - \\"scullyLogo\\"

      Introducción (Alfa)

      -

      ¿Qué es Scully?

      -

      Scully el mejor generador de sitios estáticos para proyectos de Angular buscando adoptar JAMStack.

      -

      ¿Cómo funciona?

      -

      Tras bambalinas, Scully analiza la plicación de Angular y genera una versión estática de esta. Además, es FACIL DE USAR porque proporciona varios esquemas (schematics) de Angular.

      -

      Scully funciona en Windows, Linux y macOS.

      -

      Visite uno de los siguientes temas:

      - -
      -

      Unase a la comunidad de Scully en Gitter

      -

      Scully Horas de Oficina todos los martes al medio día MST.

      -
      -

      ¿Le gustaría colaborar a Scully?

      -

      El equipo aprecia su retroalimentación y nos gustaría conocer cómo está usando Scully en convinación con otras herramientas.

      -

      ¿Le gustaría compartir su experiencia con la comunidad? Por favor vea nuestra guía de CONTRIBUCIÓN.

      -
      - - -" -`; - -exports[`docsSite should have content for all markdown files 26`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/showcase 1`] = ` " ScullyDocs @@ -2523,7 +2573,9 @@ exports[`docsSite should have content for all markdown files 26`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

      Scully Showcase

      \\"1-800 @@ -2553,7 +2605,7 @@ img { " `; -exports[`docsSite should have content for all markdown files 27`] = ` +exports[`docsSite should have content for all markdown files check html for markdown docs/util 1`] = ` " ScullyDocs @@ -2579,7 +2631,9 @@ exports[`docsSite should have content for all markdown files 27`] = ` scully-content { display: none; } - + + + \\"scullyLogo\\"

      Utilities

      Scully works well in combination with other tools and utilities, for example:

      diff --git a/tests/jest/src/__tests__/baseHrefRewrite.spec.ts b/tests/jest/src/__tests__/baseHrefRewrite.spec.ts index 87a7e4f46..ad123d4c1 100644 --- a/tests/jest/src/__tests__/baseHrefRewrite.spec.ts +++ b/tests/jest/src/__tests__/baseHrefRewrite.spec.ts @@ -1,5 +1,3 @@ -import { readFileSync } from 'fs'; -import { join } from 'path'; import { readPage } from '../test-config.helper'; describe('Check if base-ref rewite ', () => { diff --git a/tests/jest/src/__tests__/blog-index.spec.ts b/tests/jest/src/__tests__/blog-index.spec.ts index 1d6607f9d..118df5f9e 100644 --- a/tests/jest/src/__tests__/blog-index.spec.ts +++ b/tests/jest/src/__tests__/blog-index.spec.ts @@ -1,4 +1,5 @@ import { readPage, replaceIndexNG } from '../test-config.helper'; +import { expect } from '@jest/globals'; describe('Static: Test blog index', () => { it('Check clean blog index by scully', () => { diff --git a/tests/jest/src/__tests__/docsThere.spec.ts b/tests/jest/src/__tests__/docsThere.spec.ts index faac36b62..21a7f0af1 100644 --- a/tests/jest/src/__tests__/docsThere.spec.ts +++ b/tests/jest/src/__tests__/docsThere.spec.ts @@ -1,21 +1,21 @@ -import { readdir, readFileSync } from 'fs'; +import { readdirSync, readFileSync } from 'fs'; import { join } from 'path'; import { readPage, replaceIndexNG } from '../test-config.helper'; const fm = require('front-matter'); +import { expect } from '@jest/globals'; describe('docsSite', () => { const path = join(__dirname, '../../../../docs'); - - it('should have content for all markdown files', async () => { - const files = ( - await new Promise((resolve) => - readdir(path, (err, data) => resolve(data)) - ) - ) + describe('should have content for all markdown files', () => { + const files = readdirSync(path) .filter((file) => file.endsWith('.md')) .map((file) => getSlug(file, path)); for (const file of files) { - expect(replaceIndexNG(readPage(file, 'doc-sites'))).toMatchSnapshot(); + it(`check html for markdown ${file}`, () => { + const index = readPage(file, 'doc-sites'); + const replace = replaceIndexNG(index); + expect(replace).toMatchSnapshot(); + }); } }); }); diff --git a/tests/jest/src/__tests__/home.spec.ts b/tests/jest/src/__tests__/home.spec.ts index 0d06b9959..ffb07457e 100644 --- a/tests/jest/src/__tests__/home.spec.ts +++ b/tests/jest/src/__tests__/home.spec.ts @@ -1,4 +1,5 @@ import { readPage, replaceIndexNG } from '../test-config.helper'; +import { expect } from '@jest/globals'; describe('Check list of all', () => { it('Check clean all list from scully', () => { diff --git a/tests/jest/src/__tests__/route404.spec.ts b/tests/jest/src/__tests__/route404.spec.ts index 735b1eabd..632b331f8 100644 --- a/tests/jest/src/__tests__/route404.spec.ts +++ b/tests/jest/src/__tests__/route404.spec.ts @@ -1,5 +1,6 @@ import { readPage, replaceIndexNG } from '../test-config.helper'; // import { title404 } from '../../../../libs/scully/src/lib/utils/serverstuff/title404'; +import { expect } from '@jest/globals'; // copied in here, because the import blows up in GA. const title404 = '404 - URL not provided in the app Scully is serving'; diff --git a/tests/jest/src/__tests__/transfer-state.spec.ts b/tests/jest/src/__tests__/transfer-state.spec.ts index ab34a1d87..aebbdcb2a 100644 --- a/tests/jest/src/__tests__/transfer-state.spec.ts +++ b/tests/jest/src/__tests__/transfer-state.spec.ts @@ -1,4 +1,5 @@ import { extractTransferState, readPage } from '../test-config.helper'; +import { expect } from '@jest/globals'; describe('TransferState', () => { it('should add state to page 1', () => { diff --git a/tests/jest/src/__tests__/users.spec.ts b/tests/jest/src/__tests__/users.spec.ts index ffe237d4f..c5b644598 100644 --- a/tests/jest/src/__tests__/users.spec.ts +++ b/tests/jest/src/__tests__/users.spec.ts @@ -1,4 +1,5 @@ import { readPage, replaceIndexNG } from '../test-config.helper'; +import { expect } from '@jest/globals'; describe('JsonPlugin: test user List', () => { it('Check clean blog index by scully', () => { diff --git a/tests/jest/src/setup-jest.ts b/tests/jest/src/setup-jest.ts index 3e0823316..e5cfe2b00 100644 --- a/tests/jest/src/setup-jest.ts +++ b/tests/jest/src/setup-jest.ts @@ -1,8 +1,10 @@ import 'jest-preset-angular'; +declare const expect: jest.Expect; + /* global mocks for jsdom */ const mock = () => { - let storage: {[key: string]: string} = {}; + let storage: { [key: string]: string } = {}; return { getItem: (key: string) => (key in storage ? storage[key] : null), setItem: (key: string, value: string) => (storage[key] = value || ''), @@ -11,8 +13,8 @@ const mock = () => { }; }; -Object.defineProperty(window, 'localStorage', {value: mock()}); -Object.defineProperty(window, 'sessionStorage', {value: mock()}); +Object.defineProperty(window, 'localStorage', { value: mock() }); +Object.defineProperty(window, 'sessionStorage', { value: mock() }); Object.defineProperty(window, 'getComputedStyle', { value: () => ['-webkit-appearance'], }); diff --git a/tsconfig.json b/tsconfig.json index 710e9e8a3..f2d3f4405 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -25,7 +25,8 @@ "@scullyio/plugins/demo-lib": ["libs/plugins/demo-lib/src/index.ts"], "@scullyio/plugins/scully-plugin-flash-prevention": [ "dist/libs/plugins/scully-plugin-flash-prevention" - ] + ], + "@scullyio/plugins/logrocket": ["libs/plugins/logrocket/src/index.ts"] } }, "angularCompilerOptions": { diff --git a/workspace.json b/workspace.json index 9e9291bd3..bf5ff1979 100644 --- a/workspace.json +++ b/workspace.json @@ -450,6 +450,43 @@ } } } + }, + "plugins-logrocket": { + "root": "libs/plugins/logrocket", + "sourceRoot": "libs/plugins/logrocket/src", + "projectType": "library", + "schematics": {}, + "architect": { + "lint": { + "builder": "@nrwl/linter:lint", + "options": { + "linter": "eslint", + "tsConfig": [ + "libs/plugins/logrocket/tsconfig.lib.json", + "libs/plugins/logrocket/tsconfig.spec.json" + ], + "exclude": ["**/node_modules/**", "!libs/plugins/logrocket/**/*"] + } + }, + "test": { + "builder": "@nrwl/jest:jest", + "options": { + "jestConfig": "libs/plugins/logrocket/jest.config.js", + "tsConfig": "libs/plugins/logrocket/tsconfig.spec.json", + "passWithNoTests": true + } + }, + "build": { + "builder": "@nrwl/node:package", + "options": { + "outputPath": "dist/libs/plugins/logrocket", + "tsConfig": "libs/plugins/logrocket/tsconfig.lib.json", + "packageJson": "libs/plugins/logrocket/package.json", + "main": "libs/plugins/logrocket/src/index.ts", + "assets": ["libs/plugins/logrocket/*.md"] + } + } + } } }, "cli": {