sku 12.5.1 → 12.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # sku
2
2
 
3
+ ## 12.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - When cleaning the build output directory, only delete files within the directory, rather than the entire directory ([#969](https://github.com/seek-oss/sku/pull/969))
8
+
9
+ ## 12.6.0
10
+
11
+ ### Minor Changes
12
+
13
+ - Add support for [removing assertion functions][assertion removal docs] named `invariant` and assertions from the `tiny-invariant` library, a lightweight alternative to `assert` ([#966](https://github.com/seek-oss/sku/pull/966))
14
+
15
+ **EXAMPLE USAGE**:
16
+
17
+ ```tsx
18
+ import React from 'react';
19
+ import invariant from 'tiny-invariant';
20
+
21
+ export const Rating = ({ rating }: { rating: number }) => {
22
+ invariant(rating >= 0 && rating <= 5, 'Rating must be between 0 and 5');
23
+
24
+ return <div>...</div>;
25
+ };
26
+ ```
27
+
28
+ [assertion removal docs]: https://seek-oss.github.io/sku/#/./docs/extra-features?id=assertion-removal
29
+
3
30
  ## 12.5.1
4
31
 
5
32
  ### Patch Changes
@@ -55,7 +55,13 @@ module.exports = ({
55
55
  }
56
56
 
57
57
  if (removeAssertionsInProduction) {
58
- plugins.push(require.resolve('babel-plugin-unassert'));
58
+ plugins.push([
59
+ require.resolve('babel-plugin-unassert'),
60
+ {
61
+ variables: ['assert', 'invariant'],
62
+ modules: ['assert', 'node:assert', 'tiny-invariant'],
63
+ },
64
+ ]);
59
65
  }
60
66
  }
61
67
 
@@ -8,7 +8,18 @@ const exists = require('./exists');
8
8
  const copyDirContents = require('./copyDirContents');
9
9
 
10
10
  const cleanTargetDirectory = async () => {
11
- fs.rm(paths.target, { recursive: true, force: true });
11
+ const files = await new Fdir()
12
+ .withBasePath()
13
+ .withMaxDepth(1)
14
+ .withDirs()
15
+ // This glob pattern is used to exclude the target directory itself
16
+ .glob(`${paths.target}/*`)
17
+ .crawl(paths.target)
18
+ .withPromise();
19
+
20
+ for (const file of files) {
21
+ await fs.rm(file, { recursive: true, force: true });
22
+ }
12
23
  };
13
24
 
14
25
  const copyPublicFiles = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sku",
3
- "version": "12.5.1",
3
+ "version": "12.6.1",
4
4
  "description": "Front-end development toolkit, powered by Webpack, Babel, CSS Modules, Less and Jest",
5
5
  "main": "index.js",
6
6
  "bin": {