Skip to content

Commit

Permalink
sander/PluginNames (scullyio#755)
Browse files Browse the repository at this point in the history
* feat(schematics): update schematic to stop using latest

* WIP: sync all the versions of packages

* fix(monorepo): fix naming plugins

* refactor(monorepo): back to orignal versions

Co-authored-by: jorgeucano <[email protected]>
  • Loading branch information
SanderElias and jorgeucano authored Jul 17, 2020
1 parent 7d3f718 commit 014a4b9
Show file tree
Hide file tree
Showing 27 changed files with 412 additions and 171 deletions.
9 changes: 8 additions & 1 deletion libs/ng-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,12 @@
"@angular/common": "*",
"@angular/core": "*",
"rxjs": "6.x.x"
}
},
"keywords": [
"angular",
"scully",
"seo",
"scully-plugin",
"plugin"
]
}
9 changes: 8 additions & 1 deletion libs/plugins/docs-link-update/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,12 @@
},
"dependencies": {
"jsdom": "^16.2.2"
}
},
"keywords": [
"angular",
"scully",
"seo",
"scully-plugin",
"plugin"
]
}
13 changes: 10 additions & 3 deletions libs/plugins/docs-link-update/src/lib/plugins-docs-link-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ const docsLinkPlugin = async (html: string, options: HandledRoute): Promise<stri
anchors.forEach((a) => {
const href = a.getAttribute('href');
if (href && href.toLowerCase().endsWith('.md') && !href.toLowerCase().startsWith('http')) {
const myBase = options.route.substring(0, options.route.lastIndexOf('/'));
const myBase = dropOpeningSlash(options.route.substring(0, options.route.lastIndexOf('/')));
const newRef = `${myBase}/${href.slice(0, -3)}`;
a.setAttribute('href', newRef);
}
if (href && href.startsWith('#')) {
const newRef = `${options.route}${href}`;
a.setAttribute('href', newRef);
a.setAttribute('href', 'javascript:;');
a.setAttribute('onclick', `document.location.hash='${href.slice(1)}'`);
}
});
return dom.serialize();
Expand All @@ -30,3 +30,10 @@ const docsLinkPlugin = async (html: string, options: HandledRoute): Promise<stri

const validator = async (config) => [];
registerPlugin('render', docLink, docsLinkPlugin, validator);

function dropEndingSlash(str: string) {
return str.endsWith('/') ? str.slice(0, -1) : str;
}
function dropOpeningSlash(str: string) {
return str.startsWith('/') && !str.startsWith('//') ? str.slice(1) : str;
}
11 changes: 9 additions & 2 deletions libs/plugins/extra/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "extra",
"name": "@scullyio/scully-plugin-extra",
"version": "1.0.0",
"description": "Scully extra demo plugin",
"main": "index.js",
Expand All @@ -9,5 +9,12 @@
"license": "ISC",
"peerDependencies": {
"@scullyio/scully": "*"
}
},
"keywords": [
"angular",
"scully",
"seo",
"scully-plugin",
"plugin"
]
}
12 changes: 9 additions & 3 deletions libs/plugins/from-data/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
{
"name": "from-data",
"name": "@scullyio/scully-plugin-from-data",
"version": "1.0.0",
"description": "Scully demo data plugin",
"main": "index.js",
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"tslib": "^1.13.0"
},
"peerDependencies": {
"@scullyio/scully": "*"
}
},
"keywords": [
"angular",
"scully",
"seo",
"scully-plugin",
"plugin"
]
}
11 changes: 9 additions & 2 deletions libs/plugins/google-analytics/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
{
"name": "@scullyio/plugins-google-analytics",
"name": "@scullyio/scully-plugin-google-analytics",
"version": "0.0.1",
"author": "Israel Guzman",
"repository": {
"type": "GIT",
"url": "https://github.com/scullyio/scully/tree/main/libs/plugins/google-analytics"
},
"license": "MIT"
"license": "MIT",
"keywords": [
"angular",
"scully",
"seo",
"scully-plugin",
"plugin"
]
}
11 changes: 9 additions & 2 deletions libs/plugins/logrocket/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@scullyio/plugins-logrocket",
"name": "@scullyio/scully-plugin-logrocket",
"version": "0.0.1",
"author": "Israel Guzman",
"repository": {
Expand All @@ -12,5 +12,12 @@
},
"peerDependencies": {
"@scullyio/scully": "*"
}
},
"keywords": [
"angular",
"scully",
"seo",
"scully-plugin",
"plugin"
]
}
14 changes: 9 additions & 5 deletions libs/plugins/scully-plugin-flash-prevention/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"name": "scully-plugin-flash-prevention",
"name": "@scullyio/scully-plugin-flash-prevention",
"version": "0.0.38",
"peerDependencies": {
"@scullyio/scully": "^0.0.78"
},
"main": "index.js",
"contributors": [
"Aaron Frost <[email protected]>"
Expand All @@ -13,5 +10,12 @@
},
"peerDependencies": {
"@scullyio/scully": "*"
}
},
"keywords": [
"angular",
"scully",
"seo",
"scully-plugin",
"plugin"
]
}
1 change: 1 addition & 0 deletions libs/plugins/scully-plugin-remove-scripts/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "extends": "../../../.eslintrc", "rules": {}, "ignorePatterns": ["!**/*"] }
7 changes: 7 additions & 0 deletions libs/plugins/scully-plugin-remove-scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# plugins-scully-plugin-remove-scripts

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `ng test plugins-scully-plugin-remove-scripts` to execute the unit tests via [Jest](https://jestjs.io).
9 changes: 9 additions & 0 deletions libs/plugins/scully-plugin-remove-scripts/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
name: 'plugins-scully-plugin-remove-scripts',
preset: '../../../jest.config.js',
transform: {
'^.+\\.[tj]sx?$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'],
coverageDirectory: '../../../coverage/libs/plugins/scully-plugin-remove-scripts',
};
4 changes: 4 additions & 0 deletions libs/plugins/scully-plugin-remove-scripts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "@scullyio/plugins-scully-plugin-remove-scripts",
"version": "0.0.1"
}
1 change: 1 addition & 0 deletions libs/plugins/scully-plugin-remove-scripts/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/plugins-scully-plugin-remove-scripts';
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { pluginsScullyPluginRemoveScripts } from './plugins-scully-plugin-remove-scripts';

