Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: lumapps/design-system
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.1.2
Choose a base ref
...
head repository: lumapps/design-system
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing 768 changed files with 49,165 additions and 42,445 deletions.
2 changes: 2 additions & 0 deletions .docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -20,6 +20,8 @@ http {
sendfile on;
keepalive_timeout 65;

server_tokens off; # do not leak nginx version in http headers

server {
listen 8080 default_server;

3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.git
packages/site-demo/.cache
packages/site-demo/public
*/*/node_modules
dist
node_modules
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@ yo-generators/**
storybook
**/style-dictionary
**/*.config.js
**/*.config.mjs
packages/site-demo/plugins
packages/lumx-angularjs
packages/lumx-react/jest
packages/lumx-react/src/stories/generated
packages/yo-generators
dev-packages/**
133 changes: 1 addition & 132 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,134 +1,3 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"project": "./tsconfig.json",
"ecmaFeatures": {
"jsx": true
}
},
"extends": [
"airbnb",
"airbnb/hooks",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"prettier",
"prettier/react",
"prettier/@typescript-eslint"
],
"globals": {
"angular": "readonly"
},
"plugins": [
"@typescript-eslint",
"prettier",
"eslint-plugin-prettier",
"react",
"jsx-a11y",
"import",
"lumapps"
],
"rules": {
"prettier/prettier": "error",
"react/no-array-index-key": "off",
"react/jsx-filename-extension": [
2,
{
"extensions": [
".js",
".jsx",
".ts",
".tsx"
]
}
],
"react/require-default-props": "off",
"no-continue": "off",
"no-use-before-define": "off",
"no-plusplus": [
"error",
{
"allowForLoopAfterthoughts": true
}
],
"no-restricted-syntax": [
"error",
"ForInStatement",
"LabeledStatement",
"WithStatement"
],
"no-underscore-dangle": "off",
"import/extensions": [
"error",
"never",
{
"svg": "always",
"scss": "always",
"json": "always"
}
],
"import/no-unresolved": "off",
"import/prefer-default-export": "off",
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": [
"**/*.test.jsx",
"**/*.test.tsx",
"**/*.test.js",
"**/*.test.ts",
"**/*.stories.jsx",
"**/*.stories.tsx",
"**/stories/**",
"**/testing/**"
]
}
],
"react/destructuring-assignment": "off",
"react/prop-types": "off",
"react/jsx-props-no-spreading": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-use-before-define": ["error"],
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
"spaced-comment": "off",
"lumapps/do-not-import-all-lodash": 2
},
"env": {
"jest": true,
"browser": true,
"es6": true
},
"overrides": [
{
"files": ["*/stories/*" ,"*.stories.tsx", "**/site-demo/content/**"],
"rules": {
"@typescript-eslint/explicit-module-boundary-types": "off",
"no-alert": "off",
"no-console": "off"
}
}
],
"settings": {
"import/resolver": {
"node": {
"extensions": [
".js",
".ts",
".jsx",
".tsx",
".json"
]
}
},
"import/extensions": [
".js",
".ts",
".mjs",
".jsx",
".tsx"
]
}
"extends": "lumapps"
}
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# automatically generated by terraform - please do not edit here
* @lumapps/frontend-core @lumautomation @matmkian
* @lumapps/frontend-design-system @lumautomation
57 changes: 57 additions & 0 deletions .github/actions/increment-package-versions/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: 'Increment package versions'
description: 'Increment all package.json versions and update CHANGELOG'

inputs:
releaseType:
description: 'Release type'
required: true
default: 'prerelease'
type: choice
options:
- prerelease
- patch
- minor
- major
prereleaseName:
description: 'Prerelease name (ignore if release type is not `prerelease`)'
default: 'alpha'
type: string
outputs:
distTag:
description: "NPM dist tag (latest, alpha, etc.)"
value: ${{ fromJSON(steps.version.outputs.result).distTag }}
prevDistTagVersion:
description: "Previous version in the dist tag (if any)"
value: ${{ fromJSON(steps.version.outputs.result).prevDistTagVersion }}
nextVersion:
description: "Next version"
value: ${{ fromJSON(steps.version.outputs.result).nextVersion }}
releaseBranch:
description: "Name of the release branch"
value: ${{ fromJSON(steps.version.outputs.result).releaseBranch }}

# Example release:
# - name: Upgrade package versions
# uses: ./.github/actions/increment-package-versions
# with:
# releaseType: 'patch'


# Example prerelease:
# - name: Upgrade package versions
# uses: ./.github/actions/increment-package-versions
# with:
# releaseType: 'prerelease'
# prereleaseName: 'beta'

runs:
using: composite
steps:
- name: Upgrade package versions
id: version
uses: actions/github-script@v6
with:
script: |
return require("${{ github.action_path }}")({
github, context, inputs: ${{ toJSON(inputs) }}
})
84 changes: 84 additions & 0 deletions .github/actions/increment-package-versions/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
const lodash = require('lodash');
const semver = require('semver');
const util = require('util');
const child_process = require('child_process');
const run = (cmd) => util.promisify(child_process.exec)(cmd, { cdw: process.env.GITHUB_WORKSPACE });

