diff --git a/.circleci/config.yml b/.circleci/config.yml index 4824d0d0368..57becee8577 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -59,6 +59,10 @@ jobs: paths: - ~/.cache/yarn + - run: yarn audit-ci + - run: yarn lint-ci + - run: yarn test-ci + - run: name: Prepublish the ui-lib and commit changes command: yarn prepublish-ci @@ -93,6 +97,10 @@ jobs: paths: - ~/.cache/yarn + - run: yarn audit-ci + - run: yarn lint-ci + - run: yarn test-ci + - run: name: Prepublish the ui-lib to use it in "build-ci" command: yarn prepublish-ci diff --git a/.drone.yml b/.drone.yml index be8d43ad2ee..f2d263db443 100644 --- a/.drone.yml +++ b/.drone.yml @@ -42,6 +42,7 @@ steps: - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0 - export PATH="$HOME/.yarn/bin:$PATH" - yarn install + - yarn audit-ci - yarn lint-ci - yarn test-ci - yarn prepublish-ci @@ -74,6 +75,7 @@ steps: - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0 - export PATH="$HOME/.yarn/bin:$PATH" - yarn install + - yarn audit-ci - yarn lint-ci - yarn test-ci - yarn prepublish-ci diff --git a/.travis.yml b/.travis.yml index 590e4d876a3..248e4b0fb4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,11 +31,11 @@ jobs: - stage: deploy-preview name: Build a portal preview - script: yarn prepublish-ci && yarn build-ci + script: yarn audit-ci && yarn lint-ci && yarn test-ci && yarn prepublish-ci && yarn build-ci - stage: deploy-release name: Deploy portal and make eventually NPM release - script: yarn prepublish-ci && yarn build-ci && yarn deploy-ci && yarn publish-ci + script: yarn audit-ci && yarn lint-ci && yarn test-ci && yarn prepublish-ci && yarn build-ci && yarn deploy-ci && yarn publish-ci stages: - name: test diff --git a/package.json b/package.json index a8c6f87b6ec..4126f141c79 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,19 @@ ], "main": "./packages/dnb-ui-lib/index.js", "scripts": { - "prepublish-ci": "cd ./packages/dnb-ui-lib && yarn prepublish-ci && cd -", - "precommit": "cd ./packages/dnb-ui-lib && yarn precommit && cd - && cd ./packages/dnb-design-system-portal && yarn precommit && cd -", - "build-ci": "cd ./packages/dnb-design-system-portal && yarn build-ci && cd -", - "deploy-ci": "cd ./packages/dnb-design-system-portal && yarn deploy-ci && cd -", - "start": "cd ./packages/dnb-design-system-portal && yarn start && cd -", - "lint-ci": "cd ./packages/dnb-ui-lib && yarn lint-ci && cd - && cd ./packages/dnb-design-system-portal && yarn lint-ci && cd -", - "publish-ci": "cd ./packages/dnb-ui-lib && yarn publish-ci && cd -", + "audit-ci": "yarn workspace dnb-ui-lib audit-ci", + "prepublish-ci": "yarn workspace dnb-ui-lib prepublish-ci", + "precommit": "yarn workspace dnb-ui-lib precommit && yarn workspace dnb-design-system-portal precommit", + "build-ci": "yarn workspace dnb-design-system-portal build-ci", + "deploy-ci": "yarn workspace dnb-design-system-portal deploy-ci", + "start": "yarn workspace dnb-design-system-portal start", + "lint-ci": "yarn workspace dnb-ui-lib lint-ci && yarn workspace dnb-design-system-portal lint-ci", + "publish-ci": "yarn workspace dnb-ui-lib publish-ci", "reset": "rm -rf ./node_modules && rm yarn.lock && rm -rf ./packages/dnb-ui-lib/node_modules && rm -rf ./packages/dnb-design-system-portal/node_modules && yarn install", - "build": "cd ./packages/dnb-ui-lib && yarn build && cd - && cd ./packages/dnb-design-system-portal && yarn build && cd -", - "test": "cd ./packages/dnb-ui-lib && yarn test && cd -", - "test:update": "cd ./packages/dnb-ui-lib && yarn test:update && cd -", - "test-ci": "cd ./packages/dnb-ui-lib && yarn test-ci && cd - && cd ./packages/dnb-design-system-portal && yarn test-ci && cd -", + "build": "yarn workspace dnb-ui-lib build && yarn workspace dnb-design-system-portal build", + "test": "yarn workspace dnb-ui-lib test", + "test:update": "yarn workspace dnb-ui-lib test:update", + "test-ci": "yarn workspace dnb-ui-lib test-ci && yarn workspace dnb-design-system-portal test-ci", "test-ci:update": "yarn test-ci --updateSnapshot" }, "devDependencies": { diff --git a/packages/dnb-ui-lib/package.json b/packages/dnb-ui-lib/package.json index 25f189272d3..0b027e28edb 100644 --- a/packages/dnb-ui-lib/package.json +++ b/packages/dnb-ui-lib/package.json @@ -15,6 +15,7 @@ "main": "index.js", "scripts": { "post-build": "yarn prettier:other", + "audit-ci": "audit-ci --high --package-manager=yarn", "build": "yarn prepublish:local && yarn post-build", "cdn": "live-server --no-browser --cors --port=8081", "precommit": "yarn lint-staged", @@ -92,6 +93,7 @@ "@storybook/addon-options": "^4.1.11", "@storybook/react": "^4.1.11", "@svgr/core": "^4.1.0", + "audit-ci": "^1.3.0", "babel-core": "7.0.0-bridge.0", "babel-jest": "^23.6.0", "babel-loader": "^8.0.5", diff --git a/yarn.lock b/yarn.lock index 7109d25072c..7518d8d887a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2875,6 +2875,15 @@ atob@^2.1.1: resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== +audit-ci@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/audit-ci/-/audit-ci-1.3.0.tgz#c255dcfe56c7cde555d07d7370aff826a3aa412d" + integrity sha512-NK+m2M8gV6ud0euq3vuFj6/o1IPTgu5TkLl+fUkuYmqBv4X4NZbPTbEqZpboWmWK6WKo+3nEN8E2f6VpuK1q8w== + dependencies: + cross-spawn "6.0.5" + semver "5.6.0" + yargs "12.0.2" + author-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/author-regex/-/author-regex-1.0.0.tgz#d08885be6b9bbf9439fe087c76287245f0a81450" @@ -18697,7 +18706,7 @@ semver-truncate@^1.1.2: dependencies: semver "^5.3.0" -"semver@2 >=2.2.1 || 3.x || 4 || 5", "semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", "semver@^2.3.0 || 3.x || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: +"semver@2 >=2.2.1 || 3.x || 4 || 5", "semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@5.6.0, "semver@^2.3.0 || 3.x || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: version "5.6.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==