Skip to content

Commit ca9fcd0

Browse files
committed
fs.cp w recursive and force is roughly cpr w overwrite
1 parent 5cc4e43 commit ca9fcd0

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444

4545
- name: Set up bundle
4646
run: |
47-
gem install bundler -v 1.17.3
47+
gem install bundler -v 1.17.3 # Bundler 2.x breaks test lockfile
4848
bundle config jobs 4
4949
bundle config retry 3
5050

src/shared/copy.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = function copy (source, destination, params, callback) {
1818
}
1919
else {
2020
// cpr(source, destination, { overwrite: true }, callback)
21-
cp(source, destination, { recursive: true }, callback)
21+
cp(source, destination, { recursive: true, force: true }, callback)
2222
}
2323
}
2424
catch (err) {

test/integration/_shared.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ let viewsArtifactsDisabled = [
153153
function reset (t, callback) {
154154
process.chdir(join(__dirname, '..'))
155155
destroyPath(mockTmp)
156-
cp(mockSource, mockTmp, { recursive: true }, function (err) {
156+
cp(mockSource, mockTmp, { recursive: true, force: true }, function (err) {
157157
if (err) t.fail(err)
158158
else {
159159
process.chdir(mockTmp)
@@ -163,31 +163,31 @@ function reset (t, callback) {
163163
}
164164
function resetAndCopyShared (t, callback) {
165165
reset(t, function () {
166-
cp('_shared', 'src', { recursive: true }, function done (err) {
166+
cp('_shared', 'src', { recursive: true, force: true }, function done (err) {
167167
if (err) t.fail(err)
168168
else callback()
169169
})
170170
})
171171
}
172172
function resetAndCopySharedAutoinstall (t, callback) {
173173
reset(t, function () {
174-
cp('_shared-autoinstall', '.', { recursive: true }, function done (err) {
174+
cp('_shared-autoinstall', '.', { recursive: true, force: true }, function done (err) {
175175
if (err) t.fail(err)
176176
else callback()
177177
})
178178
})
179179
}
180180
function resetAndCopySharedCustom (t, callback) {
181181
reset(t, function () {
182-
cp('_shared-custom', '.', { recursive: true }, function done (err) {
182+
cp('_shared-custom', '.', { recursive: true, force: true }, function done (err) {
183183
if (err) t.fail(err)
184184
else callback()
185185
})
186186
})
187187
}
188188
function resetAndCopySharedPlugins (t, callback) {
189189
reset(t, function () {
190-
cp('_shared-plugins', 'src', { recursive: true }, function done (err) {
190+
cp('_shared-plugins', 'src', { recursive: true, force: true }, function done (err) {
191191
if (err) t.fail(err)
192192
else callback()
193193
})

test/integration/default/shared-tests.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ test(`[Shared file copying with plugins (default paths)] shared() copies shared
108108
pluginArtifacts.length + 1,
109109
)
110110
resetAndCopySharedPlugins(t, function () {
111-
cp(join('src', 'app.plugins'), join('.', 'app.arc'), { recursive: true },
111+
cp(join('src', 'app.plugins'), join('.', 'app.arc'), { recursive: true, force: true },
112112
function (err) {
113113
if (err) t.fail(err)
114114
else {
@@ -183,7 +183,7 @@ test(`[Shared file copying (custom paths)] shared() copies shared and views (unl
183183
test(`[Shared file copying (default paths)] shared() views to only @views (unless disabled or folder not found)`, t => {
184184
t.plan(viewsArtifacts.length + viewsArtifactsDisabled.length + 1)
185185
resetAndCopyShared(t, function () {
186-
cp(join('src', 'app.arc-views'), join('.', 'app.arc'), { recursive: true }, function (err) {
186+
cp(join('src', 'app.arc-views'), join('.', 'app.arc'), { recursive: true, force: true }, function (err) {
187187
if (err) t.fail(err)
188188
else {
189189
hydrate.shared({}, function (err) {
@@ -212,7 +212,7 @@ test(`[Shared file copying (default paths)] shared() views to only @views (unles
212212
test(`[Shared file copying (custom paths)] shared() views to only @views (unless disabled or folder not found)`, t => {
213213
t.plan(viewsArtifacts.length + viewsArtifactsDisabled.length + 1)
214214
resetAndCopySharedCustom(t, function () {
215-
cp(join('_shared-custom', 'app.arc-views'), join('.', 'app.arc'), { recursive: true }, function (err) {
215+
cp(join('_shared-custom', 'app.arc-views'), join('.', 'app.arc'), { recursive: true, force: true }, function (err) {
216216
if (err) t.fail(err)
217217
else {
218218
hydrate.shared({}, function (err) {

test/integration/symlink/shared-tests.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ test(`[Shared file symlinking with plugins (default paths)] shared() copies shar
112112
pluginArtifacts.length + 1,
113113
)
114114
resetAndCopySharedPlugins(t, function () {
115-
cp(join('src', 'app.plugins'), join('.', 'app.arc'), { recursive: true },
115+
cp(join('src', 'app.plugins'), join('.', 'app.arc'), { recursive: true, force: true },
116116
function (err) {
117117
if (err) t.fail(err)
118118
else {
@@ -187,7 +187,7 @@ test(`[Shared file symlinking (custom paths)] shared() copies shared and views (
187187
test(`[Shared file symlinking (default paths)] shared() views to only @views (unless disabled or folder not found)`, t => {
188188
t.plan(viewsArtifacts.length + viewsArtifactsDisabled.length + 1)
189189
resetAndCopyShared(t, function () {
190-
cp(join('src', 'app.arc-views'), join('.', 'app.arc'), { recursive: true }, function (err) {
190+
cp(join('src', 'app.arc-views'), join('.', 'app.arc'), { recursive: true, force: true }, function (err) {
191191
if (err) t.fail(err)
192192
else {
193193
hydrate.shared({ symlink }, function (err) {
@@ -216,7 +216,7 @@ test(`[Shared file symlinking (default paths)] shared() views to only @views (un
216216
test(`[Shared file symlinking (custom paths)] shared() views to only @views (unless disabled or folder not found)`, t => {
217217
t.plan(viewsArtifacts.length + viewsArtifactsDisabled.length + 1)
218218
resetAndCopySharedCustom(t, function () {
219-
cp(join('_shared-custom', 'app.arc-views'), join('.', 'app.arc'), { recursive: true }, function (err) {
219+
cp(join('_shared-custom', 'app.arc-views'), join('.', 'app.arc'), { recursive: true, force: true }, function (err) {
220220
if (err) t.fail(err)
221221
else {
222222
hydrate.shared({ symlink }, function (err) {

0 commit comments

Comments
 (0)