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

Upgrade NX to 20.3.2 #1141

Merged
merged 2 commits into from
Jan 20, 2025
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,5 @@ package-lock.json
!/scripts/**/data/.gitkeep

vite.config.*.timestamp*

vitest.config.*.timestamp*
8 changes: 4 additions & 4 deletions libs/salesforce-api/src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ export interface Headers {
has(name: string): boolean;
set(name: string, value: string): void;
forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
entries(): IterableIterator<[string, string]>;
keys(): IterableIterator<string>;
values(): IterableIterator<string>;
[Symbol.iterator](): IterableIterator<[string, string]>;
entries(): HeadersIterator<[string, string]>;
keys(): HeadersIterator<string>;
values(): HeadersIterator<string>;
[Symbol.iterator](): HeadersIterator<[string, string]>;
}

export interface FetchOptions {
Expand Down
58 changes: 33 additions & 25 deletions migrations.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,49 @@
{
"migrations": [
{
"version": "20.0.0-beta.7",
"description": "Migration for v20.0.0-beta.7",
"implementation": "./src/migrations/update-20-0-0/move-use-daemon-process",
"package": "nx",
"name": "move-use-daemon-process"
"cli": "nx",
"version": "20.2.0-beta.2",
"description": "Update the ModuleFederationConfig import use @nx/module-federation.",
"factory": "./src/migrations/update-20-2-0/migrate-mf-imports-to-new-package",
"package": "@nx/react",
"name": "update-20-2-0-update-module-federation-config-import"
},
{
"version": "20.0.1",
"description": "Set `useLegacyCache` to true for migrating workspaces",
"implementation": "./src/migrations/update-20-0-1/use-legacy-cache",
"x-repair-skip": true,
"package": "nx",
"name": "use-legacy-cache"
"cli": "nx",
"version": "20.2.0-beta.2",
"description": "Update the withModuleFederation import use @nx/module-federation/webpack.",
"factory": "./src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package",
"package": "@nx/react",
"name": "update-20-2-0-update-with-module-federation-import"
},
{
"cli": "nx",
"version": "20.0.0-beta.5",
"description": "replace getJestProjects with getJestProjectsAsync",
"implementation": "./src/migrations/update-20-0-0/replace-getJestProjects-with-getJestProjectsAsync",
"package": "@nx/jest",
"name": "replace-getJestProjects-with-getJestProjectsAsync"
"version": "20.3.0-beta.2",
"description": "If workspace includes Module Federation projects, ensure the new @nx/module-federation package is installed.",
"factory": "./src/migrations/update-20-3-0/ensure-nx-module-federation-package",
"package": "@nx/react",
"name": "ensure-nx-module-federation-package"
},
{
"version": "20.0.4-beta.0",
"description": "Add gitignore entry for temporary vite config files.",
"implementation": "./src/migrations/update-20-0-4/add-vite-temp-files-to-git-ignore",
"package": "@nx/vite",
"name": "update-20-0-4"
"version": "20.2.0-beta.5",
"description": "Update TypeScript ESLint packages to v8.13.0 if they are already on v8",
"implementation": "./src/migrations/update-20-2-0/update-typescript-eslint-v8-13-0",
"package": "@nx/eslint",
"name": "update-typescript-eslint-v8.13.0"
},
{
"version": "20.3.0-beta.1",
"description": "Update ESLint flat config to include .cjs, .mjs, .cts, and .mts files in overrides (if needed)",
"implementation": "./src/migrations/update-20-3-0/add-file-extensions-to-overrides",
"package": "@nx/eslint",
"name": "add-file-extensions-to-overrides"
},
{
"version": "20.0.6-beta.0",
"description": "Add gitignore entry for temporary vite config files and remove previous incorrect glob.",
"implementation": "./src/migrations/update-20-0-4/add-vite-temp-files-to-git-ignore",
"version": "20.3.0-beta.2",
"description": "Add gitignore entry for temporary vitest config files.",
"implementation": "./src/migrations/update-20-3-0/add-vitest-temp-files-to-git-ignore",
"package": "@nx/vite",
"name": "update-20-0-6"
"name": "update-20-3-0"
}
]
}
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,5 @@
}
],
"defaultBase": "main",
"useLegacyCache": true
"useLegacyCache": false
}
52 changes: 28 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@
"build:storybook": "storybook build -c libs/ui/.storybook -o dist/storybook -s node_modules/@salesforce-ux/design-system/assets/styles",
"build:web-extension:dev": "nx run jetstream-web-extension:build --configuration=development",
"build:web-extension": "nx run jetstream-web-extension:build",
"build:web-extension:zip": "rm -f dist/apps/jetstream-web-extension-${version}.zip && cd dist/apps/jetstream-web-extension && zip -q -o -r -9 ../../jetstream-web-extension-${version}.zip *",
"build:web-extension:clean": "rm -f dist/apps/jetstream-web-extension-${version}.zip",
"build:web-extension:zip": "yarn build:web-extension:clean && cd dist/apps/jetstream-web-extension && zip -q -o -r -9 ../../jetstream-web-extension-${version}.zip *",
"build:web-extension:status": "node scripts/publish-web-extension.mjs --check-status",
"build:web-extension:upload": "node scripts/publish-web-extension.mjs --upload -f dist/jetstream-web-extension-${version}.zip",
"build:web-extension:publish": "node scripts/publish-web-extension.mjs --upload -f dist/jetstream-web-extension-${version}.zip",
"email:dev": "email dev --dir ./libs/email/src/lib/email-templates --port 3003",
"email:build": "email build --dir ./libs/email/src/lib/email-templates --packageManager yarn",
"scripts:replace-deps": "node ./scripts/replace-package-deps.mjs",
Expand Down Expand Up @@ -107,31 +111,31 @@
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^2.1.1",
"@eslint/js": "~8.57.0",
"@nx/devkit": "20.1.2",
"@nx/esbuild": "20.1.2",
"@nx/eslint": "20.1.2",
"@nx/eslint-plugin": "20.1.2",
"@nx/express": "20.1.2",
"@nx/jest": "20.1.2",
"@nx/js": "20.1.2",
"@nx/next": "20.1.2",
"@nx/node": "20.1.2",
"@nx/playwright": "20.1.2",
"@nx/plugin": "20.1.2",
"@nx/react": "20.1.2",
"@nx/storybook": "20.1.2",
"@nx/vite": "20.1.2",
"@nx/web": "20.1.2",
"@nx/webpack": "20.1.2",
"@nx/workspace": "20.1.2",
"@nx/devkit": "20.3.2",
"@nx/esbuild": "20.3.2",
"@nx/eslint": "20.3.2",
"@nx/eslint-plugin": "20.3.2",
"@nx/express": "20.3.2",
"@nx/jest": "20.3.2",
"@nx/js": "20.3.2",
"@nx/next": "20.3.2",
"@nx/node": "20.3.2",
"@nx/playwright": "20.3.2",
"@nx/plugin": "20.3.2",
"@nx/react": "20.3.2",
"@nx/storybook": "20.3.2",
"@nx/vite": "20.3.2",
"@nx/web": "20.3.2",
"@nx/webpack": "20.3.2",
"@nx/workspace": "20.3.2",
"@playwright/test": "^1.48.2",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
"@release-it/bumper": "^6.0.1",
"@salesforce-ux/design-system": "^2.25.6",
"@storybook/addon-essentials": "8.2.9",
"@storybook/addon-essentials": "8.5.0",
"@storybook/addon-knobs": "^7.0.2",
"@storybook/core-server": "8.2.9",
"@storybook/react": "8.2.9",
"@storybook/core-server": "8.5.0",
"@storybook/react": "8.5.0",
"@svgr/webpack": "8.0.1",
"@swc-node/register": "1.9.2",
"@swc/cli": "0.3.14",
Expand Down Expand Up @@ -210,7 +214,7 @@
"jsonc-eslint-parser": "^2.1.0",
"next-sitemap": "^4.2.3",
"npm-run-all": "^4.1.5",
"nx": "20.1.2",
"nx": "20.3.2",
"postcss": "^8.4.48",
"postcss-preset-env": "7",
"prettier": "2.7.0",
Expand All @@ -229,7 +233,7 @@
"tailwindcss": "^3.4.14",
"ts-jest": "29.1.0",
"ts-node": "^10.9.2",
"typescript": "5.5.4",
"typescript": "5.6.3",
"typescript-eslint": "^8.0.0",
"url-loader": "^4.1.1",
"vite": "^5.1.4",
Expand Down Expand Up @@ -270,7 +274,7 @@
"@react-aria/overlays": "^3.21.1",
"@react-email/components": "^0.0.25",
"@react-email/render": "1.0.1",
"@storybook/addon-interactions": "^8.2.8",
"@storybook/addon-interactions": "8.5.0",
"@swc/helpers": "0.5.11",
"@tanstack/react-virtual": "^3.4.0",
"@tippyjs/react": "^4.2.6",
Expand Down
52 changes: 40 additions & 12 deletions scripts/publish-web-extension.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'dotenv/config';
import minimist from 'minimist';
import { join } from 'path';
import { z } from 'zod';
import { chalk, fs } from 'zx'; // https://github.com/google/zx
import { chalk, fs, question } from 'zx'; // https://github.com/google/zx

