react-native-boost 0.0.1 → 0.0.3

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 (43) hide show
  1. package/package.json +42 -17
  2. package/{dist/plugin.js → plugin/index.js} +57 -22
  3. package/src/optimizers/text/index.ts +33 -9
  4. package/src/plugin.ts +7 -3
  5. package/src/types/index.ts +29 -0
  6. package/src/utils/generate-test-plugin.ts +17 -0
  7. package/src/utils/logger.ts +3 -0
  8. package/src/utils/plugin-error.ts +6 -0
  9. package/.github/FUNDING.yml +0 -1
  10. package/.github/actions/setup/action.yml +0 -28
  11. package/.github/workflows/release.yml +0 -87
  12. package/.github/workflows/stale.yml +0 -37
  13. package/.github/workflows/test.yml +0 -54
  14. package/.husky/pre-commit +0 -2
  15. package/.lintstagedrc +0 -3
  16. package/.nvmrc +0 -1
  17. package/.prettierignore +0 -4
  18. package/.prettierrc +0 -14
  19. package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +0 -541
  20. package/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs +0 -28
  21. package/.yarn/releases/yarn-3.6.1.cjs +0 -874
  22. package/.yarnrc.yml +0 -2
  23. package/CODE_OF_CONDUCT.md +0 -132
  24. package/CONTRIBUTING.md +0 -122
  25. package/README.md +0 -72
  26. package/commitlint.config.mjs +0 -1
  27. package/dist/plugin.js.map +0 -7
  28. package/eslint.config.mjs +0 -14
  29. package/src/optimizers/text/__tests__/fixtures/basic/code.js +0 -2
  30. package/src/optimizers/text/__tests__/fixtures/basic/options.js +0 -4
  31. package/src/optimizers/text/__tests__/fixtures/basic/output.js +0 -3
  32. package/src/optimizers/text/__tests__/fixtures/text-content/code.js +0 -2
  33. package/src/optimizers/text/__tests__/fixtures/text-content/options.js +0 -4
  34. package/src/optimizers/text/__tests__/fixtures/text-content/output.js +0 -3
  35. package/src/optimizers/text/__tests__/fixtures/text-content-as-explicit-child-prop/code.js +0 -2
  36. package/src/optimizers/text/__tests__/fixtures/text-content-as-explicit-child-prop/options.js +0 -4
  37. package/src/optimizers/text/__tests__/fixtures/text-content-as-explicit-child-prop/output.js +0 -3
  38. package/src/optimizers/text/__tests__/fixtures/two-components/code.js +0 -3
  39. package/src/optimizers/text/__tests__/fixtures/two-components/options.js +0 -4
  40. package/src/optimizers/text/__tests__/fixtures/two-components/output.js +0 -4
  41. package/src/optimizers/text/__tests__/index.test.ts +0 -12
  42. package/tsconfig.json +0 -14
  43. package/vitest.config.ts +0 -8
package/package.json CHANGED
@@ -1,18 +1,34 @@
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.1",
4
+ "version": "0.0.3",
5
5
  "main": "dist/plugin.js",
6
+ "keywords": [
7
+ "react-native",
8
+ "ios",
9
+ "android",
10
+ "performance",
11
+ "optimization",
12
+ "bundle",
13
+ "optimize"
14
+ ],
6
15
  "scripts": {
7
- "clean": "rm -rf dist",
8
- "build": "yarn clean && esbuild src/plugin.ts --bundle --outfile=dist/plugin.js --sourcemap --platform=node",
16
+ "clean": "rm -rf plugin",
17
+ "build": "yarn clean && esbuild src/plugin.ts --bundle --outfile=plugin/index.js --platform=node",
9
18
  "test": "vitest",
10
19
  "typecheck": "tsc --noEmit",
11
20
  "lint": "eslint src/**/*.ts",
12
21
  "format": "prettier --write .",
13
- "prepare": "husky",
14
22
  "release": "release-it"
15
23
  },
24
+ "files": [
25
+ "src",
26
+ "plugin",
27
+ "!**/__tests__",
28
+ "!**/__fixtures__",
29
+ "!**/__mocks__",
30
+ "!**/.*"
31
+ ],
16
32
  "repository": {
17
33
  "type": "git",
18
34
  "url": "git+https://github.com/kuatsu/react-native-boost.git"
@@ -24,32 +40,38 @@
24
40
  },
25
41
  "homepage": "https://github.com/kuatsu/react-native-boost#readme",
26
42
  "packageManager": "yarn@3.6.1",