/**
* Increment package versions for release or prerelease.
*
* See `action.yml` for details on the params in `inputs`.
*/
async function main({ inputs, context }) {
const [_, baseBranch] = context.ref.match(/refs\/heads\/(.*)/) || [];

if (!baseBranch && !context.ref.startsWith('refs/pull')) {
console.log(`Release workflow can only be run from a branch or PR.\n`);
process.exit(1);
}

const releaseType = inputs.releaseType || 'prerelease';
console.log(`Release type: ${releaseType}`);
const prereleaseName = lodash.kebabCase(inputs.prereleaseName || 'alpha');

const getVersion = (tag) => run(`npm view @lumx/core@${tag} version`).then(({ stdout }) => stdout.trim());
const npmLatestVersion = await getVersion('latest');

if (releaseType !== 'prerelease') {
// Exit if not on master
if (baseBranch !== 'master') {
console.log(`New ${releaseType} release can only be created from master branch.\n`);
process.exit(1);
}

const localVersion = require(`${process.env.GITHUB_WORKSPACE}/lerna.json`).version;
if (localVersion !== npmLatestVersion) {
console.log(`NPM latest version (${npmLatestVersion}) does not match the local latest version (${localVersion}).\n`);
process.exit(1);
}

// Check that the changelog has unreleased changes.
try {
await run('yarn changelog-verify --unreleased');
} catch (err) {
console.log(err);
process.exit(1);
}
} else {
console.log(`Prerelease name: ${prereleaseName}`);
}

// Get NPM dist tag
const distTag = releaseType === 'prerelease' ? prereleaseName : 'latest';
console.log(`NPM dist tag: ${distTag}`);

// Get base version (version from which to increment)
const prevDistTagVersion = await getVersion(distTag);
let baseVersion = prevDistTagVersion;
// Prerelease should start with latest NPM version + patch (ex: 'v1.0.0' => 'v1.0.1-alpha.0')
if (releaseType === 'prerelease' && (!baseVersion || !baseVersion.startsWith(semver.inc(npmLatestVersion, 'patch')))) {
baseVersion = npmLatestVersion;
}
console.log(`${releaseType} base version: ${baseVersion}`);

// Increment version
const nextVersion = semver.inc(baseVersion, releaseType, prereleaseName);
console.log(`New ${releaseType} version: ${nextVersion}`);

// Checkout new branch (lerna version requires this)
const releaseBranch = `release/${nextVersion}`;
await run(`git checkout -b ${releaseBranch}`);

// Update version in all packages
await run(`yarn lerna version --no-git-tag-version --yes ${nextVersion}`);

// Update yarn.lock with new package versions
await run(`YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install`);

// Update version in changelog (need to run in a package which has a version, so not the root package)
await run(`yarn workspace @lumx/core update-version-changelog`);

return { nextVersion, distTag, releaseBranch, releaseType, prevDistTagVersion };
}

module.exports = main;
7 changes: 1 addition & 6 deletions .github/actions/release-note/action.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
name: 'Release note'
description: 'Create GitHub release with autogenerated notes (coming from the CHANGELOG)'

inputs:
versionTag:
description: The version tag for the release
required: true

runs:
using: composite
steps:
- uses: actions/github-script@v6
with:
script: |
const main = require('.github/actions/release-note/index.js');
await main({ versionTag: '${{ inputs.versionTag}}', context, github });
await main({ context, github });
28 changes: 11 additions & 17 deletions .github/actions/release-note/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
/* eslint-disable */

const fs = require('fs');
const util = require('util');
const exec = util.promisify(require('child_process').exec);

const { getStoryBookURL } = require('../utils');
const { CHANGELOG_PATH } = require('../../../configs/path');
const VERSION_HEADER_REGEXP = /^## \[(.*?)\]\[\]/mg;
const CHROMATIC_PROJECT_ID = '5fbfb1d508c0520021560f10';

// Get short SHA from version tag (vX.Y.Z)
const getVersionSHA = (versionTag) => exec(`git rev-parse --short ${versionTag}`)
.then(({ stdout }) => stdout.trim());

// Extract changelog from latest version in CHANGELOG.md
async function getLatestVersionChangelog() {
@@ -28,17 +22,18 @@ async function getLatestVersionChangelog() {
/**
* Generate release note and create a release on GH.
*/
async function main({ versionTag, github, context }) {
const [{ version, versionChangelog }, versionSHA] = await Promise.all([
getLatestVersionChangelog(),
getVersionSHA(versionTag),
]);
async function main({ github, context }) {
const storybookURLPromise = getStoryBookURL(context.sha);
const { version, versionChangelog } = await getLatestVersionChangelog();
const versionTag = `v${version}`;

// Related links
const changelogURL = `https://github.com/lumapps/design-system/blob/${versionTag}/CHANGELOG.md`;
const storybookURL = `https://${versionSHA}--${CHROMATIC_PROJECT_ID}.chromatic.com/`;
const storyBookURL = await storybookURLPromise;
const links = `[🎨 StoryBook](${storyBookURL}) - [📄 See changelog history](${changelogURL})`;

// Release notes
const body = `### [🎨 StoryBook](${storybookURL})\n\n### [📄 Changelog](${changelogURL})\n\n${versionChangelog}`;
const body = `${versionChangelog}\n\n${links}`;

await github.rest.repos.createRelease({
draft: false,
@@ -47,7 +42,7 @@ async function main({ versionTag, github, context }) {
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: versionTag,
name: `v${version}`,
name: versionTag,
body,
});
}
@@ -56,8 +51,7 @@ module.exports = main;

// Example use (run with `node .github/actions/release-note/index.js`)
if (require.main === module) main({
versionTag: 'v3.0.5',
context: { repo: { repo: 'design-system', owner: 'lumapps' } },
context: { repo: { repo: 'design-system', owner: 'lumapps' }, sha: 'cdde1f3d1' },
// Mocked GH API
github: { rest: { repos: { createRelease: console.log } } },
});
Loading