ci: Trim FE package.json files before publishing (no-changelog)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2023-08-31 14:05:12 +02:00
parent 9cfe5e3c66
commit 1b4247498b
4 changed files with 17 additions and 3 deletions

View file

@ -39,7 +39,8 @@ jobs:
- name: Publish to NPM
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
pnpm publish -r --publish-branch ${{github.event.pull_request.base.ref}} --access public --tag rc
node scripts/trim-fe-packageJson.js
pnpm publish -r --publish-branch ${{github.event.pull_request.base.ref}} --access public --tag rc --no-git-checks
npm dist-tag rm n8n rc
- name: Create a Release on GitHub

View file

@ -16,8 +16,7 @@ RUN pnpm install --frozen-lockfile
RUN pnpm build
RUN rm -rf node_modules
RUN jq 'del(.pnpm.patchedDependencies)' package.json > package.json.tmp; mv package.json.tmp package.json
RUN jq '{name: .name, version: .version}' packages/editor-ui/package.json > editor-ui.tmp; mv editor-ui.tmp packages/editor-ui/package.json
RUN jq '{name: .name, version: .version}' packages/design-system/package.json > design-system.tmp; mv design-system.tmp packages/design-system/package.json
RUN node scripts/trim-fe-packageJson.js
RUN NODE_ENV=production pnpm install --prod --no-optional
RUN find . -type f -name "*.ts" -o -name "*.js.map" -o -name "*.vue" -o -name "tsconfig.json" -o -name "*.tsbuildinfo" | xargs rm -rf
RUN rm -rf packages/@n8n_io/eslint-config packages/editor-ui/src packages/editor-ui/node_modules packages/design-system

View file

@ -15,6 +15,8 @@ RUN set -eux; \
case "$apkArch" in \
'armv7') apk del build-dependencies;; \
esac && \
rm -rf /usr/local/lib/node_modules/n8n/node_modules/n8n-design-system && \
rm -rf /usr/local/lib/node_modules/n8n/node_modules/n8n-editor-ui/node_modules && \
find /usr/local/lib/node_modules/n8n -type f -name "*.ts" -o -name "*.js.map" -o -name "*.vue" | xargs rm && \
rm -rf /root/.npm

View file

@ -0,0 +1,12 @@
const { writeFileSync } = require('fs')
const { resolve } = require('path');
const baseDir = resolve(__dirname, '..');
const trimPackageJson = (packageName) => {
const filePath = resolve(baseDir, 'packages', packageName, 'package.json');
const { scripts, peerDependencies, devDependencies, dependencies, ...packageJson } = require(filePath);
writeFileSync(filePath, JSON.stringify(packageJson, null, 2) + '\n', 'utf-8');
}
trimPackageJson('design-system')
trimPackageJson('editor-ui')