Skip to content

Commit

Permalink
workspace:
Browse files Browse the repository at this point in the history
[ADDED] ci
@produck/range-axis:
[ADDED] script: build
  • Loading branch information
lichaozhy committed Sep 17, 2023
1 parent 6916362 commit 363a2a9
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 6 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
workflow_dispatch:
push:
tags:
- "**"

jobs:
build:
runs-on: ubuntu-latest

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

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"

- name: Install npm dependencies
run: npm run deps:install

- name: Run tests
run: npm run coverage

- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions packages/range-axis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# range-axis
To compute axis which some integer ranges on it
4 changes: 3 additions & 1 deletion packages/range-axis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"type": "module",
"types": "./src/index.d.ts",
"scripts": {
"test": "mocha \"**/*.spec.mjs\" --no-diff -t 999999999"
"build": "rollup -c script/rollup.config.mjs",
"test": "mocha \"**/*.spec.mjs\" --no-diff -t 999999999",
"prepublishOnly": " npm run build"
},
"keywords": [
"range",
Expand Down
34 changes: 34 additions & 0 deletions packages/range-axis/script/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { builtinModules, createRequire } from 'node:module';
import path from 'node:path';

import { defineConfig } from 'rollup';

const require = createRequire(import.meta.url);
const meta = require('../package.json');

const BANNER =
'/*!\n' +
` * ${meta.name} v${meta.version}\n` +
` * (c) 2022-${new Date().getFullYear()} ChaosLee\n` +
` * Released under the ${meta.license} License.\n` +
' */';

const moduleList = [
{
output: path.resolve('src/index.gen.cjs'),
format: 'cjs',
isExternal: true,
},
];

export default moduleList.map(config => {
return defineConfig({
input: path.resolve('src/index.mjs'),
output: {
file: config.output,
format: config.format,
name: config.name,
banner: BANNER,
},
});
});
30 changes: 30 additions & 0 deletions packages/range-axis/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
declare module Structure {
class Boundary {
number: number;
inclusive: boolean;
}

class Range {
from: Boundary;
to: Boundary;
readonly length: number;
}

class Axis {
readonly size: number;
[Symbol.iterator]: Generator<Range, undefined, unknown>;
}

type BoundaryLike = Boundary | number;
type RangeLike = Range | [BoundaryLike, BoundaryLike] | BoundaryLike;
type AxisLike = Axis | RangeLike[];
}

declare class RangeAxisAlgorithm {
setTolerance(value: number): undefined;
union(A: Structure.AxisLike, B: Structure.AxisLike): Structure.Axis;
intersection(A: Structure.AxisLike, B: Structure.AxisLike): Structure.Axis;
difference(A: Structure.AxisLike, B: Structure.AxisLike): Structure.Axis;
}

export { RangeAxisAlgorithm as Algorithm };
6 changes: 1 addition & 5 deletions packages/range-axis/src/index.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
export * from './Structure/index.mjs';
export { operator as Union } from './Union.mjs';
export { operator as Intersection } from './Intersection.mjs';
export { operator as Difference } from './Difference.mjs';
export { I, E, INFINITY } from './Structure/Boundary.mjs';
export { RangeAxisAlgorithm as Algorithm } from './Algorithm.mjs';

0 comments on commit 363a2a9

Please sign in to comment.