describe('pluginsScullyPluginRemoveScripts', () => {
it('should work', () => {
expect(pluginsScullyPluginRemoveScripts()).toEqual('plugins-scully-plugin-remove-scripts');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function pluginsScullyPluginRemoveScripts(): string {
return 'plugins-scully-plugin-remove-scripts';
}
7 changes: 7 additions & 0 deletions libs/plugins/scully-plugin-remove-scripts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"types": ["node", "jest"]
},
"include": ["**/*.ts"]
}
12 changes: 12 additions & 0 deletions libs/plugins/scully-plugin-remove-scripts/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -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"]
}
9 changes: 9 additions & 0 deletions libs/plugins/scully-plugin-remove-scripts/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.spec.js", "**/*.spec.jsx", "**/*.d.ts"]
}
2 changes: 1 addition & 1 deletion libs/scully-schematics/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions libs/scully-schematics/src/ng-add/version-names.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const scullyVersion = 'latest';
export const scullyComponentVersion = 'latest';
export const requiredAngularVersionRange = '^9.0.0-rc.4';
export const scullyVersion = '^1.0.0-beta.0';
export const scullyComponentVersion = '^1.0.0-beta.0';
// export const requiredAngularVersionRange = '^9.0.0-rc.4';
9 changes: 8 additions & 1 deletion libs/scully/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,12 @@
"@types/yargs": "^15.0.4",
"codelyzer": "^5.1.2",
"prettier": "^1.19.1"
}
},
"keywords": [
"angular",
"scully",
"seo",
"scully-plugin",
"plugin"
]
}
3 changes: 3 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
},
"plugins-docs-link-update": {
"tags": []
},
"plugins-scully-plugin-remove-scripts": {
"tags": []
}
}
}
6 changes: 3 additions & 3 deletions scully.sample-blog.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/** load the plugins */
import '@scullyio/from-data';
// import './demos/plugins/extra-plugin.js';
import '@scullyio/plugin-extra';
import { HandledRoute, registerPlugin, ScullyConfig, setPluginConfig, logError } from '@scullyio/scully';
import { HandledRoute, logError, registerPlugin, ScullyConfig, setPluginConfig } from '@scullyio/scully';
import { baseHrefRewrite } from '@scullyio/scully-plugin-base-href-rewrite';
import '@scullyio/scully-plugin-extra';
import { getFlashPreventionPlugin } from '@scullyio/scully-plugin-flash-prevention';
import '@scullyio/scully-plugin-from-data';
import './demos/plugins/errorPlugin';
import './demos/plugins/tocPlugin';
import './demos/plugins/voidPlugin';
Expand Down
14 changes: 5 additions & 9 deletions scully.scully-docs.config.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
import { ScullyConfig, setPluginConfig, prod } from '@scullyio/scully';
import { DisableAngular } from 'scully-plugin-disable-angular';
import { LogRocket } from '@scullyio/plugins/logrocket';
import { GoogleAnalytics } from '@scullyio/plugins/google-analytics';
import { prod, ScullyConfig, setPluginConfig } from '@scullyio/scully';
import { docLink } from '@scullyio/scully-plugin-docs-link-update';
import { GoogleAnalytics } from '@scullyio/scully-plugin-google-analytics';
import { LogRocket } from '@scullyio/scully-plugin-logrocket';
import { DisableAngular } from 'scully-plugin-disable-angular';

setPluginConfig('md', { enableSyntaxHighlighting: true });

const defaultPostRenderers = [DisableAngular];
const defaultPostRenderers = [LogRocket, GoogleAnalytics, DisableAngular];

if (prod) {
/*
* Config for production
* */
setPluginConfig(LogRocket, { app: 'herodevs', id: 'scully' });
defaultPostRenderers.push(LogRocket);

setPluginConfig(GoogleAnalytics, { globalSiteTag: 'UA-171495765-1' });
defaultPostRenderers.push(GoogleAnalytics);
} else {
/*
* Config for test
*/
setPluginConfig(LogRocket, { app: 'test', id: 'test' });
defaultPostRenderers.push(LogRocket);

setPluginConfig(GoogleAnalytics, { globalSiteTag: 'test' });
defaultPostRenderers.push(GoogleAnalytics);
}

export const config: ScullyConfig = {
Expand Down
Loading

0 comments on commit 014a4b9

Please sign in to comment.