functionalscript 0.0.439 → 0.0.440
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/{node-pack.yml → com.yml} +9 -7
- package/.github/workflows/node.js.yml +3 -3
- package/.github/workflows/npm-publish.yml +2 -2
- package/com/cpp/com.hpp +1 -1
- package/com/cpp/module.f.cjs +1 -1
- package/com/test/build.cjs +27 -32
- package/com/test/build.f.cjs +93 -0
- package/com/test/rust/Cargo.toml +9 -0
- package/com/test/rust/src/lib.rs +1 -0
- package/dev/test/module.f.cjs +1 -11
- package/package.json +2 -2
- package/text/sgr/module.f.cjs +17 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
2
2
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
3
3
|
|
|
4
|
-
name:
|
|
4
|
+
name: COM Test
|
|
5
5
|
|
|
6
6
|
on:
|
|
7
7
|
push:
|
|
@@ -12,15 +12,17 @@ on:
|
|
|
12
12
|
jobs:
|
|
13
13
|
build:
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
os: ['ubuntu-latest', 'windows-latest', 'macos-12']
|
|
18
|
+
|
|
19
|
+
runs-on: ${{ matrix.os }}
|
|
16
20
|
|
|
17
21
|
steps:
|
|
18
22
|
- uses: actions/checkout@v2
|
|
19
|
-
- name: Use Node.js
|
|
23
|
+
- name: Use Node.js 19
|
|
20
24
|
uses: actions/setup-node@v2
|
|
21
25
|
with:
|
|
22
|
-
node-version:
|
|
26
|
+
node-version: 19
|
|
23
27
|
- run: npm ci
|
|
24
|
-
- run:
|
|
25
|
-
- run: npm run version
|
|
26
|
-
- run: npm pack
|
|
28
|
+
- run: node ./com/test/build.cjs
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
2
2
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
3
3
|
|
|
4
|
-
name: node
|
|
4
|
+
name: node CI
|
|
5
5
|
|
|
6
6
|
on:
|
|
7
7
|
push:
|
|
@@ -16,7 +16,7 @@ jobs:
|
|
|
16
16
|
|
|
17
17
|
strategy:
|
|
18
18
|
matrix:
|
|
19
|
-
node-version: [16.x, 18.x]
|
|
19
|
+
node-version: [16.x, 18.x, 19.x]
|
|
20
20
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
21
21
|
|
|
22
22
|
steps:
|
|
@@ -25,7 +25,7 @@ jobs:
|
|
|
25
25
|
uses: actions/setup-node@v2
|
|
26
26
|
with:
|
|
27
27
|
node-version: ${{ matrix.node-version }}
|
|
28
|
-
- run: npm
|
|
28
|
+
- run: npm ci
|
|
29
29
|
- run: npm test
|
|
30
30
|
- run: npm run version
|
|
31
31
|
- run: npm pack
|
|
@@ -14,7 +14,7 @@ jobs:
|
|
|
14
14
|
- uses: actions/checkout@v2
|
|
15
15
|
- uses: actions/setup-node@v2
|
|
16
16
|
with:
|
|
17
|
-
node-version:
|
|
17
|
+
node-version: 19
|
|
18
18
|
- run: npm ci
|
|
19
19
|
- run: npm test
|
|
20
20
|
|
|
@@ -27,7 +27,7 @@ jobs:
|
|
|
27
27
|
fetch-depth: 0
|
|
28
28
|
- uses: actions/setup-node@v2
|
|
29
29
|
with:
|
|
30
|
-
node-version:
|
|
30
|
+
node-version: 19
|
|
31
31
|
registry-url: https://registry.npmjs.org/
|
|
32
32
|
- run: npm ci
|
|
33
33
|
- run: npm run version
|
package/com/cpp/com.hpp
CHANGED
package/com/cpp/module.f.cjs
CHANGED
package/com/test/build.cjs
CHANGED
|
@@ -1,37 +1,32 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const {
|
|
1
|
+
const { writeFileSync } = require('node:fs')
|
|
2
|
+
const { execSync } = require('node:child_process')
|
|
3
|
+
const { platform } = require('node:process')
|
|
4
|
+
const build = require('./build.f.cjs')
|
|
5
|
+
const { cpp, cs, rust } = build
|
|
6
|
+
const { join } = require('../../types/string/module.f.cjs')
|
|
7
|
+
const { log, error } = console
|
|
8
|
+
const { bold, reset } = require('../../text/sgr/module.f.cjs')
|
|
6
9
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
try {
|
|
11
|
-
const flags = os.platform() === 'win32' ? [] : ['-std=c++11', '-lc++']
|
|
12
|
-
const line = join(' ')(flat([['clang'], flags, [dirname + '/cpp/main.cpp']]))
|
|
13
|
-
console.log(cp.execSync(line).toString())
|
|
14
|
-
} catch (e) {
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
console.error(e.output.toString())
|
|
10
|
+
const nodeJs = {
|
|
11
|
+
dirname: __dirname,
|
|
12
|
+
platform,
|
|
17
13
|
}
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
/** @type {(f: build.Func) => void} */
|
|
16
|
+
const run = f => {
|
|
17
|
+
const { file: { name, content }, line } = f(nodeJs)
|
|
18
|
+
log(`${bold}writing: ${name}${reset}`)
|
|
19
|
+
writeFileSync(name, content)
|
|
20
|
+
const cmd = join(' ')(line)
|
|
21
|
+
log(`${bold}running: ${cmd}${reset}`)
|
|
22
|
+
try {
|
|
23
|
+
log(execSync(cmd).toString())
|
|
24
|
+
} catch (e) {
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
error(e.output.toString())
|
|
27
|
+
}
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
try {
|
|
33
|
-
console.log(cp.execSync("cargo build").toString());
|
|
34
|
-
} catch (e) {
|
|
35
|
-
// @ts-ignore
|
|
36
|
-
console.error(e.output.toString());
|
|
37
|
-
}
|
|
30
|
+
run(cpp)
|
|
31
|
+
run(cs)
|
|
32
|
+
run(rust)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
const list = require('../../types/list/module.f.cjs')
|
|
2
|
+
const { flat } = list
|
|
3
|
+
|
|
4
|
+
const cppContent = require('../cpp/test.f.cjs').result
|
|
5
|
+
const csContent = require('../cs/test.f.cjs').result
|
|
6
|
+
const rustContent = require("../rust/test.f.cjs").result();
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {|
|
|
10
|
+
* 'aix' |
|
|
11
|
+
* 'android' |
|
|
12
|
+
* 'darwin' |
|
|
13
|
+
* 'freebsd' |
|
|
14
|
+
* 'haiku' |
|
|
15
|
+
* 'linux' |
|
|
16
|
+
* 'openbsd' |
|
|
17
|
+
* 'sunos' |
|
|
18
|
+
* 'win32' |
|
|
19
|
+
* 'cygwin' |
|
|
20
|
+
* 'netbsd'
|
|
21
|
+
* } Platform
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @typedef {{
|
|
26
|
+
* readonly dirname: string
|
|
27
|
+
* readonly platform: Platform
|
|
28
|
+
* }} NodeJs
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @typedef {{
|
|
33
|
+
* readonly file: {
|
|
34
|
+
* readonly name: string
|
|
35
|
+
* readonly content: string
|
|
36
|
+
* }
|
|
37
|
+
* readonly line: list.List<string>
|
|
38
|
+
* }} Output
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/** @typedef {(nodejs: NodeJs) => Output} Func */
|
|
42
|
+
|
|
43
|
+
/** @type {(platform: Platform) => readonly string[]} */
|
|
44
|
+
const flags = platform => {
|
|
45
|
+
switch (platform) {
|
|
46
|
+
case 'win32':
|
|
47
|
+
return []
|
|
48
|
+
case 'linux':
|
|
49
|
+
return ['-lstdc++']
|
|
50
|
+
default:
|
|
51
|
+
return ['-std=c++11', '-lc++']
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** @type {Func} */
|
|
56
|
+
const cpp = ({dirname, platform}) => ({
|
|
57
|
+
file: {
|
|
58
|
+
name: `${dirname}/cpp/_result.hpp`,
|
|
59
|
+
content: cppContent,
|
|
60
|
+
},
|
|
61
|
+
line: flat([
|
|
62
|
+
['clang'],
|
|
63
|
+
flags(platform),
|
|
64
|
+
[`${dirname}/cpp/main.cpp`]]
|
|
65
|
+
),
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
/** @type {Func} */
|
|
69
|
+
const cs = ({dirname}) => ({
|
|
70
|
+
file: {
|
|
71
|
+
name: `${dirname}/cs/_result.cs`,
|
|
72
|
+
content: csContent,
|
|
73
|
+
},
|
|
74
|
+
line: ['dotnet', 'build', `${dirname}/cs/cs.csproj`],
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
/** @type {Func} */
|
|
78
|
+
const rust = ({dirname}) => ({
|
|
79
|
+
file: {
|
|
80
|
+
name: `${dirname}/rust/src/_result.rs`,
|
|
81
|
+
content: rustContent,
|
|
82
|
+
},
|
|
83
|
+
line: ['cargo', 'build']
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
module.exports = {
|
|
87
|
+
/** @readonly */
|
|
88
|
+
cpp,
|
|
89
|
+
/** @readonly */
|
|
90
|
+
cs,
|
|
91
|
+
/** @readonly */
|
|
92
|
+
rust,
|
|
93
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mod _result;
|
package/dev/test/module.f.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const list = require('../../types/list/module.f.cjs')
|
|
2
2
|
const { fold } = list
|
|
3
|
+
const { reset, fgGreen } = require('../../text/sgr/module.f.cjs')
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* @typedef {{
|
|
@@ -34,17 +35,6 @@ const { fold } = list
|
|
|
34
35
|
* }} Input
|
|
35
36
|
*/
|
|
36
37
|
|
|
37
|
-
/**
|
|
38
|
-
* https://en.wikipedia.org/wiki/ANSI_escape_code#SGR
|
|
39
|
-
*
|
|
40
|
-
* @type {(c: number) => string}
|
|
41
|
-
*/
|
|
42
|
-
const sgr = c => `\x1b[${c.toString()}m`
|
|
43
|
-
|
|
44
|
-
const reset = sgr(0)
|
|
45
|
-
|
|
46
|
-
const fgGreen = sgr(32)
|
|
47
|
-
|
|
48
38
|
/** @type {(s: string) => boolean} */
|
|
49
39
|
const isTest = s => s.endsWith('test.f.cjs')
|
|
50
40
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "functionalscript",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.440",
|
|
4
4
|
"description": "FunctionalScript is a functional subset of JavaScript",
|
|
5
5
|
"main": "module.f.cjs",
|
|
6
6
|
"scripts": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/functionalscript/functionalscript#readme",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/node": "^18.
|
|
32
|
+
"@types/node": "^18.11.2",
|
|
33
33
|
"typescript": "^4.8.4"
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://en.wikipedia.org/wiki/ANSI_escape_code#SGR
|
|
3
|
+
*
|
|
4
|
+
* @type {(c: number) => string}
|
|
5
|
+
*/
|
|
6
|
+
const sgr = c => `\x1b[${c.toString()}m`
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
/** @readonly */
|
|
10
|
+
sgr,
|
|
11
|
+
/** @readonly */
|
|
12
|
+
reset: sgr(0),
|
|
13
|
+
/** @readonly */
|
|
14
|
+
bold: sgr(1),
|
|
15
|
+
/** @readonly */
|
|
16
|
+
fgGreen: sgr(32),
|
|
17
|
+
}
|