27
- "devDependencies": {
43
+ "publishConfig": {
44
+ "registry": "https://registry.npmjs.org"
45
+ },
46
+ "dependencies": {
28
47
  "@babel/core": "^7.25.0",
29
48
  "@babel/helper-module-imports": "^7.25.0",
30
- "@babel/helper-plugin-utils": "^7.25.0",
49
+ "@babel/helper-plugin-utils": "^7.25.0"
50
+ },
51
+ "devDependencies": {
31
52
  "@babel/plugin-syntax-jsx": "^7.25.0",
32
53
  "@babel/preset-typescript": "^7.25.0",
33
- "@commitlint/cli": "^19.7.1",
34
- "@commitlint/config-conventional": "^17.0.2",
35
- "@eslint/js": "^9.21.0",
36
- "@release-it/conventional-changelog": "^5.0.0",
54
+ "@release-it/conventional-changelog": "^10.0.0",
37
55
  "@types/babel__helper-module-imports": "^7.0.0",
38
56
  "@types/babel__helper-plugin-utils": "^7.0.0",
39
57
  "@types/node": "^20",
40
58
  "babel-plugin-tester": "^11.0.4",
41
59
  "esbuild": "^0.25.0",
42
- "eslint": "^9.21.0",
43
- "eslint-plugin-unicorn": "^57.0.0",
44
60
  "globals": "^16.0.0",
45
- "husky": "^9.1.7",
46
- "lint-staged": "^15.4.3",
47
- "prettier": "^3.5.2",
48
61
  "release-it": "^18.1.2",
49
62
  "typescript": "^5.7.3",
50
- "typescript-eslint": "^8.24.1",
51
63
  "vitest": "^3.0.6"
52
64
  },
65
+ "peerDependencies": {
66
+ "expo": "*",
67
+ "react": "*",
68
+ "react-native": "*"
69
+ },
70
+ "peerDependenciesMeta": {
71
+ "expo": {
72
+ "optional": true
73
+ }
74
+ },
53
75
  "release-it": {
54
76
  "git": {
55
77
  "commitMessage": "chore: release ${version}",
@@ -63,7 +85,10 @@
63
85
  },
64
86
  "plugins": {
65
87
  "@release-it/conventional-changelog": {
66
- "preset": "angular"
88
+ "preset": {
89
+ "name": "angular"
90
+ },
91
+ "infile": "CHANGELOG.md"
67
92
  }
68
93
  }
69
94
  }
@@ -1,4 +1,4 @@
1
- console.log('hello world')
1
+ "use strict";
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -32251,9 +32251,9 @@ var require_browser = __commonJS({
32251
32251
  }
32252
32252
  });
32253
32253
 
