@@ -30,48 +30,47 @@ jobs:
3030 with :
3131 node-version : ${{ matrix.NODE }}
3232 cache : ' npm'
33+ cache-dependency-path : |
34+ package-lock.json
35+ apps/nextjs-testing/**/package-lock.json
3336
34- - name : Extract create-next- app version
37+ - name : Determine test app directory
3538 run : |
36- NEXT_APP_VERSION=$(node -e "const versions = require('./packages/devextreme-cli/src/utility/latest-versions.js'); console.log(versions['create-next-app'])")
37- echo "Using create-next-app version: $NEXT_APP_VERSION"
38- echo "NEXT_APP_VERSION=$NEXT_APP_VERSION" >> $GITHUB_ENV
39+ TS_PART=${{ matrix.TYPESCRIPT == true && 'ts' || 'js' }}
40+ SRC_PART=${{ matrix.SRC_DIR == true && 'src' || 'nosrc' }}
41+ ROUTER_PART=${{ matrix.APP_ROUTER == true && 'app' || 'pages' }}
42+ echo "TEST_APP_DIR=apps/nextjs-testing/${TS_PART}-${SRC_PART}-${ROUTER_PART}" >> $GITHUB_ENV
3943 shell : bash
4044
41- - name : Create Next.js application
45+ - name : Verify committed apps are up-to-date
4246 run : |
43- npx create-next-app@${{ env.NEXT_APP_VERSION }} test-nextjs-app \
44- --typescript=${{ matrix.TYPESCRIPT }} \
45- --src-dir=${{ matrix.SRC_DIR }} \
46- --app=${{ matrix.APP_ROUTER }} \
47- --eslint \
48- --no-tailwind \
49- --import-alias="@/*" \
50- --no-git \
51- --use-npm
47+ EXPECTED_VERSION=$(node -e "const v = require('./packages/devextreme-cli/src/utility/latest-versions.js'); console.log(v['create-next-app'])")
48+ COMMITTED_VERSION=$(node -e "const m = require('./apps/nextjs-testing/.generator-meta.json'); console.log(m['create-next-app'])")
49+ if [ "$EXPECTED_VERSION" != "$COMMITTED_VERSION" ]; then
50+ echo "ERROR: Committed test apps use create-next-app@$COMMITTED_VERSION but latest-versions.js specifies $EXPECTED_VERSION"
51+ echo "Run 'npm run regenerate-nextjs-apps' and commit the results"
52+ exit 1
53+ fi
5254 shell : bash
5355
54- - name : Add actual devExtreme-cli
55- run : |
56- cd test-nextjs-app
57- npm add devextreme-cli
58- rm -r ./node_modules/devextreme-cli/src/
59- cp -r ../packages/devextreme-cli/src/ ./node_modules/devextreme-cli/
60- ls ./node_modules/devextreme-cli
61- ls ./node_modules/devextreme-cli/src
62- shell : bash
63- timeout-minutes : 15
56+ - name : Install devextreme-cli dependencies
57+ run : npm ci --prefix packages/devextreme-cli
58+ timeout-minutes : 5
59+
60+ - name : Install test app dependencies
61+ run : cd ${{ env.TEST_APP_DIR }} && npm ci
62+ timeout-minutes : 5
6463
6564 - name : Add DevExtreme to Next.js application
6665 run : |
67- cd test-nextjs-app
68- npx devextreme-cli add devextreme-react
66+ cd ${{ env.TEST_APP_DIR }}
67+ node ../../../packages/ devextreme-cli/index.js add devextreme-react
6968 shell : bash
7069 timeout-minutes : 15
7170
7271 - name : Verify DevExtreme dependencies in package.json
7372 run : |
74- cd test-nextjs-app
73+ cd ${{ env.TEST_APP_DIR }}
7574
7675 if ! grep -q '"devextreme":' package.json; then
7776 echo "Error: devextreme dependency not found in package.json"
8887
8988 - name : Build Next.js application
9089 run : |
91- cd test-nextjs-app
90+ cd ${{ env.TEST_APP_DIR }}
9291 npm run build
9392 shell : bash
9493 timeout-minutes : 15
0 commit comments