@jcoreio/toolchain 4.9.0 → 4.9.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcoreio/toolchain",
3
- "version": "4.9.0",
3
+ "version": "4.9.1",
4
4
  "description": "base JS build toolchain",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,26 @@
1
+ const getModules = require('../util/getModules.cjs')
2
+ const execa = require('../util/execa.cjs')
3
+ const path = require('path')
4
+
5
+ module.exports = [
6
+ async function smokeTestBuild() {
7
+ const { cjs, esm } = await getModules('dist/package.json')
8
+
9
+ function relpath(file) {
10
+ const result = path.relative(process.cwd(), file)
11
+ return result.startsWith('.') ? result : `./${result}`
12
+ }
13
+
14
+ for (const file of cjs) {
15
+ await execa('node', ['-e', `require(${JSON.stringify(relpath(file))})`])
16
+ }
17
+ for (const file of esm) {
18
+ await execa('node', [
19
+ '--input-type',
20
+ 'module',
21
+ '-e',
22
+ `import ${JSON.stringify(relpath(file))}`,
23
+ ])
24
+ }
25
+ },
26
+ ]
@@ -1,26 +1,7 @@
1
- const getModules = require('../util/getModules.cjs')
2
- const execa = require('../util/execa.cjs')
3
- const path = require('path')
1
+ const getPluginsAsyncFunction = require('../util/getPluginsAsyncFunction.cjs')
4
2
 
5
- exports.run = async function smokeTestBuild() {
6
- const { cjs, esm } = await getModules('dist/package.json')
7
-
8
- function relpath(file) {
9
- const result = path.relative(process.cwd(), file)
10
- return result.startsWith('.') ? result : `./${result}`
11
- }
12
-
13
- for (const file of cjs) {
14
- await execa('node', ['-e', `require(${JSON.stringify(relpath(file))})`])
15
- }
16
- for (const file of esm) {
17
- await execa('node', [
18
- '--input-type',
19
- 'module',
20
- '-e',
21
- `import ${JSON.stringify(relpath(file))}`,
22
- ])
23
- }
3
+ exports.run = async function smokeTestBuild(args) {
4
+ await getPluginsAsyncFunction('smokeTestBuild')(args)
24
5
  }
25
6
 
26
7
  exports.description = 'smoke test that build output can be required/imported'
@@ -42,12 +42,17 @@ const scripts = toolchainConfig
42
42
  ...Object.fromEntries(
43
43
  Object.entries(toolchainConfig.scripts || {}).map(([name, script]) => [
44
44
  name,
45
- typeof script === 'string'
45
+ typeof script === 'string' && script.trim()
46
46
  ? {
47
47
  run: (args = []) =>
48
48
  execa([script, ...args].join(' '), { shell: true }),
49
49
  description: script,
50
50
  }
51
+ : !script || typeof script === 'string'
52
+ ? {
53
+ run: () => {},
54
+ description: '(no-op)',
55
+ }
51
56
  : script,
52
57
  ])
53
58
  ),