diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index 02142e51438ae..af47945465e88 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -55,7 +55,7 @@ jobs: with: path: ./* key: ${{ github.sha }} - - run: ./check-pre-compiled.sh + - run: ./scripts/check-pre-compiled.sh if: ${{needs.build.outputs.docsChange != 'docs only change'}} testUnit: @@ -146,7 +146,7 @@ jobs: path: ./* key: ${{ github.sha }} - - run: bash ./test-pnp.sh + - run: bash ./scripts/test-pnp.sh if: ${{needs.build.outputs.docsChange != 'docs only change'}} testsPass: @@ -251,7 +251,7 @@ jobs: path: ./* key: ${{ github.sha }} - - run: ./publish-release.sh + - run: ./scripts/publish-release.sh prStats: name: Release Stats @@ -263,7 +263,7 @@ jobs: with: path: ./* key: ${{ github.sha }} - - run: ./release-stats.sh + - run: ./scripts/release-stats.sh - uses: ./.github/actions/next-stats-action env: PR_STATS_COMMENT_TOKEN: ${{ secrets.PR_STATS_COMMENT_TOKEN }} diff --git a/package.json b/package.json index f0fa1bf9c2e7e..d1723b7eb8807 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "publish-canary": "lerna version prerelease --preid canary --force-publish && release --pre --skip-questions", "publish-stable": "lerna version --force-publish", "lint-staged": "lint-staged", + "next-with-deps": "./scripts/next-with-deps.sh", "next": "node --trace-deprecation --enable-source-maps packages/next/dist/bin/next", "debug": "node --inspect packages/next/dist/bin/next" }, diff --git a/check-examples.sh b/scripts/check-examples.sh similarity index 95% rename from check-examples.sh rename to scripts/check-examples.sh index 03dcbb6f638eb..2cd58ee6358cf 100755 --- a/check-examples.sh +++ b/scripts/check-examples.sh @@ -1,7 +1,5 @@ #!/bin/bash -cd `dirname $0` - for folder in examples/* ; do cp -n packages/create-next-app/templates/default/gitignore $folder/.gitignore; if [ -f "$folder/package.json" ]; then diff --git a/check-pre-compiled.sh b/scripts/check-pre-compiled.sh similarity index 100% rename from check-pre-compiled.sh rename to scripts/check-pre-compiled.sh diff --git a/scripts/next-with-deps.sh b/scripts/next-with-deps.sh new file mode 100755 index 0000000000000..39279282b1c16 --- /dev/null +++ b/scripts/next-with-deps.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +START_DIR=$PWD +# gets last argument which should be the project dir +for PROJECT_DIR in $@;do :;done + +if [ -z $PROJECT_DIR ];then + echo "No project directory provided, exiting..." + exit 1; +fi; + +if [ ! -d $PROJECT_DIR ];then + echo "Invalid project directory provided, exiting..." + exit 1; +fi; + +if [ $PROJECT_DIR == $PWD ] || [ "$PROJECT_DIR" == "." ];then + echo "Project directory can not be root, exiting..." + exit 1; +fi; + +CONFLICTING_DEPS=("react" "react-dom" "styled-jsx" "next") + +for dep in ${CONFLICTING_DEPS[@]};do + if [ -d "$PROJECT_DIR/node_modules/$dep" ];then + HAS_CONFLICTING_DEP="yup" + fi; +done + +if [ ! -z $HAS_CONFLICTING_DEP ] || [ ! -d "$PROJECT_DIR/node_modules" ];then + cd $PROJECT_DIR + yarn install + for dep in ${CONFLICTING_DEPS[@]};do + rm -rf node_modules/$dep + done +fi + +cd $START_DIR +yarn next $@ diff --git a/publish-release.sh b/scripts/publish-release.sh similarity index 100% rename from publish-release.sh rename to scripts/publish-release.sh diff --git a/release-stats.sh b/scripts/release-stats.sh similarity index 100% rename from release-stats.sh rename to scripts/release-stats.sh diff --git a/test-pnp.sh b/scripts/test-pnp.sh similarity index 100% rename from test-pnp.sh rename to scripts/test-pnp.sh diff --git a/skip-docs-change.js b/skip-docs-change.js index c1a97d5d9de96..42bffb1f08cae 100644 --- a/skip-docs-change.js +++ b/skip-docs-change.js @@ -3,7 +3,16 @@ const { exec: execOrig, spawn } = require('child_process') const exec = promisify(execOrig) -const DOCS_FOLDERS = ['bench', 'docs', 'errors', 'examples'] +const DOCS_FOLDERS = [ + 'bench', + 'docs', + 'errors', + 'examples', + 'UPGRADING.md', + 'contributing.md', + 'CODE_OF_CONDUCT.md', + 'readme.md', +] async function main() { await exec('git fetch origin canary')