Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove cpr #194

Merged
merged 8 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/actions/autoinstall/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
ryanblock marked this conversation as resolved.
Show resolved Hide resolved
stats.push(`Found a total of ${totalDeps} dependencies to install`)
update.status('Dependency analysis', ...stats)
update.done(`Completed in ${Date.now() - start}ms`)
Expand Down
5 changes: 2 additions & 3 deletions src/shared/copy.js
Original file line number Diff line number Diff line change
@@ -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')
Expand All @@ -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) {
Expand Down
13 changes: 6 additions & 7 deletions test/integration/_shared.js
Original file line number Diff line number Diff line change
@@ -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')
Expand Down Expand Up @@ -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)
Expand All @@ -163,31 +162,31 @@ 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()
})
})
}
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()
})
})
}
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()
})
})
}
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()
})
Expand Down
5 changes: 5 additions & 0 deletions test/integration/default/install-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 +
Expand Down
13 changes: 9 additions & 4 deletions test/integration/default/shared-tests.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
let { dirname, join } = require('path')
let {
cp,
existsSync,
lstatSync,
mkdirSync,
readFileSync,
renameSync,
writeFileSync,
} = require('fs')
let cp = require('cpr')
let test = require('tape')
let {
resetAndCopyShared,
Expand All @@ -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 () {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
5 changes: 5 additions & 0 deletions test/integration/default/update-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
5 changes: 5 additions & 0 deletions test/integration/symlink/install-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
13 changes: 9 additions & 4 deletions test/integration/symlink/shared-tests.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
let { dirname, join } = require('path')
let {
cp,
existsSync,
lstatSync,
mkdirSync,
readFileSync,
renameSync,
writeFileSync,
} = require('fs')
let cp = require('cpr')
let test = require('tape')
let {
resetAndCopyShared,
Expand All @@ -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/
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
5 changes: 5 additions & 0 deletions test/integration/symlink/update-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
Loading