Skip to content

Commit

Permalink
feat: boostrap viewer-render project
Browse files Browse the repository at this point in the history
Related to #1166
  • Loading branch information
Skaiir authored and vsgoulart committed Oct 23, 2024
1 parent 461ebcf commit 172423e
Show file tree
Hide file tree
Showing 12 changed files with 155 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules
test-results/
playwright-report/
playwright/.cache/
lerna-debug.log
12 changes: 12 additions & 0 deletions package-lock.json

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

8 changes: 8 additions & 0 deletions packages/form-js-viewer-render/RenderPlayground.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { foo } from './src/index.js';
import { Fragment } from 'preact';

const RenderPlayground = () => {
return <Fragment>{foo()}</Fragment>;
};

export { RenderPlayground };
18 changes: 18 additions & 0 deletions packages/form-js-viewer-render/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="@bpmn-io/form-js-viewer-core" />
<title>@bpmn-io/form-js-viewer-render</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<script type="module">
import { render } from "preact";
import { RenderPlayground } from "./RenderPlayground";
render(RenderPlayground(), document.body);
</script>
</body>
</html>
22 changes: 22 additions & 0 deletions packages/form-js-viewer-render/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"moduleResolution": "Bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"declaration": true,
"useUnknownInCatchVariables": true,
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src"],
"exclude": ["node_modules"]
}
35 changes: 35 additions & 0 deletions packages/form-js-viewer-render/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "@bpmn-io/form-js-viewer-render",
"version": "1.8.6",
"description": "Render form state - powered by bpmn.io",
"type": "module",
"publishConfig": {
"access": "public"
},
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/types/index.d.ts",
"scripts": {
"all": "run-s test build",
"build": "run-p bundle generate-types",
"bundle": "vite build",
"dev": "vite",
"generate-types": "tsc --allowJs --skipLibCheck --declaration --emitDeclarationOnly --outDir dist/types src/index.js && copyfiles --flat src/*.d.ts dist/types",
"test": "vitest",
"prepublishOnly": "npm run build"
},
"license": "SEE LICENSE IN LICENSE",
"repository": {
"type": "git",
"url": "git+https://github.com/bpmn-io/form-js.git",
"directory": "packages/form-js-viewer-render"
},
"author": {
"name": "bpmn.io contributors",
"url": "https://github.com/bpmn-io"
},
"sideEffects": false,
"files": [
"dist"
]
}
5 changes: 5 additions & 0 deletions packages/form-js-viewer-render/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function foo() {
return 'foo';
}

export { foo };
6 changes: 6 additions & 0 deletions packages/form-js-viewer-render/src/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../jsconfig.json",
"compilerOptions": {
"lib": ["ES2020", "DOM", "DOM.Iterable"]
}
}
9 changes: 9 additions & 0 deletions packages/form-js-viewer-render/test/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": [
"plugin:vitest-globals/recommended",
"plugin:prettier/recommended"
],
"env": {
"vitest-globals/env": true
}
}
5 changes: 5 additions & 0 deletions packages/form-js-viewer-render/test/index.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { foo } from '@/index.js';

it('should pass a test', () => {
expect(foo()).toBe('foo');
});
11 changes: 11 additions & 0 deletions packages/form-js-viewer-render/test/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../jsconfig.json",
"compilerOptions": {
"lib": ["ES2020"],
"types": ["@types/node", "vitest/globals"],
"esModuleInterop": true,
"declaration": false,
"resolveJsonModule": true
},
"include": ["**/*.spec.js"]
}
23 changes: 23 additions & 0 deletions packages/form-js-viewer-render/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { resolve } from 'path';
import { defineConfig } from 'vite';
import preact from '@preact/preset-vite';

export default defineConfig({
plugins: [preact()],
build: {
lib: {
entry: resolve(__dirname, 'src/index.js'),
fileName: 'index',
formats: ['es', 'cjs'],
},
},
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
},
},
test: {
globals: true,
files: ['test/**/*.spec.js'],
},
});

0 comments on commit 172423e

Please sign in to comment.