Vendor SharedCode locally
This commit is contained in:
1 parent
a8c51b8484
commit
6eb8f4ad60
88 files changed
+9708
-275
No files matched your search
@@ -0,0 +1,15 @@
|
||||
import { readFile, writeFile } from 'node:fs/promises';
|
||||
|
||||
const source = await readFile(new URL('../packages/web-ui/dist/styles.css', import.meta.url), 'utf8');
|
||||
const tokenImport = "@import '@gabriel20xx/design-tokens/theme.css';";
|
||||
const componentStyles = source
|
||||
.split(/\r?\n/)
|
||||
.filter((line) => line.trim() !== tokenImport)
|
||||
.join('\n')
|
||||
.trimStart();
|
||||
|
||||
await writeFile(
|
||||
new URL('../shared-styles.css', import.meta.url),
|
||||
`@import './packages/design-tokens/theme.css';\n\n${componentStyles}`,
|
||||
'utf8'
|
||||
);
|
||||
@@ -0,0 +1,26 @@
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { readdirSync, statSync } from 'node:fs';
|
||||
import { join, relative } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const root = fileURLToPath(new URL('..', import.meta.url));
|
||||
const directories = ['packages/node-backend/src', 'packages/node-backend/test'];
|
||||
|
||||
function javascriptFiles(directory) {
|
||||
const absoluteDirectory = join(root, directory);
|
||||
const files = [];
|
||||
for (const entry of readdirSync(absoluteDirectory)) {
|
||||
const absolutePath = join(absoluteDirectory, entry);
|
||||
if (statSync(absolutePath).isFile() && /\.(?:c|m)?js$/.test(entry)) {
|
||||
files.push(absolutePath);
|
||||
}
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
for (const directory of directories) {
|
||||
for (const file of javascriptFiles(directory)) {
|
||||
execFileSync(process.execPath, ['--check', file], { stdio: 'inherit' });
|
||||
console.log(`Syntax OK: ${relative(root, file)}`);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
readonly module_path='repos.gfranz.ch/Gabriel20xx/shared/backend'
|
||||
readonly module_directory='backend'
|
||||
|
||||
release_tag="${1:?usage: package-go-module.sh backend/vX.Y.Z [output-directory]}"
|
||||
output_directory="${2:-dist}"
|
||||
version="${release_tag#backend/}"
|
||||
|
||||
if [[ "$release_tag" != backend/v* ]] || [[ ! "$version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
|
||||
echo "Expected a release tag such as backend/v0.1.0; got: $release_tag" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
repository_root="$(git rev-parse --show-toplevel)"
|
||||
git rev-parse --verify --quiet "${release_tag}^{commit}" >/dev/null || {
|
||||
echo "Release tag does not resolve to a commit: $release_tag" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
stage_directory="$(mktemp -d)"
|
||||
trap 'rm -rf "$stage_directory"' EXIT
|
||||
|
||||
module_root="$stage_directory/${module_path}@${version}"
|
||||
mkdir -p "$module_root"
|
||||
|
||||
# Go module ZIP files must contain <module>@<version>/ at their root. The
|
||||
# module is stored in the backend/ subdirectory of the shared repository,
|
||||
# so strip that repository directory while extracting the tagged source.
|
||||
git archive --format=tar "$release_tag" "$module_directory" \
|
||||
| tar -x --strip-components=1 -C "$module_root"
|
||||
|
||||
test -f "$module_root/go.mod"
|
||||
grep -Fxq "module $module_path" "$module_root/go.mod"
|
||||
if [[ "$output_directory" = /* ]]; then
|
||||
output_path="$output_directory"
|
||||
else
|
||||
output_path="$repository_root/$output_directory"
|
||||
fi
|
||||
mkdir -p "$output_path"
|
||||
zip_file="$output_path/${module_path//\//_}@${version}.zip"
|
||||
rm -f "$zip_file"
|
||||
|
||||
(
|
||||
cd "$stage_directory"
|
||||
zip -qr "$zip_file" "${module_path}@${version}"
|
||||
)
|
||||
|
||||
unzip -tq "$zip_file" >/dev/null
|
||||
echo "Created $zip_file"
|
||||
Reference in new issue
Block a user