react-native-boost 0.0.1 → 0.0.2
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/README.md +32 -17
- package/package.json +19 -5
- package/{dist/plugin.js → plugin/index.js} +22 -15
- package/src/optimizers/text/index.ts +16 -5
- package/src/plugin.ts +5 -3
- package/src/types/index.ts +9 -0
- package/src/utils/generate-test-plugin.ts +17 -0
- package/.github/FUNDING.yml +0 -1
- package/.github/actions/setup/action.yml +0 -28
- package/.github/workflows/release.yml +0 -87
- package/.github/workflows/stale.yml +0 -37
- package/.github/workflows/test.yml +0 -54
- package/.husky/pre-commit +0 -2
- package/.lintstagedrc +0 -3
- package/.nvmrc +0 -1
- package/.prettierignore +0 -4
- package/.prettierrc +0 -14
- package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +0 -541
- package/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs +0 -28
- package/.yarn/releases/yarn-3.6.1.cjs +0 -874
- package/.yarnrc.yml +0 -2
- package/CODE_OF_CONDUCT.md +0 -132
- package/CONTRIBUTING.md +0 -122
- package/commitlint.config.mjs +0 -1
- package/dist/plugin.js.map +0 -7
- package/eslint.config.mjs +0 -14
- package/src/optimizers/text/__tests__/fixtures/basic/code.js +0 -2
- package/src/optimizers/text/__tests__/fixtures/basic/options.js +0 -4
- package/src/optimizers/text/__tests__/fixtures/basic/output.js +0 -3
- package/src/optimizers/text/__tests__/fixtures/text-content/code.js +0 -2
- package/src/optimizers/text/__tests__/fixtures/text-content/options.js +0 -4
- package/src/optimizers/text/__tests__/fixtures/text-content/output.js +0 -3
- package/src/optimizers/text/__tests__/fixtures/text-content-as-explicit-child-prop/code.js +0 -2
- package/src/optimizers/text/__tests__/fixtures/text-content-as-explicit-child-prop/options.js +0 -4
- package/src/optimizers/text/__tests__/fixtures/text-content-as-explicit-child-prop/output.js +0 -3
- package/src/optimizers/text/__tests__/fixtures/two-components/code.js +0 -3
- package/src/optimizers/text/__tests__/fixtures/two-components/options.js +0 -4
- package/src/optimizers/text/__tests__/fixtures/two-components/output.js +0 -4
- package/src/optimizers/text/__tests__/index.test.ts +0 -12
- package/tsconfig.json +0 -14
- package/vitest.config.ts +0 -8
package/README.md
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
  
