Skip to content

Commit bcd0d01

Browse files
committed
ci: use tar balls instead of npm install /path
Node 8 actually symlink when installing a path, so using a tar ball forces it to be more like a real install.
1 parent 447f9f7 commit bcd0d01

File tree

5 files changed

+49
-5
lines changed

5 files changed

+49
-5
lines changed

lib/packages.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ const packages =
2727
packageJson: path.join(pkg.root, 'package.json'),
2828
root: pkg.root,
2929
relative: path.relative(path.dirname(__dirname), pkg.root),
30-
main: path.resolve(pkg.root, 'src/index.ts')
30+
main: path.resolve(pkg.root, 'src/index.ts'),
31+
tar: path.join(distRoot, pkg.name.replace('/', '_') + '.tgz')
3132
};
3233
return packages;
3334
}, {});

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@
6868
"json-loader": "^0.5.4",
6969
"less": "^2.7.2",
7070
"less-loader": "^4.0.2",
71-
"loader-utils": "^1.0.2",
7271
"license-webpack-plugin": "^0.4.3",
72+
"loader-utils": "^1.0.2",
7373
"lodash": "^4.11.1",
7474
"magic-string": "^0.19.0",
7575
"memory-fs": "^0.4.1",
@@ -136,6 +136,7 @@
136136
"resolve-bin": "^0.4.0",
137137
"rewire": "^2.5.1",
138138
"spdx-satisfies": "^0.1.3",
139+
"tar": "^3.1.5",
139140
"through": "^2.3.6",
140141
"tree-kill": "^1.0.0",
141142
"ts-node": "^3.0.6",

tests/e2e/setup/500-create-project.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default function() {
3333
.then(() => createProject)
3434
.then(() => updateJsonFile('package.json', json => {
3535
Object.keys(packages).forEach(pkgName => {
36-
json['dependencies'][pkgName] = packages[pkgName].dist;
36+
json['dependencies'][pkgName] = packages[pkgName].tar;
3737
});
3838
}))
3939
.then(() => argv['ng2'] ? useNg2() : Promise.resolve())

tools/publish/src/build.ts

+19-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {buildSchema} from './build-schema';
55

66
const denodeify = require('denodeify');
77
const glob = denodeify(require('glob'));
8+
const tar = require('tar');
89
const npmRun = require('npm-run');
910

1011

@@ -31,7 +32,7 @@ function copy(from: string, to: string): Promise<void> {
3132

3233

3334
function rm(p: string): Promise<void> {
34-
path.relative(process.cwd(), p);
35+
p = path.relative(process.cwd(), p);
3536
return new Promise<void>((resolve, reject) => {
3637
fs.unlink(p, err => {
3738
if (err) {
@@ -44,6 +45,12 @@ function rm(p: string): Promise<void> {
4445
}
4546

4647

48+
function tarFiles(out: string, dir: string): Promise<void> {
49+
// const files = fs.readdirSync(dir);
50+
return tar.create({ gzip: true, strict: true, portable: true, cwd: dir, file: out }, ['.']);
51+
}
52+
53+
4754
function getDeps(pkg: any): any {
4855
const packageJson = require(pkg.packageJson);
4956
return Object.assign({}, packageJson['dependencies'], packageJson['devDependencies']);
@@ -216,10 +223,20 @@ export default function build(packagesToBuild: string[], _opts: any,
216223
const licenseLogger = new Logger('license', logger);
217224
return Promise.all(Object.keys(packages).map(pkgName => {
218225
const pkg = packages[pkgName];
219-
licenseLogger.info(`${pkgName}`);
226+
licenseLogger.info(pkgName);
220227
return copy('LICENSE', path.join(pkg.dist, 'LICENSE'));
221228
}));
222229
})
230+
.then(() => {
231+
logger.info('Tarring all packages...');
232+
233+
const tarLogger = new Logger('license', logger);
234+
return Promise.all(Object.keys(packages).map(pkgName => {
235+
const pkg = packages[pkgName];
236+
tarLogger.info(`${pkgName} => ${pkg.tar}`);
237+
return tarFiles(pkg.tar, pkg.dist);
238+
}));
239+
})
223240
.then(() => process.exit(0), (err) => {
224241
logger.fatal(err);
225242
});

yarn.lock

+25
Original file line numberDiff line numberDiff line change
@@ -3184,6 +3184,18 @@ minimist@^1.1.3, minimist@^1.2.0:
31843184
version "1.2.0"
31853185
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
31863186

3187+
minipass@^2.0.0, minipass@^2.0.2:
3188+
version "2.1.1"
3189+
resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.1.1.tgz#c80c80a3491c180d4071d8f219bd1b4b0284999d"
3190+
dependencies:
3191+
yallist "^3.0.0"
3192+
3193+
minizlib@^1.0.3:
3194+
version "1.0.3"
3195+
resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.0.3.tgz#d5c1abf77be154619952e253336eccab9b2a32f5"
3196+
dependencies:
3197+
minipass "^2.0.0"
3198+
31873199
mixin-object@^2.0.1:
31883200
version "2.0.1"
31893201
resolved "https://registry.yarnpkg.com/mixin-object/-/mixin-object-2.0.1.tgz#4fb949441dab182540f1fe035ba60e1947a5e57e"
@@ -4945,6 +4957,15 @@ tar@^2.0.0, tar@^2.2.1:
49454957
fstream "^1.0.2"
49464958
inherits "2"
49474959

4960+
tar@^3.1.5:
4961+
version "3.1.5"
4962+
resolved "https://registry.yarnpkg.com/tar/-/tar-3.1.5.tgz#4981e97ab7bad4cb1d5da9232047c9047a681aef"
4963+
dependencies:
4964+
minipass "^2.0.2"
4965+
minizlib "^1.0.3"
4966+
mkdirp "^0.5.0"
4967+
yallist "^3.0.2"
4968+
49484969
49494970
version "0.8.3"
49504971
resolved "https://registry.yarnpkg.com/temp/-/temp-0.8.3.tgz#e0c6bc4d26b903124410e4fed81103014dfc1f59"
@@ -5454,6 +5475,10 @@ yallist@^2.1.2:
54545475
version "2.1.2"
54555476
resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
54565477

5478+
yallist@^3.0.0, yallist@^3.0.2:
5479+
version "3.0.2"
5480+
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9"
5481+
54575482
yargs-parser@^4.2.0:
54585483
version "4.2.1"
54595484
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-4.2.1.tgz#29cceac0dc4f03c6c87b4a9f217dd18c9f74871c"

0 commit comments

Comments
 (0)