Skip to content

Commit

Permalink
Merge branch 'feature/chalk' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
bsorrentino committed Jun 12, 2019
2 parents d120da4 + 85c444b commit 3378605
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 21 deletions.
10 changes: 10 additions & 0 deletions samples/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
// STARTUP
//

load('./target/js/jvm-npm.js');

print( typeof require );

require.paths = [
"node_emul"
];

java.lang.System.setProperty( 'jvm-npm.debug', 'false');

var process = {
argv:'',
platform:'macosx',
Expand Down
33 changes: 26 additions & 7 deletions samples/graaljs-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,31 @@
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.bsc</groupId>
<artifactId>jvm-npm-core</artifactId>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/js</outputDirectory>
<includes>**/*.js</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
Expand All @@ -286,13 +311,7 @@
</plugins>
</build>
<dependencies>
<!--
<dependency>
<groupId>org.bsc</groupId>
<artifactId>jvm-npm-core</artifactId>
</dependency>
-->


<dependency>
<groupId>org.bsc.processor</groupId>
<artifactId>java2ts-processor</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions samples/node_emul/os/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
exports = {
release:function() {
return java.lang.System.getProperty('os.version');
}
}
10 changes: 10 additions & 0 deletions samples/node_emul/os/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "os",
"version": "1.0.0",
"description": "nodejs os module emulation",
"main": "index.js",
"scripts": {},
"keywords": ["nodejs", "os"],
"author": "bsorrentino <bartolomeo.sorrentino@gmail.com> (http://soulsoftware-bsc.blogspot.it/)",
"license": "MIT"
}
25 changes: 15 additions & 10 deletions samples/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
"description": "",
"main": "main.js",
"dependencies": {
"chalk": "^2.4.2",
"colors": "^1.1.2",
"marked": "^0.6.2",
"mustache": "^2.3.0",
"os": "file:node/os",
"validator": "^10.3.0"
},
"devDependencies": {
"@types/chalk": "^2.2.0",
"@types/colors": "^1.1.3",
"@types/marked": "^0.6.3",
"@types/mustache": "^0.8.30",
Expand All @@ -19,8 +22,10 @@
"typescript": "^3.3.4000"
},
"scripts": {
"build:main": "parcel build ts/main.ts --target=node --bundle-node-modules --no-source-maps -d ./target/js",
"start:graaljs":"mvn -f graaljs-pom.xml exec:exec",
"build:chalk": "parcel build ts/main.chalk.ts --target=node --bundle-node-modules --no-source-maps --no-minify -d ./target/js -o main.js",
"build:main": "parcel build ts/main.ts --target=node --bundle-node-modules --no-source-maps --no-minify -d ./target/js",
"build:main2": "parcel build ts/main.ts --no-source-maps --no-minify -d ./target/js",
"start:graaljs": "mvn -f graaljs-pom.xml exec:exec",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
Expand Down
1 change: 1 addition & 0 deletions samples/ts/color.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ export function test() {
Stream.of<string>( "<item2>" ).forEach( e => {
print( colors.green(e) );
});

}
25 changes: 25 additions & 0 deletions samples/ts/main.chalk.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import chalk from 'chalk';

const msg = 'HELLO WORLD!';

console.log(
`
${chalk.blue(msg)}
${chalk.inverse(msg)}
${chalk.blue.bgRed.bold(msg)}
${chalk.blue.underline.bold(msg)}
`
);

const error = chalk.bold.red;
const warning = chalk.keyword('orange');

console.log(error('Error!'));
console.log(warning('Warning!'));

console.log(`
CPU: ${chalk.red('90%')}
RAM: ${chalk.green('40%')}
DISK: ${chalk.yellow('70%')}
`);

7 changes: 5 additions & 2 deletions samples/ts/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import { MemoryType, Optional, URI } from './j2ts/jdk8-types';

import { test as future_test } from './future.test';
import { MemoryType, Optional, URI } from './j2ts/jdk8-types';
import { test as marked_test } from './marked.test';
import { test as promise_test } from './promise.test';

Expand Down Expand Up @@ -31,18 +31,21 @@ MemoryType.HEAP.ordinal = ${MemoryType.HEAP.ordinal()}
`
)


let async_start = async () => {

/*
color_test();
mustache_test();
validator_test();
stream_test();
*/
//color_test();

future_test();
marked_test();
print( await promise_test() );

}


Expand Down

0 comments on commit 3378605

Please sign in to comment.