@jcoreio/toolchain 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/build.cjs +14 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcoreio/toolchain",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "base JS build toolchain",
5
5
  "repository": {
6
6
  "type": "git",
package/scripts/build.cjs CHANGED
@@ -27,19 +27,23 @@ exports.run = async function build(args = []) {
27
27
  )
28
28
  ).catch(ignoreEnoent)
29
29
 
30
- const flowFiles = await glob(Path.join('src', '**', '*.{js,mjs,cjs}.flow'))
30
+ const flowFiles = await glob(Path.join('src', '**', '*.{js,mjs}.flow'))
31
+ const flowFilesSet = new Set(flowFiles)
31
32
  await Promise.all(
32
33
  flowFiles.map(async (src) => {
33
- for (const ext of src.endsWith('.js.flow')
34
- ? ['.js.flow', '.cjs.flow', '.mjs.flow']
35
- : /\.(js|mjs|cjs)\.flow$/.exec(ext)[0]) {
36
- const dest = Path.join(
37
- 'dist',
38
- Path.relative('src', src.replace(/\.(js|mjs|cjs)\.flow$/, ext))
39
- )
34
+ const dest = Path.join('dist', Path.relative('src', src))
35
+ // eslint-disable-next-line no-console
36
+ console.error(src, '->', dest)
37
+ await fs.copy(src, dest)
38
+
39
+ if (
40
+ src.endsWith('.js.flow') &&
41
+ !flowFilesSet.has(src.replace(/\.js\.flow$/, '.mjs.flow'))
42
+ ) {
43
+ const mjsDest = dest.replace(/\.js\.flow$/, '.mjs.flow')
40
44
  // eslint-disable-next-line no-console
41
- console.error(src, '->', dest)
42
- await fs.copy(src, dest)
45
+ console.error(src, '->', mjsDest)
46
+ await fs.copy(src, mjsDest)
43
47
  }
44
48
  })
45
49
  )