diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 56759ac..ff5a295 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - node-version: [ 16.x, 18.x, 20.x ] + node-version: [ 16.x, 18.x, 20.x, 22.x ] os: [ windows-latest, ubuntu-latest, macOS-latest ] # Go diff --git a/package.json b/package.json index b409c2c..70f11d4 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "@architect/utils": "~4.0.6", "acorn-loose": "~8.4.0", "chalk": "4.1.2", - "cpr": "~3.0.1", "esquery": "~1.6.0", "glob": "10.4.5", "minimist": "~1.2.8", diff --git a/src/actions/autoinstall/index.js b/src/actions/autoinstall/index.js index 0ea12a5..19eb36d 100644 --- a/src/actions/autoinstall/index.js +++ b/src/actions/autoinstall/index.js @@ -54,8 +54,8 @@ module.exports = function autoinstaller (params) { `Scanned ${projectDirs} project dirs`, `Inspected ${projectFiles} project files`, ] - if (nodeDeps.length) stats.push(`Installed ${nodeDeps} Node.js dependencies`) - if (pyDeps.length) stats.push(`Installed ${pyDeps} Python dependencies`) + if (nodeDeps > 0) stats.push(`Installed ${nodeDeps} Node.js dependencies`) + if (pyDeps > 0) stats.push(`Installed ${pyDeps} Python dependencies`) stats.push(`Found a total of ${totalDeps} dependencies to install`) update.status('Dependency analysis', ...stats) update.done(`Completed in ${Date.now() - start}ms`) diff --git a/src/shared/copy.js b/src/shared/copy.js index 5130dcf..a6d96b8 100644 --- a/src/shared/copy.js +++ b/src/shared/copy.js @@ -1,5 +1,4 @@ -let cp = require('cpr') -let { mkdirSync } = require('fs') +let { cp, mkdirSync } = require('fs') let { dirname } = require('path') let { sync: symlinkOrCopy } = require('symlink-or-copy') let { destroyPath } = require('../lib') @@ -17,7 +16,7 @@ module.exports = function copy (source, destination, params, callback) { callback() } else { - cp(source, destination, { overwrite: true }, callback) + cp(source, destination, { recursive: true, force: true }, callback) } } catch (err) { diff --git a/test/integration/_shared.js b/test/integration/_shared.js index 05676c3..562287e 100644 --- a/test/integration/_shared.js +++ b/test/integration/_shared.js @@ -1,6 +1,5 @@ let { dirname, join } = require('path') -let { existsSync } = require('fs') -let cp = require('cpr') +let { cp, existsSync } = require('fs') let { globSync } = require('glob') let { pathToUnix } = require('@architect/utils') let { destroyPath } = require('../../src/lib') @@ -153,7 +152,7 @@ let viewsArtifactsDisabled = [ function reset (t, callback) { process.chdir(join(__dirname, '..')) destroyPath(mockTmp) - cp(mockSource, mockTmp, { overwrite: true }, function (err) { + cp(mockSource, mockTmp, { recursive: true, force: true }, function (err) { if (err) t.fail(err) else { process.chdir(mockTmp) @@ -163,7 +162,7 @@ function reset (t, callback) { } function resetAndCopyShared (t, callback) { reset(t, function () { - cp('_shared', 'src', { overwrite: true }, function done (err) { + cp('_shared', 'src', { recursive: true, force: true }, function done (err) { if (err) t.fail(err) else callback() }) @@ -171,7 +170,7 @@ function resetAndCopyShared (t, callback) { } function resetAndCopySharedAutoinstall (t, callback) { reset(t, function () { - cp('_shared-autoinstall', '.', { overwrite: true }, function done (err) { + cp('_shared-autoinstall', '.', { recursive: true, force: true }, function done (err) { if (err) t.fail(err) else callback() }) @@ -179,7 +178,7 @@ function resetAndCopySharedAutoinstall (t, callback) { } function resetAndCopySharedCustom (t, callback) { reset(t, function () { - cp('_shared-custom', '.', { overwrite: true }, function done (err) { + cp('_shared-custom', '.', { recursive: true, force: true }, function done (err) { if (err) t.fail(err) else callback() }) @@ -187,7 +186,7 @@ function resetAndCopySharedCustom (t, callback) { } function resetAndCopySharedPlugins (t, callback) { reset(t, function () { - cp('_shared-plugins', 'src', { overwrite: true }, function done (err) { + cp('_shared-plugins', 'src', { recursive: true, force: true }, function done (err) { if (err) t.fail(err) else callback() }) diff --git a/test/integration/default/install-tests.js b/test/integration/default/install-tests.js index 24e5bcc..ca25d3c 100644 --- a/test/integration/default/install-tests.js +++ b/test/integration/default/install-tests.js @@ -32,6 +32,11 @@ let { let hydrate = require('../../..') process.env.CI = true // Suppresses tape issues with progress indicator +test('Does not exit code 1', t => { + process.on('exit', code => { if (code === 1) t.fail('Exited code 1!') }) + t.end() +}) + test(`[Default (file copying)] install() hydrates all Functions', shared and views dependencies (autoinstall enabled)`, t => { let count = pythonDependencies.length + diff --git a/test/integration/default/shared-tests.js b/test/integration/default/shared-tests.js index 0c75701..6fc59a0 100644 --- a/test/integration/default/shared-tests.js +++ b/test/integration/default/shared-tests.js @@ -1,5 +1,6 @@ let { dirname, join } = require('path') let { + cp, existsSync, lstatSync, mkdirSync, @@ -7,7 +8,6 @@ let { renameSync, writeFileSync, } = require('fs') -let cp = require('cpr') let test = require('tape') let { resetAndCopyShared, @@ -26,6 +26,11 @@ let { let hydrate = require('../../..') process.env.CI = true // Suppresses tape issues with progress indicator +test('Does not exit code 1', t => { + process.on('exit', code => { if (code === 1) t.fail('Exited code 1!') }) + t.end() +}) + test(`[Shared file copying (default paths)] shared() never uses symlinks by default`, t => { t.plan(2) resetAndCopyShared(t, function () { @@ -102,7 +107,7 @@ test(`[Shared file copying with plugins (default paths)] shared() copies shared pluginArtifacts.length + 1, ) resetAndCopySharedPlugins(t, function () { - cp(join('src', 'app.plugins'), join('.', 'app.arc'), { overwrite: true }, + cp(join('src', 'app.plugins'), join('.', 'app.arc'), { recursive: true, force: true }, function (err) { if (err) t.fail(err) else { @@ -177,7 +182,7 @@ test(`[Shared file copying (custom paths)] shared() copies shared and views (unl test(`[Shared file copying (default paths)] shared() views to only @views (unless disabled or folder not found)`, t => { t.plan(viewsArtifacts.length + viewsArtifactsDisabled.length + 1) resetAndCopyShared(t, function () { - cp(join('src', 'app.arc-views'), join('.', 'app.arc'), { overwrite: true }, function (err) { + cp(join('src', 'app.arc-views'), join('.', 'app.arc'), { recursive: true, force: true }, function (err) { if (err) t.fail(err) else { hydrate.shared({}, function (err) { @@ -206,7 +211,7 @@ test(`[Shared file copying (default paths)] shared() views to only @views (unles test(`[Shared file copying (custom paths)] shared() views to only @views (unless disabled or folder not found)`, t => { t.plan(viewsArtifacts.length + viewsArtifactsDisabled.length + 1) resetAndCopySharedCustom(t, function () { - cp(join('_shared-custom', 'app.arc-views'), join('.', 'app.arc'), { overwrite: true }, function (err) { + cp(join('_shared-custom', 'app.arc-views'), join('.', 'app.arc'), { recursive: true, force: true }, function (err) { if (err) t.fail(err) else { hydrate.shared({}, function (err) { diff --git a/test/integration/default/update-tests.js b/test/integration/default/update-tests.js index 2e587d5..6e79ef5 100644 --- a/test/integration/default/update-tests.js +++ b/test/integration/default/update-tests.js @@ -11,6 +11,11 @@ let { let hydrate = require('../../..') process.env.CI = true // Suppresses tape issues with progress indicator +test('Does not exit code 1', t => { + process.on('exit', code => { if (code === 1) t.fail('Exited code 1!') }) + t.end() +}) + test(`[Default (file copying)] update() bumps installed dependencies to newer versions`, t => { t.plan(4) reset(t, function () { diff --git a/test/integration/symlink/install-tests.js b/test/integration/symlink/install-tests.js index 0ecda0f..d2cdf8f 100644 --- a/test/integration/symlink/install-tests.js +++ b/test/integration/symlink/install-tests.js @@ -33,6 +33,11 @@ let hydrate = require('../../..') process.env.CI = true // Suppresses tape issues with progress indicator let symlink = true +test('Does not exit code 1', t => { + process.on('exit', code => { if (code === 1) t.fail('Exited code 1!') }) + t.end() +}) + // As of late 2020, this test passes GHCI in both windows-latest and windows-2016 // This is strange, bc windows-2016 should be running a pre-Windows-symlink build (10.0.14393 Build 3930) // See: https://blogs.windows.com/windowsdeveloper/2016/12/02/symlinks-windows-10/ diff --git a/test/integration/symlink/shared-tests.js b/test/integration/symlink/shared-tests.js index ca41738..da0abee 100644 --- a/test/integration/symlink/shared-tests.js +++ b/test/integration/symlink/shared-tests.js @@ -1,5 +1,6 @@ let { dirname, join } = require('path') let { + cp, existsSync, lstatSync, mkdirSync, @@ -7,7 +8,6 @@ let { renameSync, writeFileSync, } = require('fs') -let cp = require('cpr') let test = require('tape') let { resetAndCopyShared, @@ -27,6 +27,11 @@ let hydrate = require('../../..') process.env.CI = true // Suppresses tape issues with progress indicator let symlink = true +test('Does not exit code 1', t => { + process.on('exit', code => { if (code === 1) t.fail('Exited code 1!') }) + t.end() +}) + // As of late 2020, this test passes GHCI in both windows-latest and windows-2016 // This is strange, bc windows-2016 should be running a pre-Windows-symlink build (10.0.14393 Build 3930) // See: https://blogs.windows.com/windowsdeveloper/2016/12/02/symlinks-windows-10/ @@ -106,7 +111,7 @@ test(`[Shared file symlinking with plugins (default paths)] shared() copies shar pluginArtifacts.length + 1, ) resetAndCopySharedPlugins(t, function () { - cp(join('src', 'app.plugins'), join('.', 'app.arc'), { overwrite: true }, + cp(join('src', 'app.plugins'), join('.', 'app.arc'), { recursive: true, force: true }, function (err) { if (err) t.fail(err) else { @@ -181,7 +186,7 @@ test(`[Shared file symlinking (custom paths)] shared() copies shared and views ( test(`[Shared file symlinking (default paths)] shared() views to only @views (unless disabled or folder not found)`, t => { t.plan(viewsArtifacts.length + viewsArtifactsDisabled.length + 1) resetAndCopyShared(t, function () { - cp(join('src', 'app.arc-views'), join('.', 'app.arc'), { overwrite: true }, function (err) { + cp(join('src', 'app.arc-views'), join('.', 'app.arc'), { recursive: true, force: true }, function (err) { if (err) t.fail(err) else { hydrate.shared({ symlink }, function (err) { @@ -210,7 +215,7 @@ test(`[Shared file symlinking (default paths)] shared() views to only @views (un test(`[Shared file symlinking (custom paths)] shared() views to only @views (unless disabled or folder not found)`, t => { t.plan(viewsArtifacts.length + viewsArtifactsDisabled.length + 1) resetAndCopySharedCustom(t, function () { - cp(join('_shared-custom', 'app.arc-views'), join('.', 'app.arc'), { overwrite: true }, function (err) { + cp(join('_shared-custom', 'app.arc-views'), join('.', 'app.arc'), { recursive: true, force: true }, function (err) { if (err) t.fail(err) else { hydrate.shared({ symlink }, function (err) { diff --git a/test/integration/symlink/update-tests.js b/test/integration/symlink/update-tests.js index 03b3d2b..00e3cd4 100644 --- a/test/integration/symlink/update-tests.js +++ b/test/integration/symlink/update-tests.js @@ -14,6 +14,11 @@ let hydrate = require('../../..') process.env.CI = true // Suppresses tape issues with progress indicator let symlink = true +test('Does not exit code 1', t => { + process.on('exit', code => { if (code === 1) t.fail('Exited code 1!') }) + t.end() +}) + // As of late 2020, this test passes GHCI in both windows-latest and windows-2016 // This is strange, bc windows-2016 should be running a pre-Windows-symlink build (10.0.14393 Build 3930) // See: https://blogs.windows.com/windowsdeveloper/2016/12/02/symlinks-windows-10/