Skip to content

Commit

Permalink
ci: Remove gulp (no-changelog) (#9283)
Browse files Browse the repository at this point in the history
Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
  • Loading branch information
netroy and ivov authored May 6, 2024
1 parent 7b925ab commit cf441e0
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 1,678 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_title_conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 0 additions & 16 deletions packages/@n8n/nodes-langchain/gulpfile.js

This file was deleted.

3 changes: 1 addition & 2 deletions packages/@n8n/nodes-langchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": {
Expand Down
19 changes: 19 additions & 0 deletions packages/core/bin/copy-icons
Original file line number Diff line number Diff line change
@@ -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 });
}),
),
);
})();
68 changes: 28 additions & 40 deletions packages/nodes-base/gulpfile.js → packages/core/bin/generate-translations
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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;
}
Expand All @@ -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 });
2 changes: 2 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
1 change: 0 additions & 1 deletion packages/design-system/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ storybook-static
.storybook

.browserslistrc
gulpfile.js
jest.config.js
vite.config.ts

Expand Down
10 changes: 6 additions & 4 deletions packages/editor-ui/src/plugins/i18n/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
```
Expand Down Expand Up @@ -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
```

Expand All @@ -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`.
4 changes: 1 addition & 3 deletions packages/nodes-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": {
Expand Down
Loading

0 comments on commit cf441e0

Please sign in to comment.