-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpublish.js
29 lines (24 loc) · 927 Bytes
/
publish.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const { execSync } = require('child_process');
const path = require('path');
const { writeFileSync, readFileSync } = require('fs');
execSync('rm -rf fabric-repository && git clone https://github.com/fabricjs/fabric.js.git fabric-repository');
const { name, description } = require('./package.json');
const fabricPkg = require('./fabric-repository/package.json');
const readmePath = path.resolve(__dirname, 'fabric-repository/README.md');
const fabricReadme = readFileSync(readmePath);
writeFileSync(
path.resolve(__dirname, 'fabric-repository/package.json'),
JSON.stringify({
...fabricPkg,
optionalDependencies: {},
name,
description,
}, null, '\t'),
);
writeFileSync(
readmePath,
name + '\n-----------\n\n' + description + '\n\n\n' + fabricReadme,
);
execSync('cd fabric-repository && npm i --no-shrinkwrap && npm run build');
execSync('npm publish fabric-repository');
console.log('Success!');