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

chore: build working again on windows #4954

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
64 changes: 64 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/atomic-hosted-page/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@playwright/test": "1.50.1",
"@types/node": "22.13.4",
"rollup": "4.34.8",
"rimraf": "3.0.2",
"vite": "6.0.11",
"ncp": "2.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/atomic-hosted-page/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"executor": "nx:run-commands",
"options": {
"commands": [
"rm -rf dist cdn",
"rimraf -rf dist cdn",
"tsc --outdir dist",
"tsc --outdir cdn --project tsconfig.cdn.json",
"node ./scripts/esbuild.js"
Expand Down
4 changes: 2 additions & 2 deletions packages/atomic/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"node ./scripts/stencil-proxy.mjs",
"node ./scripts/build.mjs --config=tsconfig.lit.json",
"node ./scripts/process-css.mjs --config=tsconfig.lit.json ",
"if [ \"$DEPLOYMENT_ENVIRONMENT\" == \"CDN\" ]; then rollup -c rollup.config.js; fi",
"npm run-script -w=@coveo/release if-not-cdn -- \"rollup -c rollup.config.js\"",
"esbuild src/autoloader/index.ts --format=esm --outfile=dist/atomic/autoloader/index.esm.js",
"esbuild src/autoloader/index.ts --format=cjs --outfile=dist/atomic/autoloader/index.cjs.js"
],
Expand Down Expand Up @@ -155,7 +155,7 @@
"dependsOn": ["^build", "cached:build:stencil"],
"executor": "nx:run-commands",
"options": {
"command": "rm -f ./dist/atomic/loader/package.json",
"command": "rimraf ./dist/atomic/loader/package.json",
"cwd": "packages/atomic"
}
},
Expand Down
6 changes: 3 additions & 3 deletions packages/atomic/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import resolve from '@rollup/plugin-node-resolve';
import {readdirSync, statSync} from 'fs';
import {join, resolve as resolvePath, relative} from 'path';
import {join, resolve as resolvePath, relative, sep} from 'path';
import {generateExternalPackageMappings} from './scripts/externalPackageMappings.mjs';

