-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 316b55a
Showing
14 changed files
with
5,844 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Directory for the build | ||
/lib | ||
|
||
# Coverage reports | ||
/coverage | ||
|
||
/tmp | ||
|
||
/test_resources/running | ||
|
||
# IDE stuff | ||
.idea/ | ||
|
||
# Node stuff | ||
node_modules | ||
*.log | ||
|
||
# OS Stuff | ||
.DS_Store | ||
Thumbs.db | ||
|
||
.nyc_output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
image: node:10.9 | ||
|
||
before_script: | ||
- npm install --silent | ||
|
||
test: | ||
stage: test | ||
script: | ||
- npm run coverage | ||
artifacts: | ||
name: "sscrypto_coverage_${CI_BUILD_ID}_${CI_BUILD_REF}" | ||
when: always | ||
expire_in: 6 mos | ||
paths: | ||
- coverage/ | ||
|
||
|
||
deploy: | ||
stage: deploy | ||
script: | ||
- npm run build | ||
- npm publish | ||
only: | ||
- tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# .babelrc | ||
.babelrc | ||
|
||
# Tests | ||
/**/*spec.js | ||
/**/*spec.js.map | ||
|
||
# Coverage reports | ||
/coverage | ||
|
||
/tmp | ||
|
||
/test_resources | ||
|
||
# IDE stuff | ||
.idea/ | ||
|
||
# Node stuff | ||
node_modules | ||
*.log | ||
|
||
# OS Stuff | ||
.DS_Store | ||
Thumbs.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"include": [ | ||
"lib/**/*.js" | ||
], | ||
"exclude": [ | ||
"lib/**/*.spec.js" | ||
], | ||
"all": true, | ||
"report-dir": "./coverage", | ||
"reporter": [ | ||
"html", | ||
"text", | ||
"text-summary" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'use strict' | ||
const cm = require('centimaitre') | ||
const jetpack = require('fs-jetpack') | ||
const babel = require('@babel/core') | ||
const { promisify } = require('util') | ||
const path = require('path') | ||
|
||
const srcDir = jetpack.cwd('./src/') | ||
const libDir = jetpack.cwd('./lib/') | ||
const coverageDir = jetpack.cwd('./coverage/') | ||
|
||
const babelTransform = promisify(babel.transformFile) | ||
|
||
cm.setDefaultOptions({ | ||
sourceMaps: true | ||
}) | ||
|
||
cm.task('clean-coverage', () => { | ||
coverageDir.dir('.', { empty: true }) | ||
jetpack.remove('.nyc_output') | ||
}) | ||
|
||
cm.task('clean', () => { | ||
libDir.dir('.', { empty: true }) | ||
}) | ||
|
||
cm.task('build', ['clean'], async (options) => { | ||
const rootDirPath = jetpack.path() | ||
const files = srcDir.find({ matching: '**/*.js' }) | ||
for (const file of files) { | ||
const res = await babelTransform(srcDir.path(file), { | ||
sourceMaps: options.sourceMaps, | ||
sourceFileName: path.relative(rootDirPath, srcDir.path(file)), | ||
sourceRoot: path.relative(libDir.path(path.dirname(file)), rootDirPath), | ||
presets: [ | ||
['@babel/preset-env', { | ||
targets: { | ||
'electron': '1.8.6' | ||
}, | ||
useBuiltIns: false | ||
}] | ||
] | ||
}) | ||
if (options.sourceMaps) { | ||
res.map.file = `${path.basename(file)}` | ||
res.code = res.code + `\n//# sourceMappingURL=${path.basename(file)}.map` | ||
await libDir.writeAsync(file + '.map', JSON.stringify(res.map)) | ||
} | ||
await libDir.writeAsync(file, res.code) | ||
} | ||
}) |
Oops, something went wrong.