From 8759d27286a324a9349e016333737e833c211d5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B8egh?= Date: Fri, 11 Feb 2022 10:06:41 +0100 Subject: [PATCH 01/10] feat(TypeScript): remove original ts/tsx files and only leave type definition files --- package.json | 2 +- packages/dnb-eufemia/package.json | 7 ++++-- .../scripts/prepub/generate-types.sh | 11 ++++++++ .../dnb-eufemia/scripts/prepub/prebuild.sh | 13 ++++++++++ .../scripts/release/copy-build-artifacts.sh | 4 +-- .../dnb-eufemia/tsconfig.definitions.json | 25 +++++++++++++++++++ packages/dnb-eufemia/tsconfig.json | 4 +-- 7 files changed, 59 insertions(+), 7 deletions(-) create mode 100755 packages/dnb-eufemia/scripts/prepub/generate-types.sh create mode 100755 packages/dnb-eufemia/scripts/prepub/prebuild.sh create mode 100644 packages/dnb-eufemia/tsconfig.definitions.json diff --git a/package.json b/package.json index 462f0c31925..3de1cf037c9 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "publish:dry": "yarn workspace @dnb/eufemia publish:dry", "reset": "rm -rf ./node_modules && yarn workspace @dnb/eufemia reset && yarn workspace dnb-design-system-portal reset && yarn install", "build": "yarn workspace @dnb/eufemia build", - "build:ci": "yarn workspace @dnb/eufemia prebuild:ci && yarn workspace @dnb/eufemia postbuild:ci && yarn workspace @dnb/eufemia publish:prepare", + "build:ci": "yarn workspace @dnb/eufemia build:ci", "test": "yarn workspace @dnb/eufemia test", "test:update": "yarn workspace @dnb/eufemia test:update", "test:types": "yarn workspace @dnb/eufemia test:types", diff --git a/packages/dnb-eufemia/package.json b/packages/dnb-eufemia/package.json index 076cb13f562..95eed4d1b29 100644 --- a/packages/dnb-eufemia/package.json +++ b/packages/dnb-eufemia/package.json @@ -19,8 +19,9 @@ "audit:ci:npm": "audit-ci --config ./audit-ci.json --report-type summary", "audit:ci:yarn": "audit-ci --config ./audit-ci.json --package-manager=yarn --report-type summary", "audit:ci:yarn-outdated": "babel-node ./scripts/prepub/audit/toOpt && audit-ci --config ./audit-ci.json --package-manager=yarn --report-type full && babel-node ./scripts/prepub/audit/toDev", - "build": "yarn build:prebuild && yarn build:esm && yarn build:copy", + "build": "./scripts/prepub/prebuild.sh", "prebuild:ci": "yarn build", + "build:ci": "yarn prebuild:ci && yarn postbuild:ci && yarn publish:prepare", "postbuild:ci": "./scripts/release/postbuild.sh", "build:cjs": "./scripts/release/babel-cjs.sh", "build:clean": "rm -rf build/**", @@ -32,8 +33,10 @@ "build:pack": "yarn build && yarn publish:prepare && cd ./build && yarn pack", "build:prebuild": "babel-node ./scripts/prepub/runPrepub.js", "build:resources": "babel-node ./scripts/prepub/resources/makeResourcesPackage.js", - "build:types": "babel-node ./scripts/prepub/generateTypes.js && yarn test:auto-generated-types", + "build:types": "./scripts/prepub/generate-types.sh", + "build:types:definitions": "yarn tsc --project tsconfig.definitions.json", "build:types:dev": "nodemon --exec 'babel-node ./scripts/prepub/generateTypes.js' --ext js --watch './src/**/*' --watch './scripts/**/*'", + "build:types:esm": "yarn tsc --project tsconfig.definitions.json --declarationDir ./build/esm --rootDir src", "build:umd": "./scripts/release/babel-umd.sh", "precommit": "yarn lint-staged", "dev:icons": "nodemon --exec 'babel-node ./scripts/tools/convertIcons' --ignore '/icons/**' --ignore '*.json'", diff --git a/packages/dnb-eufemia/scripts/prepub/generate-types.sh b/packages/dnb-eufemia/scripts/prepub/generate-types.sh new file mode 100755 index 00000000000..806c72430dc --- /dev/null +++ b/packages/dnb-eufemia/scripts/prepub/generate-types.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e # Exit immediately if a command exits with a non-zero status. + +echo 'Generating type definitions ...' + +babel-node ./scripts/prepub/generateTypes.js +yarn build:types:definitions +yarn test:auto-generated-types + +echo 'Generating type definitions done!' \ No newline at end of file diff --git a/packages/dnb-eufemia/scripts/prepub/prebuild.sh b/packages/dnb-eufemia/scripts/prepub/prebuild.sh new file mode 100755 index 00000000000..917554a3a24 --- /dev/null +++ b/packages/dnb-eufemia/scripts/prepub/prebuild.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -e # Exit immediately if a command exits with a non-zero status. + +echo 'Prebuild started ...' + +yarn build:prebuild +yarn build:esm +yarn build:types:esm +yarn build:copy +rm -rf build/esm + +echo 'Prebuild done!' \ No newline at end of file diff --git a/packages/dnb-eufemia/scripts/release/copy-build-artifacts.sh b/packages/dnb-eufemia/scripts/release/copy-build-artifacts.sh index 1c6257bbfda..b64e2fdc1ff 100755 --- a/packages/dnb-eufemia/scripts/release/copy-build-artifacts.sh +++ b/packages/dnb-eufemia/scripts/release/copy-build-artifacts.sh @@ -2,7 +2,7 @@ set -e # Exit immediately if a command exits with a non-zero status. -echo 'Copy artifacts ...' +echo 'Copy build artifacts ...' rm -rf build/**/{__tests__,cjs} cp -r ./assets/ ./build/assets @@ -10,4 +10,4 @@ cp .npmignore ./build/.npmignore cp README README.md LICENSE ./build babel-node ./scripts/release/copyFinaleBuild.js -echo 'Copy artifacts done!' \ No newline at end of file +echo 'Copy build artifacts done!' \ No newline at end of file diff --git a/packages/dnb-eufemia/tsconfig.definitions.json b/packages/dnb-eufemia/tsconfig.definitions.json new file mode 100644 index 00000000000..44ad74b6ea1 --- /dev/null +++ b/packages/dnb-eufemia/tsconfig.definitions.json @@ -0,0 +1,25 @@ +{ + "compileOnSave": false, + "compilerOptions": { + "jsx": "react-jsx", + "skipLibCheck": true, + "declaration": true, + "emitDeclarationOnly": true, + "allowJs": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "isolatedModules": true, + "declarationDir": ".", + "rootDir": ".", + "baseUrl": "." + }, + "include": ["src/**/*.js", "src/**/*.ts", "src/**/*.tsx"], + "exclude": [ + "node_modules", + "build", + "scripts", + "src/core", + "**/stories/**/*", + "**/__tests__/**/*" + ] +} diff --git a/packages/dnb-eufemia/tsconfig.json b/packages/dnb-eufemia/tsconfig.json index dc3ffe0c740..492cd5100c0 100644 --- a/packages/dnb-eufemia/tsconfig.json +++ b/packages/dnb-eufemia/tsconfig.json @@ -7,9 +7,9 @@ "allowSyntheticDefaultImports": true, "isolatedModules": true, "types": ["node", "jest"], - "outDir": "./out", + "outDir": "./build", "rootDir": ".", "baseUrl": "." }, - "exclude": ["./node_modules", "build"] + "exclude": ["node_modules", "build"] } From 924125a540eff099f32c616ae90a19f2ee5f3e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B8egh?= Date: Tue, 15 Feb 2022 15:41:48 +0100 Subject: [PATCH 02/10] Omit creating index files and let tsc do the job --- .../scripts/prepub/tasks/generateTypes.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes.js b/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes.js index a79d9e2ecb4..017b5e5853e 100644 --- a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes.js +++ b/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes.js @@ -52,13 +52,6 @@ export default async function generateTypes({ } } -function isIndexFile({ file, basename }) { - return ( - /^index/.test(basename) || - /src\/(components|fragments|extensions)\/[A-Z][^.]*\.js/.test(file) - ) -} - export const createTypes = async ( listOfAllFiles, { isTest = false, ...opts } = {} @@ -107,11 +100,7 @@ export const createTypes = async ( } } - if (isIndexFile({ file, basename })) { - if (!fs.existsSync(destFile)) { - await fs.copyFile(file, destFile) - } - } else if ( + if ( /^[A-Z]/.test(basename) && (await fileContains(file, 'propTypes')) ) { From f0c118eec1eb31d5a5e285646cff27b8c4d730de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B8egh?= Date: Tue, 15 Feb 2022 21:01:09 +0100 Subject: [PATCH 03/10] Ignore DS_Store files --- packages/dnb-eufemia/scripts/prepub/tasks/prepareTemplates.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/prepareTemplates.js b/packages/dnb-eufemia/scripts/prepub/tasks/prepareTemplates.js index f392860026f..5b441060432 100644 --- a/packages/dnb-eufemia/scripts/prepub/tasks/prepareTemplates.js +++ b/packages/dnb-eufemia/scripts/prepub/tasks/prepareTemplates.js @@ -277,7 +277,7 @@ const runFactory = async ({ } processToNamesList = processToNamesList .filter(({ file }) => { - if (/not_in_use|__tests__/g.test(file)) { + if (/not_in_use|__tests__|DS_Store/g.test(file)) { return false } return !processToNamesIgnoreList.includes(file) From 413dd40fc6f823b33bfa6c72c4c4603f23cf83be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B8egh?= Date: Tue, 15 Feb 2022 21:03:15 +0100 Subject: [PATCH 04/10] Re-order and export because of tsc error --- .../global-status/GlobalStatusProvider.js | 230 +++++++++--------- .../shared/helpers/{Suffix.js => Suffix.tsx} | 26 +- 2 files changed, 130 insertions(+), 126 deletions(-) rename packages/dnb-eufemia/src/shared/helpers/{Suffix.js => Suffix.tsx} (63%) diff --git a/packages/dnb-eufemia/src/components/global-status/GlobalStatusProvider.js b/packages/dnb-eufemia/src/components/global-status/GlobalStatusProvider.js index 42dba1f210f..487248860a8 100644 --- a/packages/dnb-eufemia/src/components/global-status/GlobalStatusProvider.js +++ b/packages/dnb-eufemia/src/components/global-status/GlobalStatusProvider.js @@ -9,121 +9,7 @@ import { convertJsxToString, } from '../../shared/component-helper' -// The meaning with this is that we can force a rerender without sharing the same context -class GlobalStatusProvider { - static providers = {} - - static create = (id = 'main', props = null) => { - return (GlobalStatusProvider.providers[id] = - new GlobalStatusProviderItem(id, props)) - } - - static init(id = 'main', onReady = null, props = null) { - const existingStatus = GlobalStatusProvider.get(id) - - if (existingStatus) { - if (props) { - existingStatus.add(props) - } - if (typeof onReady === 'function') { - onReady(existingStatus) - } - return existingStatus - } - - const newStatus = GlobalStatusProvider.create(id, props) - - if (onReady) { - // send along the new status - newStatus.addOnReady(newStatus, onReady) - } - - if (id !== 'main') { - warn(`No found.`) - } - - return newStatus - } - - static get(id = 'main') { - return GlobalStatusProvider.providers[id] || null - } - - static remove(id = 'main') { - if (GlobalStatusProvider.providers[id]) { - delete GlobalStatusProvider.providers[id] - } - } - - static prepareItemWithStatusId(item, status_id = null) { - if (typeof item === 'string') { - item = { text: item } - } - - if (!item.item_id) { - if (status_id && status_id !== 'status-main') { - item.item_id = status_id - } else { - if (item?.text) { - item.item_id = slugify(convertJsxToString(item.text)) - } else { - item.item_id = slugify(item) - } - } - } - - return item - } - - static combineMessages(stack) { - const globalStatus = stack.reduce((acc, cur) => { - // make a copy, because items are read-only - cur = { ...cur } - - if (typeof cur.items === 'string' && cur.items[0] === '[') { - cur.items = JSON.parse(cur.items) - } - - // if there is only one item, put it into the array - if (cur.item) { - if (typeof cur.item === 'string' && cur.item[0] === '{') { - cur.item = JSON.parse(cur.item) - } - // make sure we have an array of items - cur.items = cur.items || [] - cur.items.push(cur.item) - } - - // merge items from prev stack into the current - if (cur.items) { - cur.items = cur.items.reduce((_acc, item) => { - // only a fallback and to make sure we have - item = GlobalStatusProvider.prepareItemWithStatusId(item) - - const foundAtIndex = _acc.findIndex( - ({ item_id }) => item_id === item.item_id - ) - if (foundAtIndex > -1) { - _acc[foundAtIndex] = item - } else { - _acc.push(item) - } - - return _acc - }, acc.items || []) // here we use the items from the prev stack - } - - // merge the prev stack with the current - Object.assign(acc, cur) - - return acc - }, {}) - - return globalStatus - } -} - -class GlobalStatusProviderItem { +export class GlobalStatusProviderItem { constructor(id, props = null) { this.internal_id = id if (props) { @@ -312,6 +198,120 @@ class GlobalStatusProviderItem { _onReadyEvents = [] // for startup events } +// The meaning with this is that we can force a rerender without sharing the same context +class GlobalStatusProvider { + static providers = {} + + static create = (id = 'main', props = null) => { + return (GlobalStatusProvider.providers[id] = + new GlobalStatusProviderItem(id, props)) + } + + static init(id = 'main', onReady = null, props = null) { + const existingStatus = GlobalStatusProvider.get(id) + + if (existingStatus) { + if (props) { + existingStatus.add(props) + } + if (typeof onReady === 'function') { + onReady(existingStatus) + } + return existingStatus + } + + const newStatus = GlobalStatusProvider.create(id, props) + + if (onReady) { + // send along the new status + newStatus.addOnReady(newStatus, onReady) + } + + if (id !== 'main') { + warn(`No found.`) + } + + return newStatus + } + + static get(id = 'main') { + return GlobalStatusProvider.providers[id] || null + } + + static remove(id = 'main') { + if (GlobalStatusProvider.providers[id]) { + delete GlobalStatusProvider.providers[id] + } + } + + static prepareItemWithStatusId(item, status_id = null) { + if (typeof item === 'string') { + item = { text: item } + } + + if (!item.item_id) { + if (status_id && status_id !== 'status-main') { + item.item_id = status_id + } else { + if (item?.text) { + item.item_id = slugify(convertJsxToString(item.text)) + } else { + item.item_id = slugify(item) + } + } + } + + return item + } + + static combineMessages(stack) { + const globalStatus = stack.reduce((acc, cur) => { + // make a copy, because items are read-only + cur = { ...cur } + + if (typeof cur.items === 'string' && cur.items[0] === '[') { + cur.items = JSON.parse(cur.items) + } + + // if there is only one item, put it into the array + if (cur.item) { + if (typeof cur.item === 'string' && cur.item[0] === '{') { + cur.item = JSON.parse(cur.item) + } + // make sure we have an array of items + cur.items = cur.items || [] + cur.items.push(cur.item) + } + + // merge items from prev stack into the current + if (cur.items) { + cur.items = cur.items.reduce((_acc, item) => { + // only a fallback and to make sure we have + item = GlobalStatusProvider.prepareItemWithStatusId(item) + + const foundAtIndex = _acc.findIndex( + ({ item_id }) => item_id === item.item_id + ) + if (foundAtIndex > -1) { + _acc[foundAtIndex] = item + } else { + _acc.push(item) + } + + return _acc + }, acc.items || []) // here we use the items from the prev stack + } + + // merge the prev stack with the current + Object.assign(acc, cur) + + return acc + }, {}) + + return globalStatus + } +} + // add a fallback, in case we don't run this inside the same React instance if (typeof window !== 'undefined') { window.GlobalStatusProvider = GlobalStatusProvider diff --git a/packages/dnb-eufemia/src/shared/helpers/Suffix.js b/packages/dnb-eufemia/src/shared/helpers/Suffix.tsx similarity index 63% rename from packages/dnb-eufemia/src/shared/helpers/Suffix.js rename to packages/dnb-eufemia/src/shared/helpers/Suffix.tsx index 5b7da4531ca..264dea0a7d0 100644 --- a/packages/dnb-eufemia/src/shared/helpers/Suffix.js +++ b/packages/dnb-eufemia/src/shared/helpers/Suffix.tsx @@ -4,12 +4,22 @@ */ import React from 'react' -import PropTypes from 'prop-types' import classnames from 'classnames' -export const SuffixContext = React.createContext() +const SuffixContext = React.createContext(null) -const Suffix = ({ className, children, context, ...props }) => { +interface SuffixProps { + className: string + children: React.ReactNode + context: Record +} + +const Suffix = ({ + className, + children, + context, + ...props +}: SuffixProps) => { const content = ( // The styles are as of now, set in @dnb/eufemia/src/style/components/imports.scss @@ -27,13 +37,7 @@ const Suffix = ({ className, children, context, ...props }) => { return content } -Suffix.propTypes = { - className: PropTypes.string, - children: PropTypes.node, -} -Suffix.defaultProps = { - className: null, - children: null, -} + +export { SuffixContext } export default Suffix From 51ce1609b13144767fc6c57423f4d52ea74840c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B8egh?= Date: Tue, 15 Feb 2022 22:13:35 +0100 Subject: [PATCH 05/10] Test for d.ts files instead of tsx --- .../release/__tests__/postbuild.test.js | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/packages/dnb-eufemia/scripts/release/__tests__/postbuild.test.js b/packages/dnb-eufemia/scripts/release/__tests__/postbuild.test.js index 9b0198312a2..ff1d43e6e26 100644 --- a/packages/dnb-eufemia/scripts/release/__tests__/postbuild.test.js +++ b/packages/dnb-eufemia/scripts/release/__tests__/postbuild.test.js @@ -192,23 +192,19 @@ describe('babel build', () => { break } - if (stage == 'cjs') { - const exists = fs.existsSync( - path.resolve( - packpath.self(), - `build/${stage}/components/breadcrumb/Breadcrumb.tsx` - ) - ) - expect(exists).toBe(false) - } else { - const content = fs.readFileSync( - path.resolve( - packpath.self(), - `build/${stage}/components/breadcrumb/Breadcrumb.tsx` - ), - 'utf-8' - ) - expect(content).toContain('export interface BreadcrumbProps') - } + const tsxFile = path.resolve( + packpath.self(), + `build/${stage}/components/breadcrumb/Breadcrumb.tsx` + ) + const dtsFile = path.resolve( + packpath.self(), + `build/${stage}/components/breadcrumb/Breadcrumb.d.ts` + ) + + expect(fs.existsSync(tsxFile)).toBe(false) + expect(fs.existsSync(dtsFile)).toBe(true) + + const content = fs.readFileSync(dtsFile, 'utf-8') + expect(content).toContain('export interface BreadcrumbProps') }) }) From 68aeb26e5700afa796d9645eaca407dfc94feeef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B8egh?= Date: Tue, 15 Feb 2022 22:20:32 +0100 Subject: [PATCH 06/10] Only copy .d.ts files --- packages/dnb-eufemia/scripts/release/babel-cjs.sh | 2 +- packages/dnb-eufemia/scripts/release/copyTypeScriptFiles.js | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/dnb-eufemia/scripts/release/babel-cjs.sh b/packages/dnb-eufemia/scripts/release/babel-cjs.sh index b78fe337994..334f5ad19f9 100755 --- a/packages/dnb-eufemia/scripts/release/babel-cjs.sh +++ b/packages/dnb-eufemia/scripts/release/babel-cjs.sh @@ -19,7 +19,7 @@ echo 'Building cjs bundle done!' echo 'Copy additional files to cjs ...' -OUT_DIR=./build/cjs ONLY_DEFINITION_FILES=1 babel-node ./scripts/release/copyTypeScriptFiles.js +OUT_DIR=./build/cjs babel-node ./scripts/release/copyTypeScriptFiles.js OUT_DIR=./build/cjs babel-node ./scripts/release/copyStyles.js echo 'Copy extra cjs package.json ...' diff --git a/packages/dnb-eufemia/scripts/release/copyTypeScriptFiles.js b/packages/dnb-eufemia/scripts/release/copyTypeScriptFiles.js index 8a9721c0baa..7aa82f36b6d 100644 --- a/packages/dnb-eufemia/scripts/release/copyTypeScriptFiles.js +++ b/packages/dnb-eufemia/scripts/release/copyTypeScriptFiles.js @@ -14,10 +14,6 @@ if (require.main === module) { async function copyTypeScriptFiles(dist) { const globbyFiles = ['./src/**/*.d.ts'] - if (process.env.ONLY_DEFINITION_FILES !== '1') { - globbyFiles.push('./src/**/*.ts', './src/**/*.tsx') - } - const files = await globby(globbyFiles) for await (const file of files) { From 81727f80490a4a1c7e47dfa8c139237e47ccc1a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B8egh?= Date: Wed, 16 Feb 2022 10:47:42 +0100 Subject: [PATCH 07/10] Fixup logs --- packages/dnb-eufemia/scripts/prepub/generateTypes.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/dnb-eufemia/scripts/prepub/generateTypes.js b/packages/dnb-eufemia/scripts/prepub/generateTypes.js index b6ef542df1f..b4e56f356c0 100644 --- a/packages/dnb-eufemia/scripts/prepub/generateTypes.js +++ b/packages/dnb-eufemia/scripts/prepub/generateTypes.js @@ -11,19 +11,19 @@ import { generateTypes } from './index' const runGenerateTypesTasks = async ({ doRefetch } = {}) => { process.env.NODE_ENV = 'production' - log.start('Starting to build types...', doRefetch) + log.start('Starting to generate type definitions ...', doRefetch) try { await generateTypes() - log.succeed('Types build has succeeded!') + log.succeed('Type definitions are successfully generated!') } catch (e) { - log.fail(new ErrorHandler('Failed to build types!', e)) + log.fail(new ErrorHandler('Failed to generate type definitions!', e)) } return true } const run = async () => { process.env.NODE_ENV = 'production' - log.start('Starting making JS properties file ...') + log.start('Make JavaScript properties file ...') await runGenerateTypesTasks() From c5986213e8d4e35c5e4fe5261385d0a19a615e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B8egh?= Date: Wed, 16 Feb 2022 15:26:36 +0100 Subject: [PATCH 08/10] Clean up pre-build logic --- packages/dnb-eufemia/package.json | 4 +- .../prepub/{prebuild.sh => local-prebuild.sh} | 0 .../release/__tests__/postbuild.test.js | 51 +++++++++++++------ 3 files changed, 38 insertions(+), 17 deletions(-) rename packages/dnb-eufemia/scripts/prepub/{prebuild.sh => local-prebuild.sh} (100%) diff --git a/packages/dnb-eufemia/package.json b/packages/dnb-eufemia/package.json index 95eed4d1b29..261d872db80 100644 --- a/packages/dnb-eufemia/package.json +++ b/packages/dnb-eufemia/package.json @@ -19,8 +19,8 @@ "audit:ci:npm": "audit-ci --config ./audit-ci.json --report-type summary", "audit:ci:yarn": "audit-ci --config ./audit-ci.json --package-manager=yarn --report-type summary", "audit:ci:yarn-outdated": "babel-node ./scripts/prepub/audit/toOpt && audit-ci --config ./audit-ci.json --package-manager=yarn --report-type full && babel-node ./scripts/prepub/audit/toDev", - "build": "./scripts/prepub/prebuild.sh", - "prebuild:ci": "yarn build", + "build": "./scripts/prepub/local-prebuild.sh", + "prebuild:ci": "yarn build:prebuild", "build:ci": "yarn prebuild:ci && yarn postbuild:ci && yarn publish:prepare", "postbuild:ci": "./scripts/release/postbuild.sh", "build:cjs": "./scripts/release/babel-cjs.sh", diff --git a/packages/dnb-eufemia/scripts/prepub/prebuild.sh b/packages/dnb-eufemia/scripts/prepub/local-prebuild.sh similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/prebuild.sh rename to packages/dnb-eufemia/scripts/prepub/local-prebuild.sh diff --git a/packages/dnb-eufemia/scripts/release/__tests__/postbuild.test.js b/packages/dnb-eufemia/scripts/release/__tests__/postbuild.test.js index ff1d43e6e26..956514883d1 100644 --- a/packages/dnb-eufemia/scripts/release/__tests__/postbuild.test.js +++ b/packages/dnb-eufemia/scripts/release/__tests__/postbuild.test.js @@ -39,6 +39,42 @@ describe('type definitions', () => { 'utf-8' ) ).toMatch(/export interface/g) + + // Test the output of js files + const dtsInput = path.resolve( + packpath.self(), + `build/${stage}/components/input/Input.d.ts` + ) + + expect(fs.existsSync(dtsInput)).toBe(true) + + const contentInput = fs.readFileSync(dtsInput, 'utf-8') + expect(contentInput).toContain( + 'export interface InputProps extends React.HTMLProps' + ) + } + ) + + it.each(buildStages)( + 'has correct Breadcrumb type definitions on stage %s', + (stage) => { + // Test the output of tsx files + const tsxBreadcrumb = path.resolve( + packpath.self(), + `build/${stage}/components/breadcrumb/Breadcrumb.tsx` + ) + const dtsBreadcrumb = path.resolve( + packpath.self(), + `build/${stage}/components/breadcrumb/Breadcrumb.d.ts` + ) + + expect(fs.existsSync(tsxBreadcrumb)).toBe(false) + expect(fs.existsSync(dtsBreadcrumb)).toBe(true) + + const contentBreadcrumb = fs.readFileSync(dtsBreadcrumb, 'utf-8') + expect(contentBreadcrumb).toContain( + 'export interface BreadcrumbProps' + ) } ) }) @@ -191,20 +227,5 @@ describe('babel build', () => { } break } - - const tsxFile = path.resolve( - packpath.self(), - `build/${stage}/components/breadcrumb/Breadcrumb.tsx` - ) - const dtsFile = path.resolve( - packpath.self(), - `build/${stage}/components/breadcrumb/Breadcrumb.d.ts` - ) - - expect(fs.existsSync(tsxFile)).toBe(false) - expect(fs.existsSync(dtsFile)).toBe(true) - - const content = fs.readFileSync(dtsFile, 'utf-8') - expect(content).toContain('export interface BreadcrumbProps') }) }) From fedcd29cc727154cef811c0f0bbaa6970b582b1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B8egh?= Date: Wed, 16 Feb 2022 15:32:47 +0100 Subject: [PATCH 09/10] Rename folder from prepub to prebuild --- packages/dnb-eufemia/package.json | 20 +++++++++---------- .../dnb-eufemia/scripts/figma/FigmaAPI.js | 2 +- .../scripts/figma/tasks/commitChanges.js | 2 +- .../audit/prepareForAudit.js | 0 .../{prepub => prebuild}/audit/toDev.js | 0 .../{prepub => prebuild}/audit/toOpt.js | 0 .../{prepub => prebuild}/commitToBranch.js | 0 .../config/postcssConfig.js | 0 .../scripts/{prepub => prebuild}/dev.js | 0 .../{prepub => prebuild}/generate-types.sh | 2 +- .../{prepub => prebuild}/generateTypes.js | 0 .../scripts/{prepub => prebuild}/index.js | 0 .../{prepub => prebuild}/local-prebuild.sh | 0 .../{prepub => prebuild}/makeProperties.js | 0 .../resources/makeResourcesPackage.js | 0 .../scripts/{prepub => prebuild}/runPrepub.js | 0 .../convertSvgToJsx.test.js.snap | 0 .../__snapshots__/generateTypes.test.js.snap | 0 .../tasks/__tests__/convertSvgToJsx.test.js | 0 .../tasks/__tests__/generateTypes.test.js | 0 .../tasks/__tests__/makeLibStyles.test.js | 0 .../tasks/__tests__/makeMainStyle.test.js | 0 .../__tests__/makePropertiesFile.test.js | 0 .../__tests__/makeReleaseVersion.test.js | 0 .../__tests__/postTypeGeneration.test.js | 0 .../tasks/__tests__/test-files/bell.svg | 0 .../tasks/__tests__/themeFactory.test.js | 0 .../tasks/convertSvgToJsx.js | 0 .../tasks/generateTypes.js | 0 .../__tests__/__mocks__/ClassComponent.js | 0 .../__tests__/__mocks__/PrimaryComponent.d.ts | 0 .../__tests__/__mocks__/PrimaryComponent.js | 0 .../__tests__/__mocks__/PrimaryComponent.md | 0 .../__tests__/__mocks__/SecondaryComponent.js | 0 .../__tests__/__mocks__/SecondaryComponent.md | 0 .../__tests__/__mocks__/SpaceComponent.md | 0 .../babelPluginCorrectTypes.test.js.snap | 0 .../babelPluginExtendTypes.test.js.snap | 0 .../babelPluginIncludeDocs.test.js.snap | 0 ...babelPluginPropTypesRelations.test.js.snap | 0 .../__tests__/babelPluginCorrectTypes.test.js | 0 .../__tests__/babelPluginExtendTypes.test.js | 0 .../__tests__/babelPluginIncludeDocs.test.js | 0 .../babelPluginPropTypesRelations.test.js | 0 .../babelPluginConfigDefaults.js | 0 .../generateTypes/babelPluginCorrectTypes.js | 0 .../generateTypes/babelPluginExtendTypes.js | 0 .../generateTypes/babelPluginIncludeDocs.js | 0 .../babelPluginPropTypesRelations.js | 0 .../generateTypes/fetchPropertiesFromDocs.js | 0 .../tasks/makeLibStyles.js | 0 .../tasks/makeMainStyle.js | 0 .../tasks/makePropertiesFile.js | 0 .../tasks/makeReleaseVersion.js | 0 .../tasks/prepareTemplates.js | 0 .../tasks/styleFactory.js | 0 .../tasks/themeFactory.js | 0 .../tasks/transformUtils.js | 0 .../dnb-eufemia/scripts/tools/convertIcons.js | 2 +- .../scripts/tools/convertWebStyles.js | 2 +- .../src/core/jest/jestPuppeteerTeardown.js | 2 +- 61 files changed, 16 insertions(+), 16 deletions(-) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/audit/prepareForAudit.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/audit/toDev.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/audit/toOpt.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/commitToBranch.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/config/postcssConfig.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/dev.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/generate-types.sh (82%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/generateTypes.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/index.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/local-prebuild.sh (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/makeProperties.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/resources/makeResourcesPackage.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/runPrepub.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/__tests__/__snapshots__/convertSvgToJsx.test.js.snap (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/__tests__/__snapshots__/generateTypes.test.js.snap (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/__tests__/convertSvgToJsx.test.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/__tests__/generateTypes.test.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/__tests__/makeLibStyles.test.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/__tests__/makeMainStyle.test.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/__tests__/makePropertiesFile.test.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/__tests__/makeReleaseVersion.test.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/__tests__/postTypeGeneration.test.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/__tests__/test-files/bell.svg (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/__tests__/themeFactory.test.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/convertSvgToJsx.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/__tests__/__mocks__/ClassComponent.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/__tests__/__mocks__/PrimaryComponent.d.ts (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/__tests__/__mocks__/PrimaryComponent.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/__tests__/__mocks__/PrimaryComponent.md (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/__tests__/__mocks__/SecondaryComponent.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/__tests__/__mocks__/SecondaryComponent.md (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/__tests__/__mocks__/SpaceComponent.md (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/__tests__/__snapshots__/babelPluginCorrectTypes.test.js.snap (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/__tests__/__snapshots__/babelPluginExtendTypes.test.js.snap (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/__tests__/__snapshots__/babelPluginIncludeDocs.test.js.snap (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/__tests__/__snapshots__/babelPluginPropTypesRelations.test.js.snap (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/__tests__/babelPluginCorrectTypes.test.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/__tests__/babelPluginExtendTypes.test.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/__tests__/babelPluginIncludeDocs.test.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/__tests__/babelPluginPropTypesRelations.test.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/babelPluginConfigDefaults.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/babelPluginCorrectTypes.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/babelPluginExtendTypes.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/babelPluginIncludeDocs.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/babelPluginPropTypesRelations.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/generateTypes/fetchPropertiesFromDocs.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/makeLibStyles.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/makeMainStyle.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/makePropertiesFile.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/makeReleaseVersion.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/prepareTemplates.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/styleFactory.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/themeFactory.js (100%) rename packages/dnb-eufemia/scripts/{prepub => prebuild}/tasks/transformUtils.js (100%) diff --git a/packages/dnb-eufemia/package.json b/packages/dnb-eufemia/package.json index 261d872db80..5a0e03458d3 100644 --- a/packages/dnb-eufemia/package.json +++ b/packages/dnb-eufemia/package.json @@ -18,8 +18,8 @@ "audit:ci": "yarn audit:ci:yarn", "audit:ci:npm": "audit-ci --config ./audit-ci.json --report-type summary", "audit:ci:yarn": "audit-ci --config ./audit-ci.json --package-manager=yarn --report-type summary", - "audit:ci:yarn-outdated": "babel-node ./scripts/prepub/audit/toOpt && audit-ci --config ./audit-ci.json --package-manager=yarn --report-type full && babel-node ./scripts/prepub/audit/toDev", - "build": "./scripts/prepub/local-prebuild.sh", + "audit:ci:yarn-outdated": "babel-node ./scripts/prebuild/audit/toOpt && audit-ci --config ./audit-ci.json --package-manager=yarn --report-type full && babel-node ./scripts/prebuild/audit/toDev", + "build": "./scripts/prebuild/local-prebuild.sh", "prebuild:ci": "yarn build:prebuild", "build:ci": "yarn prebuild:ci && yarn postbuild:ci && yarn publish:prepare", "postbuild:ci": "./scripts/release/postbuild.sh", @@ -31,17 +31,17 @@ "prebuild:figma:ci": "yarn figma", "postbuild:figma:ci": "yarn test:update && yarn test:screenshots:update && babel-node ./scripts/figma/tasks/commitChanges", "build:pack": "yarn build && yarn publish:prepare && cd ./build && yarn pack", - "build:prebuild": "babel-node ./scripts/prepub/runPrepub.js", - "build:resources": "babel-node ./scripts/prepub/resources/makeResourcesPackage.js", - "build:types": "./scripts/prepub/generate-types.sh", + "build:prebuild": "babel-node ./scripts/prebuild/runPrepub.js", + "build:resources": "babel-node ./scripts/prebuild/resources/makeResourcesPackage.js", + "build:types": "./scripts/prebuild/generate-types.sh", "build:types:definitions": "yarn tsc --project tsconfig.definitions.json", - "build:types:dev": "nodemon --exec 'babel-node ./scripts/prepub/generateTypes.js' --ext js --watch './src/**/*' --watch './scripts/**/*'", + "build:types:dev": "nodemon --exec 'babel-node ./scripts/prebuild/generateTypes.js' --ext js --watch './src/**/*' --watch './scripts/**/*'", "build:types:esm": "yarn tsc --project tsconfig.definitions.json --declarationDir ./build/esm --rootDir src", "build:umd": "./scripts/release/babel-umd.sh", "precommit": "yarn lint-staged", "dev:icons": "nodemon --exec 'babel-node ./scripts/tools/convertIcons' --ignore '/icons/**' --ignore '*.json'", - "dev:resources": "nodemon --exec 'babel-node ./scripts/prepub/resources/makeResourcesPackage.js' --ext js,html,json,css,scss --watch './build/style/**/*' --watch './scripts/**/*' --ignore '*.json'", - "dev:tasks": "nodemon --exec 'babel-node ./scripts/prepub/dev.js' --watch 'rollup.config.js' --ext js,html,json,css,scss --watch './src/components/**/*' --watch './src/style/**/*' --watch './scripts/**/*' --ignore '*.json'", + "dev:resources": "nodemon --exec 'babel-node ./scripts/prebuild/resources/makeResourcesPackage.js' --ext js,html,json,css,scss --watch './build/style/**/*' --watch './scripts/**/*' --ignore '*.json'", + "dev:tasks": "nodemon --exec 'babel-node ./scripts/prebuild/dev.js' --watch 'rollup.config.js' --ext js,html,json,css,scss --watch './src/components/**/*' --watch './src/style/**/*' --watch './scripts/**/*' --ignore '*.json'", "dev:umd": "nodemon --exec 'yarn build:umd && yarn build:copy' --ext js,html,json,css,scss --watch './src/**/*' --ignore './umd/*'", "figma": "babel-node ./scripts/figma/updateAll", "figma:dev:commit": "nodemon --exec 'babel-node ./scripts/figma/tasks/commitChanges'", @@ -58,7 +58,7 @@ "lint:lockfile": "yarn lockfile-lint --path ../../yarn.lock --type yarn --validate-https --allowed-hosts yarn github.com codeload.github.com", "lint:styles": "stylelint './src/**/*.{js,scss}'", "lint:styles:staged": "stylelint './{src,scripts}/**/*.{js,scss}'", - "make-properties": "babel-node ./scripts/prepub/makeProperties", + "make-properties": "babel-node ./scripts/prebuild/makeProperties", "publish:ci": "yarn publish:prepare && ./scripts/release/publish-release.sh", "publish:dry": "dotenv semantic-release --no-ci --dry-run", "publish:prepare": "./scripts/release/publish-prepare.sh", @@ -66,7 +66,7 @@ "skeleton:font": "nodemon --exec 'babel-node ./scripts/tools/createSkeletonFont.js'", "start": "start-storybook -s / -p 8002 --ci --no-release-notes --no-version-updates", "test": "jest", - "test:auto-generated-types": "TEST_POST_TYPES=1 jest --ci --rootDir ./scripts/prepub ./postTypeGeneration.test.js", + "test:auto-generated-types": "TEST_POST_TYPES=1 jest --ci --rootDir ./scripts/prebuild ./postTypeGeneration.test.js", "test:ci": "jest --ci", "test:screenshots": "jest --config=./jest.config.screenshots.js --forceExit --detectOpenHandles", "test:screenshots:ci": "jest --config=./jest.config.screenshots.js --ci --forceExit --detectOpenHandles", diff --git a/packages/dnb-eufemia/scripts/figma/FigmaAPI.js b/packages/dnb-eufemia/scripts/figma/FigmaAPI.js index 42911253096..b29db67777a 100644 --- a/packages/dnb-eufemia/scripts/figma/FigmaAPI.js +++ b/packages/dnb-eufemia/scripts/figma/FigmaAPI.js @@ -9,7 +9,7 @@ import { extractIconsAsPDF, } from './tasks/assetsExtractors' import { getFigmaDoc } from './helpers/docHelpers' -import { getRequiredBranchName } from './../prepub/commitToBranch' +import { getRequiredBranchName } from './../prebuild/commitToBranch' import { log, ErrorHandler } from '../lib' log.start('> Figma: Preparing for connecting to the Figma API ...') diff --git a/packages/dnb-eufemia/scripts/figma/tasks/commitChanges.js b/packages/dnb-eufemia/scripts/figma/tasks/commitChanges.js index 2ae33ef2501..94ca13b8781 100644 --- a/packages/dnb-eufemia/scripts/figma/tasks/commitChanges.js +++ b/packages/dnb-eufemia/scripts/figma/tasks/commitChanges.js @@ -3,7 +3,7 @@ * */ -import { commitToBranch } from '../../prepub/commitToBranch' +import { commitToBranch } from '../../prebuild/commitToBranch' if (require.main === module) { commitToBranch({ diff --git a/packages/dnb-eufemia/scripts/prepub/audit/prepareForAudit.js b/packages/dnb-eufemia/scripts/prebuild/audit/prepareForAudit.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/audit/prepareForAudit.js rename to packages/dnb-eufemia/scripts/prebuild/audit/prepareForAudit.js diff --git a/packages/dnb-eufemia/scripts/prepub/audit/toDev.js b/packages/dnb-eufemia/scripts/prebuild/audit/toDev.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/audit/toDev.js rename to packages/dnb-eufemia/scripts/prebuild/audit/toDev.js diff --git a/packages/dnb-eufemia/scripts/prepub/audit/toOpt.js b/packages/dnb-eufemia/scripts/prebuild/audit/toOpt.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/audit/toOpt.js rename to packages/dnb-eufemia/scripts/prebuild/audit/toOpt.js diff --git a/packages/dnb-eufemia/scripts/prepub/commitToBranch.js b/packages/dnb-eufemia/scripts/prebuild/commitToBranch.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/commitToBranch.js rename to packages/dnb-eufemia/scripts/prebuild/commitToBranch.js diff --git a/packages/dnb-eufemia/scripts/prepub/config/postcssConfig.js b/packages/dnb-eufemia/scripts/prebuild/config/postcssConfig.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/config/postcssConfig.js rename to packages/dnb-eufemia/scripts/prebuild/config/postcssConfig.js diff --git a/packages/dnb-eufemia/scripts/prepub/dev.js b/packages/dnb-eufemia/scripts/prebuild/dev.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/dev.js rename to packages/dnb-eufemia/scripts/prebuild/dev.js diff --git a/packages/dnb-eufemia/scripts/prepub/generate-types.sh b/packages/dnb-eufemia/scripts/prebuild/generate-types.sh similarity index 82% rename from packages/dnb-eufemia/scripts/prepub/generate-types.sh rename to packages/dnb-eufemia/scripts/prebuild/generate-types.sh index 806c72430dc..4c7bccc6f20 100755 --- a/packages/dnb-eufemia/scripts/prepub/generate-types.sh +++ b/packages/dnb-eufemia/scripts/prebuild/generate-types.sh @@ -4,7 +4,7 @@ set -e # Exit immediately if a command exits with a non-zero status. echo 'Generating type definitions ...' -babel-node ./scripts/prepub/generateTypes.js +babel-node ./scripts/prebuild/generateTypes.js yarn build:types:definitions yarn test:auto-generated-types diff --git a/packages/dnb-eufemia/scripts/prepub/generateTypes.js b/packages/dnb-eufemia/scripts/prebuild/generateTypes.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/generateTypes.js rename to packages/dnb-eufemia/scripts/prebuild/generateTypes.js diff --git a/packages/dnb-eufemia/scripts/prepub/index.js b/packages/dnb-eufemia/scripts/prebuild/index.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/index.js rename to packages/dnb-eufemia/scripts/prebuild/index.js diff --git a/packages/dnb-eufemia/scripts/prepub/local-prebuild.sh b/packages/dnb-eufemia/scripts/prebuild/local-prebuild.sh similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/local-prebuild.sh rename to packages/dnb-eufemia/scripts/prebuild/local-prebuild.sh diff --git a/packages/dnb-eufemia/scripts/prepub/makeProperties.js b/packages/dnb-eufemia/scripts/prebuild/makeProperties.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/makeProperties.js rename to packages/dnb-eufemia/scripts/prebuild/makeProperties.js diff --git a/packages/dnb-eufemia/scripts/prepub/resources/makeResourcesPackage.js b/packages/dnb-eufemia/scripts/prebuild/resources/makeResourcesPackage.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/resources/makeResourcesPackage.js rename to packages/dnb-eufemia/scripts/prebuild/resources/makeResourcesPackage.js diff --git a/packages/dnb-eufemia/scripts/prepub/runPrepub.js b/packages/dnb-eufemia/scripts/prebuild/runPrepub.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/runPrepub.js rename to packages/dnb-eufemia/scripts/prebuild/runPrepub.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/__tests__/__snapshots__/convertSvgToJsx.test.js.snap b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/__snapshots__/convertSvgToJsx.test.js.snap similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/__tests__/__snapshots__/convertSvgToJsx.test.js.snap rename to packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/__snapshots__/convertSvgToJsx.test.js.snap diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/__tests__/__snapshots__/generateTypes.test.js.snap b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/__snapshots__/generateTypes.test.js.snap similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/__tests__/__snapshots__/generateTypes.test.js.snap rename to packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/__snapshots__/generateTypes.test.js.snap diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/__tests__/convertSvgToJsx.test.js b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/convertSvgToJsx.test.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/__tests__/convertSvgToJsx.test.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/convertSvgToJsx.test.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/__tests__/generateTypes.test.js b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/generateTypes.test.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/__tests__/generateTypes.test.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/generateTypes.test.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/__tests__/makeLibStyles.test.js b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeLibStyles.test.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/__tests__/makeLibStyles.test.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeLibStyles.test.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/__tests__/makeMainStyle.test.js b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeMainStyle.test.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/__tests__/makeMainStyle.test.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeMainStyle.test.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/__tests__/makePropertiesFile.test.js b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makePropertiesFile.test.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/__tests__/makePropertiesFile.test.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makePropertiesFile.test.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/__tests__/makeReleaseVersion.test.js b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeReleaseVersion.test.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/__tests__/makeReleaseVersion.test.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeReleaseVersion.test.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/__tests__/postTypeGeneration.test.js b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/postTypeGeneration.test.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/__tests__/postTypeGeneration.test.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/postTypeGeneration.test.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/__tests__/test-files/bell.svg b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/test-files/bell.svg similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/__tests__/test-files/bell.svg rename to packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/test-files/bell.svg diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/__tests__/themeFactory.test.js b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/themeFactory.test.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/__tests__/themeFactory.test.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/themeFactory.test.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/convertSvgToJsx.js b/packages/dnb-eufemia/scripts/prebuild/tasks/convertSvgToJsx.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/convertSvgToJsx.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/convertSvgToJsx.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__mocks__/ClassComponent.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__mocks__/ClassComponent.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__mocks__/ClassComponent.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__mocks__/ClassComponent.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__mocks__/PrimaryComponent.d.ts b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__mocks__/PrimaryComponent.d.ts similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__mocks__/PrimaryComponent.d.ts rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__mocks__/PrimaryComponent.d.ts diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__mocks__/PrimaryComponent.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__mocks__/PrimaryComponent.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__mocks__/PrimaryComponent.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__mocks__/PrimaryComponent.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__mocks__/PrimaryComponent.md b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__mocks__/PrimaryComponent.md similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__mocks__/PrimaryComponent.md rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__mocks__/PrimaryComponent.md diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__mocks__/SecondaryComponent.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__mocks__/SecondaryComponent.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__mocks__/SecondaryComponent.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__mocks__/SecondaryComponent.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__mocks__/SecondaryComponent.md b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__mocks__/SecondaryComponent.md similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__mocks__/SecondaryComponent.md rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__mocks__/SecondaryComponent.md diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__mocks__/SpaceComponent.md b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__mocks__/SpaceComponent.md similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__mocks__/SpaceComponent.md rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__mocks__/SpaceComponent.md diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__snapshots__/babelPluginCorrectTypes.test.js.snap b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__snapshots__/babelPluginCorrectTypes.test.js.snap similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__snapshots__/babelPluginCorrectTypes.test.js.snap rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__snapshots__/babelPluginCorrectTypes.test.js.snap diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__snapshots__/babelPluginExtendTypes.test.js.snap b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__snapshots__/babelPluginExtendTypes.test.js.snap similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__snapshots__/babelPluginExtendTypes.test.js.snap rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__snapshots__/babelPluginExtendTypes.test.js.snap diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__snapshots__/babelPluginIncludeDocs.test.js.snap b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__snapshots__/babelPluginIncludeDocs.test.js.snap similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__snapshots__/babelPluginIncludeDocs.test.js.snap rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__snapshots__/babelPluginIncludeDocs.test.js.snap diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__snapshots__/babelPluginPropTypesRelations.test.js.snap b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__snapshots__/babelPluginPropTypesRelations.test.js.snap similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/__snapshots__/babelPluginPropTypesRelations.test.js.snap rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/__snapshots__/babelPluginPropTypesRelations.test.js.snap diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/babelPluginCorrectTypes.test.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/babelPluginCorrectTypes.test.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/babelPluginCorrectTypes.test.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/babelPluginCorrectTypes.test.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/babelPluginExtendTypes.test.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/babelPluginExtendTypes.test.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/babelPluginExtendTypes.test.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/babelPluginExtendTypes.test.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/babelPluginIncludeDocs.test.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/babelPluginIncludeDocs.test.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/babelPluginIncludeDocs.test.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/babelPluginIncludeDocs.test.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/babelPluginPropTypesRelations.test.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/babelPluginPropTypesRelations.test.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/__tests__/babelPluginPropTypesRelations.test.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/__tests__/babelPluginPropTypesRelations.test.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/babelPluginConfigDefaults.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginConfigDefaults.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/babelPluginConfigDefaults.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginConfigDefaults.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/babelPluginCorrectTypes.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginCorrectTypes.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/babelPluginCorrectTypes.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginCorrectTypes.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/babelPluginExtendTypes.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginExtendTypes.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/babelPluginExtendTypes.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginExtendTypes.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/babelPluginIncludeDocs.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginIncludeDocs.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/babelPluginIncludeDocs.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginIncludeDocs.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/babelPluginPropTypesRelations.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginPropTypesRelations.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/babelPluginPropTypesRelations.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/babelPluginPropTypesRelations.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/fetchPropertiesFromDocs.js b/packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/fetchPropertiesFromDocs.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/generateTypes/fetchPropertiesFromDocs.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/generateTypes/fetchPropertiesFromDocs.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/makeLibStyles.js b/packages/dnb-eufemia/scripts/prebuild/tasks/makeLibStyles.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/makeLibStyles.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/makeLibStyles.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/makeMainStyle.js b/packages/dnb-eufemia/scripts/prebuild/tasks/makeMainStyle.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/makeMainStyle.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/makeMainStyle.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/makePropertiesFile.js b/packages/dnb-eufemia/scripts/prebuild/tasks/makePropertiesFile.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/makePropertiesFile.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/makePropertiesFile.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/makeReleaseVersion.js b/packages/dnb-eufemia/scripts/prebuild/tasks/makeReleaseVersion.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/makeReleaseVersion.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/makeReleaseVersion.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/prepareTemplates.js b/packages/dnb-eufemia/scripts/prebuild/tasks/prepareTemplates.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/prepareTemplates.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/prepareTemplates.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/styleFactory.js b/packages/dnb-eufemia/scripts/prebuild/tasks/styleFactory.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/styleFactory.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/styleFactory.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/themeFactory.js b/packages/dnb-eufemia/scripts/prebuild/tasks/themeFactory.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/themeFactory.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/themeFactory.js diff --git a/packages/dnb-eufemia/scripts/prepub/tasks/transformUtils.js b/packages/dnb-eufemia/scripts/prebuild/tasks/transformUtils.js similarity index 100% rename from packages/dnb-eufemia/scripts/prepub/tasks/transformUtils.js rename to packages/dnb-eufemia/scripts/prebuild/tasks/transformUtils.js diff --git a/packages/dnb-eufemia/scripts/tools/convertIcons.js b/packages/dnb-eufemia/scripts/tools/convertIcons.js index 64b04f653c8..30948b26070 100644 --- a/packages/dnb-eufemia/scripts/tools/convertIcons.js +++ b/packages/dnb-eufemia/scripts/tools/convertIcons.js @@ -4,5 +4,5 @@ * */ -import convertSvgToJsx from '../prepub/tasks/convertSvgToJsx' +import convertSvgToJsx from '../prebuild/tasks/convertSvgToJsx' convertSvgToJsx({ preventDelete: true }) diff --git a/packages/dnb-eufemia/scripts/tools/convertWebStyles.js b/packages/dnb-eufemia/scripts/tools/convertWebStyles.js index 848b676c037..59eeea1e2d2 100644 --- a/packages/dnb-eufemia/scripts/tools/convertWebStyles.js +++ b/packages/dnb-eufemia/scripts/tools/convertWebStyles.js @@ -4,5 +4,5 @@ * */ -import makeEveryComponentStyle from '../prepub/tasks/makeEveryComponentStyle' +import makeEveryComponentStyle from '../prebuild/tasks/makeEveryComponentStyle' makeEveryComponentStyle({ preventDelete: true }) diff --git a/packages/dnb-eufemia/src/core/jest/jestPuppeteerTeardown.js b/packages/dnb-eufemia/src/core/jest/jestPuppeteerTeardown.js index 36aa5de2870..2aa251581fd 100644 --- a/packages/dnb-eufemia/src/core/jest/jestPuppeteerTeardown.js +++ b/packages/dnb-eufemia/src/core/jest/jestPuppeteerTeardown.js @@ -13,7 +13,7 @@ const { isCI } = require('repo-utils') import { commitToBranch, getCurrentBranchName, -} from '../../../scripts/prepub/commitToBranch' +} from '../../../scripts/prebuild/commitToBranch' const { DIR, testScreenshotOnPort } = require('./jestSetupScreenshots').config From b08cb951cc812fbbedfdb01470b059e0ed5bca22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20H=C3=B8egh?= Date: Wed, 16 Feb 2022 15:37:22 +0100 Subject: [PATCH 10/10] Rename folder from release to postbuild --- .../dnb-design-system-portal/scripts/version.js | 2 +- packages/dnb-eufemia/jest.config.js | 2 +- packages/dnb-eufemia/package.json | 16 ++++++++-------- .../__tests__/__mocks__/version.mock | 0 .../__tests__/postbuild.test.js | 0 .../__tests__/prepareForRelease.test.js | 0 .../scripts/{release => postbuild}/babel-cjs.sh | 4 ++-- .../scripts/{release => postbuild}/babel-es.sh | 4 ++-- .../scripts/{release => postbuild}/babel-esm.sh | 4 ++-- .../scripts/{release => postbuild}/babel-umd.sh | 0 .../copy-build-artifacts.sh | 2 +- .../{release => postbuild}/copyFinaleBuild.js | 0 .../scripts/{release => postbuild}/copyStyles.js | 0 .../copyTypeScriptFiles.js | 0 .../getNextReleaseVersion.js | 4 ++-- .../scripts/{release => postbuild}/postbuild.sh | 2 +- .../{release => postbuild}/prepareForRelease.js | 0 .../{release => postbuild}/publish-prepare.sh | 4 ++-- .../{release => postbuild}/publish-release.sh | 0 .../tasks/__tests__/makeReleaseVersion.test.js | 6 +++--- .../scripts/prebuild/tasks/makeReleaseVersion.js | 2 +- 21 files changed, 26 insertions(+), 26 deletions(-) rename packages/dnb-eufemia/scripts/{release => postbuild}/__tests__/__mocks__/version.mock (100%) rename packages/dnb-eufemia/scripts/{release => postbuild}/__tests__/postbuild.test.js (100%) rename packages/dnb-eufemia/scripts/{release => postbuild}/__tests__/prepareForRelease.test.js (100%) rename packages/dnb-eufemia/scripts/{release => postbuild}/babel-cjs.sh (80%) rename packages/dnb-eufemia/scripts/{release => postbuild}/babel-es.sh (77%) rename packages/dnb-eufemia/scripts/{release => postbuild}/babel-esm.sh (77%) rename packages/dnb-eufemia/scripts/{release => postbuild}/babel-umd.sh (100%) rename packages/dnb-eufemia/scripts/{release => postbuild}/copy-build-artifacts.sh (84%) rename packages/dnb-eufemia/scripts/{release => postbuild}/copyFinaleBuild.js (100%) rename packages/dnb-eufemia/scripts/{release => postbuild}/copyStyles.js (100%) rename packages/dnb-eufemia/scripts/{release => postbuild}/copyTypeScriptFiles.js (100%) rename packages/dnb-eufemia/scripts/{release => postbuild}/getNextReleaseVersion.js (87%) rename packages/dnb-eufemia/scripts/{release => postbuild}/postbuild.sh (85%) rename packages/dnb-eufemia/scripts/{release => postbuild}/prepareForRelease.js (100%) rename packages/dnb-eufemia/scripts/{release => postbuild}/publish-prepare.sh (64%) rename packages/dnb-eufemia/scripts/{release => postbuild}/publish-release.sh (100%) diff --git a/packages/dnb-design-system-portal/scripts/version.js b/packages/dnb-design-system-portal/scripts/version.js index caa0ba62d96..e6fbf88784a 100644 --- a/packages/dnb-design-system-portal/scripts/version.js +++ b/packages/dnb-design-system-portal/scripts/version.js @@ -8,7 +8,7 @@ const path = require('path') const { isCI } = require('ci-info') const { getNextReleaseVersion, -} = require('@dnb/eufemia/scripts/release/getNextReleaseVersion') +} = require('@dnb/eufemia/scripts/postbuild/getNextReleaseVersion') const init = async () => { if (!isCI) { diff --git a/packages/dnb-eufemia/jest.config.js b/packages/dnb-eufemia/jest.config.js index d0378c18c7d..ffcc81c8537 100644 --- a/packages/dnb-eufemia/jest.config.js +++ b/packages/dnb-eufemia/jest.config.js @@ -4,7 +4,7 @@ const config = { testRegex: '(/__tests__/\\.js|(\\.|/)(test|spec))\\.(js|jsx|ts|tsx)?$', modulePathIgnorePatterns: [ 'not_in_use', - '/scripts/release/*', + '/scripts/postbuild/*', '/build/', '/assets/', '/stories/', diff --git a/packages/dnb-eufemia/package.json b/packages/dnb-eufemia/package.json index 5a0e03458d3..251aedc587e 100644 --- a/packages/dnb-eufemia/package.json +++ b/packages/dnb-eufemia/package.json @@ -22,12 +22,12 @@ "build": "./scripts/prebuild/local-prebuild.sh", "prebuild:ci": "yarn build:prebuild", "build:ci": "yarn prebuild:ci && yarn postbuild:ci && yarn publish:prepare", - "postbuild:ci": "./scripts/release/postbuild.sh", - "build:cjs": "./scripts/release/babel-cjs.sh", + "postbuild:ci": "./scripts/postbuild/postbuild.sh", + "build:cjs": "./scripts/postbuild/babel-cjs.sh", "build:clean": "rm -rf build/**", - "build:copy": "./scripts/release/copy-build-artifacts.sh", - "build:es": "./scripts/release/babel-es.sh", - "build:esm": "./scripts/release/babel-esm.sh", + "build:copy": "./scripts/postbuild/copy-build-artifacts.sh", + "build:es": "./scripts/postbuild/babel-es.sh", + "build:esm": "./scripts/postbuild/babel-esm.sh", "prebuild:figma:ci": "yarn figma", "postbuild:figma:ci": "yarn test:update && yarn test:screenshots:update && babel-node ./scripts/figma/tasks/commitChanges", "build:pack": "yarn build && yarn publish:prepare && cd ./build && yarn pack", @@ -37,7 +37,7 @@ "build:types:definitions": "yarn tsc --project tsconfig.definitions.json", "build:types:dev": "nodemon --exec 'babel-node ./scripts/prebuild/generateTypes.js' --ext js --watch './src/**/*' --watch './scripts/**/*'", "build:types:esm": "yarn tsc --project tsconfig.definitions.json --declarationDir ./build/esm --rootDir src", - "build:umd": "./scripts/release/babel-umd.sh", + "build:umd": "./scripts/postbuild/babel-umd.sh", "precommit": "yarn lint-staged", "dev:icons": "nodemon --exec 'babel-node ./scripts/tools/convertIcons' --ignore '/icons/**' --ignore '*.json'", "dev:resources": "nodemon --exec 'babel-node ./scripts/prebuild/resources/makeResourcesPackage.js' --ext js,html,json,css,scss --watch './build/style/**/*' --watch './scripts/**/*' --ignore '*.json'", @@ -59,9 +59,9 @@ "lint:styles": "stylelint './src/**/*.{js,scss}'", "lint:styles:staged": "stylelint './{src,scripts}/**/*.{js,scss}'", "make-properties": "babel-node ./scripts/prebuild/makeProperties", - "publish:ci": "yarn publish:prepare && ./scripts/release/publish-release.sh", + "publish:ci": "yarn publish:prepare && ./scripts/postbuild/publish-release.sh", "publish:dry": "dotenv semantic-release --no-ci --dry-run", - "publish:prepare": "./scripts/release/publish-prepare.sh", + "publish:prepare": "./scripts/postbuild/publish-prepare.sh", "reset": "rm -rf ./node_modules ./components ./elements ./es ./icons ./extensions ./shared ./style ./umd", "skeleton:font": "nodemon --exec 'babel-node ./scripts/tools/createSkeletonFont.js'", "start": "start-storybook -s / -p 8002 --ci --no-release-notes --no-version-updates", diff --git a/packages/dnb-eufemia/scripts/release/__tests__/__mocks__/version.mock b/packages/dnb-eufemia/scripts/postbuild/__tests__/__mocks__/version.mock similarity index 100% rename from packages/dnb-eufemia/scripts/release/__tests__/__mocks__/version.mock rename to packages/dnb-eufemia/scripts/postbuild/__tests__/__mocks__/version.mock diff --git a/packages/dnb-eufemia/scripts/release/__tests__/postbuild.test.js b/packages/dnb-eufemia/scripts/postbuild/__tests__/postbuild.test.js similarity index 100% rename from packages/dnb-eufemia/scripts/release/__tests__/postbuild.test.js rename to packages/dnb-eufemia/scripts/postbuild/__tests__/postbuild.test.js diff --git a/packages/dnb-eufemia/scripts/release/__tests__/prepareForRelease.test.js b/packages/dnb-eufemia/scripts/postbuild/__tests__/prepareForRelease.test.js similarity index 100% rename from packages/dnb-eufemia/scripts/release/__tests__/prepareForRelease.test.js rename to packages/dnb-eufemia/scripts/postbuild/__tests__/prepareForRelease.test.js diff --git a/packages/dnb-eufemia/scripts/release/babel-cjs.sh b/packages/dnb-eufemia/scripts/postbuild/babel-cjs.sh similarity index 80% rename from packages/dnb-eufemia/scripts/release/babel-cjs.sh rename to packages/dnb-eufemia/scripts/postbuild/babel-cjs.sh index 334f5ad19f9..6a42c9d9299 100755 --- a/packages/dnb-eufemia/scripts/release/babel-cjs.sh +++ b/packages/dnb-eufemia/scripts/postbuild/babel-cjs.sh @@ -19,8 +19,8 @@ echo 'Building cjs bundle done!' echo 'Copy additional files to cjs ...' -OUT_DIR=./build/cjs babel-node ./scripts/release/copyTypeScriptFiles.js -OUT_DIR=./build/cjs babel-node ./scripts/release/copyStyles.js +OUT_DIR=./build/cjs babel-node ./scripts/postbuild/copyTypeScriptFiles.js +OUT_DIR=./build/cjs babel-node ./scripts/postbuild/copyStyles.js echo 'Copy extra cjs package.json ...' diff --git a/packages/dnb-eufemia/scripts/release/babel-es.sh b/packages/dnb-eufemia/scripts/postbuild/babel-es.sh similarity index 77% rename from packages/dnb-eufemia/scripts/release/babel-es.sh rename to packages/dnb-eufemia/scripts/postbuild/babel-es.sh index 674e07d871b..a58c4db79d3 100755 --- a/packages/dnb-eufemia/scripts/release/babel-es.sh +++ b/packages/dnb-eufemia/scripts/postbuild/babel-es.sh @@ -19,5 +19,5 @@ echo 'Building es bundle done!' echo 'Copy additional files to es ...' -OUT_DIR=./build/es babel-node ./scripts/release/copyTypeScriptFiles.js -OUT_DIR=./build/es babel-node ./scripts/release/copyStyles.js +OUT_DIR=./build/es babel-node ./scripts/postbuild/copyTypeScriptFiles.js +OUT_DIR=./build/es babel-node ./scripts/postbuild/copyStyles.js diff --git a/packages/dnb-eufemia/scripts/release/babel-esm.sh b/packages/dnb-eufemia/scripts/postbuild/babel-esm.sh similarity index 77% rename from packages/dnb-eufemia/scripts/release/babel-esm.sh rename to packages/dnb-eufemia/scripts/postbuild/babel-esm.sh index ac4342e4091..153b9f37135 100755 --- a/packages/dnb-eufemia/scripts/release/babel-esm.sh +++ b/packages/dnb-eufemia/scripts/postbuild/babel-esm.sh @@ -19,5 +19,5 @@ echo 'Building esm bundle done!' echo 'Copy additional files to esm ...' -OUT_DIR=./build/esm babel-node ./scripts/release/copyTypeScriptFiles.js -OUT_DIR=./build/esm babel-node ./scripts/release/copyStyles.js +OUT_DIR=./build/esm babel-node ./scripts/postbuild/copyTypeScriptFiles.js +OUT_DIR=./build/esm babel-node ./scripts/postbuild/copyStyles.js diff --git a/packages/dnb-eufemia/scripts/release/babel-umd.sh b/packages/dnb-eufemia/scripts/postbuild/babel-umd.sh similarity index 100% rename from packages/dnb-eufemia/scripts/release/babel-umd.sh rename to packages/dnb-eufemia/scripts/postbuild/babel-umd.sh diff --git a/packages/dnb-eufemia/scripts/release/copy-build-artifacts.sh b/packages/dnb-eufemia/scripts/postbuild/copy-build-artifacts.sh similarity index 84% rename from packages/dnb-eufemia/scripts/release/copy-build-artifacts.sh rename to packages/dnb-eufemia/scripts/postbuild/copy-build-artifacts.sh index b64e2fdc1ff..ef6acbee601 100755 --- a/packages/dnb-eufemia/scripts/release/copy-build-artifacts.sh +++ b/packages/dnb-eufemia/scripts/postbuild/copy-build-artifacts.sh @@ -8,6 +8,6 @@ rm -rf build/**/{__tests__,cjs} cp -r ./assets/ ./build/assets cp .npmignore ./build/.npmignore cp README README.md LICENSE ./build -babel-node ./scripts/release/copyFinaleBuild.js +babel-node ./scripts/postbuild/copyFinaleBuild.js echo 'Copy build artifacts done!' \ No newline at end of file diff --git a/packages/dnb-eufemia/scripts/release/copyFinaleBuild.js b/packages/dnb-eufemia/scripts/postbuild/copyFinaleBuild.js similarity index 100% rename from packages/dnb-eufemia/scripts/release/copyFinaleBuild.js rename to packages/dnb-eufemia/scripts/postbuild/copyFinaleBuild.js diff --git a/packages/dnb-eufemia/scripts/release/copyStyles.js b/packages/dnb-eufemia/scripts/postbuild/copyStyles.js similarity index 100% rename from packages/dnb-eufemia/scripts/release/copyStyles.js rename to packages/dnb-eufemia/scripts/postbuild/copyStyles.js diff --git a/packages/dnb-eufemia/scripts/release/copyTypeScriptFiles.js b/packages/dnb-eufemia/scripts/postbuild/copyTypeScriptFiles.js similarity index 100% rename from packages/dnb-eufemia/scripts/release/copyTypeScriptFiles.js rename to packages/dnb-eufemia/scripts/postbuild/copyTypeScriptFiles.js diff --git a/packages/dnb-eufemia/scripts/release/getNextReleaseVersion.js b/packages/dnb-eufemia/scripts/postbuild/getNextReleaseVersion.js similarity index 87% rename from packages/dnb-eufemia/scripts/release/getNextReleaseVersion.js rename to packages/dnb-eufemia/scripts/postbuild/getNextReleaseVersion.js index f13d8eae3af..d5fe853e853 100644 --- a/packages/dnb-eufemia/scripts/release/getNextReleaseVersion.js +++ b/packages/dnb-eufemia/scripts/postbuild/getNextReleaseVersion.js @@ -4,8 +4,8 @@ */ // When on a "release" branch: -// run: yarn nodemon --exec 'babel-node ./scripts/release/getNextReleaseVersion.js' --ext js --watch './scripts/**/*' -// run (mjs): yarn nodemon --exec 'node --experimental-import-meta-resolve ./scripts/release/getNextReleaseVersion.mjs' --ext mjs --watch './scripts/**/*' +// run: yarn nodemon --exec 'babel-node ./scripts/postbuild/getNextReleaseVersion.js' --ext js --watch './scripts/**/*' +// run (mjs): yarn nodemon --exec 'node --experimental-import-meta-resolve ./scripts/postbuild/getNextReleaseVersion.mjs' --ext mjs --watch './scripts/**/*' const { exec } = require('child_process') const getBranchName = require('current-git-branch') diff --git a/packages/dnb-eufemia/scripts/release/postbuild.sh b/packages/dnb-eufemia/scripts/postbuild/postbuild.sh similarity index 85% rename from packages/dnb-eufemia/scripts/release/postbuild.sh rename to packages/dnb-eufemia/scripts/postbuild/postbuild.sh index 7fc70f20f5b..22a05ca97d7 100755 --- a/packages/dnb-eufemia/scripts/release/postbuild.sh +++ b/packages/dnb-eufemia/scripts/postbuild/postbuild.sh @@ -15,6 +15,6 @@ yarn prettier:other echo 'Testing the postbuild ...' -jest --ci --rootDir ./scripts/release ./postbuild.test.js +jest --ci --rootDir ./scripts/postbuild ./postbuild.test.js echo 'Postbuild done!' diff --git a/packages/dnb-eufemia/scripts/release/prepareForRelease.js b/packages/dnb-eufemia/scripts/postbuild/prepareForRelease.js similarity index 100% rename from packages/dnb-eufemia/scripts/release/prepareForRelease.js rename to packages/dnb-eufemia/scripts/postbuild/prepareForRelease.js diff --git a/packages/dnb-eufemia/scripts/release/publish-prepare.sh b/packages/dnb-eufemia/scripts/postbuild/publish-prepare.sh similarity index 64% rename from packages/dnb-eufemia/scripts/release/publish-prepare.sh rename to packages/dnb-eufemia/scripts/postbuild/publish-prepare.sh index 70ea41fb985..160904921b8 100755 --- a/packages/dnb-eufemia/scripts/release/publish-prepare.sh +++ b/packages/dnb-eufemia/scripts/postbuild/publish-prepare.sh @@ -4,10 +4,10 @@ set -e # Exit immediately if a command exits with a non-zero status. echo 'Prepare before publish has started ...' -babel-node ./scripts/release/prepareForRelease.js +babel-node ./scripts/postbuild/prepareForRelease.js echo 'Testing the postbuild before publish ...' -jest --ci --rootDir ./scripts/release ./prepareForRelease.test.js +jest --ci --rootDir ./scripts/postbuild ./prepareForRelease.test.js echo 'Prepare before publish is done!' diff --git a/packages/dnb-eufemia/scripts/release/publish-release.sh b/packages/dnb-eufemia/scripts/postbuild/publish-release.sh similarity index 100% rename from packages/dnb-eufemia/scripts/release/publish-release.sh rename to packages/dnb-eufemia/scripts/postbuild/publish-release.sh diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeReleaseVersion.test.js b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeReleaseVersion.test.js index 71ee95555ea..93adff2c0c4 100644 --- a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeReleaseVersion.test.js +++ b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/makeReleaseVersion.test.js @@ -6,11 +6,11 @@ import fs from 'fs-extra' import { makeReleaseVersion } from '../makeReleaseVersion' import * as getBranchName from 'current-git-branch' -import * as getNextReleaseVersion from '../../../release/getNextReleaseVersion' +import * as getNextReleaseVersion from '../../../postbuild/getNextReleaseVersion' -jest.mock('../../../release/getNextReleaseVersion', () => { +jest.mock('../../../postbuild/getNextReleaseVersion', () => { return { - ...jest.requireActual('../../../release/getNextReleaseVersion'), + ...jest.requireActual('../../../postbuild/getNextReleaseVersion'), getNextReleaseVersion: jest.fn().mockResolvedValue(), } }) diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/makeReleaseVersion.js b/packages/dnb-eufemia/scripts/prebuild/tasks/makeReleaseVersion.js index ca25297c476..e8ada506925 100644 --- a/packages/dnb-eufemia/scripts/prebuild/tasks/makeReleaseVersion.js +++ b/packages/dnb-eufemia/scripts/prebuild/tasks/makeReleaseVersion.js @@ -9,7 +9,7 @@ import getBranchName from 'current-git-branch' import { getNextReleaseVersion, releaseBranches, -} from '../../release/getNextReleaseVersion' +} from '../../postbuild/getNextReleaseVersion' export async function makeReleaseVersion() { const branchName = getBranchName()