Integrate flowershow packages (#923)

* [packages][m]: mv @flowershow/core package here

* [packages/core][xs]: rename to @portaljs/core

* [package.json][xs]: setup npm workspaces

* [packages/core][xs]:replace deprecated rollup executor

* [core/package.json][s]: fix mermaid versions

* [core/tsconfig][xs]: rm extends

* [core/jest.config][xs]: rm coverageDirectory

* [core/package.json][xs]: install core-js

* [packages.json][s]:use same version for all nrwl packages

* [core/.eslintrc][xs]: adjust ignorePatterns

* [core/project.json][xs]: rm publish targets

* [packages][m]: mv @flowershow/remark-wiki-link here

* [packages][m]: mv @flowershow/remark-wiki-link here

* [packages][m]: mv @flowershow/remark-embed here

* [remark-callouts/project.json][xs]: adjst test pattern

* [package.json][s]: install missing deps

* [remark-callouts][xs]: adjst fields in package.json

* [remark-callouts][s]: rm pubish targets and adjst build executor

* [remark-embed/jest.config][xs]: rm unknown option coverageDirectory

* [remark-embed][xs]: rm publish targets

* [remark-embed][s]: rename to @portaljs/remark-embed

* [remark-wiki-link/eslintrc][xs]:adjst ignorePatterns

* [package.json][xs]: install missing deps

* [remark-wiki-link/test][xs]:specify format

- also temporarily force any type on htmlExtension

* [remark-wiki-link/README][xs]: replace @flowershow with @portaljs

* [remark-wiki-link][xs]:rm old changelog

* [remark-wiki-link][xs]: adjst package.json

* [remark-wiki-link/project.json][xs]: rm publish targets

* [core][s]: rm old changelog

* [core/README][xs]:correct scope name

* [remark-callouts/README][xs]: add @portaljs to pckg name

* [remark-embed/README][xs]: add @portaljs to pckg name

* [package-lock.json][xs]: refresh after rebasing on main
This commit is contained in:
Ola Rubaj
2023-06-07 12:21:00 +02:00
committed by GitHub
parent 0b8c56bcac
commit af134cac8b
139 changed files with 10264 additions and 2303 deletions

View File

@@ -0,0 +1,4 @@
{
"presets": ["@babel/preset-env"],
"plugins": ["@babel/plugin-transform-runtime"]
}

View File

@@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}

View File

@@ -0,0 +1,3 @@
# @portaljs/remark-embed
Converts Youtube link surrounded by newlines in markdown to embedded iframe

View File

@@ -0,0 +1,15 @@
/* eslint-disable */
export default {
displayName: "remark-embed",
preset: "../../jest.preset.js",
globals: {
"ts-jest": {
tsconfig: "<rootDir>/tsconfig.spec.json",
},
},
testEnvironment: "node",
transform: {
"^.+\\.[tj]sx?$": "ts-jest",
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx"]
};

View File

@@ -0,0 +1,36 @@
{
"name": "@portaljs/remark-embed",
"version": "1.0.0",
"description": "Converts youtube link in mdx to an iframe embed",
"repository": {
"type": "git",
"url": "git+https://github.com/datopian/portaljs.git",
"directory": "packages/remark-embed"
},
"keywords": [
"remark",
"remark-plugin",
"markdown",
"obsidian"
],
"author": "Rufus Pollock",
"license": "MIT",
"bugs": {
"url": "https://github.com/datopian/portaljs/issues"
},
"homepage": "https://github.com/datopian/portaljs#readme",
"publishConfig": {
"access": "public"
},
"dependencies": {
"unist-util-visit": "^4.1.1"
},
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
}
}

View File

@@ -0,0 +1,45 @@
{
"name": "remark-embed",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/remark-embed/src",
"projectType": "library",
"targets": {
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/remark-embed/**/*.ts"]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "packages/remark-embed/jest.config.ts",
"passWithNoTests": true
}
},
"build": {
"executor": "@nrwl/rollup:rollup",
"outputs": ["{options.outputPath}"],
"options": {
"entryFile": "packages/remark-embed/src/index.ts",
"outputPath": "packages/remark-embed/dist",
"compiler": "babel",
"tsConfig": "packages/remark-embed/tsconfig.lib.json",
"project": "packages/remark-embed/package.json",
"format": ["esm", "cjs"],
"external": ["unist-util-visit"],
"generateExportsField": true,
"assets": [
{
"glob": "packages/remark-embed/README.md",
"input": ".",
"output": "."
}
]
}
}
},
"tags": []
}

View File

@@ -0,0 +1 @@
export { default } from "./lib/remark-embed";

View File

@@ -0,0 +1,49 @@
import { visit } from "unist-util-visit";
function transformer(tree) {
visit(tree, "paragraph", (node) => {
visit(node, "text", (textNode) => {
if (
textNode.value.includes("https://www.youtube.com") &&
!textNode.value.includes("\n")
) {
const urlSplit = textNode.value.split(/[=&]+/);
const iframeUrl = `https://www.youtube.com/embed/${urlSplit[1]}`;
Object.assign(node, {
...node,
type: "element",
data: {
hProperties: {
style: "position:relative;padding-bottom:56.25%",
},
},
children: [
{
...textNode,
type: "element",
tagName: "iframe",
data: {
hName: "iframe",
hProperties: {
style:
"position:absolute;top:0;left:0;width:100%;height:100%",
src: iframeUrl,
allowfullscreen: true,
frameborder: "0",
allow:
"accelerometer autoplay clipboard-write encrypted-media gyroscope picture-in-picture",
},
},
},
],
});
}
});
});
}
function attacher() {
return transformer;
}
export default attacher;

View File

@@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}

View File

@@ -0,0 +1,15 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"target": "es2020",
"module": "es2020",
"types": ["node"],
"moduleResolution": "node",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true
},
"exclude": ["**/*.spec.ts", "**/*.test.ts"],
"include": ["src/**/*.ts"]
}

View File

@@ -0,0 +1,21 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"module": "es2020",
"moduleResolution": "node",
"types": ["jest", "node"]
},
"include": [
"jest.config.ts",
"**/*.test.ts",
"**/*.spec.ts",
"**/*.test.tsx",
"**/*.spec.tsx",
"**/*.test.js",
"**/*.spec.js",
"**/*.test.jsx",
"**/*.spec.jsx",
"**/*.d.ts"
]
}