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: build script supports Windows #276

Merged
merged 2 commits into from
Mar 6, 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
2 changes: 1 addition & 1 deletion packages/rsocket-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"rsocket-flowable": "^0.0.28",
"rsocket-types": "^0.0.28"
},
"gitHead": "1e15f3c9752f17a06537ee8741900ba12a151a42"
"gitHead": "844d70d3a7fd3cbb193a8b853297b6c5cc73e722"
}
2 changes: 1 addition & 1 deletion packages/rsocket-flowable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
},
"license": "BSD-3-Clause",
"main": "build/index.js",
"gitHead": "1e15f3c9752f17a06537ee8741900ba12a151a42"
"gitHead": "844d70d3a7fd3cbb193a8b853297b6c5cc73e722"
}
2 changes: 1 addition & 1 deletion packages/rsocket-tck/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"rsocket-flowable": "^0.0.28",
"rsocket-tcp-client": "^0.0.28"
},
"gitHead": "1e15f3c9752f17a06537ee8741900ba12a151a42"
"gitHead": "844d70d3a7fd3cbb193a8b853297b6c5cc73e722"
}
2 changes: 1 addition & 1 deletion packages/rsocket-tcp-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"rsocket-flowable": "^0.0.28",
"rsocket-types": "^0.0.28"
},
"gitHead": "1e15f3c9752f17a06537ee8741900ba12a151a42"
"gitHead": "844d70d3a7fd3cbb193a8b853297b6c5cc73e722"
}
2 changes: 1 addition & 1 deletion packages/rsocket-tcp-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
"rsocket-tcp-client": "^0.0.28",
"rsocket-types": "^0.0.28"
},
"gitHead": "1e15f3c9752f17a06537ee8741900ba12a151a42"
"gitHead": "844d70d3a7fd3cbb193a8b853297b6c5cc73e722"
}
2 changes: 1 addition & 1 deletion packages/rsocket-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"dependencies": {
"rsocket-flowable": "^0.0.28"
},
"gitHead": "1e15f3c9752f17a06537ee8741900ba12a151a42"
"gitHead": "844d70d3a7fd3cbb193a8b853297b6c5cc73e722"
}
2 changes: 1 addition & 1 deletion packages/rsocket-websocket-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"rsocket-flowable": "^0.0.28",
"rsocket-types": "^0.0.28"
},
"gitHead": "1e15f3c9752f17a06537ee8741900ba12a151a42"
"gitHead": "844d70d3a7fd3cbb193a8b853297b6c5cc73e722"
}
2 changes: 1 addition & 1 deletion packages/rsocket-websocket-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
"rsocket-types": "^0.0.28",
"ws": "^7.3.1"
},
"gitHead": "1e15f3c9752f17a06537ee8741900ba12a151a42"
"gitHead": "844d70d3a7fd3cbb193a8b853297b6c5cc73e722"
}
16 changes: 12 additions & 4 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ const BUILD_DIR = 'build';
const SRC_DIR = 'src';
const ROOT_DIR = path.resolve(__dirname, '..');
const PACKAGES_DIR = path.resolve(ROOT_DIR, 'packages');
const JS_FILES_PATTERN = path.resolve(PACKAGES_DIR, '**/*.js');
const JS_FILES_PATTERN = path.resolve(PACKAGES_DIR, '**/*.js')
.split(path.sep)
.join(path.posix.sep);
const IGNORE_PATTERN = '**/__(mocks|snapshots|tests)__/**';
const FLOW_EXTENSION = '.flow';

Expand Down Expand Up @@ -103,7 +105,7 @@ function buildPackage(pkg) {
const pattern = path.resolve(srcDir, '**/*');
const files = glob.sync(pattern, {nodir: true});

files.forEach((file) => buildFile(file, true));
files.forEach((file) => buildFile(file, false));
process.stdout.write(`${chalk.green('=>')} ${path.basename(pkg)} (npm)\n`);
}

Expand All @@ -115,14 +117,20 @@ function buildFile(file, silent) {
const destPath = path.resolve(packageBuildPath, relativeToSrcPath);

mkdirp.sync(path.dirname(destPath));
if (micromatch.isMatch(file, IGNORE_PATTERN)) {

const isIgnored = micromatch.isMatch(file, IGNORE_PATTERN);
// normalize paths to using posix format
const normalizedPath = file.split(path.sep).join(path.posix.sep);
const isJS = micromatch.isMatch(normalizedPath, JS_FILES_PATTERN);

if (isIgnored) {
silent ||
process.stdout.write(
chalk.dim(' \u2022 ') +
path.relative(PACKAGES_DIR, file) +
' (ignore)\n'
);
} else if (!micromatch.isMatch(file, JS_FILES_PATTERN)) {
} else if (isJS === false) {
fs.createReadStream(file).pipe(fs.createWriteStream(destPath));
silent ||
process.stdout.write(
Expand Down
Loading