Skip to content

Commit

Permalink
Update build process and dependency versions (#677)
Browse files Browse the repository at this point in the history
Simplified TypeScript declaration handling by streamlining the build plugin and removed unnecessary `outDir` config. Upgraded multiple dependencies, including `@simplewebauthn` and Babel-related libraries, for improved functionality and compatibility. Adjusted code for better null/undefined checks in Stimulus controller.
  • Loading branch information
Spomky authored Jan 18, 2025
1 parent f1432e7 commit fb2e193
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@
"check-format": "yarn format --no-write --check"
},
"devDependencies": {
"@simplewebauthn/types": "^12.0.0",
"@babel/core": "^7.15.8",
"@babel/preset-env": "^7.15.8",
"@babel/preset-react": "^7.15.8",
"@babel/preset-typescript": "^7.15.8",
"@rollup/plugin-commonjs": "^26.0.0",
"@rollup/plugin-node-resolve": "^15.0.0",
"@rollup/plugin-typescript": "^11.0.0",
"@rollup/plugin-commonjs": "^28.0",
"@rollup/plugin-node-resolve": "^16.0",
"@rollup/plugin-typescript": "^11.1",
"@symfony/stimulus-testing": "^2.0.1",
"@typescript-eslint/eslint-plugin": "^7.14.0",
"@typescript-eslint/parser": "^7.14.0",
"@typescript-eslint/eslint-plugin": "^8.20",
"@typescript-eslint/parser": "^8.20",
"babel-jest": "^29.0",
"clean-css-cli": "^5.6.2",
"eslint": "^9.6.0",
Expand Down
15 changes: 6 additions & 9 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,14 @@ const wildcardExternalsPlugin = (peerDependencies) => ({
*
* This could probably be configured in the TypeScript plugin.
*/
const moveTypescriptDeclarationsPlugin = (packagePath) => ({
name: 'move-ts-declarations',
writeBundle: async () => {
const files = glob.sync(path.join(packagePath, 'dist', '**', 'assets', 'src', '**/*.d.ts'));
const moveTypescriptDeclarationsPlugin = () => ({
name: 'move-to-dist',
writeBundle: () =>{
console.log(packageRoot);
const files = glob.sync(path.join(packageRoot, 'dist', '**', 'assets', 'src', '**/*.d.ts'));
files.forEach((file) => {
// a bit odd, but remove first 8 directories, which will leave
// only the relative path to the file
const relativePath = file.split('/').slice(8).join('/');

const targetFile = path.join(packagePath, 'dist', relativePath);
const targetFile = path.join(packageRoot, 'dist', relativePath);
if (!fs.existsSync(path.dirname(targetFile))) {
fs.mkdirSync(path.dirname(targetFile), { recursive: true });
}
Expand Down Expand Up @@ -83,7 +81,6 @@ module.exports = {
filterRoot: packageRoot,
include: ['src/**/*.ts'],
compilerOptions: {
outDir: 'dist',
declaration: true,
emitDeclarationOnly: true,
}
Expand Down
4 changes: 2 additions & 2 deletions src/stimulus/assets/dist/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ class default_1 extends Controller {
const options = {
requestResultUrl: this.requestResultUrlValue,
requestOptionsUrl: this.requestOptionsUrlValue,
requestSuccessRedirectUri: (_a = this.requestSuccessRedirectUriValue) !== null && _a !== void 0 ? _a : null,
requestSuccessRedirectUri: (_a = this.requestSuccessRedirectUriValue) !== null && _a !== undefined ? _a : null,
creationResultUrl: this.creationResultUrlValue,
creationOptionsUrl: this.creationOptionsUrlValue,
creationSuccessRedirectUri: (_b = this.creationSuccessRedirectUriValue) !== null && _b !== void 0 ? _b : null,
creationSuccessRedirectUri: (_b = this.creationSuccessRedirectUriValue) !== null && _b !== undefined ? _b : null,
};
this._dispatchEvent('webauthn:connect', { options });
const supportAutofill = await browserSupportsWebAuthnAutofill();
Expand Down
6 changes: 3 additions & 3 deletions src/stimulus/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
},
"importmap": {
"@hotwired/stimulus": "^3.0.0",
"@simplewebauthn/browser": "^10.0.0"
"@simplewebauthn/browser": "^13.0.0"
}
},
"peerDependencies": {
"@hotwired/stimulus": "^3.0.0",
"@simplewebauthn/browser": "^10.0.0"
"@simplewebauthn/browser": "^13.0.0"
},
"devDependencies": {
"@hotwired/stimulus": "^3.0.0",
"@simplewebauthn/browser": "^10.0.0"
"@simplewebauthn/browser": "^13.0.0"
}
}

0 comments on commit fb2e193

Please sign in to comment.