Skip to content

Commit

Permalink
build: finish the jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
noomorph committed Oct 21, 2024
1 parent 016ff4e commit 1b495c2
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 68 deletions.
53 changes: 29 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,40 @@
name: CI
name: CI/CD Pipeline

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]

workflow_dispatch:
branches: [main]

jobs:

main:
name: Default
ci-cd:
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3

- name: NPM install
uses: bahmutov/npm-install@v1
- uses: actions/checkout@v4
with:
useLockFile: false

- name: Bootstrap
run: npm run bootstrap

fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn install --immutable
- name: Hotfix for yarn bin resolution
run: echo "$PWD/node_modules/.bin" >> $GITHUB_PATH
- name: Lint
run: npm run lint:ci

- name: Build
run: npm run build

run: yarn lint
- name: Test
run: npm run test
run: yarn test
- name: Build
run: yarn build
- name: Smoke test
run: yarn start --help
- name: Release
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn semantic-release
36 changes: 0 additions & 36 deletions .github/workflows/release.yml

This file was deleted.

8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"prepare": "husky install",
"build": "node scripts/esbuild.js",
"start": "node dist/cli.js",
"lint": "yarn workspaces foreach -R run lint",
"lint": "yarn workspaces foreach --exclude '@interslavic/cli' -R run lint",
"test": "yarn workspaces foreach --exclude '@interslavic/cli' -R run test",
"semantic-release": "semantic-release"
},
Expand All @@ -41,13 +41,17 @@
"semantic-release": "^24.1.0",
"zx": "^8.1.5"
},
"optionalDependencies": {
"dtrace-provider": "^0.8.8"
},
"publishConfig": {
"access": "public"
},
"release": {
"branches": [
"main"
]
],
"pkgRoot": "."
},
"packageManager": "[email protected]"
}
11 changes: 7 additions & 4 deletions packages/analysis/src/multireplacer/executors/RegExpExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ import type { Executor } from './Executor';
type ReplacementValue = string | ((match: string, ...args: any[]) => string);

export class RegExpExecutor<T> implements Executor<T> {
protected readonly sticky: RegExp;
protected readonly global: RegExp;

constructor(
protected readonly regexp: RegExp,
protected readonly replacements: Replacement<ReplacementValue, T>[],
) {}

protected readonly sticky = this._cloneRegexp('y');
protected readonly global = this._cloneRegexp('g');
) {
this.sticky = this._cloneRegexp('y');
this.global = this._cloneRegexp('g');
}

execute(origin: Intermediate<T>): Intermediate<T>[] {
const lastIndices = new Map<Intermediate, number>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export class MultilingualSynsetSerializer extends XmlSerializer<
},
prettier: {
...options.prettier,
plugins: [
'@prettier/plugin-xml',
...(options.prettier?.plugins ?? []),
],
parser: 'xml',
},
});
Expand Down
26 changes: 25 additions & 1 deletion scripts/esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,30 @@ import fs from 'node:fs/promises';
import * as esbuild from 'esbuild';
import { nodeExternalsPlugin } from 'esbuild-node-externals';

const ESM_REQUIRE_SHIM = `
await (async () => {
const { dirname } = await import("path");
const { fileURLToPath } = await import("url");
/**
* Shim entry-point related paths.
*/
if (typeof globalThis.__filename === "undefined") {
globalThis.__filename = fileURLToPath(import.meta.url);
}
if (typeof globalThis.__dirname === "undefined") {
globalThis.__dirname = dirname(globalThis.__filename);
}
/**
* Shim require if needed.
*/
if (typeof globalThis.require === "undefined") {
const { default: module } = await import("module");
globalThis.require = module.createRequire(import.meta.url);
}
})();
`;

async function build() {
try {
await fs.mkdir('dist', { recursive: true });
Expand All @@ -15,7 +39,7 @@ async function build() {
target: 'node20',
format: 'esm',
banner: {
js: '#!/usr/bin/env node',
js: '#!/usr/bin/env node\n\n' + ESM_REQUIRE_SHIM,
},
minify: false,
sourcemap: true,
Expand Down
6 changes: 5 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -942,11 +942,15 @@ __metadata:
"@interslavic/prettier-config-cli": "workspace:*"
"@interslavic/typescript-config-cli": "workspace:*"
cz-conventional-changelog: "npm:^3.3.0"
dtrace-provider: "npm:^0.8.8"
esbuild: "npm:^0.23.1"
esbuild-node-externals: "npm:^1.14.0"
husky: "npm:^9.1.5"
semantic-release: "npm:^24.1.0"
zx: "npm:^8.1.5"
dependenciesMeta:
dtrace-provider:
optional: true
bin:
isv: dist/cli.js
languageName: unknown
Expand Down Expand Up @@ -4126,7 +4130,7 @@ __metadata:
languageName: node
linkType: hard

"dtrace-provider@npm:~0.8":
"dtrace-provider@npm:^0.8.8, dtrace-provider@npm:~0.8":
version: 0.8.8
resolution: "dtrace-provider@npm:0.8.8"
dependencies:
Expand Down

0 comments on commit 1b495c2

Please sign in to comment.