-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script for making artifacts package
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import sh from 'shelljs'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
function recreateDir(path: string): void { | ||
if (fs.existsSync(path)) { | ||
sh.rm('-r', path) | ||
} | ||
sh.mkdir('-p', path) | ||
} | ||
|
||
const MONOREPO_ROOT = path.join(__dirname, '..'); | ||
const INTERNAL_TOOLS_ARTIFACTS = path.join(MONOREPO_ROOT, 'artifacts', 'internal-tools'); | ||
|
||
const ARTIFACTS_DIR = path.join(MONOREPO_ROOT, 'artifacts'); | ||
const ARTIFACTS_PACKAGE_DIR = path.join(ARTIFACTS_DIR, 'devextreme-artifacts'); | ||
|
||
import { version, license, author } from '../package.json'; | ||
|
||
recreateDir(ARTIFACTS_PACKAGE_DIR); | ||
|
||
sh.cp('-r', INTERNAL_TOOLS_ARTIFACTS, ARTIFACTS_PACKAGE_DIR); | ||
sh.pushd(ARTIFACTS_PACKAGE_DIR); | ||
{ | ||
fs.writeFileSync('package.json', JSON.stringify({})); | ||
|
||
sh.exec('npm pkg set name=devextreme-artifacts'); | ||
sh.exec(`npm pkg set version=${version}`); | ||
sh.exec(`npm pkg set license=${license}`) | ||
sh.exec(`npm pkg set author="${author}"`); | ||
|
||
sh.exec('npm pack --pack-destination="../npm"'); | ||
} | ||
sh.popd(); |