1
1
mirror of https://github.com/n8n-io/n8n.git synced 2024-10-26 13:29:14 +03:00

ci: Remove gulp (no-changelog) (#9283)

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2024-05-06 18:42:03 +02:00 committed by GitHub
parent 7b925ab871
commit cf441e0294
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 142 additions and 1677 deletions

View File

@ -37,7 +37,7 @@ Must be one of the following:
- `test` - Adding missing tests or correcting existing tests
- `docs` - Documentation only changes
- `refactor` - A code change that neither fixes a bug nor adds a feature
- `build` - Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
- `build` - Changes that affect the build system or external dependencies (example scopes: broccoli, npm)
- `ci` - Changes to our CI configuration files and scripts (e.g. Github actions)
If the prefix is `feat`, `fix` or `perf`, it will appear in the changelog. However if there is any BREAKING CHANGE (see Footer section below), the commit will always appear in the changelog.

View File

@ -1,16 +0,0 @@
const path = require('path');
const { task, src, dest } = require('gulp');
task('build:icons', copyIcons);
function copyIcons() {
const nodeSource = path.resolve('nodes', '**', '*.{png,svg}');
const nodeDestination = path.resolve('dist', 'nodes');
src(nodeSource).pipe(dest(nodeDestination));
const credSource = path.resolve('credentials', '**', '*.{png,svg}');
const credDestination = path.resolve('dist', 'credentials');
return src(credSource).pipe(dest(credDestination));
}

View File

@ -13,7 +13,7 @@
"clean": "rimraf dist .turbo",
"dev": "pnpm run watch",
"typecheck": "tsc",
"build": "tsc -p tsconfig.build.json && gulp build:icons && pnpm build:metadata",
"build": "tsc -p tsconfig.build.json && pnpm n8n-copy-icons && pnpm build:metadata",
"build:metadata": "pnpm n8n-generate-known && pnpm n8n-generate-ui-types",
"format": "prettier nodes credentials --write",
"lint": "eslint nodes credentials",
@ -127,7 +127,6 @@
"@types/json-schema": "^7.0.15",
"@types/temp": "^0.9.1",
"eslint-plugin-n8n-nodes-base": "^1.16.0",
"gulp": "^4.0.2",
"n8n-core": "workspace:*"
},
"dependencies": {

19
packages/core/bin/copy-icons Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env node
const glob = require('fast-glob');
const pLimit = require('p-limit');
const { cp } = require('fs/promises');
const { packageDir } = require('./common');
const limiter = pLimit(20);
const icons = glob.sync('{nodes,credentials}/**/*.{png,svg}', { cwd: packageDir });
(async () => {
await Promise.all(
icons.map((icon) =>
limiter(() => {
return cp(icon, `dist/${icon}`, { recursive: true });
}),
),
);
})();

View File

@ -1,55 +1,22 @@
#!/usr/bin/env node
const {
existsSync,
promises: { writeFile },
} = require('fs');
const path = require('path');
const { task, src, dest } = require('gulp');
const { packageDir } = require('./common');
const ALLOWED_HEADER_KEYS = ['displayName', 'description'];
const PURPLE_ANSI_COLOR_CODE = 35;
task('build:icons', copyIcons);
function copyIcons() {
src('nodes/**/*.{png,svg}').pipe(dest('dist/nodes'));
return src('credentials/**/*.{png,svg}').pipe(dest('dist/credentials'));
}
task('build:translations', writeHeaders);
/**
* Write node translation headers to single file at `/dist/nodes/headers.js`.
*/
function writeHeaders(done) {
const { N8N_DEFAULT_LOCALE: locale } = process.env;
log(`Default locale set to: ${colorize(PURPLE_ANSI_COLOR_CODE, locale || 'en')}`);
if (!locale || locale === 'en') {
log('No translation required - Skipping translations build...');
return done();
}
const nodeTranslationPaths = getNodeTranslationPaths();
const headers = getHeaders(nodeTranslationPaths);
const headersDistPath = path.join(__dirname, 'dist', 'nodes', 'headers.js');
writeDistFile(headers, headersDistPath);
log('Headers file written to:');
log(headersDistPath, { bulletpoint: true });
done();
}
function getNodeTranslationPaths() {
const nodeDistPaths = require('./package.json').n8n.nodes;
const nodeDistPaths = require(`${packageDir}/package.json`).n8n.nodes;
const { N8N_DEFAULT_LOCALE: locale } = process.env;
return nodeDistPaths.reduce((acc, cur) => {
const nodeTranslationPath = path.join(
__dirname,
packageDir,
cur.split('/').slice(1, -1).join('/'),
'translations',
locale,
@ -98,8 +65,8 @@ function writeDistFile(data, distPath) {
writeFile(distPath, `module.exports = ${JSON.stringify(data, null, 2)}`);
}
const log = (string, { bulletpoint } = { bulletpoint: false }) => {
if (bulletpoint) {
const log = (string, { bulletPoint } = { bulletPoint: false }) => {
if (bulletPoint) {
process.stdout.write(colorize(PURPLE_ANSI_COLOR_CODE, `- ${string}\n`));
return;
}
@ -109,3 +76,24 @@ const log = (string, { bulletpoint } = { bulletpoint: false }) => {
const colorize = (ansiColorCode, string) =>
['\033[', ansiColorCode, 'm', string, '\033[0m'].join('');
/**
* Write node translation headers to single file at `/dist/nodes/headers.js`.
*/
const { N8N_DEFAULT_LOCALE: locale } = process.env;
log(`Default locale set to: ${colorize(PURPLE_ANSI_COLOR_CODE, locale || 'en')}`);
if (!locale || locale === 'en') {
log('No translation required - Skipping translations build...');
return;
}
const nodeTranslationPaths = getNodeTranslationPaths();
const headers = getHeaders(nodeTranslationPaths);
const headersDistPath = path.join(packageDir, 'dist', 'nodes', 'headers.js');
writeDistFile(headers, headersDistPath);
log('Headers file written to:');
log(headersDistPath, { bulletPoint: true });

View File

@ -15,7 +15,9 @@
"main": "dist/index",
"types": "dist/index.d.ts",
"bin": {
"n8n-copy-icons": "./bin/copy-icons",
"n8n-generate-known": "./bin/generate-known",
"n8n-generate-translations": "./bin/generate-translations",
"n8n-generate-ui-types": "./bin/generate-ui-types"
},
"scripts": {

View File

@ -6,7 +6,6 @@ storybook-static
.storybook
.browserslistrc
gulpfile.js
jest.config.js
vite.config.ts

View File

@ -219,8 +219,10 @@ export class Github implements INodeType {
```json
{
"header.displayName": "🇩🇪 GitHub",
"header.description": "🇩🇪 Consume GitHub API"
"header": {
"displayName": "🇩🇪 GitHub",
"description": "🇩🇪 Consume GitHub API"
}
}
```
@ -495,7 +497,7 @@ pnpm start
```sh
export N8N_DEFAULT_LOCALE=de
cd packages/nodes-base
pnpm build:translations
pnpm n8n-generate-translations
pnpm watch
```
@ -504,6 +506,6 @@ After changing the dynamic text file:
1. Stop and restart the first terminal.
2. Refresh the browser at `http://localhost:5678`
If a `headerText` section was changed, re-run `pnpm build:translations` in `/nodes-base`.
If a `headerText` section was changed, re-run `pnpm n8n-generate-translations` in `/nodes-base`.
> **Note**: To translate base and dynamic text simultaneously, run three terminals following the steps from both sections (first terminal running only once) and browse `http://localhost:8080`.

View File

@ -17,8 +17,7 @@
"clean": "rimraf dist .turbo",
"dev": "pnpm watch",
"typecheck": "tsc",
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && gulp build:icons && gulp build:translations && pnpm build:metadata",
"build:translations": "gulp build:translations",
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && pnpm n8n-copy-icons && pnpm n8n-generate-translations && pnpm build:metadata",
"build:metadata": "pnpm n8n-generate-known && pnpm n8n-generate-ui-types",
"format": "prettier --write . --ignore-path ../../.prettierignore",
"lint": "eslint . --quiet && node ./scripts/validate-load-options-methods.js",
@ -834,7 +833,6 @@
"@types/uuid": "^8.3.2",
"@types/xml2js": "^0.4.14",
"eslint-plugin-n8n-nodes-base": "^1.16.0",
"gulp": "^4.0.0",
"n8n-core": "workspace:*"
},
"dependencies": {

File diff suppressed because it is too large Load Diff