Skip to content

Commit b6379b3

Browse files
committed
fix(assetsDirs): allow same destination asset dir copy task
Closes #2615
1 parent 762160a commit b6379b3

File tree

9 files changed

+15
-11
lines changed

9 files changed

+15
-11
lines changed

src/sys/deno/deno-copy-tasks.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type * as d from '../../declarations';
22
import type { Deno } from '../../../types/lib.deno';
3-
import { buildError, catchError, flatOne, normalizePath, unique } from '@utils';
3+
import { buildError, catchError, flatOne, normalizePath } from '@utils';
44
import { basename, dirname, expandGlob, isGlob, isAbsolute, join, resolve } from './deps';
55

66
export async function denoCopyTasks(deno: typeof Deno, copyTasks: Required<d.CopyTask>[], srcDir: string) {
@@ -13,8 +13,6 @@ export async function denoCopyTasks(deno: typeof Deno, copyTasks: Required<d.Cop
1313
try {
1414
copyTasks = flatOne(await Promise.all(copyTasks.map(task => processGlobs(task, srcDir))));
1515

16-
copyTasks = unique(copyTasks, task => task.dest);
17-
1816
const allCopyTasks: d.CopyTask[] = [];
1917

2018
// figure out all the file copy tasks we'll have

src/sys/node/node-copy-tasks.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as d from '../../declarations';
2-
import { buildError, catchError, flatOne, isGlob, normalizePath, unique } from '@utils';
2+
import { buildError, catchError, flatOne, isGlob, normalizePath } from '@utils';
33
import { copyFile, mkdir, readdir, stat } from './node-fs-promisify';
44
import path from 'path';
55
import glob from 'glob';
@@ -14,8 +14,6 @@ export async function nodeCopyTasks(copyTasks: Required<d.CopyTask>[], srcDir: s
1414
try {
1515
copyTasks = flatOne(await Promise.all(copyTasks.map(task => processGlobs(task, srcDir))));
1616

17-
copyTasks = unique(copyTasks, task => task.dest);
18-
1917
const allCopyTasks: d.CopyTask[] = [];
2018

2119
// figure out all the file copy tasks we'll have
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
file-1.txt

test/end-to-end/src/car-detail/car-detail.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Component, Prop, h } from '@stencil/core';
22
import { CarData } from '../car-list/car-data';
33

4-
54
@Component({
6-
tag: 'car-detail'
5+
tag: 'car-detail',
6+
assetsDirs: ['assets-a'],
77
})
88
export class CarDetail {
99
@Prop() car: CarData;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
file-2.txt

test/end-to-end/src/car-list/car-list.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import { CarData } from './car-data';
99
@Component({
1010
tag: 'car-list',
1111
styleUrl: 'car-list.css',
12-
shadow: true
12+
shadow: true,
13+
assetsDirs: ['assets-a'],
1314
})
1415
export class CarList {
1516
@Prop() cars: CarData[];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
file-3.txt

test/end-to-end/src/dom-api/dom-api.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { Component, h } from '@stencil/core';
22

33
@Component({
4-
tag: 'dom-api'
4+
tag: 'dom-api',
5+
assetsDirs: ['assets-b'],
56
})
67
export class DomApiCmp {
7-
88
render() {
99
return (
1010
<span data-z="z" class="red green blue" data-a="a">

test/end-to-end/test-end-to-end-dist.js

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ fs.accessSync(path.join(typesDir, 'car-list', 'car-list.d.ts'));
3232
const wwwDir = path.join(__dirname, 'www');
3333
fs.accessSync(path.join(wwwDir, 'build', 'endtoend.js'));
3434
fs.accessSync(path.join(wwwDir, 'build', 'endtoend.esm.js'));
35+
fs.accessSync(path.join(wwwDir, 'build', 'endtoend.css'));
36+
fs.accessSync(path.join(wwwDir, 'build', 'assets-a/file-1.txt'));
37+
fs.accessSync(path.join(wwwDir, 'build', 'assets-a/file-2.txt'));
38+
fs.accessSync(path.join(wwwDir, 'build', 'assets-b/file-3.txt'));
3539
fs.accessSync(path.join(wwwDir, 'index.html'));
3640

3741
fs.accessSync(path.join(__dirname, 'dist-react', 'components.ts'));

0 commit comments

Comments
 (0)