32254
- // node_modules/has-flag/index.js
32254
+ // ../../node_modules/has-flag/index.js
32255
32255
  var require_has_flag = __commonJS({
32256
- "node_modules/has-flag/index.js"(exports2, module2) {
32256
+ "../../node_modules/has-flag/index.js"(exports2, module2) {
32257
32257
  "use strict";
32258
32258
  module2.exports = (flag, argv = process.argv) => {
32259
32259
  const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
@@ -32264,9 +32264,9 @@ var require_has_flag = __commonJS({
32264
32264
  }
32265
32265
  });
32266
32266
 
32267
- // node_modules/supports-color/index.js
32267
+ // ../../node_modules/supports-color/index.js
32268
32268
  var require_supports_color = __commonJS({
32269
- "node_modules/supports-color/index.js"(exports2, module2) {
32269
+ "../../node_modules/supports-color/index.js"(exports2, module2) {
32270
32270
  "use strict";
32271
32271
  var os = require("os");
32272
32272
  var tty = require("tty");
@@ -32372,7 +32372,7 @@ var require_node = __commonJS({
32372
32372
  var tty = require("tty");
32373
32373
  var util = require("util");
32374
32374
  exports2.init = init;
32375
- exports2.log = log;
32375
+ exports2.log = log2;
32376
32376
  exports2.formatArgs = formatArgs;
32377
32377
  exports2.save = save;
32378
32378
  exports2.load = load;
@@ -32507,7 +32507,7 @@ var require_node = __commonJS({
32507
32507
  }
32508
32508
  return (/* @__PURE__ */ new Date()).toISOString() + " ";
32509
32509
  }
32510
- function log(...args) {
32510
+ function log2(...args) {
32511
32511
  return process.stderr.write(util.formatWithOptions(exports2.inspectOpts, ...args) + "\n");
32512
32512
  }
32513
32513
  function save(namespaces) {
@@ -54600,9 +54600,9 @@ var require_native_modules2 = __commonJS({
54600
54600
  }
54601
54601
  });
54602
54602
 
54603
- // node_modules/@babel/helper-compilation-targets/node_modules/yallist/iterator.js
54603
+ // node_modules/yallist/iterator.js
54604
54604
  var require_iterator = __commonJS({
54605
- "node_modules/@babel/helper-compilation-targets/node_modules/yallist/iterator.js"(exports2, module2) {
54605
+ "node_modules/yallist/iterator.js"(exports2, module2) {
54606
54606
  "use strict";
54607
54607
  module2.exports = function(Yallist) {
54608
54608
  Yallist.prototype[Symbol.iterator] = function* () {
@@ -54614,9 +54614,9 @@ var require_iterator = __commonJS({
54614
54614
  }
54615
54615
  });
54616
54616
 
54617
- // node_modules/@babel/helper-compilation-targets/node_modules/yallist/yallist.js
54617
+ // node_modules/yallist/yallist.js
54618
54618
  var require_yallist = __commonJS({
54619
- "node_modules/@babel/helper-compilation-targets/node_modules/yallist/yallist.js"(exports2, module2) {
54619
+ "node_modules/yallist/yallist.js"(exports2, module2) {
54620
54620
  "use strict";
54621
54621
  module2.exports = Yallist;
54622
54622
  Yallist.Node = Node;
@@ -54983,9 +54983,9 @@ var require_yallist = __commonJS({
54983
54983
  }
54984
54984
  });
54985
54985
 
54986
- // node_modules/@babel/helper-compilation-targets/node_modules/lru-cache/index.js
54986
+ // node_modules/lru-cache/index.js
54987
54987
  var require_lru_cache = __commonJS({
54988
- "node_modules/@babel/helper-compilation-targets/node_modules/lru-cache/index.js"(exports2, module2) {
54988
+ "node_modules/lru-cache/index.js"(exports2, module2) {
54989
54989
  "use strict";
54990
54990
  var Yallist = require_yallist();
54991
54991
  var MAX = Symbol("max");
@@ -70364,7 +70364,18 @@ var import_helper_plugin_utils = __toESM(require_lib());
70364
70364
  // src/optimizers/text/index.ts
70365
70365
  var import_core = __toESM(require_lib27());
70366
70366
  var import_helper_module_imports = __toESM(require_lib11());
70367
- function textOptimizer(path) {
70367
+
70368
+ // src/utils/plugin-error.ts
70369
+ var PluginError = class extends Error {
70370
+ constructor(message) {
70371
+ super(`[react-native-boost] Babel plugin exception: ${message}`);
70372
+ this.name = "PluginError";
70373
+ }
70374
+ };
70375
+
70376
+ // src/optimizers/text/index.ts
70377
+ var textOptimizer = (path, log2 = () => {
70378
+ }) => {
70368
70379
  if (!import_core.types.isJSXIdentifier(path.node.name)) return;
70369
70380
  const parent = path.parent;
70370
70381
  if (!import_core.types.isJSXElement(parent)) return;
@@ -70380,7 +70391,16 @@ function textOptimizer(path) {
70380
70391
  }
70381
70392
  if (hasBlacklistedProperties(path)) return;
70382
70393
  if (!hasOnlyStringChildren(path, parent)) return;
70383
- const file = path.hub.file;
70394
+ const hub = path.hub;
70395
+ const file = typeof hub === "object" && hub !== null && "file" in hub ? hub.file : void 0;
70396
+ if (!file) {
70397
+ throw new PluginError("No file found in Babel hub");
70398
+ }
70399
+ if (!file.__optimized) {
70400
+ const filename = file.opts?.filename || "unknown file";
70401
+ log2(`Optimizing file: ${filename}`);
70402
+ file.__optimized = true;
70403
+ }
70384
70404
  if (!file.__nativeTextImport) {
70385
70405
  file.__nativeTextImport = (0, import_helper_module_imports.addNamed)(path, "NativeText", "react-native/Libraries/Text/TextNativeComponent");
70386
70406
  }
@@ -70389,7 +70409,7 @@ function textOptimizer(path) {
70389
70409
  if (!path.node.selfClosing && parent.closingElement && import_core.types.isJSXIdentifier(parent.closingElement.name) && parent.closingElement.name.name === "Text") {
70390
70410
  parent.closingElement.name.name = nativeTextIdentifier.name;
70391
70411
  }
70392
- }
70412
+ };
70393
70413
  function hasOnlyStringChildren(path, node) {
70394
70414
  return node.children.every((child) => isStringNode(path, child));
70395
70415
  }
@@ -70437,8 +70457,16 @@ function hasBlacklistedProperties(path) {
70437
70457
  if (import_core.types.isJSXSpreadAttribute(attribute)) {
70438
70458
  if (import_core.types.isIdentifier(attribute.argument)) {
70439
70459
  const binding = path.scope.getBinding(attribute.argument.name);
70440
- if (binding && import_core.types.isObjectExpression(binding.path.node)) {
70441
- return binding.path.node.properties.some((property) => {
70460
+ let objectExpression;
70461
+ if (binding) {
70462
+ if (import_core.types.isVariableDeclarator(binding.path.node)) {
70463
+ objectExpression = binding.path.node.init;
70464
+ } else if (import_core.types.isObjectExpression(binding.path.node)) {
70465
+ objectExpression = binding.path.node;
70466
+ }
70467
+ }
70468
+ if (objectExpression && import_core.types.isObjectExpression(objectExpression)) {
70469
+ return objectExpression.properties.some((property) => {
70442
70470
  if (import_core.types.isObjectProperty(property) && import_core.types.isIdentifier(property.key)) {
70443
70471
  return blacklistedProperties.has(property.key.name);
70444
70472
  }
@@ -70458,16 +70486,23 @@ function hasBlacklistedProperties(path) {
70458
70486
  });
70459
70487
  }
70460
70488
 
70489
+ // src/utils/logger.ts
70490
+ var log = (message) => {
70491
+ console.log(`[react-native-boost] ${message}`);
70492
+ };
70493
+
70461
70494
  // src/plugin.ts
70462
70495
  var plugin_default = (0, import_helper_plugin_utils.declare)((api) => {
70463
70496
  api.assertVersion(7);
70464
70497
  return {
70465
- name: "react-native-boost/text",
70498
+ name: "react-native-boost",
70466
70499
  visitor: {
70467
- JSXOpeningElement(path) {
70468
- textOptimizer(path);
70500
+ JSXOpeningElement(path, state) {
70501
+ const options = state.opts ?? {};
70502
+ const logger = options.verbose ? log : () => {
70503
+ };
70504
+ if (options.optimizations?.text !== false) textOptimizer(path, logger);
70469
70505
  }
70470
70506
  }
70471
70507
  };
70472
70508
  });
70473
- //# sourceMappingURL=plugin.js.map
@@ -1,8 +1,10 @@
1
1
  import { NodePath, types as t } from '@babel/core';
2
2
  import { addNamed } from '@babel/helper-module-imports';
3
+ import { HubFile, Optimizer } from '../../types';
4
+ import PluginError from '../../utils/plugin-error';
3
5
 
4
- export function textOptimizer(path: NodePath<t.JSXOpeningElement>): void {
5
- // Ensure we're processing a JSX element
6
+ export const textOptimizer: Optimizer = (path, log = () => {}) => {
7
+ // Ensure we're processing a JSX Text element
6
8
  if (!t.isJSXIdentifier(path.node.name)) return;
7
9
 
8
10
  const parent = path.parent;
@@ -26,10 +28,22 @@ export function textOptimizer(path: NodePath<t.JSXOpeningElement>): void {
26
28
  if (!hasOnlyStringChildren(path, parent)) return;
27
29
  // TODO: Don't bail if the element has a style prop
28
30
 
29
- // Add NativeTextComponent import (cached on file) so we only add it once per file
30
- const file = (path.hub as unknown as { file: t.File }).file as t.File & {
31
- __nativeTextImport?: t.Identifier;
32
- };
31
+ // Extract the file from the Babel hub and add flags for logging & import caching
32
+ const hub = path.hub as unknown;
33
+ const file = typeof hub === 'object' && hub !== null && 'file' in hub ? (hub.file as HubFile) : undefined;
34
+
35
+ if (!file) {
36
+ throw new PluginError('No file found in Babel hub');
37
+ }
38
+
39
+ // Log the file's optimized status only once
40
+ if (!file.__optimized) {
41
+ const filename = file.opts?.filename || 'unknown file';
42
+ log(`Optimizing file: ${filename}`);
43
+ file.__optimized = true;
44
+ }
45
+
46
+ // Add TextNativeComponent import (cached on file) so we only add it once per file
33
47
  if (!file.__nativeTextImport) {
34
48
  file.__nativeTextImport = addNamed(path, 'NativeText', 'react-native/Libraries/Text/TextNativeComponent');
35
49
  }
@@ -45,7 +59,7 @@ export function textOptimizer(path: NodePath<t.JSXOpeningElement>): void {
45
59
  ) {
46
60
  parent.closingElement.name.name = nativeTextIdentifier.name;
47
61
  }
48
- }
62
+ };
49
63
 
50
64
  function hasOnlyStringChildren(path: NodePath<t.JSXOpeningElement>, node: t.JSXElement): boolean {
51
65
  return node.children.every((child) => isStringNode(path, child));
@@ -98,11 +112,21 @@ const blacklistedProperties = new Set([
98
112
 
99
113
  function hasBlacklistedProperties(path: NodePath<t.JSXOpeningElement>): boolean {
100
114
  return path.node.attributes.some((attribute) => {
115
+ // Check if we can resolve the spread attribute
101
116
  if (t.isJSXSpreadAttribute(attribute)) {
102
117
  if (t.isIdentifier(attribute.argument)) {
103
118
  const binding = path.scope.getBinding(attribute.argument.name);
104
- if (binding && t.isObjectExpression(binding.path.node)) {
105
- return binding.path.node.properties.some((property) => {
119
+ let objectExpression: t.ObjectExpression | undefined;
120
+ if (binding) {
121
+ // If the binding node is a VariableDeclarator, use its initializer
122
+ if (t.isVariableDeclarator(binding.path.node)) {
123
+ objectExpression = binding.path.node.init as t.ObjectExpression;
124
+ } else if (t.isObjectExpression(binding.path.node)) {
125
+ objectExpression = binding.path.node;
126
+ }
127
+ }
128
+ if (objectExpression && t.isObjectExpression(objectExpression)) {
129
+ return objectExpression.properties.some((property) => {
106
130
  if (t.isObjectProperty(property) && t.isIdentifier(property.key)) {
107
131
  return blacklistedProperties.has(property.key.name);
108
132
  }
package/src/plugin.ts CHANGED
@@ -1,14 +1,18 @@
1
1
  import { declare } from '@babel/helper-plugin-utils';
2
2
  import { textOptimizer } from './optimizers/text';
3
+ import { PluginOptions } from './types';
4
+ import { log } from './utils/logger';
3
5
 
4
6
  export default declare((api) => {
5
7
  api.assertVersion(7);
6
8
 
7
9
  return {
8
- name: 'react-native-boost/text',
10
+ name: 'react-native-boost',
9
11
  visitor: {
10
- JSXOpeningElement(path) {
11
- textOptimizer(path);
12
+ JSXOpeningElement(path, state) {
13
+ const options = (state.opts ?? {}) as PluginOptions;
14
+ const logger = options.verbose ? log : () => {};
15
+ if (options.optimizations?.text !== false) textOptimizer(path, logger);
12
16
  },
13
17
  },
14
18
  };
@@ -0,0 +1,29 @@
1
+ import { NodePath, types as t } from '@babel/core';
2
+
3
+ export interface PluginOptions {
4
+ /**
5
+ * Whether or not to log optimized files to the console.
6
+ * @default false
7
+ */
8
+ verbose?: boolean;
9
+ /**
10
+ * The optimizations to apply to the plugin.
11
+ */
12
+ optimizations?: {
13
+ /**
14
+ * Whether or not to optimize the text component.
15
+ * @default true
16
+ */
17
+ text?: boolean;
18
+ };
19
+ }
20
+
21
+ export type Optimizer = (path: NodePath<t.JSXOpeningElement>, log?: (message: string) => void) => void;
22
+
23
+ export type HubFile = t.File & {
24
+ opts: {
25
+ filename: string;
26
+ };
27
+ __nativeTextImport?: t.Identifier;
28
+ __optimized?: boolean;
29
+ };
@@ -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
+ };
@@ -0,0 +1,3 @@
1
+ export const log = (message: string) => {
2
+ console.log(`[react-native-boost] ${message}`);
3
+ };
@@ -0,0 +1,6 @@
1
+ export default class PluginError extends Error {
2
+ constructor(message: string) {
3
+ super(`[react-native-boost] Babel plugin exception: ${message}`);
4
+ this.name = 'PluginError';
5
+ }
6
+ }
@@ -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
@@ -1,2 +0,0 @@
1
- npx commitlint --edit
2
- npx lint-staged
package/.lintstagedrc DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "*.ts": "npx eslint"
3
- }
package/.nvmrc DELETED
@@ -1 +0,0 @@
1
- v20
package/.prettierignore DELETED
@@ -1,4 +0,0 @@
1
- fixtures
2
- node_modules
3
- yarn.lock
4
- .yarn
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
- }