const ENV = z
.object({
Expand All @@ -20,7 +20,7 @@ const ENV = z
});

const argv = minimist(process.argv.slice(2), {
boolean: ['upload', 'publish', 'publish-public', 'check-status', 'help'],
boolean: ['upload', 'publish', 'publish-public', 'check-status', 'accept-all', 'help'],
string: ['filepath', 'publish-target'],
default: {
upload: false,
Expand Down Expand Up @@ -58,8 +58,8 @@ if (argv.help) {
-u, --upload Upload extension to the web store (default=true)
-p, --publish Publish extension to the web store (default=false)
-f, --filepath <path> Path to the extension zip file (required if --upload is set, otherwise not allowed)
--publish-public Set to publish the extension to the public (default=false)
-s, --check-status Get the status of the extension, if set no other operation will be performed
--accept-all Say yes to all prompts (default=false)
-h, --help display help for command

Required Environment variables:
Expand All @@ -71,6 +71,8 @@ if (argv.help) {
process.exit(0);
}

const acceptAll = argv['accept-all'];

if (!argv.upload && !argv.publish && !argv['check-status']) {
console.error(chalk.red('At least one of --check-status, --upload or --publish must be set'));
process.exit(1);
Expand Down Expand Up @@ -146,6 +148,7 @@ class GoogleClient {

console.log('Checking status...');

// https://developer.chrome.com/docs/webstore/api#get
const response = await fetch(`https://www.googleapis.com/chromewebstore/v1.1/items/${ENV.EXTENSION_ID}?projection=DRAFT`, {
method: 'GET',
headers: {
Expand All @@ -170,6 +173,7 @@ class GoogleClient {

console.log('Uploading...');

// https://developer.chrome.com/docs/webstore/api#update
const response = await fetch(`https://www.googleapis.com/upload/chromewebstore/v1.1/items/${ENV.EXTENSION_ID}`, {
method: 'PUT',
headers: {
Expand All @@ -195,18 +199,18 @@ class GoogleClient {

console.log('Publishing...');

const response = await fetch(`https://www.googleapis.com/chromewebstore/v1.1/items/${ENV.EXTENSION_ID}`, {
method: 'PUT',
// headers: {
// Authorization: `Bearer ${this.accessToken}`,
// 'x-goog-api-version': '2',
// },
// body: fs.readFileSync('dist.zip'),
// https://developer.chrome.com/docs/webstore/api#publish
const response = await fetch(`https://www.googleapis.com/chromewebstore/v1.1/items/${ENV.EXTENSION_ID}/publish`, {
method: 'POST',
headers: {
Authorization: `Bearer ${this.accessToken}`,
'x-goog-api-version': '2',
},
});

if (!response.ok) {
console.error(await response.text());
throw new Error('Failed to publish extension');
throw new Error('Failed to get extension status');
}

const body = await response.json();
Expand All @@ -232,12 +236,36 @@ async function main() {
process.exit(1);
}

console.log('Extension path:', zipFilePath);
const shouldContinue = acceptAll
? true
: await question('Are you sure you want to upload the extension? (y/n) ').then((response) =>
response.trim().toLowerCase().startsWith('y')
);

if (!shouldContinue) {
console.log('Aborting');
process.exit(0);
}

await client.uploadExtension(filepath);
}

if (publish) {
console.log(chalk.green(`Publishing extension...`));
// await client.publishExtension();

const shouldContinue = acceptAll
? true
: await question('Are you sure you want to publish the extension? (y/n) ').then((response) =>
response.trim().toLowerCase().startsWith('y')
);

if (!shouldContinue) {
console.log('Aborting');
process.exit(0);
}

await client.publishExtension();
}
}

Expand Down
Loading
Loading