Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use swc compiler for everything #165

Merged
merged 4 commits into from
Jan 27, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: use swc compiler for everything
junners committed Jan 27, 2025
commit 8e173b91e9381e0bade7e8e93f3166df348097a2
9 changes: 3 additions & 6 deletions .github/workflows/deploy-BETA.yml
Original file line number Diff line number Diff line change
@@ -47,12 +47,9 @@ jobs:
- name: Install Dependencies
run: |
npm ci
npm run build
cp package*.json out && cp tsconfig.cjs.json out
mkdir -p out/src
mkdir -p out/src/media
cp ./src/media/bannerslim.png out/src/media
cp readme.md out
npm run swc:build
npm run swc:cp:files
npm run swc:cp:types
- name: Semantic Release Dependency
run: npm install -g @semantic-release/changelog @semantic-release/commit-analyzer @semantic-release/git @semantic-release/npm conventional-changelog-conventionalcommits semantic-release
- name: Publish Beta
10 changes: 3 additions & 7 deletions .github/workflows/deploy-RELEASE.yml
Original file line number Diff line number Diff line change
@@ -41,13 +41,9 @@ jobs:
run: |
npm install
npm run build
cp package.json out
cp tsconfig.cjs.json out
mkdir -p out/src
mkdir -p out/src/media
cp ./src/media/bannerslim.png out/src/media
cp readme.md out
cd out
npm run swc:cp:files
npm run swc:cp:types
cd out/src
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKENX }}
5 changes: 3 additions & 2 deletions .swcrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"$schema": "https://swc.rs/schema.json",
"sourceMaps": "inline",
"sourceMaps": false,
"module": {
"type": "commonjs",
"strictMode": true,
"noInterop": false
"noInterop": false,
"resolveFully": true
},
"jsc": {
"externalHelpers": false,
36 changes: 30 additions & 6 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -170,16 +170,40 @@ const config: Config = {
// testRunner: "jest-circus/runner",

// A map from regular expressions to paths to transformers
// transform: { "^.+.tsx?$": ["ts-jest", { tsconfig: "tsconfig.cjs.json", isolatedModules: true }] },
transform: {
"^.+\\.(t|j)sx?$": "@swc/jest",
"^.+\\.(t|j)sx?$": [
"@swc/jest",
{
$schema: "https://swc.rs/schema.json",
sourceMaps: "inline",
exclude: ["index.d.ts"],
module: {
type: "es6",
strictMode: true,
noInterop: false,
},
jsc: {
externalHelpers: false,
target: "es2015",
parser: {
syntax: "typescript",
tsx: true,
decorators: true,
dynamicImport: true,
},
transform: {
legacyDecorator: true,
decoratorMetadata: false,
},
keepClassNames: true,
baseUrl: ".",
},
},
],
},

// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
// transformIgnorePatterns: [
// "/node_modules/",
// "\\.pnp\\.[^\\/]+$"
// ],
transformIgnorePatterns: ["/node_modules/", "\\.pnp\\.[^\\/]+$"],

// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// unmockedModulePathPatterns: undefined,
File renamed without changes
1,411 changes: 1,411 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -10,14 +10,21 @@
"test": "jest",
"test:cov": "jest --coverage",
"build": "tsc -p tsconfig.cjs.json",
"tsc:cp:files": "cp ./readme.md ./package*.json ./out/ && cp -R ./media ./out/",
"prepare": "husky",
"precommit": "lint-staged",
"lint": "eslint {src,tests}",
"prepack": "npm run build",
"rollup": "rollup --config",
"uglify": "uglifyjs dist/index.js --compress -o dist/index.min.js",
"dist": "npm run rollup && npm run uglify",
"postversion": "cp package.json .. && cp package-lock.json .."
"tsc:postversion": "cp package.json .. && cp package-lock.json ..",
"swc:build": "swc src --out-dir out",
"swc:build:link": "npm run prepack && npm run cp:files && npm link ./out/src",
"swc:gen:types": "tsc -p tsconfig.types.json --declaration --emitDeclarationOnly",
"swc:cp:types": "npm run gen:types && cp -R ./types/* ./out/src",
"swc:cp:files": "cp ./readme.md ./package*.json ./out/src && cp -R ./media ./out/src",
"swc:sim:pack": "npm run build && npm run cp:files && npm run cp:types",
"postversion": "cp package.json ../.. && cp package-lock.json ../.."
},
"keywords": [],
"license": "MIT",
@@ -31,6 +38,7 @@
"@rollup/plugin-commonjs": "^28.0.2",
"@rollup/plugin-node-resolve": "^16.0.0",
"@rollup/plugin-typescript": "^12.1.2",
"@swc/cli": "^0.6.0",
"@swc/core": "^1.10.9",
"@swc/jest": "^0.2.37",
"@types/jest": "^29.5.14",
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Lightning Flow Scanner Banner](./src/media/bannerslim.png)](https://github.com/Lightning-Flow-Scanner)
[![Lightning Flow Scanner Banner](./media/bannerslim.png)](https://github.com/Lightning-Flow-Scanner)

_An Extensible Rule Engine capable of conducting static analysis on the metadata associated with Salesforce Lightning Flows, Process Builders, and Workflows. Used by the Lightning Flow Scanner [Salesforce CLI Plugin](https://www.npmjs.com/package/lightning-flow-scanner) and [VS Code Extension](https://marketplace.visualstudio.com/items?itemName=ForceConfigControl.lightningflowscanner&ssr=false#review-details)._

2 changes: 1 addition & 1 deletion release.config.mjs
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ export default {
changelogFile: "CHANGELOG.md",
},
],
["@semantic-release/npm", { pkgRoot: "out" }],
["@semantic-release/npm", { pkgRoot: "out/src" }],
[
"@semantic-release/git",
{
24 changes: 24 additions & 0 deletions tsconfig.types.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"resolveJsonModule": true,
"outDir": "types",
"lib": ["es2020.string", "es6"],
"experimentalDecorators": true,
"sourceMap": false,
"rootDir": "src",
"strict": false /* enable all strict type-checking options */,
"baseUrl": ".",
"declaration": true,
"esModuleInterop": true
},
"exclude": [
"node_modules",
"out/**",
".idea/**",
"src/data/CustomRuleExample.ts",
"tests/**/*.test.ts",
"jest.config.ts"
],
}