Skip to content

Commit

Permalink
fix(middleware): update secrets (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
ido-pluto committed Oct 13, 2023
1 parent 941b5ee commit 189cd42
Show file tree
Hide file tree
Showing 7 changed files with 10,964 additions and 6,829 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,37 @@ name: Node.js CI

on:
push:
branches: [master]
branches: [ master ]
pull_request:
branches: [master]
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30

strategy:
matrix:
node-version: [16.x, 17.x]
node-version: [ 18.x, 20.x ]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- uses: browser-actions/setup-chrome@v1
- name: Use Node.js ${{ matrix.node-version }}

uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm ci
run: npm ci --ignore-scripts && npm install -g wasm-pack

- name: Build
run: npm run build && npm run postinstall

- name: Coverage
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: npm run coverage && npx codecov
run: PUPPETEER_EXECUTABLE_PATH=$(which chrome) npm run coverage && npx codecov
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@ on:
concurrency: release-${{ github.ref }}
jobs:
release:
timeout-minutes: 30

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "17"
node-version: "20"
- name: Install modules
run: npm ci
run: npm ci --ignore-scripts && npm install -g wasm-pack
- name: Build
run: npm run build production && npm run postinstall
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
run: npx semantic-release
45 changes: 26 additions & 19 deletions build/build.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fsExtra from 'fs-extra';
import path from 'path';
import {build} from 'esbuild-wasm'
import { args } from './tools/StreamCommand.js';
import {build} from 'esbuild-wasm';
import {args} from './tools/StreamCommand.js';
import './buildprojects.js';

const __dirname = path.resolve();
Expand All @@ -11,18 +11,18 @@ const copyFrom = __dirname + '/src/', copyTo = __dirname + '/dist/';
const filesToCopy = ['static', 'SystemData'];
console.log('Copying js files...');

for(const i of filesToCopy){
for (const i of filesToCopy) {
await fsExtra.copy(copyFrom + i, copyTo + i);
}

/* js to ts */

const fromScript = copyFrom + 'scripts/';
await fsExtra.ensureDir(copyTo+'scripts/');
await fsExtra.ensureDir(copyTo + 'scripts/');

const {dependencies, name: packageName} = await fsExtra.readJSON(__dirname + '/package.json');

build({
await build({
external: ['./static/ImportWithoutCache.cjs', ...Object.keys(dependencies)],
drop: ['debugger'],
entryPoints: ['src/index.ts', fromScript + 'install.ts'],
Expand All @@ -32,10 +32,10 @@ build({
format: 'esm',
target: 'node17',
minify: args.production,
sourcemap: args.production ? undefined: 'inline',
sourcemap: args.production ? undefined : 'inline',
define: {
debug: !args.production,
esbuild: true,
debug: !args.production ? 'true' : '',
esbuild: 'true',
packageName: `'${packageName}'`
}
});
Expand All @@ -44,27 +44,34 @@ build({

/**
* minify all the js files in the folder
* @param {string} path
* @param {string} path
*/
async function minifyFolder(from, to, path) {
const files = await fsExtra.readdir(from + path, { withFileTypes: true });
const files = await fsExtra.readdir(from + path, {withFileTypes: true});
await fsExtra.ensureDir(to + path);

const promises = [];
for (const i of files) {
const fullPath = path + i.name;

if (i.isDirectory()) {
minifyFolder(from, to, fullPath + '/');
promises.push(
minifyFolder(from, to, fullPath + '/')
);
} else if (fullPath.endsWith('.js')) {
build({
entryPoints: [from + fullPath],
bundle: false,
platform: 'node',
outfile: to + fullPath,
minify: true
});
promises.push(
build({
entryPoints: [from + fullPath],
bundle: false,
platform: 'node',
outfile: to + fullPath,
minify: true
})
);
}
}

await Promise.all(promises);
}

minifyFolder(__dirname + '/src', __dirname + '/dist', '/static/client/');
await minifyFolder(__dirname + '/src', __dirname + '/dist', '/static/client/');

0 comments on commit 189cd42

Please sign in to comment.