From 494bb963b2eb2b4be616ebe97a5d7555e1cb2e98 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Fri, 3 Jan 2020 13:19:35 -0500 Subject: [PATCH 1/3] Drop Node 8 support. --- .github/workflows/ci.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed2879b..aba173f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: strategy: matrix: - node: ['^8.12.0', '10', '12'] + node: ['10', '12', '13'] os: [ubuntu-latest, macOS-latest] steps: diff --git a/package.json b/package.json index 068ecb3..99b57e4 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "walk-sync": "^2.0.2" }, "engines": { - "node": "8.* || 10.* || >= 12" + "node": "10.* || >= 12" }, "publishConfig": { "registry": "https://registry.npmjs.org" From ca661a438e0403e750dc28a877d89bfc84870242 Mon Sep 17 00:00:00 2001 From: simonihmig Date: Fri, 12 Jun 2020 13:17:37 +0200 Subject: [PATCH 2/3] Remove custom yarn installation from CI --- .github/workflows/ci.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aba173f..f326431 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,8 +21,6 @@ jobs: - uses: actions/setup-node@v1 with: node-version: 12.x - - name: install yarn - run: npm install -g yarn - name: install dependencies run: yarn install - name: linting @@ -42,8 +40,6 @@ jobs: - uses: actions/setup-node@v1 with: node-version: ${{ matrix.node }} - - name: install yarn - run: npm install --global yarn - name: install dependencies run: yarn - name: test @@ -58,8 +54,6 @@ jobs: - uses: actions/setup-node@v1 with: node-version: '12.x' - - name: install yarn - run: npm install -g yarn - name: install dependencies run: yarn install --no-lockfile - name: test From f66dcf9b06286f78cc44e30e8b7b16dde14fe15e Mon Sep 17 00:00:00 2001 From: simonihmig Date: Fri, 12 Jun 2020 14:19:15 +0200 Subject: [PATCH 3/3] Symlink after yarn install --- bin/cli.js | 2 +- tests/cli-test.js | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/bin/cli.js b/bin/cli.js index f4f07f4..7f7ed8f 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -15,7 +15,7 @@ const pkgUp = require('pkg-up'); function insideProject() { let nearestPackagePath = pkgUp.sync(); - if (nearestPackagePath === null) { + if (!nearestPackagePath) { return false; } diff --git a/tests/cli-test.js b/tests/cli-test.js index 2d5bbff..34d77bc 100644 --- a/tests/cli-test.js +++ b/tests/cli-test.js @@ -12,7 +12,7 @@ const ROOT = process.cwd(); QUnit.module('codemod-cli', function(hooks) { let codemodProject; - function setupProject(hooks) { + function setupProject(hooks, installDeps = false) { let sharedProject; hooks.before(async function() { @@ -24,13 +24,22 @@ QUnit.module('codemod-cli', function(hooks) { process.chdir(ROOT); }); - hooks.beforeEach(function() { + hooks.beforeEach(async function() { codemodProject.copy(sharedProject.path('test-project')); + const jestPath = `${codemodProject.path()}/node_modules/jest`; + const codemodCliPath = `${codemodProject.path()}/node_modules/codemod-cli`; + + if (installDeps) { + await execa('yarn'); + fs.removeSync(jestPath); + fs.removeSync(codemodCliPath); + } + // setup required dependencies in the project fs.ensureDirSync(`${codemodProject.path()}/node_modules`); - fs.symlinkSync(`${ROOT}/node_modules/jest`, `${codemodProject.path()}/node_modules/jest`); - fs.symlinkSync(PROJECT_ROOT, `${codemodProject.path()}/node_modules/codemod-cli`); + fs.symlinkSync(`${ROOT}/node_modules/jest`, jestPath); + fs.symlinkSync(PROJECT_ROOT, codemodCliPath); }); } @@ -72,11 +81,7 @@ QUnit.module('codemod-cli', function(hooks) { }); QUnit.module('linting', function(hooks) { - setupProject(hooks); - - hooks.beforeEach(async function() { - await execa('yarn'); - }); + setupProject(hooks, true); QUnit.test('should pass for a basic project', async function(assert) { let result = await execa('yarn', ['lint']);