|
|
4
4
|
|
|
5
|
-
A powerful Babel plugin that automatically optimizes React Native apps
|
|
5
|
+
A powerful Babel plugin that automatically optimizes React Native apps through source code analysis and optimization. It identifies safe micro-optimization opportunities, which can lead to significant performance improvements.
|
|
6
6
|
|
|
7
7
|
> [!WARNING]
|
|
8
|
-
> This project is highly experimental and under active development. **Your app might break** and the optimization strategies used
|
|
8
|
+
> This project is highly experimental and under active development. **Your app might break** and the optimization strategies used can change significantly between versions. Use with caution!
|
|
9
9
|
|
|
10
10
|
- ⚡ Automatic performance optimization through source code analysis
|
|
11
|
-
-
|
|
11
|
+
- 🔒 Safe optimizations that don't break your app
|
|
12
12
|
- 🎯 Zero runtime overhead - all optimizations happen during build time
|
|
13
|
-
- 📱
|
|
13
|
+
- 📱 Cross-platform compatible
|
|
14
14
|
- 🧪 Works seamlessly with Expo
|
|
15
15
|
- 🎨 Configurable optimization strategies
|
|
16
16
|
|
|
@@ -18,22 +18,45 @@ A powerful Babel plugin that automatically optimizes React Native apps by intell
|
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
20
|
npm install --save-dev react-native-boost
|
|
21
|
+
# or
|
|
22
|
+
yarn add --dev react-native-boost
|
|
21
23
|
```
|
|
22
24
|
|
|
23
25
|
Then, add the plugin to your Babel configuration (`babel.config.js`):
|
|
24
26
|
|
|
25
27
|
```js
|
|
26
28
|
module.exports = {
|
|
27
|
-
plugins: ['
|
|
29
|
+
plugins: ['react-native-boost/plugin'],
|
|
28
30
|
};
|
|
29
31
|
```
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
Optionally, you can configure the plugin to disable specific optimizations:
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
```js
|
|
36
|
+
module.exports = {
|
|
37
|
+
plugins: [
|
|
38
|
+
[
|
|
39
|
+
'react-native-boost/plugin',
|
|
40
|
+
{
|
|
41
|
+
optimizations: {
|
|
42
|
+
text: false,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## How It Works
|
|
51
|
+
|
|
52
|
+
Several standard components in React Native are actually wrappers around their native counterparts. These wrappers often only handle edge cases and aren't needed in most cases. However, they add additional runtime overhead and depth to the component tree, which can lead to performance bottlenecks.
|
|
53
|
+
|
|
54
|
+
React Native Boost replaces these wrapper components directly with their respective native components, flattening the component tree. It intelligently analyzes your code and only optimizes components that are used in a way where they can be optimized without breaking the app.
|
|
55
|
+
|
|
56
|
+
Here's an example of how it works:
|
|
34
57
|
|
|
35
58
|
```jsx
|
|
36
|
-
// Your original code
|
|
59
|
+
// Your original code 🐌
|
|
37
60
|
import React from 'react';
|
|
38
61
|
import { View, Text } from 'react-native';
|
|
39
62
|
|
|
@@ -43,7 +66,7 @@ const MyComponent = () => (
|
|
|
43
66
|
</View>
|
|
44
67
|
);
|
|
45
68
|
|
|
46
|
-
//
|
|
69
|
+
// Automafically transformed to ✨
|
|
47
70
|
import React from 'react';
|
|
48
71
|
import { View } from 'react-native';
|
|
49
72
|
import { NativeText } from 'react-native/Libraries/Components/Text/NativeText';
|
|
@@ -55,14 +78,6 @@ const MyComponent = () => (
|
|
|
55
78
|
);
|
|
56
79
|
```
|
|
57
80
|
|
|
58
|
-
## How It Works
|
|
59
|
-
|
|
60
|
-
react-native-boost analyzes your code during the build process and:
|
|
61
|
-
|
|
62
|
-
- Identifies React Native components with optimization opportunities
|
|
63
|
-
- Verifies that the usage of the component meets the criteria for optimization
|
|
64
|
-
- Transforms the imports and component usage to their native, more performant equivalents
|
|
65
|
-
|
|
66
81
|
## Contributing
|
|
67
82
|
|
|
68
83
|
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-boost",
|
|
3
3
|
"description": "🚀 Boost your React Native app's performance with a single line of code",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.2",
|
|
5
5
|
"main": "dist/plugin.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"clean": "rm -rf
|
|
8
|
-
"build": "yarn clean && esbuild src/plugin.ts --bundle --outfile=
|
|
7
|
+
"clean": "rm -rf plugin",
|
|
8
|
+
"build": "yarn clean && esbuild src/plugin.ts --bundle --outfile=plugin/index.js --platform=node",
|
|
9
9
|
"test": "vitest",
|
|
10
10
|
"typecheck": "tsc --noEmit",
|
|
11
11
|
"lint": "eslint src/**/*.ts",
|
|
@@ -13,6 +13,14 @@
|
|
|
13
13
|
"prepare": "husky",
|
|
14
14
|
"release": "release-it"
|
|
15
15
|
},
|
|
16
|
+
"files": [
|
|
17
|
+
"src",
|
|
18
|
+
"plugin",
|
|
19
|
+
"!**/__tests__",
|
|
20
|
+
"!**/__fixtures__",
|
|
21
|
+
"!**/__mocks__",
|
|
22
|
+
"!**/.*"
|
|
23
|
+
],
|
|
16
24
|
"repository": {
|
|
17
25
|
"type": "git",
|
|
18
26
|
"url": "git+https://github.com/kuatsu/react-native-boost.git"
|
|
@@ -24,6 +32,9 @@
|
|
|
24
32
|
},
|
|
25
33
|
"homepage": "https://github.com/kuatsu/react-native-boost#readme",
|
|
26
34
|
"packageManager": "yarn@3.6.1",
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"registry": "https://registry.npmjs.org"
|
|
37
|
+
},
|
|
27
38
|
"devDependencies": {
|
|
28
39
|
"@babel/core": "^7.25.0",
|
|
29
40
|
"@babel/helper-module-imports": "^7.25.0",
|
|
@@ -33,7 +44,7 @@
|
|
|
33
44
|
"@commitlint/cli": "^19.7.1",
|
|
34
45
|
"@commitlint/config-conventional": "^17.0.2",
|
|
35
46
|
"@eslint/js": "^9.21.0",
|
|
36
|
-
"@release-it/conventional-changelog": "^
|
|
47
|
+
"@release-it/conventional-changelog": "^10.0.0",
|
|
37
48
|
"@types/babel__helper-module-imports": "^7.0.0",
|
|
38
49
|
"@types/babel__helper-plugin-utils": "^7.0.0",
|
|
39
50
|
"@types/node": "^20",
|
|
@@ -63,7 +74,10 @@
|
|
|
63
74
|
},
|
|
64
75
|
"plugins": {
|
|
65
76
|
"@release-it/conventional-changelog": {
|
|
66
|
-
"preset":
|
|
77
|
+
"preset": {
|
|
78
|
+
"name": "angular"
|
|
79
|
+
},
|
|
80
|
+
"infile": "CHANGELOG.md"
|
|
67
81
|
}
|
|
68
82
|
}
|
|
69
83
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
console.log('hello world')
|
|
2
1
|
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -54600,9 +54599,9 @@ var require_native_modules2 = __commonJS({
|
|
|
54600
54599
|
}
|
|
54601
54600
|
});
|
|
54602
54601
|
|
|
54603
|
-
// node_modules
|
|
54602
|
+
// node_modules/yallist/iterator.js
|
|
54604
54603
|
var require_iterator = __commonJS({
|
|
54605
|
-
"node_modules
|
|
54604
|
+
"node_modules/yallist/iterator.js"(exports2, module2) {
|
|
54606
54605
|
"use strict";
|
|
54607
54606
|
module2.exports = function(Yallist) {
|
|
54608
54607
|
Yallist.prototype[Symbol.iterator] = function* () {
|
|
@@ -54614,9 +54613,9 @@ var require_iterator = __commonJS({
|
|
|
54614
54613
|
}
|
|
54615
54614
|
});
|
|
54616
54615
|
|
|
54617
|
-
// node_modules
|
|
54616
|
+
// node_modules/yallist/yallist.js
|
|
54618
54617
|
var require_yallist = __commonJS({
|
|
54619
|
-
"node_modules
|
|
54618
|
+
"node_modules/yallist/yallist.js"(exports2, module2) {
|
|
54620
54619
|
"use strict";
|
|
54621
54620
|
module2.exports = Yallist;
|
|
54622
54621
|
Yallist.Node = Node;
|
|
@@ -54983,9 +54982,9 @@ var require_yallist = __commonJS({
|
|
|
54983
54982
|
}
|
|
54984
54983
|
});
|
|
54985
54984
|
|
|
54986
|
-
// node_modules
|
|
54985
|
+
// node_modules/lru-cache/index.js
|
|
54987
54986
|
var require_lru_cache = __commonJS({
|
|
54988
|
-
"node_modules
|
|
54987
|
+
"node_modules/lru-cache/index.js"(exports2, module2) {
|
|
54989
54988
|
"use strict";
|
|
54990
54989
|
var Yallist = require_yallist();
|
|
54991
54990
|
var MAX = Symbol("max");
|
|
@@ -70364,7 +70363,7 @@ var import_helper_plugin_utils = __toESM(require_lib());
|
|
|
70364
70363
|
// src/optimizers/text/index.ts
|
|
70365
70364
|
var import_core = __toESM(require_lib27());
|
|
70366
70365
|
var import_helper_module_imports = __toESM(require_lib11());
|
|
70367
|
-
|
|
70366
|
+
var textOptimizer = (path) => {
|
|
70368
70367
|
if (!import_core.types.isJSXIdentifier(path.node.name)) return;
|
|
70369
70368
|
const parent = path.parent;
|
|
70370
70369
|
if (!import_core.types.isJSXElement(parent)) return;
|
|
@@ -70389,7 +70388,7 @@ function textOptimizer(path) {
|
|
|
70389
70388
|
if (!path.node.selfClosing && parent.closingElement && import_core.types.isJSXIdentifier(parent.closingElement.name) && parent.closingElement.name.name === "Text") {
|
|
70390
70389
|
parent.closingElement.name.name = nativeTextIdentifier.name;
|
|
70391
70390
|
}
|
|
70392
|
-
}
|
|
70391
|
+
};
|
|
70393
70392
|
function hasOnlyStringChildren(path, node) {
|
|
70394
70393
|
return node.children.every((child) => isStringNode(path, child));
|
|
70395
70394
|
}
|
|
@@ -70437,8 +70436,16 @@ function hasBlacklistedProperties(path) {
|
|
|
70437
70436
|
if (import_core.types.isJSXSpreadAttribute(attribute)) {
|
|
70438
70437
|
if (import_core.types.isIdentifier(attribute.argument)) {
|
|
70439
70438
|
const binding = path.scope.getBinding(attribute.argument.name);
|
|
70440
|
-
|
|
70441
|
-
|
|
70439
|
+
let objectExpression;
|
|
70440
|
+
if (binding) {
|
|
70441
|
+
if (import_core.types.isVariableDeclarator(binding.path.node)) {
|
|
70442
|
+
objectExpression = binding.path.node.init;
|
|
70443
|
+
} else if (import_core.types.isObjectExpression(binding.path.node)) {
|
|
70444
|
+
objectExpression = binding.path.node;
|
|
70445
|
+
}
|
|
70446
|
+
}
|
|
70447
|
+
if (objectExpression && import_core.types.isObjectExpression(objectExpression)) {
|
|
70448
|
+
return objectExpression.properties.some((property) => {
|
|
70442
70449
|
if (import_core.types.isObjectProperty(property) && import_core.types.isIdentifier(property.key)) {
|
|
70443
70450
|
return blacklistedProperties.has(property.key.name);
|
|
70444
70451
|
}
|
|
@@ -70462,12 +70469,12 @@ function hasBlacklistedProperties(path) {
|
|
|
70462
70469
|
var plugin_default = (0, import_helper_plugin_utils.declare)((api) => {
|
|
70463
70470
|
api.assertVersion(7);
|
|
70464
70471
|
return {
|
|
70465
|
-
name: "react-native-boost
|
|
70472
|
+
name: "react-native-boost",
|
|
70466
70473
|
visitor: {
|
|
70467
|
-
JSXOpeningElement(path) {
|
|
70468
|
-
|
|
70474
|
+
JSXOpeningElement(path, state) {
|
|
70475
|
+
const options = state.opts ?? {};
|
|
70476
|
+
if (options.optimizations?.text !== false) textOptimizer(path);
|
|
70469
70477
|
}
|
|
70470
70478
|
}
|
|
70471
70479
|
};
|
|
70472
70480
|
});
|
|
70473
|
-
//# sourceMappingURL=plugin.js.map
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { NodePath, types as t } from '@babel/core';
|
|
2
2
|
import { addNamed } from '@babel/helper-module-imports';
|
|
3
|
+
import { Optimizer } from '../../types';
|
|
3
4
|
|
|
4
|
-
export
|
|
5
|
-
// Ensure we're processing a JSX element
|
|
5
|
+
export const textOptimizer: Optimizer = (path) => {
|
|
6
|
+
// Ensure we're processing a JSX Text element
|
|
6
7
|
if (!t.isJSXIdentifier(path.node.name)) return;
|
|
7
8
|
|
|
8
9
|
const parent = path.parent;
|
|
@@ -45,7 +46,7 @@ export function textOptimizer(path: NodePath<t.JSXOpeningElement>): void {
|
|
|
45
46
|
) {
|
|
46
47
|
parent.closingElement.name.name = nativeTextIdentifier.name;
|
|
47
48
|
}
|
|
48
|
-
}
|
|
49
|
+
};
|
|
49
50
|
|
|
50
51
|
function hasOnlyStringChildren(path: NodePath<t.JSXOpeningElement>, node: t.JSXElement): boolean {
|
|
51
52
|
return node.children.every((child) => isStringNode(path, child));
|
|
@@ -98,11 +99,21 @@ const blacklistedProperties = new Set([
|
|
|
98
99
|
|
|
99
100
|
function hasBlacklistedProperties(path: NodePath<t.JSXOpeningElement>): boolean {
|
|
100
101
|
return path.node.attributes.some((attribute) => {
|
|
102
|
+
// Check if we can resolve the spread attribute
|
|
101
103
|
if (t.isJSXSpreadAttribute(attribute)) {
|
|
102
104
|
if (t.isIdentifier(attribute.argument)) {
|
|
103
105
|
const binding = path.scope.getBinding(attribute.argument.name);
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
let objectExpression: t.ObjectExpression | undefined;
|
|
107
|
+
if (binding) {
|
|
108
|
+
// If the binding node is a VariableDeclarator, use its initializer.
|
|
109
|
+
if (t.isVariableDeclarator(binding.path.node)) {
|
|
110
|
+
objectExpression = binding.path.node.init as t.ObjectExpression;
|
|
111
|
+
} else if (t.isObjectExpression(binding.path.node)) {
|
|
112
|
+
objectExpression = binding.path.node;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (objectExpression && t.isObjectExpression(objectExpression)) {
|
|
116
|
+
return objectExpression.properties.some((property) => {
|
|
106
117
|
if (t.isObjectProperty(property) && t.isIdentifier(property.key)) {
|
|
107
118
|
return blacklistedProperties.has(property.key.name);
|
|
108
119
|
}
|
package/src/plugin.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { declare } from '@babel/helper-plugin-utils';
|
|
2
2
|
import { textOptimizer } from './optimizers/text';
|
|
3
|
+
import { PluginOptions } from './types';
|
|
3
4
|
|
|
4
5
|
export default declare((api) => {
|
|
5
6
|
api.assertVersion(7);
|
|
6
7
|
|
|
7
8
|
return {
|
|
8
|
-
name: 'react-native-boost
|
|
9
|
+
name: 'react-native-boost',
|
|
9
10
|
visitor: {
|
|
10
|
-
JSXOpeningElement(path) {
|
|
11
|
-
|
|
11
|
+
JSXOpeningElement(path, state) {
|
|
12
|
+
const options = (state.opts ?? {}) as PluginOptions;
|
|
13
|
+
if (options.optimizations?.text !== false) textOptimizer(path);
|
|
12
14
|
},
|
|
13
15
|
},
|
|
14
16
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { declare } from '@babel/helper-plugin-utils';
|
|
2
|
+
import { Optimizer } from '../types';
|
|
3
|
+
|
|
4
|
+
export const generateTestPlugin = (optimizer: Optimizer) => {
|
|
5
|
+
return declare((api) => {
|
|
6
|
+
api.assertVersion(7);
|
|
7
|
+
|
|
8
|
+
return {
|
|
9
|
+
name: 'react-native-boost',
|
|
10
|
+
visitor: {
|
|
11
|
+
JSXOpeningElement(path) {
|
|
12
|
+
optimizer(path);
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
};
|
package/.github/FUNDING.yml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
github: mfkrause
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
name: Setup
|
|
2
|
-
description: Setup Node.js and install dependencies
|
|
3
|
-
|
|
4
|
-
runs:
|
|
5
|
-
using: composite
|
|
6
|
-
steps:
|
|
7
|
-
- name: Setup Node.js
|
|
8
|
-
uses: actions/setup-node@v4
|
|
9
|
-
with:
|
|
10
|
-
node-version-file: .nvmrc
|
|
11
|
-
|
|
12
|
-
- name: Cache dependencies
|
|
13
|
-
id: yarn-cache
|
|
14
|
-
uses: actions/cache@v4
|
|
15
|
-
with:
|
|
16
|
-
path: |
|
|
17
|
-
**/node_modules
|
|
18
|
-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
19
|
-
restore-keys: |
|
|
20
|
-
${{ runner.os }}-yarn-
|
|
21
|
-
|
|
22
|
-
- name: Install dependencies
|
|
23
|
-
if: steps.yarn-cache.outputs.cache-hit != 'true'
|
|
24
|
-
run: |
|
|
25
|
-
# yarn install --cwd example --frozen-lockfile # TODO: re-enable once example has been added
|
|
26
|
-
# yarn install --cwd docs --frozen-lockfile # TODO: re-enable once docs have been added
|
|
27
|
-
yarn install --frozen-lockfile
|
|
28
|
-
shell: bash
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
name: Release
|
|
2
|
-
on:
|
|
3
|
-
workflow_dispatch:
|
|
4
|
-
inputs:
|
|
5
|
-
release_type:
|
|
6
|
-
description: 'Release type (patch, minor, major, or a semver version)'
|
|
7
|
-
required: false
|
|
8
|
-
type: string
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
lint:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
steps:
|
|
14
|
-
- name: Checkout
|
|
15
|
-
uses: actions/checkout@v4
|
|
16
|
-
|
|
17
|
-
- name: Setup
|
|
18
|
-
uses: ./.github/actions/setup
|
|
19
|
-
|
|
20
|
-
- name: Lint files
|
|
21
|
-
run: yarn lint
|
|
22
|
-
|
|
23
|
-
- name: Run Prettier
|
|
24
|
-
run: yarn format
|
|
25
|
-
|
|
26
|
-
- name: Verify formatted code is unchanged
|
|
27
|
-
run: git diff --exit-code HEAD
|
|
28
|
-
|
|
29
|
-
- name: Typecheck files
|
|
30
|
-
run: yarn typecheck
|
|
31
|
-
|
|
32
|
-
test:
|
|
33
|
-
runs-on: ubuntu-latest
|
|
34
|
-
steps:
|
|
35
|
-
- name: Checkout
|
|
36
|
-
uses: actions/checkout@v4
|
|
37
|
-
|
|
38
|
-
- name: Setup
|
|
39
|
-
uses: ./.github/actions/setup
|
|
40
|
-
|
|
41
|
-
- name: Run tests
|
|
42
|
-
run: yarn test
|
|
43
|
-
|
|
44
|
-
build-release:
|
|
45
|
-
runs-on: ubuntu-latest
|
|
46
|
-
needs: [lint, test]
|
|
47
|
-
steps:
|
|
48
|
-
- name: Checkout
|
|
49
|
-
uses: actions/checkout@v4
|
|
50
|
-
with:
|
|
51
|
-
fetch-depth: 0
|
|
52
|
-
|
|
53
|
-
- name: Setup
|
|
54
|
-
uses: ./.github/actions/setup
|
|
55
|
-
|
|
56
|
-
- name: Build package
|
|
57
|
-
run: yarn build
|
|
58
|
-
|
|
59
|
-
- name: Set NPM token & GitHub config
|
|
60
|
-
run: |
|
|
61
|
-
npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
|
|
62
|
-
git config user.name "Kuatsu CI/CD"
|
|
63
|
-
git config user.email "null@kuatsu.de"
|
|
64
|
-
env:
|
|
65
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
66
|
-
|
|
67
|
-
- name: Validate release type
|
|
68
|
-
if: ${{ inputs.release_type != '' }}
|
|
69
|
-
run: |
|
|
70
|
-
if [[ "${{ inputs.release_type }}" =~ ^(patch|minor|major)$ ]]; then
|
|
71
|
-
echo "Valid release type: ${{ inputs.release_type }}"
|
|
72
|
-
elif [[ "${{ inputs.release_type }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
73
|
-
echo "Valid semver version: ${{ inputs.release_type }}"
|
|
74
|
-
else
|
|
75
|
-
echo "Invalid input. Must be 'patch', 'minor', 'major', or a valid semver version (e.g., 1.2.3)."
|
|
76
|
-
exit 1
|
|
77
|
-
fi
|
|
78
|
-
|
|
79
|
-
- name: Release
|
|
80
|
-
run: |
|
|
81
|
-
if [ -n "${{ inputs.release_type }}" ]; then
|
|
82
|
-
yarn release --increment ${{ inputs.release_type }}
|
|
83
|
-
else
|
|
84
|
-
yarn release
|
|
85
|
-
fi
|
|
86
|
-
env:
|
|
87
|
-
GITHUB_TOKEN: ${{ secrets.CICD_PAT }}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
name: 'Close stale issues and PRs'
|
|
2
|
-
on:
|
|
3
|
-
schedule:
|
|
4
|
-
- cron: '30 1 * * *'
|
|
5
|
-
|
|
6
|
-
jobs:
|
|
7
|
-
stale:
|
|
8
|
-
runs-on: ubuntu-latest
|
|
9
|
-
permissions:
|
|
10
|
-
issues: write
|
|
11
|
-
pull-requests: write
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/stale@v9
|
|
14
|
-
with:
|
|
15
|
-
stale-issue-message: 'This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
|
|
16
|
-
stale-pr-message: 'This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
|
|
17
|
-
days-before-stale: 60
|
|
18
|
-
days-before-close: 7
|
|
19
|
-
stale-issue-label: stale
|
|
20
|
-
stale-pr-label: stale
|
|
21
|
-
exempt-issue-labels: 'help wanted,in progress,pinned'
|
|
22
|
-
exempt-pr-labels: 'in progress,pinned'
|
|
23
|
-
stale-missing-info:
|
|
24
|
-
runs-on: ubuntu-latest
|
|
25
|
-
permissions:
|
|
26
|
-
issues: write
|
|
27
|
-
pull-requests: write
|
|
28
|
-
steps:
|
|
29
|
-
- uses: actions/stale@v9
|
|
30
|
-
with:
|
|
31
|
-
any-of-labels: 'repro-missing'
|
|
32
|
-
stale-issue-message: 'This issue is stale because it is missing information. Please add the requested information or this will be closed in 7 days.'
|
|
33
|
-
stale-pr-message: 'This PR is stale because it is missing information. Please add the requested information or this will be closed in 7 days.'
|
|
34
|
-
days-before-stale: 14
|
|
35
|
-
days-before-close: 7
|
|
36
|
-
stale-issue-label: stale
|
|
37
|
-
stale-pr-label: stale
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
name: Test & build
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
branches:
|
|
5
|
-
- master
|
|
6
|
-
pull_request:
|
|
7
|
-
branches:
|
|
8
|
-
- master
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
lint:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
steps:
|
|
14
|
-
- name: Checkout
|
|
15
|
-
uses: actions/checkout@v4
|
|
16
|
-
|
|
17
|
-
- name: Setup
|
|
18
|
-
uses: ./.github/actions/setup
|
|
19
|
-
|
|
20
|
-
- name: Lint files
|
|
21
|
-
run: yarn lint
|
|
22
|
-
|
|
23
|
-
- name: Run Prettier
|
|
24
|
-
run: yarn format
|
|
25
|
-
|
|
26
|
-
- name: Verify formatted code is unchanged
|
|
27
|
-
run: git diff --exit-code HEAD
|
|
28
|
-
|
|
29
|
-
- name: Typecheck files
|
|
30
|
-
run: yarn typecheck
|
|
31
|
-
|
|
32
|
-
test:
|
|
33
|
-
runs-on: ubuntu-latest
|
|
34
|
-
steps:
|
|
35
|
-
- name: Checkout
|
|
36
|
-
uses: actions/checkout@v4
|
|
37
|
-
|
|
38
|
-
- name: Setup
|
|
39
|
-
uses: ./.github/actions/setup
|
|
40
|
-
|
|
41
|
-
- name: Run tests
|
|
42
|
-
run: yarn test
|
|
43
|
-
|
|
44
|
-
build:
|
|
45
|
-
runs-on: ubuntu-latest
|
|
46
|
-
steps:
|
|
47
|
-
- name: Checkout
|
|
48
|
-
uses: actions/checkout@v4
|
|
49
|
-
|
|
50
|
-
- name: Setup
|
|
51
|
-
uses: ./.github/actions/setup
|
|
52
|
-
|
|
53
|
-
- name: Build package
|
|
54
|
-
run: yarn build
|
package/.husky/pre-commit
DELETED
package/.lintstagedrc
DELETED
package/.nvmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
v20
|
package/.prettierignore
DELETED
package/.prettierrc
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"printWidth": 120,
|
|
3
|
-
"tabWidth": 2,
|
|
4
|
-
"useTabs": false,
|
|
5
|
-
"semi": true,
|
|
6
|
-
"singleQuote": true,
|
|
7
|
-
"quoteProps": "consistent",
|
|
8
|
-
"jsxSingleQuote": false,
|
|
9
|
-
"trailingComma": "es5",
|
|
10
|
-
"bracketSpacing": true,
|
|
11
|
-
"bracketSameLine": true,
|
|
12
|
-
"arrowParens": "always",
|
|
13
|
-
"endOfLine": "lf"
|
|
14
|
-
}
|