Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Ported npm package shell script over to ant

    Removed the npm package shell script and
    moved it to an ant task in order to support
    building the package on windows.
  • Loading branch information...
commit bd5a99f6ae8a709127bdc410a72f1be590af9e51 1 parent a2430d0
Dav Glass authored
2  src/yui/Makefile
@@ -12,4 +12,4 @@ docmods:
12 12 ./scripts/build_doc_modules.js
13 13
14 14 npm:
15   - ./scripts/npm_package.sh
  15 + ant -f npm.xml
1  src/yui/npm.properties
... ... @@ -0,0 +1 @@
  1 +outdir=../../../yui-npm
30 src/yui/npm.xml
... ... @@ -0,0 +1,30 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project name="npm" default="package">
  3 + <description>YUI NPM Build</description>
  4 + <property file="npm.properties" />
  5 +
  6 + <echo level="info">Packaging YUI for npm deployment</echo>
  7 + <echo level="info">Using outdir: ${outdir}</echo>
  8 + <target name="package">
  9 + <echo level="info">Making outdir: ${outdir}</echo>
  10 + <delete dir="${outdir}" />
  11 + <mkdir dir="${outdir}" />
  12 +
  13 + <echo level="info">Copying files to build location</echo>
  14 + <copy todir="${outdir}" overwrite="true">
  15 + <fileset dir="../../build/" />
  16 + </copy>
  17 +
  18 + <copy file="../../package.json" tofile="${outdir}/package.json"/>
  19 + <copy file="./scripts/npm_package_shim.js" tofile="${outdir}/package.js"/>
  20 +
  21 + <echo level="info">Running Node.js package script</echo>
  22 + <exec executable="node" failonerror="true" searchpath="true" resolveexecutable="true">
  23 + <arg value="./scripts/npm_package.js"/>
  24 + <arg value="${outdir}"/>
  25 + </exec>
  26 +
  27 + <echo level="info">NPM package complete: ${outdir}</echo>
  28 + </target>
  29 +
  30 +</project>
14 src/yui/scripts/npm_package.js
@@ -9,7 +9,7 @@ var fs = require('fs'),
9 9 YUI.Env.core = [];
10 10 Y = YUI(); //This makes YUI.Env.aliases valid
11 11
12   -console.log('Prepping release for npm');
  12 +console.error('Prepping release for npm');
13 13
14 14 var start = process.argv[2];
15 15
@@ -18,6 +18,8 @@ if (!start) {
18 18 process.exit(1);
19 19 }
20 20
  21 +start = path.resolve(start);
  22 +
21 23 if (!path.existsSync(start)) {
22 24 console.error('Out directory does not exist, exiting..');
23 25 process.exit(1);
@@ -46,7 +48,7 @@ var makeDebug = function(mod, p) {
46 48 return str;
47 49 };
48 50
49   -console.log('Writing index.js files');
  51 +console.error('Writing index.js files');
50 52 var dirs = fs.readdirSync(start);
51 53 dirs.forEach(function(mod) {
52 54 var p = path.join(start, mod, 'index.js');
@@ -57,9 +59,9 @@ dirs.forEach(function(mod) {
57 59 fs.writeFileSync(d, makeDebug(mod), 'utf8');
58 60 }
59 61 });
60   -console.log('Index files written');
  62 +console.error('Index files written');
61 63
62   -console.log('Writing seed debug file');
  64 +console.error('Writing seed debug file');
63 65 var index = 'exports.path = function() {' +
64 66 ' return __dirname;' +
65 67 '};\n' +
@@ -70,11 +72,11 @@ var index = 'exports.path = function() {' +
70 72 var p = path.join(start, 'debug.js');
71 73 fs.writeFileSync(p, index, 'utf8');
72 74
73   -console.log('Writing alias files');
  75 +console.error('Writing alias files');
74 76 Object.keys(YUI.Env.aliases).forEach(function(mod) {
75 77 var index = makeIndex(mod, true);
76 78 var p = path.join(start, mod + '.js');
77 79 fs.writeFileSync(p, index, 'utf8');
78 80 });
79 81
80   -console.log('NPM Release Ready');
  82 +console.error('NPM Release Ready');
30 src/yui/scripts/npm_package.sh
... ... @@ -1,30 +0,0 @@
1   -#!/bin/bash
2   -
3   -cd "$(dirname "$0")"
4   -
5   -out=$1
6   -
7   -if [ ! -d "$out" ]; then
8   - out=/tmp/npm-yui/
9   - echo "Build directory not found using default: ${out}"
10   -fi
11   -
12   -echo "Using ${out} as build directory"
13   -
14   -if [ -d $out ]; then
15   - echo "Old build dir found, removing.."
16   - rm -rRf $out
17   -fi
18   -
19   -echo "Creating build dir"
20   -mkdir $out
21   -
22   -echo "Copying files to build location"
23   -cp -R ../../../build/* $out
24   -wait
25   -cp ../../../package.json "$out/package.json"
26   -wait
27   -cp ./npm_package_shim.js "$out/package.js"
28   -wait
29   -echo "Copy complete, running prep"
30   -./npm_package.js $out

0 comments on commit bd5a99f

Please sign in to comment.
Something went wrong with that request. Please try again.