Repository: nuejs/nue (JavaScript)

Issue:
Add Cloudflare system folder "functions" to the hard coded IGNORE list
## Add Cloudflare system folder "functions" to the hard coded IGNORE list

**Rationale**
- For the same reasons as described in #198 
- Pit of success - Will not require a user  who is also using Cloudflare Pages [functions](https://developers.cloudflare.com/pages/functions/), to have to do anything special in order to avoid accidentally publishing artifacts (like developer markdown notes), or secrets. 

**Impact**
- Expected changes are simply adding "functions" to `const IGNORE` and update tests.

https://github.com/nuejs/nue/blob/16b348a79a25c72ab3107ba0f50fd1ce56818d36/packages/nuekit/src/nuefs.js#L71-L79
 


Discussion:

Patch:
diff --git a/.gitignore b/.gitignore
index a2684b4e5..1d2a69b1c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,5 @@
 node_modules
 dist
 .idea
+.vscode
+_test
\ No newline at end of file
diff --git a/packages/nuekit/src/nuefs.js b/packages/nuekit/src/nuefs.js
index 0cadbea25..01c1fca94 100644
--- a/packages/nuekit/src/nuefs.js
+++ b/packages/nuekit/src/nuefs.js
@@ -67,8 +67,8 @@ export async function fswalk(root, _dir='', _ret=[]) {
   return _ret
 }
 
-
-const IGNORE = ['node_modules', 'package.json', 'bun.lockb', 'pnpm-lock.yaml']
+const CLOUDFLARE_SERVERSIDE_DIRS = [ `functions` ] 
+const IGNORE = ['node_modules', 'package.json', 'bun.lockb', 'pnpm-lock.yaml', ... CLOUDFLARE_SERVERSIDE_DIRS]
 
 function ignore(name='') {
   return '._'.includes(name[0]) || IGNORE.includes(name)


Test patch:
diff --git a/packages/nuekit/test/nuekit.test.js b/packages/nuekit/test/nuekit.test.js
index 305307041..8f4d9c23c 100644
--- a/packages/nuekit/test/nuekit.test.js
+++ b/packages/nuekit/test/nuekit.test.js
@@ -14,11 +14,11 @@ expect.extend({ toMatchPath })
 const root = '_test'
 
 // setup and teardown
-beforeAll(async () => {
+beforeEach(async () => {
   await fs.rm(root, { recursive: true, force: true })
   await fs.mkdir(root, { recursive: true })
 })
-afterAll(async () => await fs.rm(root, { recursive: true, force: true }))
+afterEach(async () => await fs.rm(root, { recursive: true, force: true }))
 
 // helper function for creating files to the root directory
 async function write(path, content='') {
@@ -129,18 +129,23 @@ test('content collection', async () => {
   await write('blog/first-b.md', createFront('Second', '2020-01-04'))
   await write('blog/nested/hey1.md', createFront('Third', '2020-01-02'))
   await write('blog/nested/hey2.md', createFront('Fourth', '2020-01-03'))
-
+  // 4. Cloudflare `functions` directory is excluded
+  await write('blog/functions/contact-us.md', "my secret notes")
+  // 5. System files starting with '_' or '.' are excluded.
+  await write('blog/.item6.md', createFront('Sixth', '2020-01-03'))
+  await write('blog/_item7.md', createFront('Seventh', '2020-01-03'))
+  
   const site = await getSite()
   const coll = await site.getContentCollection('blog')
   const actual = coll.map(c => {
     return { pubDate: c.pubDate, url: c.url, title: c.title, dir: c.dir, slug: c.slug }
   })
-  // expected order is : First, Second, Fourth, Third.
+  // expected order is : First, Second, Fourth, Third
   expect(actual).toEqual([
     { pubDate: undefined, url: '/blog/first-a.html', title: 'First', dir: 'blog', slug: 'first-a.html' },
-    { pubDate: new Date('2020-01-04T00:00:00.000Z'), url: '/blog/first-b.html', title: 'Second', dir: 'blog', slug: 'first-b.html' },
-    { pubDate: new Date('2020-01-03T00:00:00.000Z'), url: '/blog/nested/hey2.html', title: 'Fourth', dir: 'blog/nested', slug: 'hey2.html' },
-    { pubDate: new Date('2020-01-02T00:00:00.000Z'), url: '/blog/nested/hey1.html', title: 'Third', dir: 'blog/nested', slug: 'hey1.html' },
+    { pubDate: new Date('2020-01-04'), url: '/blog/first-b.html', title: 'Second', dir: 'blog', slug: 'first-b.html' },
+    { pubDate: new Date('2020-01-03'), url: '/blog/nested/hey2.html', title: 'Fourth', dir: 'blog/nested', slug: 'hey2.html' },
+    { pubDate: new Date('2020-01-02'), url: '/blog/nested/hey1.html', title: 'Third', dir: 'blog/nested', slug: 'hey1.html' },
   ])
 })