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

fix: Fix attribution generation #28415

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion .depcheckrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ ignores:
- 'crypto-browserify' # polyfill
- 'process' # polyfill
- 'stream-http' # polyfill
- 'rimraf' # misc: install helper
- 'json-schema-to-ts' # misc: typescript helper
- 'https-browserify' # polyfill
- 'path-browserify' # polyfill
Expand Down
26 changes: 26 additions & 0 deletions development/clear-webpack-cache.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env node

const fs = require('node:fs/promises');
const path = require('node:path');

const WEBPACK_CACHE_DIRECTORY = path.resolve(
__dirname,
'..',
'node_modules',
'.cache',
'webpack',
);

/**
* Clear the Webpack cache.
*
* This is typically run in the `postinstall` npm/Yarn lifecycle script.
*/
async function main() {
await fs.rm(WEBPACK_CACHE_DIRECTORY, { force: true, recursive: true });
}

main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
Mrtenz marked this conversation as resolved.
Show resolved Hide resolved
11 changes: 10 additions & 1 deletion development/generate-attributions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ main() {
# relative to the project root irrespective of where this script was run.
cd "${PROJECT_DIRECTORY}"

# Remove allow-scripts plugin.
# Allow-scripts won't run correctly after a production-only install because the configuration
# includes exact paths to each dependency, and those paths can change in a production-only
# install because of the hoisting algorithm.
# We don't need postinstall scripts to run in order to generate attributions anyway.
yarn plugin remove @yarnpkg/plugin-allow-scripts

# Instruct Yarn to only install production dependencies
yarn workspaces focus --production

Expand All @@ -38,7 +45,9 @@ main() {

# Check if the script is running in a CI environment (GitHub Actions sets the CI variable to true)
if [ -z "${CI:-}" ]; then
# If not running in CI, restore development dependencies
# If not running in CI, restore the allow-scripts plugin and development dependencies.
cd "${PROJECT_DIRECTORY}"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously the attempt to re-install development dependencies was also failing, because yarn was run in the wrong directory. This is now fixed as well.

git checkout -- .yarnrc.yml .yarn
yarn
fi
}
Expand Down
18 changes: 2 additions & 16 deletions lavamoat/build-system/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -3174,22 +3174,8 @@
"__dirname": true
},
"packages": {
"eslint>file-entry-cache>flat-cache>flatted": true,
"eslint>file-entry-cache>flat-cache>rimraf": true
}
},
"eslint>file-entry-cache>flat-cache>rimraf": {
"builtin": {
"assert": true,
"fs": true,
"path.join": true
},
"globals": {
"process.platform": true,
"setTimeout": true
},
"packages": {
"nyc>glob": true
"del>rimraf": true,
"eslint>file-entry-cache>flat-cache>flatted": true
}
},
"eslint>glob-parent": {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"scripts": {
"webpack": "tsx ./development/webpack/launch.ts",
"webpack:clearcache": "rimraf node_modules/.cache/webpack",
"webpack:clearcache": "./development/clear-webpack-cache.js",
"postinstall": "yarn webpack:clearcache",
"env:e2e": "SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' yarn",
"start": "yarn build:dev dev --apply-lavamoat=false --snow=false",
Expand Down Expand Up @@ -640,7 +640,6 @@
"redux-mock-store": "^1.5.4",
"remote-redux-devtools": "^0.5.16",
"resolve-url-loader": "^3.1.5",
"rimraf": "^5.0.5",
"sass-embedded": "^1.71.0",
"sass-loader": "^14.1.1",
"schema-utils": "^4.2.0",
Expand Down
1 change: 0 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -26841,7 +26841,6 @@ __metadata:
remove-trailing-slash: "npm:^0.1.1"
reselect: "npm:^3.0.1"
resolve-url-loader: "npm:^3.1.5"
rimraf: "npm:^5.0.5"
sass-embedded: "npm:^1.71.0"
sass-loader: "npm:^14.1.1"
schema-utils: "npm:^4.2.0"
Expand Down