const isCDN = process.env.DEPLOYMENT_ENVIRONMENT === 'CDN';
Expand Down Expand Up @@ -63,8 +63,8 @@ export default {
manualChunks: (id) => {
if (id.includes('node_modules')) {
return (
'vendor/' +
id.toString().split('node_modules/')[1].split('/')[0].toString()
`vendor${sep}` +
id.toString().split(`node_modules${sep}`)[1].split(sep)[0].toString()
);
}
},
Expand Down
16 changes: 6 additions & 10 deletions packages/atomic/scripts/stencil-proxy.mjs
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
import {cpSync, readdirSync, renameSync} from 'node:fs';
import {join} from 'node:path';
import {join, sep, resolve, relative} from 'node:path';

const srcDir = './stencil-proxy';
const distDir = './dist';
const srcDir = resolve('./stencil-proxy');
const distDir = resolve('./dist');

const files = readdirSync(srcDir, {recursive: true, withFileTypes: true});

const prefixFileWithUnderscore = (file) =>
file.split('/').slice(0, -1).join('/') + '/_' + file.split('/').pop();
file.split(sep).slice(0, -1).join(sep) + sep + '_' + file.split(sep).pop();

for (const file of files) {
if (file.isFile()) {
const filePath = join(file.parentPath, file.name)
.split('/')
.slice(1)
.join('/');
console.log(filePath);
const filePath = relative(srcDir, join(file.parentPath, file.name));
const proxyFile = join(srcDir, filePath);
const proxiedFile = join(distDir, filePath);
renameSync(proxiedFile, prefixFileWithUnderscore(proxiedFile));
cpSync(proxyFile, proxiedFile);
cpSync(proxyFile, proxiedFile, {recursive: true, overwrite: true});
}
}
11 changes: 5 additions & 6 deletions packages/headless/esbuild.mjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import alias from 'esbuild-plugin-alias';
import {aliasPath} from 'esbuild-plugin-alias-path';
import {umdWrapper} from 'esbuild-plugin-umd-wrapper';
import {readFileSync, writeFileSync} from 'node:fs';
import {createRequire} from 'node:module';
import path, {dirname, resolve} from 'node:path';
import {join} from 'path';
import {dirname, resolve} from 'node:path';
import {build} from '../../scripts/esbuild/build.mjs';
import {apacheLicense} from '../../scripts/license/apache.mjs';

const __dirname = dirname(new URL(import.meta.url).pathname);

const buenoJsonPath = join(__dirname, '../bueno/package.json');
const __dirname = dirname(new URL(import.meta.url).pathname).slice(
process.platform === 'win32' ? 1 : 0
);
const buenoJsonPath = resolve(__dirname, '../bueno/package.json');
const buenoJson = JSON.parse(readFileSync(buenoJsonPath, 'utf-8'));

const require = createRequire(import.meta.url);
Expand Down
4 changes: 2 additions & 2 deletions packages/samples/angular/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"executor": "nx:run-commands",
"options": {
"commands": [
"if [ \"$DEPLOYMENT_ENVIRONMENT\" != \"CDN\" ]; then npm run build:assets; fi",
"if [ \"$DEPLOYMENT_ENVIRONMENT\" != \"CDN\" ]; then npm run build:angular; fi"
"npm run-script -w=@coveo/release if-not-cdn -- \"npm run build:assets\"",
"npm run-script -w=@coveo/release if-not-cdn -- \"npm run build:angular\""
],
"parallel": false,
"cwd": "packages/samples/angular"
Expand Down
6 changes: 3 additions & 3 deletions packages/samples/atomic-next/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"executor": "nx:run-commands",
"options": {
"commands": [
"if [ \"$DEPLOYMENT_ENVIRONMENT\" != \"CDN\" ]; then npx next build; fi",
"if [ \"$DEPLOYMENT_ENVIRONMENT\" != \"CDN\" ]; then tsc --noEmit; fi",
"if [ \"$DEPLOYMENT_ENVIRONMENT\" != \"CDN\" ]; then tsc --module commonjs --noEmit; fi"
"npm run-script -w=@coveo/release if-not-cdn -- \"npx next build\"",
"npm run-script -w=@coveo/release if-not-cdn -- \"tsc --noEmit\"",
"npm run-script -w=@coveo/release if-not-cdn -- \"tsc --module commonjs --noEmit\""
],
"parallel": true,
"cwd": "packages/samples/atomic-next"
Expand Down
4 changes: 2 additions & 2 deletions packages/samples/atomic-react/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"executor": "nx:run-commands",
"options": {
"commands": [
"if [ \"$DEPLOYMENT_ENVIRONMENT\" != \"CDN\" ]; then tsc -b; fi",
"if [ \"$DEPLOYMENT_ENVIRONMENT\" != \"CDN\" ]; then vite build; fi"
"npm run-script -w=@coveo/release if-not-cdn -- \"tsc -b\"",
"npm run-script -w=@coveo/release if-not-cdn -- \"vite build\""
],
"cwd": "packages/samples/atomic-react"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"cached:build": {
"executor": "nx:run-commands",
"options": {
"command": "if [ \"$DEPLOYMENT_ENVIRONMENT\" != \"CDN\" ]; then npm run build; fi",
"command": "npm run-script -w=@coveo/release if-not-cdn -- \"npm run build\"",
"cwd": "packages/samples/headless-commerce-ssr-remix"
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/samples/headless-react/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"executor": "nx:run-commands",
"options": {
"commands": [
"if [ \"$DEPLOYMENT_ENVIRONMENT\" != \"CDN\" ]; then npm run build:client; fi"
"npm run-script -w=@coveo/release if-not-cdn -- \"npm run build:client\""
],
"parallel": true,
"cwd": "packages/samples/headless-react"
Expand Down
2 changes: 1 addition & 1 deletion packages/samples/headless-ssr-commerce/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"cached:build": {
"executor": "nx:run-commands",
"options": {
"command": "if [ \"$DEPLOYMENT_ENVIRONMENT\" != \"CDN\" ]; then npm run build:next; fi",
"command": "npm run-script -w=@coveo/release if-not-cdn -- \"npm run build:next\"",
"cwd": "packages/samples/headless-ssr-commerce"
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/samples/headless-ssr/app-router/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"cached:build": {
"executor": "nx:run-commands",
"options": {
"command": "if [ \"$DEPLOYMENT_ENVIRONMENT\" != \"CDN\" ]; then npm run build:next; fi",
"command": "npm run-script -w=@coveo/release if-not-cdn -- \"npm run build:next\"",
"cwd": "packages/samples/headless-ssr/app-router"
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/samples/headless-ssr/pages-router/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"cached:build": {
"executor": "nx:run-commands",
"options": {
"command": "if [ \"$DEPLOYMENT_ENVIRONMENT\" != \"CDN\" ]; then npm run build:next; fi",
"command": "npm run-script -w=@coveo/release if-not-cdn -- \"npm run build:next\"",
"cwd": "packages/samples/headless-ssr/pages-router"
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/samples/iife/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"outputs": ["{projectRoot}/www/cdn"],
"executor": "nx:run-commands",
"options": {
"command": "if [ \"$DEPLOYMENT_ENVIRONMENT\" != \"CDN\" ]; then npm run build:assets; fi",
"command": "npm run-script -w=@coveo/release if-not-cdn -- \"npm run build:assets\"",
"cwd": "packages/samples/iife"
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/samples/stencil/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"outputs": ["{projectRoot}/www", "{projectRoot}/src/components.d.ts"],
"executor": "nx:run-commands",
"options": {
"command": "if [ \"$DEPLOYMENT_ENVIRONMENT\" != \"CDN\" ]; then node --max_old_space_size=6144 ../../../node_modules/@stencil/core/bin/stencil build; fi",
"command": "npm run-script -w=@coveo/release if-not-cdn -- \"node --max_old_space_size=6144 ../../../node_modules/@stencil/core/bin/stencil build\"",
"cwd": "packages/samples/stencil"
}
},
Expand Down
4 changes: 2 additions & 2 deletions packages/samples/vuejs/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"executor": "nx:run-commands",
"options": {
"commands": [
"if [ \"$DEPLOYMENT_ENVIRONMENT\" != \"CDN\" ]; then npm run build:assets; fi",
"if [ \"$DEPLOYMENT_ENVIRONMENT\" != \"CDN\" ]; then npm run build:vue; fi"
"npm run-script -w=@coveo/release if-not-cdn -- \"npm run build:assets\"",
"npm run-script -w=@coveo/release if-not-cdn -- \"npm run build:vue\""
],
"parallel": false,
"cwd": "packages/samples/vuejs"
Expand Down
13 changes: 13 additions & 0 deletions patches/fix-esm-import-path+1.10.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/fix-esm-import-path/fix-esm-import-path.js b/node_modules/fix-esm-import-path/fix-esm-import-path.js
index 2c3a802..1817a82 100644
--- a/node_modules/fix-esm-import-path/fix-esm-import-path.js
+++ b/node_modules/fix-esm-import-path/fix-esm-import-path.js
@@ -162,7 +162,7 @@ function scanImport({ srcFile, importCode, name }) {
srcFile,
importCode,
from: name,
- to: importFile.startsWith(importName + '/index')
+ to: importFile.startsWith(importName + `${path.sep}index`)
? name + '/index.js'
: name + '.js',
})
11 changes: 11 additions & 0 deletions utils/release/if-not-cdn.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env node
import {execSync} from 'node:child_process';

if (!process.env.INIT_CWD) {
throw new Error('Should be called using npm run-script');
}
process.chdir(process.env.INIT_CWD);

if (process.env.DEPLOYMENT_ENVIRONMENT !== 'CDN' && process.argv.length === 3) {
execSync(process.argv[process.argv.length - 1], {stdio: 'inherit'});
}
15 changes: 8 additions & 7 deletions utils/release/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
"typescript": "5.5.4"
},
"scripts": {
"promote-npm-prod": "./promote-npm-tag-to-latest.mjs",
"git-lock": "./git-lock.mjs",
"bump": "./bump-package.mjs",
"bump:root": "./bump-root.mjs",
"npm-publish": "./npm-publish-package.mjs",
"git-publish-all": "./git-publish-all.mjs",
"reify": "./reify.mjs",
"promote-npm-prod": "node ./promote-npm-tag-to-latest.mjs",
"git-lock": "node ./git-lock.mjs",
"bump": "node ./bump-package.mjs",
"bump:root": "node ./bump-root.mjs",
"npm-publish": "node ./npm-publish-package.mjs",
"git-publish-all": "node ./git-publish-all.mjs",
"if-not-cdn": "node ./if-not-cdn.mjs",
"reify": "node ./reify.mjs",
"test": "tsc"
}
}
Loading