Skip to content

Commit

Permalink
feat: add test to check workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
nikaaru authored and yeager-eren committed Apr 24, 2024
1 parent 52947f2 commit 69a4c3e
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ jobs:
env:
REF: ${{ github.ref }}

- name: Test
run: |
node ./scripts/build-libs/command.mjs
yarn run test
# for preview deployment for specific project, add vercel project id in environment section
- name: Preview Deployment
id: deploy
Expand Down
21 changes: 21 additions & 0 deletions scripts/build-libs/command.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env node
'use strict';
import process from 'node:process';
import { workspacePackages } from '../common/utils.mjs';
import { build } from '../publish/build.mjs';

async function run() {
const packages = await workspacePackages();
let packagesToBeBuild = packages.filter((pkg) => !pkg.private);

console.log('these packages will be built:', packagesToBeBuild.map(pkg=>pkg.name).join(', ')) ;

console.log(`🔨 Start building...`);
await build(packagesToBeBuild);
console.log('🔨 Finish building');
}

run().catch((e) => {
console.error(e);
process.exit(1);
});
2 changes: 1 addition & 1 deletion scripts/build/command.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function run() {

console.log(`[build] Running for ${path}`);

const typeCheckingTask = await $({
const typeCheckingTask = $({
cwd: pkgPath,
stderr: process.stderr,
stdout: process.stdout,
Expand Down
5 changes: 3 additions & 2 deletions scripts/common/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ export function printDirname() {
* @returns {Promise<import('./typedefs.mjs').Package[]>}
*/
export async function workspacePackages() {
const { stdout } = await execa('yarn', ['workspaces', 'info']);
const result = JSON.parse(stdout);
// --json flag guarantees that whether it is run with yarn or node, the output always has a consistent result.
const { stdout } = await execa('yarn', ['workspaces', '--json', 'info']);
const result = JSON.parse(JSON.parse(stdout).data) ;
const packagesName = Object.keys(result);
const output = packagesName.map((name) => {
const pkgJson = packageJson(result[name].location);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ describe('usePrepareBlockchainList', () => {
]);
});

it.only('Last item of the main list should be moved to front if it selected again.', () => {
it('Last item of the main list should be moved to front if it selected again.', () => {
const listLimit = 10;
const preferredBlockchains = ['AVAX_CCHAIN', 'BTC'];
const expected = [
Expand Down

0 comments on commit 69a4c3e

Please sign in to comment.