Make Clay a Pebble package

This commit is contained in:
Keegan
2016-06-14 17:02:01 -07:00
parent 8d4ff52b0f
commit 118df1d952
5 changed files with 80 additions and 30 deletions
+7 -23
View File
@@ -1,31 +1,15 @@
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
/coverage
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
/.lock-waf_darwin_build
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
/node_modules
tmp
dist
/tmp/
/src/js/index.js
/dist.zip
/build/
Executable
+4
View File
@@ -0,0 +1,4 @@
# We ignore everying except for what is actually used by the pebble tool.
/**/*
!/dist.zip
!/src/js/index.js
+2 -2
View File
@@ -92,13 +92,13 @@ gulp.task('clay', ['inlineHtml'], function() {
.transform(autoprefixify, autoprefixerOptions)
.require(require.resolve('./index'), {expose: 'pebble-clay'})
.bundle()
.pipe(source('clay.js'))
.pipe(source('index.js'))
.pipe(buffer())
.pipe(uglify({
preserveComments: 'license'
}))
.pipe(insert.prepend(versionMessage))
.pipe(gulp.dest('./dist/'));
.pipe(gulp.dest('./src/js'));
});
gulp.task('dev-js', ['js', 'sass'], function() {
+19 -5
View File
@@ -2,17 +2,17 @@
"name": "pebble-clay",
"version": "0.1.7",
"description": "Pebble Config Framework",
"main": "dist/clay.js",
"directories": {
"example": "example"
},
"main": "src/js/index.js",
"scripts": {
"test-travis": "./node_modules/.bin/gulp && ./node_modules/.bin/karma start ./test/karma.conf.js --single-run --browsers chromeTravisCI && ./node_modules/.bin/eslint ./",
"test-debug": "(export DEBUG=true && ./node_modules/.bin/gulp && ./node_modules/.bin/karma start ./test/karma.conf.js --no-single-run)",
"test": "./node_modules/.bin/gulp && ./node_modules/.bin/karma start ./test/karma.conf.js --single-run",
"lint": "./node_modules/.bin/eslint ./",
"build": "gulp",
"dev": "gulp dev"
"dev": "gulp dev",
"pebble-clean": "rm -rf tmp src/js/index.js && pebble clean",
"pebble-publish": "npm run pebble-clean && npm run build && pebble build && pebble package publish && npm run pebble-clean",
"pebble-build": "npm run build && pebble build"
},
"repository": {
"type": "git",
@@ -27,6 +27,20 @@
"bugs": {
"url": "https://github.com/pebble/clay/issues"
},
"pebble": {
"projectType": "package",
"sdkVersion": "3",
"targetPlatforms": [
"aplite",
"basalt",
"chalk",
"diorite",
"emery"
],
"resources": {
"media": []
}
},
"homepage": "https://github.com/pebble/clay#readme",
"devDependencies": {
"autoprefixer": "^6.3.1",
+48
View File
@@ -0,0 +1,48 @@
#
# This file is the default set of rules to compile a Pebble project.
#
# Feel free to customize this to your needs.
#
import os
import shutil
import waflib
top = '.'
out = 'build'
def distclean(ctx):
if os.path.exists('dist.zip'):
os.remove('dist.zip')
if os.path.exists('dist'):
shutil.rmtree('dist')
waflib.Scripting.distclean(ctx)
def options(ctx):
ctx.load('pebble_sdk_lib')
def configure(ctx):
ctx.load('pebble_sdk_lib')
def build(ctx):
ctx.load('pebble_sdk_lib')
cached_env = ctx.env
for platform in ctx.env.TARGET_PLATFORMS:
ctx.env = ctx.all_envs[platform]
ctx.set_group(ctx.env.PLATFORM_NAME)
lib_name = '{}/{}'.format(ctx.env.BUILD_DIR, ctx.env.PROJECT_INFO['name'])
ctx.pbl_build(source=ctx.path.ant_glob('src/c/**/*.c'), target=lib_name, bin_type='lib')
ctx.env = cached_env
ctx.set_group('bundle')
ctx.pbl_bundle(includes=ctx.path.ant_glob('include/**/*.h'),
js=ctx.path.ant_glob(['src/js/**/*.js', 'src/js/**/*.json']),
bin_type='lib')
if ctx.cmd == 'clean':
for n in ctx.path.ant_glob(['dist/**/*', 'dist.zip'], quiet=True):
n.delete()