Skip to content

Commit

Permalink
ci: Remove gulp (no-changelog)
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed May 6, 2024
1 parent 22b6f90 commit 65bcd85
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 1,672 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 });
}),
),
);
})();
63 changes: 25 additions & 38 deletions packages/nodes-base/gulpfile.js → packages/core/bin/generate-translations
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,48 +1,14 @@
#!/usr/bin/env node

const {
existsSync,
promises: { writeFile },
} = require('fs');
const path = require('path');
const { task, src, dest } = require('gulp');

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 { N8N_DEFAULT_LOCALE: locale } = process.env;
Expand Down Expand Up @@ -98,8 +64,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 +75,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(__dirname, '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
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

0 comments on commit 65bcd85

Please sign in to comment.