Skip to content

Commit

Permalink
ci: Trim FE package.json files before publishing (no-changelog)
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed Aug 31, 2023
1 parent 9cfe5e3 commit 1b42474
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions docker/images/n8n-custom/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions docker/images/n8n/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 12 additions & 0 deletions scripts/trim-fe-packageJson.js
Original file line number Diff line number Diff line change
@@ -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')

0 comments on commit 1b42474

Please sign in to comment.