-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
589 changed files
with
61,944 additions
and
19,275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,59 @@ | ||
name: 'Update package-lock files' | ||
name: 'Update package-lock.json files' | ||
|
||
description: 'Update package-lock files after publish RC or latest version' | ||
description: 'Update package-lock.json files after publish RC or latest version' | ||
|
||
inputs: | ||
commit-message: | ||
description: 'Commit message when updated package-lock' | ||
required: false | ||
default: 'chore: update package-locks [skip ci]' | ||
default: 'chore: update package-locks.json files [skip ci]' | ||
token: | ||
description: 'A Github Token' | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Update package-lock's | ||
- name: Set options | ||
shell: bash | ||
env: | ||
options: "--no-audit --no-progress --package-lock-only --lockfile-version 2 --legacy-peer-deps" | ||
run: | | ||
# Sync package-lock file state (root level) | ||
npm i ${{ env.options }} | ||
# Remove the node_modules directory from all packages | ||
lerna clean -y | ||
# Sync package-lock files state | ||
lerna exec --no-private -- npm i ${{ env.options }} --ignore-scripts | ||
# root deps don't update correctly on first regeneration O_o | ||
npm i ${{ env.options }} | ||
echo "OPTIONS=--no-audit --no-progress --package-lock-only --lockfile-version 2 --legacy-peer-deps" >> "$GITHUB_ENV" | ||
- name: Sync package-lock's root level | ||
shell: bash | ||
run: npm i --silent ${{ env.OPTIONS }} | ||
|
||
- name: Remove the node_modules directory from all packages | ||
shell: bash | ||
run: npx lerna clean -y | ||
|
||
- name: Sync package-lock files | ||
uses: nick-fields/[email protected] | ||
with: | ||
shell: bash | ||
timeout_minutes: 5 | ||
max_attempts: 3 | ||
on_retry_command: | | ||
git reset --hard | ||
npm i --silent ${{ env.OPTIONS }} | ||
command: | | ||
npx lerna exec --no-private -- npm i --silent ${{ env.OPTIONS }} --ignore-scripts | ||
- name: Root deps don't update correctly on first regeneration | ||
shell: bash | ||
run: | | ||
npm i ${{ env.OPTIONS }} | ||
- name: Extract branch name | ||
id: branch_name | ||
id: branch | ||
shell: bash | ||
run: echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT | ||
|
||
- name: Commit & Push package-lock's | ||
uses: actions-js/push@master | ||
with: | ||
github_token: ${{ inputs.token }} | ||
message: ${{ inputs.commit-message }} | ||
branch: ${{ steps.branch_name.outputs.BRANCH }} | ||
branch: ${{ steps.branch.outputs.BRANCH }} | ||
author_name: Salute Frontend Team | ||
author_email: [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"PACKAGES_CYPRESS": ["plasma-web", "plasma-b2c", "plasma-ui"], | ||
"PACKAGES_DS": [ | ||
"plasma-web", | ||
"plasma-b2c", | ||
"plasma-ui", | ||
"plasma-new-hope", | ||
"plasma-asdk", | ||
"caldera", | ||
"caldera-online", | ||
"sdds-serv" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = () => { | ||
const { PACKAGES_DS, BASE_URL } = process.env; | ||
|
||
const links = JSON.parse(PACKAGES_DS) | ||
.map((item) => { | ||
const name = item.replace('plasma-', ''); | ||
|
||
return `${name} storybook: ${BASE_URL}/${name}-storybook/`; | ||
}) | ||
.join('\n'); | ||
|
||
return 'Documentation preview deployed!' + '\n\n' + `website:${BASE_URL}/` + '\n' + `${links}`; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,76 @@ | ||
const CYPRESS_SCOPE = ['@salutejs/plasma-web', '@salutejs/plasma-b2c', '@salutejs/plasma-ui']; | ||
// INFO: HAS_ASSETS - это флаг для управления логикой "@auto-it" плагина upload-assets-extend | ||
// INFO: Изменения в plasma-tokens или plasma-tokens-utils так же повлияют на то что в packagesList окажется plasma-tokens-native | ||
|
||
/** | ||
* Define CI config | ||
* @typedef {object} json | ||
* @property {Array<string>} PACKAGES_CYPRESS | ||
* @property {Array<string>} PACKAGES_DS | ||
*/ | ||
const CONFIG = require('./config-ci.json'); | ||
|
||
module.exports = () => { | ||
const { CHANGED_STATE, AS_ENUMERATION } = process.env; | ||
const { RAW_DATA } = process.env; | ||
|
||
/** | ||
* | ||
* @param CHANGED_STATE Information about the changed state | ||
* @param CHANGED_STATE.name The name of the package. | ||
* @param CHANGED_STATE.version The version of the package. | ||
* @param CHANGED_STATE.private The type of the package. | ||
* @param CHANGED_STATE.location The path of the package. | ||
* @param RAW_DATA Information about the changed state | ||
* @param RAW_DATA.name The name of the package. | ||
* @param RAW_DATA.version The version of the package. | ||
* @param RAW_DATA.private The type of the package. | ||
* @param RAW_DATA.location The path of the package. | ||
* | ||
* @example | ||
* { | ||
* "name": "@salutejs/plasma-website", | ||
* "version": "0.184.0", | ||
* "private": true, | ||
* "location": "/Users/workspace/plasma/website/plasma-website" | ||
* "location": ".../plasma/website/plasma-website" | ||
* } | ||
*/ | ||
const changedState = JSON.parse(JSON.parse(CHANGED_STATE)); | ||
const rawData = JSON.parse(RAW_DATA).map(({ name }) => name); | ||
|
||
if (!changedState || !changedState.length) { | ||
return { SCOPE: [], HAS_SCOPE: false }; | ||
if (!rawData || !rawData.length) { | ||
return { | ||
RAW_DATA: [], | ||
PACKAGES_CYPRESS_RUN: [], | ||
PACKAGES_DOCUMENTATIONS_RUN: [], | ||
PROCESSED_DATA: [], | ||
HAS_PACKAGES_CYPRESS_RUN: false, | ||
HAS_PACKAGES_DS_CHANGES: false, | ||
HAS_ASSETS: false, | ||
}; | ||
} | ||
|
||
/** | ||
* Processed data - packages name without "@salutejs/" | ||
* @example | ||
* ['@salutejs/plasma-ui-docs', '@salutejs/plasma-ui', '@salutejs/plasma-core'] | ||
* ["plasma-web", "plasma-ui", "caldera"] | ||
*/ | ||
const packagesList = changedState.map(({ name }) => name); | ||
|
||
const HAS_PLASMA_UI_DOCS = packagesList.includes('@salutejs/plasma-ui-docs'); | ||
const HAS_PLASMA_WEB_DOCS = packagesList.includes('@salutejs/plasma-web-docs'); | ||
|
||
const HAS_PLASMA_UI = packagesList.includes('@salutejs/plasma-ui'); | ||
const HAS_PLASMA_WEB = packagesList.includes('@salutejs/plasma-web'); | ||
const HAS_PLASMA_B2C = packagesList.includes('@salutejs/plasma-b2c'); | ||
const HAS_PLASMA_HOPE = packagesList.includes('@salutejs/plasma-new-hope'); | ||
const HAS_PLASMA_ASDK = packagesList.includes('@salutejs/plasma-asdk'); | ||
const HAS_CALDERA = packagesList.includes('@salutejs/caldera'); | ||
const HAS_CALDERA_ONLINE = packagesList.includes('@salutejs/caldera-online'); | ||
const HAS_SDDS_SERV = packagesList.includes('@salutejs/sdds-serv'); | ||
const HAS_PLASMA_WEBSITE = packagesList.includes('@salutejs/plasma-website'); | ||
|
||
const HAS_DOCUMENTATION_CHANGED = | ||
HAS_PLASMA_WEBSITE || | ||
HAS_PLASMA_UI_DOCS || | ||
HAS_PLASMA_WEB_DOCS || | ||
HAS_PLASMA_ASDK || | ||
HAS_CALDERA || | ||
HAS_CALDERA_ONLINE || | ||
HAS_SDDS_SERV; | ||
|
||
// Флаг для управления логикой "@auto-it" плагина upload-assets-extend | ||
// Изменения в plasma-tokens или plasma-tokens-utils так же повлияют на то что в packagesList окажется plasma-tokens-native | ||
const HAS_ASSETS = packagesList.includes('@salutejs/plasma-tokens-native'); | ||
const PROCESSED_DATA = rawData.map((item) => item.replace('@salutejs/', '')); | ||
|
||
/** | ||
* List short packages name | ||
* List short packages name for run cypress test | ||
* @example | ||
* ["web", "ui", "b2c"] | ||
*/ | ||
const scope = packagesList.filter((item) => CYPRESS_SCOPE.includes(item)).map((item) => `"${item.split('-')[1]}"`); | ||
const PACKAGES_CYPRESS_RUN = PROCESSED_DATA.filter((item) => CONFIG.PACKAGES_CYPRESS.includes(item)).map((item) => | ||
item.replace('plasma-', ''), | ||
); | ||
|
||
/** | ||
* Enumeration packages name | ||
* List packages who has a documentations artifacts: storybook, docusaurus | ||
* @example | ||
* ["plasma-web", "plasma-ui", "plasma-b2c"] | ||
* ["plasma-web", "caldera", "sdds-serv"] | ||
*/ | ||
const packagesEnumeration = AS_ENUMERATION === 'true' ? packagesList.map((item) => `"${item.split('/')[1]}"`) : []; | ||
|
||
console.log('packagesEnumeration =>', packagesEnumeration); | ||
console.log('packagesList =>', packagesList); | ||
const PACKAGES_DOCUMENTATIONS_RUN = PROCESSED_DATA.filter((item) => CONFIG.PACKAGES_DS.includes(item)); | ||
|
||
return { | ||
SCOPE: JSON.stringify(scope), | ||
PACKAGES_ENUMERATION: JSON.stringify(packagesEnumeration), | ||
HAS_SCOPE: Boolean(scope.length), | ||
HAS_DOCUMENTATION_CHANGED, | ||
HAS_PLASMA_UI_DOCS, | ||
HAS_PLASMA_WEB_DOCS, | ||
HAS_PLASMA_UI, | ||
HAS_PLASMA_WEB, | ||
HAS_PLASMA_B2C, | ||
HAS_PLASMA_HOPE, | ||
HAS_PLASMA_ASDK, | ||
HAS_ASSETS, | ||
HAS_CALDERA, | ||
HAS_CALDERA_ONLINE, | ||
HAS_SDDS_SERV, | ||
RAW_DATA: JSON.stringify(rawData), | ||
PACKAGES_DOCUMENTATIONS_RUN: JSON.stringify(PACKAGES_DOCUMENTATIONS_RUN), | ||
PACKAGES_CYPRESS_RUN: JSON.stringify(PACKAGES_CYPRESS_RUN), | ||
PROCESSED_DATA: JSON.stringify(PROCESSED_DATA), | ||
HAS_PACKAGES_CYPRESS_RUN: Boolean(PACKAGES_CYPRESS_RUN.length), | ||
HAS_PACKAGES_DS_CHANGES: Boolean(PACKAGES_DOCUMENTATIONS_RUN.length), | ||
HAS_ASSETS: PROCESSED_DATA.includes('plasma-tokens-native'), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.