فهرست منبع

premium tests compiling

Adam Shaw 3 سال پیش
والد
کامیت
fb69528ecc
4فایلهای تغییر یافته به همراه19 افزوده شده و 22 حذف شده
  1. 11 0
      tests/package.json
  2. 6 4
      tests/scripts/generate-index.ts
  3. 2 0
      tests/src/index.ts
  4. 0 18
      tests/src/template.js.txt

+ 11 - 0
tests/package.json

@@ -39,5 +39,16 @@
   },
   "generatedExports": {
     ".": "./scripts/generate-index.ts"
+  },
+  "exports": {
+    ".": {
+      "default": "./dist/index.js",
+      "types": "./dist/.tsc/index.d.ts"
+    },
+    "./src/*": {
+      "default": "./dist/.tsc/*.js",
+      "types": "./dist/.tsc/*.d.ts"
+    },
+    "./scripts/*": "./scripts/*.ts"
   }
 }

+ 6 - 4
tests/scripts/generate-index.ts

@@ -5,7 +5,7 @@ import { capture } from '@fullcalendar/workspace-scripts/src/utils/exec'
 import { removeExt } from '@fullcalendar/workspace-scripts/src/utils/path'
 
 export default async function main() {
-  const templatePath = resolvePath('./src/index.ts.tpl')
+  const templatePath = resolvePath('./src/index.ts')
   const srcPathAbs = resolvePath('./src')
 
   let testPaths = await capture(
@@ -32,9 +32,11 @@ export default async function main() {
   }
 
   const templateText = await readFile(templatePath, 'utf8')
-  const template = handlebars.compile(templateText)
-  const code = template({
-    testPaths: testPaths.map((testPath) => removeExt(testPath)),
+  const code = templateText.replace(/\/\* generate-index(.*)\*\//s, (allStr, mainStr) => {
+    const template = handlebars.compile(mainStr)
+    return template({
+      testPaths: testPaths.map((testPath) => removeExt(testPath)),
+    })
   })
 
   return code

+ 2 - 0
tests/src/index.ts.tpl → tests/src/index.ts

@@ -5,6 +5,8 @@ import './lib/globals'
 import './lib/install-plugins'
 import './index.css'
 
+/* generate-index
 {{#each testPaths}}
 import '{{this}}'
 {{/each}}
+*/

+ 0 - 18
tests/src/template.js.txt

@@ -1,18 +0,0 @@
-fdescribe('', function() {
-  pushOptions({
-    initialDate: ''
-  })
-
-  describe('', function() {
-    pushOptions({
-      initialView: ''
-    })
-
-    fit('', function() {
-      initCalendar({
-        // other options
-      })
-    })
-  })
-
-})