Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
arantes555 committed Nov 28, 2018
0 parents commit 316b55a
Show file tree
Hide file tree
Showing 14 changed files with 5,844 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitignore
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
24 changes: 24 additions & 0 deletions .gitlab-ci.yml
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
24 changes: 24 additions & 0 deletions .npmignore
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
15 changes: 15 additions & 0 deletions .nycrc
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"
]
}
51 changes: 51 additions & 0 deletions cmfile.js
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)
}
})
Loading

0 comments on commit 316b55a

Please sign in to comment.