mirror of
https://github.com/n8n-io/n8n.git
synced 2024-08-17 00:50:42 +03:00
feat: Simplify n8n/chat build process (no-changelog) (#9952)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
parent
0f5dea37f4
commit
aca38a8f9c
@ -31,9 +31,9 @@ Open the **Webhook** node and replace `YOUR_PRODUCTION_WEBHOOK_URL` with your pr
|
|||||||
Add the following code to your HTML page.
|
Add the following code to your HTML page.
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<link href="https://cdn.jsdelivr.net/npm/@n8n/chat/style.css" rel="stylesheet" />
|
<link href="https://cdn.jsdelivr.net/npm/@n8n/chat/dist/style.css" rel="stylesheet" />
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import { createChat } from 'https://cdn.jsdelivr.net/npm/@n8n/chat/chat.bundle.es.js';
|
import { createChat } from 'https://cdn.jsdelivr.net/npm/@n8n/chat/dist/chat.bundle.es.js';
|
||||||
|
|
||||||
createChat({
|
createChat({
|
||||||
webhookUrl: 'YOUR_PRODUCTION_WEBHOOK_URL'
|
webhookUrl: 'YOUR_PRODUCTION_WEBHOOK_URL'
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
import { defineBuildConfig } from 'unbuild';
|
|
||||||
|
|
||||||
export default defineBuildConfig({
|
|
||||||
entries: [
|
|
||||||
{
|
|
||||||
builder: 'mkdist',
|
|
||||||
format: 'esm',
|
|
||||||
input: './src',
|
|
||||||
outDir: './tmp/lib',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
builder: 'mkdist',
|
|
||||||
format: 'cjs',
|
|
||||||
input: './src',
|
|
||||||
outDir: './tmp/cjs',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
clean: true,
|
|
||||||
declaration: true,
|
|
||||||
failOnWarn: false,
|
|
||||||
});
|
|
@ -3,13 +3,9 @@
|
|||||||
"version": "0.19.0",
|
"version": "0.19.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "pnpm run storybook",
|
"dev": "pnpm run storybook",
|
||||||
"build": "pnpm build:vite && pnpm run build:individual && npm run build:prepare",
|
"build": "pnpm build:vite && pnpm build:bundle",
|
||||||
"build:full": "pnpm build:vite && pnpm build:vite:full && pnpm run build:individual && npm run build:prepare",
|
|
||||||
"build:vite": "vite build",
|
"build:vite": "vite build",
|
||||||
"build:vite:full": "INCLUDE_VUE=true vite build",
|
"build:bundle": "INCLUDE_VUE=true vite build",
|
||||||
"build:individual": "unbuild",
|
|
||||||
"build:prepare": "node scripts/postbuild.js",
|
|
||||||
"build:pack": "node scripts/pack.js",
|
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"test:dev": "vitest",
|
"test:dev": "vitest",
|
||||||
"test": "vitest run --coverage",
|
"test": "vitest run --coverage",
|
||||||
@ -21,17 +17,18 @@
|
|||||||
"build:storybook": "storybook build",
|
"build:storybook": "storybook build",
|
||||||
"release": "pnpm run build:full && cd dist && pnpm publish"
|
"release": "pnpm run build:full && cd dist && pnpm publish"
|
||||||
},
|
},
|
||||||
"main": "./chat.umd.js",
|
"main": "./dist/chat.umd.js",
|
||||||
"module": "./chat.es.js",
|
"module": "./dist/chat.es.js",
|
||||||
"types": "./types/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./index.mjs",
|
"import": "./dist/chat.es.js",
|
||||||
"require": "./index.js"
|
"require": "./dist/chat.umd.js",
|
||||||
|
"types": "./dist/index.d.ts"
|
||||||
},
|
},
|
||||||
"./style.css": {
|
"./style.css": {
|
||||||
"import": "./style.css",
|
"import": "./dist/style.css",
|
||||||
"require": "./style.css"
|
"require": "./dist/style.css"
|
||||||
},
|
},
|
||||||
"./*": {
|
"./*": {
|
||||||
"import": "./*",
|
"import": "./*",
|
||||||
@ -49,11 +46,14 @@
|
|||||||
"@iconify-json/mdi": "^1.1.54",
|
"@iconify-json/mdi": "^1.1.54",
|
||||||
"@n8n/storybook": "workspace:*",
|
"@n8n/storybook": "workspace:*",
|
||||||
"@types/markdown-it": "^12.2.3",
|
"@types/markdown-it": "^12.2.3",
|
||||||
"shelljs": "^0.8.5",
|
|
||||||
"unbuild": "^2.0.0",
|
|
||||||
"unplugin-icons": "^0.17.0",
|
"unplugin-icons": "^0.17.0",
|
||||||
"vite-plugin-dts": "^3.7.3"
|
"vite-plugin-dts": "^3.9.1"
|
||||||
},
|
},
|
||||||
|
"files": [
|
||||||
|
"README.md",
|
||||||
|
"LICENSE.md",
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/n8n-io/n8n.git"
|
"url": "git+https://github.com/n8n-io/n8n.git"
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
const path = require('path');
|
|
||||||
const shelljs = require('shelljs');
|
|
||||||
|
|
||||||
const rootDirPath = path.resolve(__dirname, '..');
|
|
||||||
const distDirPath = path.resolve(rootDirPath, 'dist');
|
|
||||||
|
|
||||||
shelljs.cd(rootDirPath);
|
|
||||||
shelljs.exec('npm run build');
|
|
||||||
|
|
||||||
shelljs.cd(distDirPath);
|
|
||||||
shelljs.exec('npm pack');
|
|
@ -1,36 +0,0 @@
|
|||||||
const path = require('path');
|
|
||||||
const shelljs = require('shelljs');
|
|
||||||
const glob = require('fast-glob');
|
|
||||||
|
|
||||||
const rootDirPath = path.resolve(__dirname, '..');
|
|
||||||
const n8nRootDirPath = path.resolve(rootDirPath, '..', '..', '..');
|
|
||||||
const distDirPath = path.resolve(rootDirPath, 'dist');
|
|
||||||
const srcDirPath = path.resolve(rootDirPath, 'src');
|
|
||||||
const libDirPath = path.resolve(rootDirPath, 'tmp', 'lib');
|
|
||||||
const cjsDirPath = path.resolve(rootDirPath, 'tmp', 'cjs');
|
|
||||||
|
|
||||||
const packageJsonFilePath = path.resolve(rootDirPath, 'package.json');
|
|
||||||
const readmeFilePath = path.resolve(rootDirPath, 'README.md');
|
|
||||||
const licenseFilePath = path.resolve(n8nRootDirPath, 'LICENSE.md');
|
|
||||||
|
|
||||||
shelljs.cp(packageJsonFilePath, distDirPath);
|
|
||||||
shelljs.cp(readmeFilePath, distDirPath);
|
|
||||||
shelljs.cp(licenseFilePath, distDirPath);
|
|
||||||
|
|
||||||
shelljs.mv(path.resolve(distDirPath, 'src'), path.resolve(distDirPath, 'types'));
|
|
||||||
|
|
||||||
function moveFiles(files, from, to) {
|
|
||||||
files.forEach((file) => {
|
|
||||||
const toFile = file.replace(from, to);
|
|
||||||
shelljs.mkdir('-p', path.dirname(toFile));
|
|
||||||
shelljs.mv(file, toFile);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const cjsFiles = glob.sync(path.resolve(cjsDirPath, '**', '*'));
|
|
||||||
moveFiles(cjsFiles, 'tmp/cjs', 'dist');
|
|
||||||
shelljs.rm('-rf', cjsDirPath);
|
|
||||||
|
|
||||||
const libFiles = glob.sync(path.resolve(libDirPath, '**/*'));
|
|
||||||
moveFiles(libFiles, 'tmp/lib', 'dist');
|
|
||||||
shelljs.rm('-rf', libDirPath);
|
|
5
packages/@n8n/chat/src/style.scss
Normal file
5
packages/@n8n/chat/src/style.scss
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
.n8n-chat {
|
||||||
|
@import 'highlight.js/styles/github';
|
||||||
|
}
|
||||||
|
|
||||||
|
@import 'css';
|
@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../../tsconfig.json",
|
"extends": "../../../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDir": ".",
|
"rootDir": "src",
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
|
"baseUrl": "src",
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
@ -10,15 +11,13 @@
|
|||||||
"incremental": false,
|
"incremental": false,
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"baseUrl": ".",
|
"types": ["vitest/globals"],
|
||||||
"types": ["vitest/globals", "unplugin-icons/types/vue"],
|
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["src/*"],
|
"@n8n/chat/*": ["./*"]
|
||||||
"@n8n/chat/*": ["src/*"]
|
|
||||||
},
|
},
|
||||||
"lib": ["esnext", "dom", "dom.iterable", "scripthost"],
|
"lib": ["esnext", "dom", "dom.iterable", "scripthost"],
|
||||||
// TODO: remove all options below this line
|
// TODO: remove all options below this line
|
||||||
"useUnknownInCatchVariables": false
|
"useUnknownInCatchVariables": false
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts", "src/**/*.vue", "**/*.d.ts"]
|
"include": ["**/*.ts", "**/*.vue"]
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ export function createPage({
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>Chat</title>
|
<title>Chat</title>
|
||||||
<link href="https://cdn.jsdelivr.net/npm/normalize.css@8.0.1/normalize.min.css" rel="stylesheet" />
|
<link href="https://cdn.jsdelivr.net/npm/normalize.css@8.0.1/normalize.min.css" rel="stylesheet" />
|
||||||
<link href="https://cdn.jsdelivr.net/npm/@n8n/chat/style.css" rel="stylesheet" />
|
<link href="https://cdn.jsdelivr.net/npm/@n8n/chat/dist/style.css" rel="stylesheet" />
|
||||||
<style>
|
<style>
|
||||||
html,
|
html,
|
||||||
body,
|
body,
|
||||||
@ -60,7 +60,7 @@ export function createPage({
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import { createChat } from 'https://cdn.jsdelivr.net/npm/@n8n/chat@latest/chat.bundle.es.js';
|
import { createChat } from 'https://cdn.jsdelivr.net/npm/@n8n/chat/dist/chat.bundle.es.js';
|
||||||
|
|
||||||
(async function () {
|
(async function () {
|
||||||
const authentication = '${sanitizedAuthentication}';
|
const authentication = '${sanitizedAuthentication}';
|
||||||
|
@ -93,9 +93,9 @@ ${importCode} { createChat } from '@n8n/chat';`,
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
const cdnCode = computed(
|
const cdnCode = computed(
|
||||||
() => `<link href="https://cdn.jsdelivr.net/npm/@n8n/chat/style.css" rel="stylesheet" />
|
() => `<link href="https://cdn.jsdelivr.net/npm/@n8n/chat/dist/style.css" rel="stylesheet" />
|
||||||
<script type="module">
|
<script type="module">
|
||||||
${importCode} { createChat } from 'https://cdn.jsdelivr.net/npm/@n8n/chat/chat.bundle.es.js';
|
${importCode} { createChat } from 'https://cdn.jsdelivr.net/npm/@n8n/chat/dist/chat.bundle.es.js';
|
||||||
|
|
||||||
${commonCode.value.createChat}
|
${commonCode.value.createChat}
|
||||||
</${'script'}>`,
|
</${'script'}>`,
|
||||||
|
1012
pnpm-lock.yaml
1012
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user