Skip to content

Commit

Permalink
ignore build directory in default build (#874)
Browse files Browse the repository at this point in the history
  • Loading branch information
FredKSchott committed Aug 22, 2020
1 parent 5b0fe76 commit ee05c28
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/snowpack/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ function normalizeConfig(config: SnowpackConfig): SnowpackConfig {
config.knownEntrypoints = (config as any).install || [];
config.installOptions.dest = path.resolve(cwd, config.installOptions.dest);
config.devOptions.out = path.resolve(cwd, config.devOptions.out);
config.exclude = Array.from(new Set([...ALWAYS_EXCLUDE, ...config.exclude]));
config.exclude = Array.from(new Set([...ALWAYS_EXCLUDE, `${config.devOptions.out}/**/*`, ...config.exclude]));

if (!config.proxy) {
config.proxy = {} as any;
Expand Down
Binary file modified test/build/__snapshots__/build.test.js.snap
Binary file not shown.
2 changes: 1 addition & 1 deletion test/build/build.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('snowpack build', () => {

// build test
execa.sync('yarn', ['testbuild'], {cwd});
const actual = path.join(cwd, 'build');
const actual = testName === 'config-out' ? path.join(cwd, 'TEST_BUILD_OUT') : path.join(cwd, 'build');

// Test That all files match
const allFiles = glob.sync(`**/*`, {
Expand Down
1 change: 1 addition & 0 deletions test/build/config-out/TEST_BUILD_OUT/__snowpack__/env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {"MODE":"production","NODE_ENV":"production"};
18 changes: 18 additions & 0 deletions test/build/config-out/TEST_BUILD_OUT/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"private": true,
"version": "1.0.1",
"name": "@snowpack/test-config-out",
"description": "Test for devOptions.out",
"scripts": {
"testbuild": "snowpack build"
},
"snowpack": {
"devOptions": {
"out": "TEST_BUILD_OUT"
}
},
"devDependencies": {
"cross-env": "^7.0.2",
"snowpack": "^2.7.0"
}
}
1 change: 1 addition & 0 deletions test/build/config-out/TEST_BUILD_OUT/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("fooey");
18 changes: 18 additions & 0 deletions test/build/config-out/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"private": true,
"version": "1.0.1",
"name": "@snowpack/test-config-out",
"description": "Test for devOptions.out",
"scripts": {
"testbuild": "snowpack build"
},
"snowpack": {
"devOptions": {
"out": "TEST_BUILD_OUT"
}
},
"devDependencies": {
"cross-env": "^7.0.2",
"snowpack": "^2.7.0"
}
}
1 change: 1 addition & 0 deletions test/build/config-out/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('fooey');

1 comment on commit ee05c28

@vercel
Copy link

@vercel vercel bot commented on ee05c28 Aug 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.